Bug 1450250: Make svg:use use an actual shadow tree. r=heycam

Summary:
This fixes a couple fuzz bugs and prevents special-casing <svg:use> even more in
bug 1431255.

Unfortunately not as many hacks went away as I'd have hoped, since we still need
to match document rules, see the linked SVGWG issues.

But blocks_ancestor_combinators goes away, which is nice since it's on a very
hot path.

Test Plan: WPT for style invalidation, covered by existing tests otherwise.

Reviewers: heycam

Tags: #secure-revision

Bug #: 1450250

Differential Revision: https://phabricator.services.mozilla.com/D2154

MozReview-Commit-ID: C4mthjoSNFh
This commit is contained in:
Emilio Cobos Álvarez
2018-07-16 16:07:58 +02:00
parent 171c69260b
commit c97bcecad8
21 changed files with 378 additions and 268 deletions

View File

@@ -344,12 +344,9 @@ nsIContent::GetLang() const
already_AddRefed<nsIURI>
nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
{
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
MOZ_ASSERT(bindingParent);
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
if (SVGUseElement* use = GetContainingSVGUseShadowHost()) {
// XXX Ignore xml:base as we are removing it.
if (URLExtraData* data = useElement->GetContentURLData()) {
if (URLExtraData* data = use->GetContentURLData()) {
return do_AddRef(data->BaseURI());
}
}
@@ -419,11 +416,8 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
nsIURI*
nsIContent::GetBaseURIForStyleAttr() const
{
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
MOZ_ASSERT(bindingParent);
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
if (URLExtraData* data = useElement->GetContentURLData()) {
if (SVGUseElement* use = GetContainingSVGUseShadowHost()) {
if (URLExtraData* data = use->GetContentURLData()) {
return data->BaseURI();
}
}
@@ -435,11 +429,8 @@ nsIContent::GetBaseURIForStyleAttr() const
already_AddRefed<URLExtraData>
nsIContent::GetURLDataForStyleAttr(nsIPrincipal* aSubjectPrincipal) const
{
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
MOZ_ASSERT(bindingParent);
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
if (URLExtraData* data = useElement->GetContentURLData()) {
if (SVGUseElement* use = GetContainingSVGUseShadowHost()) {
if (URLExtraData* data = use->GetContentURLData()) {
return do_AddRef(data);
}
}