[Libreoffice-commits] core.git: svgio/inc svgio/source

Xisco Fauli anistenis at gmail.com
Tue Apr 12 12:13:44 UTC 2016


 svgio/inc/svgio/svgreader/svgnode.hxx |    2 +-
 svgio/source/svgreader/svgnode.cxx    |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit afe7392f88d8aa42f20a62788a14a132617f6602
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Apr 11 01:57:47 2016 +0200

    SVG: Clean up this code a litle bit
    
    Change-Id: Ib941321d43a9a04d57f3c7c4a55528927fed5036
    Reviewed-on: https://gerrit.libreoffice.org/24009
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Xisco FaulĂ­ <anistenis at gmail.com>

diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx
index 3ad7b0f..0184f29 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -123,7 +123,7 @@ namespace svgio
             const SvgStyleAttributes* checkForCssStyle(const OUString& rClassStr, const SvgStyleAttributes& rOriginal) const;
 
             /// helper for filling the CssStyle vector once dependent on mbCssStyleVectorBuilt
-            void fillCssStyleVector(const OUString& rClassStr);
+            void fillCssStyleVector(const OUString& rClassStr, const SvgStyleAttributes& rOriginal);
             void fillCssStyleVectorUsingHierarchyAndSelectors(
                 const OUString& rClassStr,
                 const SvgNode& rCurrent,
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index b1de51d..c9bd15a 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -162,7 +162,7 @@ namespace svgio
             }
         }
 
-        void SvgNode::fillCssStyleVector(const OUString& rClassStr)
+        void SvgNode::fillCssStyleVector(const OUString& rClassStr, const SvgStyleAttributes& rOriginal)
         {
             OSL_ENSURE(!mbCssStyleVectorBuilt, "OOps, fillCssStyleVector called double ?!?");
             mbCssStyleVectorBuilt = true;
@@ -199,6 +199,9 @@ namespace svgio
                 // add CssStyle for selector '*' if found
                 maCssStyleVector.push_back(pNew);
             }
+
+            //local attributes
+            maCssStyleVector.push_back(&rOriginal);
         }
 
         const SvgStyleAttributes* SvgNode::checkForCssStyle(const OUString& rClassStr, const SvgStyleAttributes& rOriginal) const
@@ -206,7 +209,7 @@ namespace svgio
             if(!mbCssStyleVectorBuilt)
             {
                 // build needed CssStyleVector for local node
-                const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr);
+                const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr, rOriginal);
             }
 
             if(maCssStyleVector.empty())
@@ -232,7 +235,6 @@ namespace svgio
                 // for the element containing the hierarchy) in a vector of pointers and to use that.
                 // Resetting the CssStyleParent on rOriginal is probably not needed
                 // but simply safer to do.
-                const_cast< SvgStyleAttributes& >(rOriginal).setCssStyleParent(nullptr);
 
                 // loop over the existing CssStyles and link them. There is a first one, take
                 // as current
@@ -246,9 +248,6 @@ namespace svgio
                     pCurrent = pNext;
                 }
 
-                // pCurrent is the last used CssStyle, let it point to the original style
-                pCurrent->setCssStyleParent(&rOriginal);
-
                 // return 1st CssStyle as style chain start element (only for the
                 // local element, still no hierarchy used here)
                 return maCssStyleVector[0];


More information about the Libreoffice-commits mailing list