mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1245751 - Part 8: Allow href without xlink on SVG <textPath> elements. r=jwatt
MozReview-Commit-ID: KObkvkctP4L --HG-- extra : rebase_source : 0a91f7826814e944c9ab440ff80d2d4fdc35dd10
This commit is contained in:
parent
5555a786b4
commit
e7eb14fbe6
@ -61,8 +61,9 @@ nsSVGElement::EnumInfo SVGTextPathElement::sEnumInfo[3] =
|
||||
}
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo SVGTextPathElement::sStringInfo[1] =
|
||||
nsSVGElement::StringInfo SVGTextPathElement::sStringInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::href, kNameSpaceID_None, true },
|
||||
{ &nsGkAtoms::href, kNameSpaceID_XLink, true }
|
||||
};
|
||||
|
||||
@ -82,7 +83,9 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextPathElement)
|
||||
already_AddRefed<SVGAnimatedString>
|
||||
SVGTextPathElement::Href()
|
||||
{
|
||||
return mStringAttributes[HREF].ToDOMAnimatedString(this);
|
||||
return mStringAttributes[HREF].IsExplicitlySet()
|
||||
? mStringAttributes[HREF].ToDOMAnimatedString(this)
|
||||
: mStringAttributes[XLINK_HREF].ToDOMAnimatedString(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -74,9 +74,9 @@ public:
|
||||
static nsSVGEnumMapping sSpacingMap[];
|
||||
static EnumInfo sEnumInfo[3];
|
||||
|
||||
enum { HREF };
|
||||
nsSVGString mStringAttributes[1];
|
||||
static StringInfo sStringInfo[1];
|
||||
enum { HREF, XLINK_HREF };
|
||||
nsSVGString mStringAttributes[2];
|
||||
static StringInfo sStringInfo[2];
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -3385,7 +3385,8 @@ SVGTextFrame::HandleAttributeChangeInDescendant(Element* aElement,
|
||||
if (aNameSpaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::startOffset) {
|
||||
NotifyGlyphMetricsChange();
|
||||
} else if (aNameSpaceID == kNameSpaceID_XLink &&
|
||||
} else if ((aNameSpaceID == kNameSpaceID_XLink ||
|
||||
aNameSpaceID == kNameSpaceID_None) &&
|
||||
aAttribute == nsGkAtoms::href) {
|
||||
// Blow away our reference, if any
|
||||
nsIFrame* childElementFrame = aElement->GetPrimaryFrame();
|
||||
@ -4822,7 +4823,14 @@ SVGTextFrame::GetTextPathPathElement(nsIFrame* aTextPathFrame)
|
||||
nsIContent* content = aTextPathFrame->GetContent();
|
||||
dom::SVGTextPathElement* tp = static_cast<dom::SVGTextPathElement*>(content);
|
||||
nsAutoString href;
|
||||
tp->mStringAttributes[dom::SVGTextPathElement::HREF].GetAnimValue(href, tp);
|
||||
if (tp->mStringAttributes[dom::SVGTextPathElement::HREF].IsExplicitlySet()) {
|
||||
tp->mStringAttributes[dom::SVGTextPathElement::HREF]
|
||||
.GetAnimValue(href, tp);
|
||||
} else {
|
||||
tp->mStringAttributes[dom::SVGTextPathElement::XLINK_HREF]
|
||||
.GetAnimValue(href, tp);
|
||||
}
|
||||
|
||||
if (href.IsEmpty()) {
|
||||
return nullptr; // no URL
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user