summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader/svgnode.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-26 13:48:54 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-26 22:44:47 +0200
commit897fce4abd0c731bf697ca1e38a8049f66f9ac7c (patch)
tree151b75697bb1efaaaf5a897cb741ba8bf18feac7 /svgio/source/svgreader/svgnode.cxx
parentfb3dfbd57d91307de383d401c1caf4bb0d9029b9 (diff)
svgio: simplify code
Change-Id: Ie363236a4b2e2d74d583b9f842b48743eefa9d24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153625 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source/svgreader/svgnode.cxx')
-rw-r--r--svgio/source/svgreader/svgnode.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index 35277ef0ed87..399b92231543 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -93,7 +93,6 @@ namespace {
} //namespace
void SvgNode::fillCssStyleVectorUsingHierarchyAndSelectors(
- const OUString& rClassStr,
const SvgNode& rCurrent,
const OUString& aConcatenated)
{
@@ -116,7 +115,7 @@ namespace {
if(pParent)
{
// check for combined selectors at parent first so that higher specificity will be in front
- fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *pParent, aNewConcatenated);
+ fillCssStyleVectorUsingHierarchyAndSelectors(*pParent, aNewConcatenated);
}
addCssStyle(rDocument, aNewConcatenated);
@@ -136,7 +135,7 @@ namespace {
if(pParent)
{
// check for combined selectors at parent first so that higher specificity will be in front
- fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *pParent, aNewConcatenated);
+ fillCssStyleVectorUsingHierarchyAndSelectors(*pParent, aNewConcatenated);
}
addCssStyle(rDocument, aNewConcatenated);
@@ -151,26 +150,28 @@ namespace {
}
}
+ OUString sCurrentType(SVGTokenToStr(getType()));
+
// check for class-dependent references to CssStyles
- if(rClassStr.isEmpty())
+ if(sCurrentType.isEmpty())
return;
OUString aNewConcatenated(aConcatenated);
- if(!rCurrent.getId() && !rCurrent.getClass() && 0 == aConcatenated.indexOf(rClassStr))
+ if(!rCurrent.getId() && !rCurrent.getClass() && 0 == aConcatenated.indexOf(sCurrentType))
{
- // no new CssStyle Selector and already starts with rClassStr, do not concatenate;
+ // no new CssStyle Selector and already starts with sCurrentType, do not concatenate;
// we pass an 'empty' node (in the sense of CssStyle Selector)
}
else
{
- aNewConcatenated = rClassStr + aConcatenated;
+ aNewConcatenated = sCurrentType + aConcatenated;
}
if(pParent)
{
// check for combined selectors at parent first so that higher specificity will be in front
- fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *pParent, aNewConcatenated);
+ fillCssStyleVectorUsingHierarchyAndSelectors(*pParent, aNewConcatenated);
}
addCssStyle(rDocument, aNewConcatenated);
@@ -179,11 +180,11 @@ namespace {
if(pParent)
{
OUString sParentType(SVGTokenToStr(pParent->getType()));
- addCssStyle(rDocument, sParentType + rClassStr);
+ addCssStyle(rDocument, sParentType + sCurrentType);
}
}
- void SvgNode::fillCssStyleVector(const OUString& rClassStr, const SvgStyleAttributes& rOriginal)
+ void SvgNode::fillCssStyleVector(const SvgStyleAttributes& rOriginal)
{
OSL_ENSURE(!mbCssStyleVectorBuilt, "OOps, fillCssStyleVector called double ?!?");
mbCssStyleVectorBuilt = true;
@@ -211,7 +212,7 @@ namespace {
}
// check the hierarchy for concatenated patterns of Selectors
- fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *this, OUString());
+ fillCssStyleVectorUsingHierarchyAndSelectors(*this, OUString());
// tdf#99115, Add css selector '*' style only if the element is on top of the hierarchy
// meaning its parent is <svg>
@@ -233,12 +234,12 @@ namespace {
maCssStyleVector.push_back(&rOriginal);
}
- const SvgStyleAttributes* SvgNode::checkForCssStyle(const OUString& rClassStr, const SvgStyleAttributes& rOriginal) const
+ const SvgStyleAttributes* SvgNode::checkForCssStyle(const SvgStyleAttributes& rOriginal) const
{
if(!mbCssStyleVectorBuilt)
{
// build needed CssStyleVector for local node
- const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr, rOriginal);
+ const_cast< SvgNode* >(this)->fillCssStyleVector(rOriginal);
}
if(maCssStyleVector.empty())