~doctormo/inkscape/css-style

« back to all changes in this revision

Viewing changes to src/style.cpp

  • Committer: Martin Owens
  • Date: 2014-03-21 04:51:57 UTC
  • Revision ID: doctormo@gmail.com-20140321045157-k7cnmlnvu42ja2xq
Attempted fix of styles from css management

Show diffs side-by-side

added added

removed removed

Lines of Context:
661
661
        sp_style_merge_from_style_string(style, val);
662
662
    }
663
663
 
664
 
    if (object) {
665
 
        sp_style_merge_from_object_stylesheet(style, object);
666
 
    } else {
667
 
        /** \todo No stylesheet information. Find out under what circumstances
668
 
         * this occurs, and handle accordingly.  (If we really wanted to, we
669
 
         * could probably get stylesheets by going through repr->doc.)
670
 
         */
671
 
    }
672
 
 
673
664
    /* 2. Presentation attributes */
674
665
    /* Attributes are only read in if not already set in a style sheet or style attribute above. */
675
666
 
866
857
    SPS_READ_PENUM_IF_UNSET(&style->shape_rendering, repr, "shape-rendering", enum_shape_rendering, true);
867
858
    SPS_READ_PENUM_IF_UNSET(&style->text_rendering,  repr, "text-rendering",  enum_text_rendering,  true);
868
859
 
869
 
    /* 3. Merge from parent */
870
860
    if (object) {
 
861
        /* 3. Merge from parent */
871
862
        if (object->parent) {
872
863
            sp_style_merge_from_parent(style, object->parent->style);
873
864
        }
 
865
        /* 4 Merge from stylesheet */
 
866
        sp_style_merge_from_object_stylesheet(style, object);
874
867
    } else {
875
868
        if (repr->parent()) {
876
869
            /// \todo fixme: This is not the prettiest thing (Lauris)
1540
1533
    g_return_if_fail(status == CR_OK);
1541
1534
    /// \todo Check what errors can occur, and handle them properly.
1542
1535
    if (props) {
1543
 
        sp_style_merge_from_props(style, props);
 
1536
        SPStyle *css_style = sp_style_new(NULL);
 
1537
        sp_style_merge_from_props(css_style, props);
1544
1538
        cr_prop_list_destroy(props);
 
1539
        sp_style_merge_from_parent(style, css_style);
 
1540
        sp_style_unref(css_style);
1545
1541
    }
1546
1542
}
1547
1543