diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2019-09-16 12:54:59 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2019-09-25 21:45:07 +0200 |
commit | 2d9ac03b943d70d94e94319ae903c66ed25dcc9c (patch) | |
tree | 47306aaaf511bbc2febc35a26f596da33560da04 /svgio/source | |
parent | d173599d0b4667d44aa31991ccb917b1d141412e (diff) |
tdf#99115: add Css selector '*' style only if the element...
... is on top of the hierarchy
Otherwise, we add it for every element on the hierarchy
Adapt unittest from https://bugs.documentfoundation.org/show_bug.cgi?id=100198
Provided by Sam Yygier
Reviewed-on: https://gerrit.libreoffice.org/78997
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
(cherry picked from commit 4007ced54d611d1397387f7329a47de5efaca32f)
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Change-Id: I72c7ae08f3ce0194eff86697b202d5553810abeb
Reviewed-on: https://gerrit.libreoffice.org/79018
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index 61b0a9138fa9..8651e1f9620f 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -174,6 +174,7 @@ namespace svgio // - 'id' CssStyle // - 'class' CssStyle(s) // - type-dependent elements (e..g. 'rect' for all rect elements) + // - Css selector '*' // - local attributes (rOriginal) // - inherited attributes (up the hierarchy) // The first four will be collected in maCssStyleVector for the current element @@ -191,13 +192,20 @@ namespace svgio // check the hierarchy for concatenated patterns of Selectors fillCssStyleVectorUsingHierarchyAndSelectors(rClassStr, *this, OUString()); - // #i125329# find Css selector '*', add as last element if found - const SvgStyleAttributes* pNew = getDocument().findGlobalCssStyleAttributes("*"); + // tdf#99115, Add css selector '*' style only if the element is on top of the hierarchy + // meaning its parent is <svg> + const SvgNode* pParent = this->getParent(); - if(pNew) + if(pParent && pParent->getType() == SVGTokenSvg) { - // add CssStyle for selector '*' if found - maCssStyleVector.push_back(pNew); + // #i125329# find Css selector '*', add as last element if found + const SvgStyleAttributes* pNew = getDocument().findGlobalCssStyleAttributes("*"); + + if(pNew) + { + // add CssStyle for selector '*' if found + maCssStyleVector.push_back(pNew); + } } //local attributes |