summaryrefslogtreecommitdiff
path: root/svgio/source
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-09-19 11:45:20 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2019-09-19 13:51:57 +0200
commitab1479956568b0d9a6022133cf651f846293aa46 (patch)
treefa4ab602b7d395e732d60df2ecd13eab69b827d7 /svgio/source
parentab825c665c1ee509769bdaf0ae95fc111a357fc6 (diff)
tdf#94765: SVGIO: Look for gradient/pattern ids once the file...
... is completely parsed it might happen the element's id the url points to hasn't been parsed yet Change-Id: Ia92c9188de5d23f2f992846aa91f3f936aeefacb Reviewed-on: https://gerrit.libreoffice.org/79118 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source')
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx79
1 files changed, 53 insertions, 26 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index b7f571478ee0..5cda5995e82f 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1336,19 +1336,7 @@ namespace svgio
}
else if(!aURL.isEmpty())
{
- const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(aURL);
-
- if(pNode)
- {
- if(SVGTokenLinearGradient == pNode->getType() || SVGTokenRadialGradient == pNode->getType())
- {
- mpSvgGradientNodeFill = static_cast< const SvgGradientNode* >(pNode);
- }
- else if(SVGTokenPattern == pNode->getType())
- {
- mpSvgPatternNodeFill = static_cast< const SvgPatternNode* >(pNode);
- }
- }
+ maNodeFillURL = aURL;
}
break;
}
@@ -1393,19 +1381,7 @@ namespace svgio
}
else if(!aURL.isEmpty())
{
- const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(aURL);
-
- if(pNode)
- {
- if(SVGTokenLinearGradient == pNode->getType() || SVGTokenRadialGradient == pNode->getType())
- {
- mpSvgGradientNodeStroke = static_cast< const SvgGradientNode* >(pNode);
- }
- else if(SVGTokenPattern == pNode->getType())
- {
- mpSvgPatternNodeStroke = static_cast< const SvgPatternNode* >(pNode);
- }
- }
+ maNodeStrokeURL = aURL;
}
break;
}
@@ -2112,6 +2088,18 @@ namespace svgio
}
else if (!maFill.isSet() && !mpSvgPatternNodeFill)
{
+ if (!maNodeFillURL.isEmpty())
+ {
+ const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(maNodeFillURL);
+
+ if(pNode)
+ {
+ if(SVGTokenLinearGradient == pNode->getType() || SVGTokenRadialGradient == pNode->getType())
+ {
+ return static_cast< const SvgGradientNode* >(pNode);
+ }
+ }
+ }
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
if (pSvgStyleAttributes && maResolvingParent[2] < nStyleDepthLimit)
@@ -2134,6 +2122,19 @@ namespace svgio
}
else if (!maStroke.isSet() && !mpSvgPatternNodeStroke)
{
+ if(!maNodeStrokeURL.isEmpty())
+ {
+ const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(maNodeStrokeURL);
+
+ if(pNode)
+ {
+ if(SVGTokenLinearGradient == pNode->getType() || SVGTokenRadialGradient == pNode->getType())
+ {
+ return static_cast< const SvgGradientNode* >(pNode);
+ }
+ }
+ }
+
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
if (pSvgStyleAttributes && maResolvingParent[3] < nStyleDepthLimit)
@@ -2156,6 +2157,19 @@ namespace svgio
}
else if (!maFill.isSet() && !mpSvgGradientNodeFill)
{
+ if (!maNodeFillURL.isEmpty())
+ {
+ const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(maNodeFillURL);
+
+ if(pNode)
+ {
+ if(SVGTokenPattern == pNode->getType())
+ {
+ return static_cast< const SvgPatternNode* >(pNode);
+ }
+ }
+ }
+
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
if (pSvgStyleAttributes && maResolvingParent[4] < nStyleDepthLimit)
@@ -2178,6 +2192,19 @@ namespace svgio
}
else if (!maStroke.isSet() && !mpSvgGradientNodeStroke)
{
+ if(!maNodeStrokeURL.isEmpty())
+ {
+ const SvgNode* pNode = mrOwner.getDocument().findSvgNodeById(maNodeStrokeURL);
+
+ if(pNode)
+ {
+ if(SVGTokenPattern == pNode->getType())
+ {
+ return static_cast< const SvgPatternNode* >(pNode);
+ }
+ }
+ }
+
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
if (pSvgStyleAttributes && maResolvingParent[5] < nStyleDepthLimit)