tdf#159968: Support overflow:visible in marker element
Change-Id: I4ea648cf94a4bb321a78843a9898769a69c5630d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164224 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
948cd8b9f6
commit
a661f9a2e0
6 changed files with 105 additions and 1 deletions
|
@ -170,6 +170,13 @@ namespace svgio::svgreader
|
|||
Central
|
||||
};
|
||||
|
||||
enum class Overflow
|
||||
{
|
||||
notset,
|
||||
hidden,
|
||||
visible
|
||||
};
|
||||
|
||||
enum class Visibility
|
||||
{
|
||||
notset,
|
||||
|
@ -207,6 +214,7 @@ namespace svgio::svgreader
|
|||
TextAnchor maTextAnchor;
|
||||
SvgPaint maColor;
|
||||
SvgNumber maOpacity;
|
||||
Overflow maOverflow;
|
||||
Visibility maVisibility;
|
||||
OUString maTitle;
|
||||
OUString maDesc;
|
||||
|
@ -410,6 +418,10 @@ namespace svgio::svgreader
|
|||
SvgNumber getOpacity() const;
|
||||
void setOpacity(const SvgNumber& rOpacity) { maOpacity = rOpacity; }
|
||||
|
||||
/// Overflow
|
||||
Overflow getOverflow() const;
|
||||
void setOverflow(const Overflow aOverflow) { maOverflow = aOverflow; }
|
||||
|
||||
/// Visibility
|
||||
Visibility getVisibility() const;
|
||||
void setVisibility(const Visibility aVisibility) { maVisibility = aVisibility; }
|
||||
|
|
|
@ -113,6 +113,7 @@ namespace svgio::svgreader
|
|||
Visibility,
|
||||
Title,
|
||||
Desc,
|
||||
Overflow,
|
||||
|
||||
// AspectRatio and params
|
||||
PreserveAspectRatio,
|
||||
|
|
|
@ -2013,6 +2013,23 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156271)
|
|||
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr, "dx1"_ostr, "23");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf159968)
|
||||
{
|
||||
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf159968.svg");
|
||||
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
|
||||
|
||||
drawinglayer::Primitive2dXmlDump dumper;
|
||||
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
|
||||
|
||||
CPPUNIT_ASSERT (pDocument);
|
||||
|
||||
// Check no mask is applied to the marker
|
||||
assertXPath(pDocument,
|
||||
"/primitive2D/transform/transform/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#000000");
|
||||
assertXPath(pDocument,
|
||||
"/primitive2D/transform/transform/transform/transform/polypolygoncolor/polypolygon/polygon/point"_ostr, 5);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf149880)
|
||||
{
|
||||
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg");
|
||||
|
|
37
svgio/qa/cppunit/data/tdf159968.svg
Normal file
37
svgio/qa/cppunit/data/tdf159968.svg
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
||||
<svg
|
||||
width="100mm"
|
||||
height="100mm"
|
||||
viewBox="0 0 100 100"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1">
|
||||
<marker
|
||||
style="overflow:visible"
|
||||
id="ArrowTriangleStylized"
|
||||
refX="0"
|
||||
refY="0"
|
||||
orient="auto-start-reverse"
|
||||
markerWidth="1"
|
||||
markerHeight="1"
|
||||
viewBox="0 0 1 1"
|
||||
preserveAspectRatio="xMidYMid">
|
||||
<path
|
||||
transform="scale(0.5)"
|
||||
style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt"
|
||||
d="m 6,0 c -3,1 -7,3 -9,5 0,0 0,-4 2,-5 -2,-1 -2,-5 -2,-5 2,2 6,4 9,5 z"
|
||||
id="path4" />
|
||||
</marker>
|
||||
</defs>
|
||||
<g
|
||||
id="layer1">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#ArrowTriangleStylized)"
|
||||
d="M 9.7161802,91.253315 84.819628,15.230769"
|
||||
id="path1"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1 KiB |
|
@ -850,7 +850,8 @@ namespace svgio::svgreader
|
|||
const basegfx::B2DRange aTargetRange(0.0, 0.0, fTargetWidth, fTargetHeight);
|
||||
const SvgAspectRatio& rRatio = rMarker.getSvgAspectRatio();
|
||||
|
||||
if(rRatio.isSet())
|
||||
|
||||
if(rRatio.isSet() && Overflow::visible != rMarker.getSvgStyleAttributes()->getOverflow())
|
||||
{
|
||||
// let mapping be created from SvgAspectRatio
|
||||
rMarkerTransform = rRatio.createMapping(aTargetRange, aPrimitiveRange);
|
||||
|
@ -1279,6 +1280,7 @@ namespace svgio::svgreader
|
|||
maTextAlign(TextAlign::notset),
|
||||
maTextDecoration(TextDecoration::notset),
|
||||
maTextAnchor(TextAnchor::notset),
|
||||
maOverflow(Overflow::notset),
|
||||
maVisibility(Visibility::notset),
|
||||
maFillRule(FillRule::notset),
|
||||
maClipRule(FillRule::notset),
|
||||
|
@ -1822,6 +1824,21 @@ namespace svgio::svgreader
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SVGToken::Overflow:
|
||||
{
|
||||
if(!aContent.isEmpty())
|
||||
{
|
||||
if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"visible"))
|
||||
{
|
||||
setOverflow(Overflow::visible);
|
||||
}
|
||||
else if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"hidden"))
|
||||
{
|
||||
setOverflow(Overflow::hidden);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SVGToken::Visibility:
|
||||
{
|
||||
if(!aContent.isEmpty())
|
||||
|
@ -2316,6 +2333,25 @@ namespace svgio::svgreader
|
|||
return SvgNumber(1.0);
|
||||
}
|
||||
|
||||
Overflow SvgStyleAttributes::getOverflow() const
|
||||
{
|
||||
if(Overflow::notset != maOverflow)
|
||||
{
|
||||
return maOverflow;
|
||||
}
|
||||
|
||||
if(mrOwner.hasLocalCssStyle())
|
||||
{
|
||||
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
|
||||
if (pSvgStyleAttributes)
|
||||
{
|
||||
return pSvgStyleAttributes->getOverflow();
|
||||
}
|
||||
}
|
||||
|
||||
return Overflow::hidden;
|
||||
}
|
||||
|
||||
Visibility SvgStyleAttributes::getVisibility() const
|
||||
{
|
||||
if(Visibility::notset == maVisibility || Visibility::inherit == maVisibility)
|
||||
|
|
|
@ -111,6 +111,7 @@ constexpr auto aSVGTokenMap = frozen::make_unordered_map<std::u16string_view, SV
|
|||
{ u"visibility", SVGToken::Visibility },
|
||||
{ u"title", SVGToken::Title },
|
||||
{ u"desc", SVGToken::Desc },
|
||||
{ u"overflow", SVGToken::Overflow },
|
||||
{ u"preserveAspectRatio", SVGToken::PreserveAspectRatio },
|
||||
{ u"defer", SVGToken::Defer },
|
||||
{ u"none", SVGToken::None },
|
||||
|
|
Loading…
Reference in a new issue