mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1123194 - make textPath work with a path that is display:none r=heycam
This commit is contained in:
parent
9b5d9671ae
commit
a18d331df6
@ -343,6 +343,7 @@ HTTP(..) == text-scale-03.svg text-scale-03-ref.svg
|
||||
== textPath-01.svg textPath-01-ref.svg
|
||||
== textPath-02.svg pass.svg
|
||||
== textPath-03.svg pass.svg
|
||||
== textPath-04.svg pass.svg
|
||||
== text-style-01a.svg text-style-01-ref.svg
|
||||
== text-style-01b.svg text-style-01-ref.svg
|
||||
== text-style-01c.svg text-style-01-ref.svg
|
||||
|
28
layout/reftests/svg/textPath-04.svg
Normal file
28
layout/reftests/svg/textPath-04.svg
Normal file
@ -0,0 +1,28 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Test effect on display:none on path</title>
|
||||
|
||||
<defs>
|
||||
<!--
|
||||
<path id="p" display="none" d="M100,100 h200"/>
|
||||
-->
|
||||
<path id="p" d="M100,100 h200"/>
|
||||
</defs>
|
||||
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
|
||||
<!-- check if something displays, its displayed in the right place -->
|
||||
<text font-size="50" fill="red" transform="translate(0,100)">
|
||||
<textPath xlink:href="#p">abc</textPath>
|
||||
</text>
|
||||
<text x="100" y="200" font-size="50" stroke-width="4" fill="lime" stroke="lime">abc</text>
|
||||
|
||||
<!-- check something displays -->
|
||||
<text x="200" y="200" font-size="50" fill="red">abc</text>
|
||||
<text font-size="50" stroke-width="4" stroke="lime" fill="lime" transform="translate(100,100)">
|
||||
<textPath xlink:href="#p">abc</textPath>
|
||||
</text>
|
||||
</svg>
|
After Width: | Height: | Size: 985 B |
@ -4816,8 +4816,8 @@ SVGTextFrame::AdjustPositionsForClusters()
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
SVGTextFrame::GetTextPathPathFrame(nsIFrame* aTextPathFrame)
|
||||
SVGPathElement*
|
||||
SVGTextFrame::GetTextPathPathElement(nsIFrame* aTextPathFrame)
|
||||
{
|
||||
nsSVGTextPathProperty *property = static_cast<nsSVGTextPathProperty*>
|
||||
(aTextPathFrame->Properties().Get(nsSVGEffects::HrefProperty()));
|
||||
@ -4842,21 +4842,19 @@ SVGTextFrame::GetTextPathPathFrame(nsIFrame* aTextPathFrame)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return property->GetReferencedFrame(nsGkAtoms::svgPathGeometryFrame, nullptr);
|
||||
Element* element = property->GetReferencedElement();
|
||||
return (element && element->IsSVG(nsGkAtoms::path)) ?
|
||||
static_cast<SVGPathElement*>(element) : nullptr;
|
||||
}
|
||||
|
||||
TemporaryRef<Path>
|
||||
SVGTextFrame::GetTextPath(nsIFrame* aTextPathFrame)
|
||||
{
|
||||
nsIFrame *pathFrame = GetTextPathPathFrame(aTextPathFrame);
|
||||
|
||||
if (!pathFrame) {
|
||||
SVGPathElement* element = GetTextPathPathElement(aTextPathFrame);
|
||||
if (!element) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsSVGPathGeometryElement *element =
|
||||
static_cast<nsSVGPathGeometryElement*>(pathFrame->GetContent());
|
||||
|
||||
RefPtr<Path> path = element->GetOrBuildPathForMeasuring();
|
||||
if (!path) {
|
||||
return nullptr;
|
||||
@ -4875,12 +4873,11 @@ SVGTextFrame::GetTextPath(nsIFrame* aTextPathFrame)
|
||||
gfxFloat
|
||||
SVGTextFrame::GetOffsetScale(nsIFrame* aTextPathFrame)
|
||||
{
|
||||
nsIFrame *pathFrame = GetTextPathPathFrame(aTextPathFrame);
|
||||
if (!pathFrame)
|
||||
SVGPathElement* pathElement = GetTextPathPathElement(aTextPathFrame);
|
||||
if (!pathElement)
|
||||
return 1.0;
|
||||
|
||||
return static_cast<dom::SVGPathElement*>(pathFrame->GetContent())->
|
||||
GetPathLengthScale(dom::SVGPathElement::eForTextPath);
|
||||
return pathElement->GetPathLengthScale(dom::SVGPathElement::eForTextPath);
|
||||
}
|
||||
|
||||
gfxFloat
|
||||
|
@ -34,6 +34,7 @@ class TextRenderedRunIterator;
|
||||
|
||||
namespace dom {
|
||||
class SVGIRect;
|
||||
class SVGPathElement;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -595,7 +596,8 @@ private:
|
||||
bool ShouldRenderAsPath(nsTextFrame* aFrame, bool& aShouldPaintSVGGlyphs);
|
||||
|
||||
// Methods to get information for a <textPath> frame.
|
||||
nsIFrame* GetTextPathPathFrame(nsIFrame* aTextPathFrame);
|
||||
mozilla::dom::SVGPathElement*
|
||||
GetTextPathPathElement(nsIFrame* aTextPathFrame);
|
||||
mozilla::TemporaryRef<Path> GetTextPath(nsIFrame* aTextPathFrame);
|
||||
gfxFloat GetOffsetScale(nsIFrame* aTextPathFrame);
|
||||
gfxFloat GetStartOffset(nsIFrame* aTextPathFrame);
|
||||
|
Loading…
Reference in New Issue
Block a user