From: Richard Hughes Date: Thu, 21 Oct 2010 18:08:22 +0000 (+0100) Subject: repr wasn't updated immediately after some text editing operations, which meant that... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7504891650ae3447082207acab671a49efa0ffb7;p=inkscape.git repr wasn't updated immediately after some text editing operations, which meant that if the file was immediately saved it might display wrong in other apps --- diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 76cf5e15b..5bad33d29 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -57,6 +57,7 @@ static void te_update_layout_now (SPItem *item) SP_TEXT(item)->rebuildLayout(); else if (SP_IS_FLOWTEXT (item)) SP_FLOWTEXT(item)->rebuildLayout(); + item->updateRepr(); } /** Returns true if there are no visible characters on the canvas */ @@ -1291,16 +1292,17 @@ static bool objects_have_equal_style(SPObject const *parent, SPObject const *chi parent_style = sp_style_write_string(parent_spstyle, SP_STYLE_FLAG_ALWAYS); sp_style_unref(parent_spstyle); - Glib::ustring child_style_construction(parent_style); + Glib::ustring child_style_construction; while (child != parent) { // FIXME: this assumes that child's style is only in style= whereas it can also be in css attributes! char const *style_text = SP_OBJECT_REPR(child)->attribute("style"); if (style_text && *style_text) { - child_style_construction += ';'; - child_style_construction += style_text; + child_style_construction.insert(0, style_text); + child_style_construction.insert(0, 1, ';'); } child = SP_OBJECT_PARENT(child); } + child_style_construction.insert(0, parent_style); SPStyle *child_spstyle = sp_style_new(SP_OBJECT_DOCUMENT(parent)); sp_style_merge_from_style_string(child_spstyle, child_style_construction.c_str()); gchar *child_style = sp_style_write_string(child_spstyle, SP_STYLE_FLAG_ALWAYS); @@ -1654,15 +1656,15 @@ static bool redundant_semi_nesting_processor(SPObject **item, SPObject *child, b SPCSSAttr *css_child_and_item = sp_repr_css_attr_new(); SPCSSAttr *css_child_only = sp_repr_css_attr_new(); + gchar const *item_style = SP_OBJECT_REPR(*item)->attribute("style"); + if (item_style && *item_style) { + sp_repr_css_attr_add_from_string(css_child_and_item, item_style); + } gchar const *child_style = SP_OBJECT_REPR(child)->attribute("style"); if (child_style && *child_style) { sp_repr_css_attr_add_from_string(css_child_and_item, child_style); sp_repr_css_attr_add_from_string(css_child_only, child_style); } - gchar const *item_style = SP_OBJECT_REPR(*item)->attribute("style"); - if (item_style && *item_style) { - sp_repr_css_attr_add_from_string(css_child_and_item, item_style); - } bool equal = css_attrs_are_equal(css_child_only, css_child_and_item); sp_repr_css_attr_unref(css_child_and_item); sp_repr_css_attr_unref(css_child_only);