зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1245751 - Part 2: Allow href without xlink on SVG <use> elements. r=jwatt
MozReview-Commit-ID: 28op2ZoRm6X --HG-- extra : rebase_source : bbf7c129463009578f45560ebfe6ff94741761be
This commit is contained in:
Родитель
b03e0b689f
Коммит
31d2e935e7
|
@ -38,8 +38,9 @@ nsSVGElement::LengthInfo SVGUseElement::sLengthInfo[4] =
|
|||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo SVGUseElement::sStringInfo[1] =
|
||||
nsSVGElement::StringInfo SVGUseElement::sStringInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::href, kNameSpaceID_None, true },
|
||||
{ &nsGkAtoms::href, kNameSpaceID_XLink, true }
|
||||
};
|
||||
|
||||
|
@ -109,7 +110,9 @@ SVGUseElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
|||
already_AddRefed<SVGAnimatedString>
|
||||
SVGUseElement::Href()
|
||||
{
|
||||
return mStringAttributes[HREF].ToDOMAnimatedString(this);
|
||||
return mStringAttributes[HREF].IsExplicitlySet()
|
||||
? mStringAttributes[HREF].ToDOMAnimatedString(this)
|
||||
: mStringAttributes[XLINK_HREF].ToDOMAnimatedString(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -395,9 +398,15 @@ void
|
|||
SVGUseElement::LookupHref()
|
||||
{
|
||||
nsAutoString href;
|
||||
if (mStringAttributes[HREF].IsExplicitlySet()) {
|
||||
mStringAttributes[HREF].GetAnimValue(href, this);
|
||||
if (href.IsEmpty())
|
||||
} else {
|
||||
mStringAttributes[XLINK_HREF].GetAnimValue(href, this);
|
||||
}
|
||||
|
||||
if (href.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> baseURI = mOriginal ? mOriginal->GetBaseURI() : GetBaseURI();
|
||||
|
|
|
@ -110,9 +110,9 @@ protected:
|
|||
nsSVGLength2 mLengthAttributes[4];
|
||||
static LengthInfo sLengthInfo[4];
|
||||
|
||||
enum { HREF };
|
||||
nsSVGString mStringAttributes[1];
|
||||
static StringInfo sStringInfo[1];
|
||||
enum { HREF, XLINK_HREF };
|
||||
nsSVGString mStringAttributes[2];
|
||||
static StringInfo sStringInfo[2];
|
||||
|
||||
nsCOMPtr<nsIContent> mOriginal; // if we've been cloned, our "real" copy
|
||||
nsCOMPtr<nsIContent> mClone; // cloned tree
|
||||
|
|
|
@ -117,8 +117,7 @@ nsSVGUseFrame::AttributeChanged(int32_t aNameSpaceID,
|
|||
SVGUseElement *useElement = static_cast<SVGUseElement*>(mContent);
|
||||
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y) {
|
||||
if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y) {
|
||||
// make sure our cached transform matrix gets (lazily) updated
|
||||
mCanvasTM = nullptr;
|
||||
nsLayoutUtils::PostRestyleEvent(
|
||||
|
@ -144,7 +143,10 @@ nsSVGUseFrame::AttributeChanged(int32_t aNameSpaceID,
|
|||
nsSVGUtils::ScheduleReflowSVG(this);
|
||||
}
|
||||
}
|
||||
} else if (aNameSpaceID == kNameSpaceID_XLink &&
|
||||
}
|
||||
|
||||
if ((aNameSpaceID == kNameSpaceID_XLink ||
|
||||
aNameSpaceID == kNameSpaceID_None) &&
|
||||
aAttribute == nsGkAtoms::href) {
|
||||
// we're changing our nature, clear out the clone information
|
||||
nsLayoutUtils::PostRestyleEvent(
|
||||
|
|
Загрузка…
Ссылка в новой задаче