From 8b2fb0e153fa846a171105b7801c398ffbe3d595 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 30 Oct 2013 11:22:20 +0000 Subject: Resolves: #i123510# changed priority in style preparation (cherry picked from commit 86459550d81c3eae067e89d9af1b6e872215a588) Change-Id: Ia567666cd76dce646479003a830d969f4962da71 --- svgio/source/svgreader/svgnode.cxx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'svgio') diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index d25f6daf3dbe..8e8f83d345a2 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -106,14 +106,12 @@ namespace svgio } } - if(maCssStyleVector.empty()) + if(!maCssStyleVector.empty()) { - return &rOriginal; - } - else - { - // set CssStyleParent at maCssStyleVector members to hang them in front of - // the existing style. Build a style chain, reset parent of original for security. + // #i123510# if CSS styles were found, create a linked list with rOriginal as parent + // and all CSS styles as linked children, so that the style attribute has + // priority over the CSS style. If there is no style attribute this means that + // no values are set at rOriginal, thus it is still correct to have that order. // Repeated style requests should only be issued from sub-Text nodes and I'm not // sure if in-between text nodes may build other chains (should not happen). But // it's only a re-chaining with pointers (cheap), so allow to do it every time. @@ -122,14 +120,15 @@ namespace svgio for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++) { - SvgStyleAttributes* pCandidate = const_cast< SvgStyleAttributes* >(maCssStyleVector[maCssStyleVector.size() - a - 1]); + SvgStyleAttributes* pNext = const_cast< SvgStyleAttributes* >(maCssStyleVector[a]); - pCandidate->setCssStyleParent(pCurrent); - pCurrent = pCandidate; + pCurrent->setCssStyleParent(pNext); + pCurrent = pNext; + pCurrent->setCssStyleParent(0); } - - return pCurrent; } + + return &rOriginal; } SvgNode::SvgNode( -- cgit