Code

Merge from trunk.
[inkscape.git] / src / style.cpp
index 380decc48776b4b3611a19f40b8ae748f83c1226..d254ab6f484fc8bceff099b5f3cef80722de62c8 100644 (file)
@@ -1,5 +1,3 @@
-#define __SP_STYLE_C__
-
 /** @file
  * @brief SVG stylesheets implementation.
  */
@@ -7,6 +5,7 @@
  *   Lauris Kaplinski <lauris@kaplinski.com>
  *   Peter Moulder <pmoulder@mail.csse.monash.edu.au>
  *   bulia byak <buliabyak@users.sf.net>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2001-2002 Lauris Kaplinski
  * Copyright (C) 2001 Ximian, Inc.
@@ -487,11 +486,11 @@ sp_style_new_from_object(SPObject *object)
     g_return_val_if_fail(object != NULL, NULL);
     g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
 
-    SPStyle *style = sp_style_new(SP_OBJECT_DOCUMENT(object));
+    SPStyle *style = sp_style_new( object->document );
     style->object = object;
     style->release_connection = object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_style_object_release), style));
 
-    if (object && SP_OBJECT_IS_CLONED(object)) {
+    if (object && object->cloned) {
         style->cloned = true;
     }
 
@@ -573,7 +572,7 @@ sp_style_read(SPStyle *style, SPObject *object, Inkscape::XML::Node *repr)
 
     sp_style_clear(style);
 
-    if (object && SP_OBJECT_IS_CLONED(object)) {
+    if (object && object->cloned) {
         style->cloned = true;
     }
 
@@ -1017,7 +1016,9 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val)
              * Fixes Bug #324849
              */
             g_warning("attribute 'clip-path' given as CSS");
-            style->object->repr->setAttribute("clip-path", val);
+
+                       //XML Tree being directly used here.
+            style->object->getRepr()->setAttribute("clip-path", val);
             break;
         case SP_PROP_CLIP_RULE:
             g_warning("Unimplemented style property SP_PROP_CLIP_RULE: value: %s", val);
@@ -1027,7 +1028,9 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val)
              * See comment for SP_PROP_CLIP_PATH
              */
             g_warning("attribute 'mask' given as CSS");
-            style->object->repr->setAttribute("mask", val);
+                       
+                       //XML Tree being directly used here.
+            style->object->getRepr()->setAttribute("mask", val);
             break;
         case SP_PROP_OPACITY:
             if (!style->opacity.set) {
@@ -1286,9 +1289,11 @@ sp_style_merge_from_object_stylesheet(SPStyle *const style, SPObject const *cons
     }
 
     CRPropList *props = NULL;
+
+    //XML Tree being directly used here while it shouldn't be.
     CRStatus status = cr_sel_eng_get_matched_properties_from_cascade(sel_eng,
                                                                      object->document->style_cascade,
-                                                                     object->repr,
+                                                                     object->getRepr(),
                                                                      &props);
     g_return_if_fail(status == CR_OK);
     /// \todo Check what errors can occur, and handle them properly.
@@ -4031,6 +4036,7 @@ SPIPaint::SPIPaint() :
     noneSet(0),
     value()
 {
+    value.color.set( 0 );
     value.href = 0;
 }
 
@@ -4437,4 +4443,4 @@ css2_escape_quote(gchar const *val) {
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :