Bug 1410578: Make <link rel="stylesheet"> work in shadow trees. r=heycam
Summary: Somewhat straight-forward, mostly removing special-casing. Differential Revision: https://phabricator.services.mozilla.com/D1761 MozReview-Commit-ID: 6f8duD4pGrl
This commit is contained in:
@@ -125,7 +125,8 @@ HTMLLinkElement::HasDeferredDNSPrefetchRequest()
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
HTMLLinkElement::BindToTree(nsIDocument* aDocument,
|
||||
nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
{
|
||||
@@ -136,12 +137,8 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Link must be inert in ShadowRoot.
|
||||
if (aDocument && !GetContainingShadow()) {
|
||||
aDocument->RegisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
||||
if (IsInComposedDoc()) {
|
||||
if (nsIDocument* doc = GetComposedDoc()) {
|
||||
doc->RegisterPendingLinkUpdate(this);
|
||||
TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender();
|
||||
}
|
||||
|
||||
@@ -182,12 +179,8 @@ HTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
|
||||
// If this is reinserted back into the document it will not be
|
||||
// from the parser.
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
|
||||
|
||||
// Check for a ShadowRoot because link elements are inert in a
|
||||
// ShadowRoot.
|
||||
ShadowRoot* oldShadowRoot = GetBindingParent() ?
|
||||
GetBindingParent()->GetShadowRoot() : nullptr;
|
||||
nsIDocument* oldDoc = GetUncomposedDoc();
|
||||
ShadowRoot* oldShadowRoot = GetContainingShadow();
|
||||
|
||||
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMLinkRemoved"));
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
|
||||
Reference in New Issue
Block a user