summaryrefslogtreecommitdiffstats
path: root/dom/html/HTMLSharedElement.cpp
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-04-17 16:02:56 +0200
committerGitHub <noreply@github.com>2020-04-17 16:02:56 +0200
commitd5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf (patch)
tree2bfef192cbb748b675ce8308c242a376798e265d /dom/html/HTMLSharedElement.cpp
parent5caf99795aa81e1fc145b8e937b1ee8197ed2486 (diff)
parentf35aa3e15fedf3cd4ad163d60ab74a9537ca5c82 (diff)
downloadUXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.gz
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.lz
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.tar.xz
UXP-d5102d6beafc2a2a0cec3cc3ee5f7ebde31ae7bf.zip
Merge pull request #1518 from MoonchildProductions/shadowdom-merge
Incremental shadowdom-merge
Diffstat (limited to 'dom/html/HTMLSharedElement.cpp')
-rw-r--r--dom/html/HTMLSharedElement.cpp62
1 files changed, 21 insertions, 41 deletions
diff --git a/dom/html/HTMLSharedElement.cpp b/dom/html/HTMLSharedElement.cpp
index bcb84d29b..a7a10b082 100644
--- a/dom/html/HTMLSharedElement.cpp
+++ b/dom/html/HTMLSharedElement.cpp
@@ -231,52 +231,32 @@ SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
}
nsresult
-HTMLSharedElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
- nsIAtom* aPrefix, const nsAString& aValue,
- bool aNotify)
+HTMLSharedElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
+ const nsAttrValue* aValue,
+ const nsAttrValue* aOldValue, bool aNotify)
{
- nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
- aValue, aNotify);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // If the href attribute of a <base> tag is changing, we may need to update
- // the document's base URI, which will cause all the links on the page to be
- // re-resolved given the new base. If the target attribute is changing, we
- // similarly need to change the base target.
- if (mNodeInfo->Equals(nsGkAtoms::base) &&
- aNameSpaceID == kNameSpaceID_None &&
- IsInUncomposedDoc()) {
- if (aName == nsGkAtoms::href) {
- SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(), this);
- } else if (aName == nsGkAtoms::target) {
- SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(), this);
- }
- }
-
- return NS_OK;
-}
-
-nsresult
-HTMLSharedElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
- bool aNotify)
-{
- nsresult rv = nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aName, aNotify);
- NS_ENSURE_SUCCESS(rv, rv);
-
- // If we're the first <base> with an href and our href attribute is being
- // unset, then we're no longer the first <base> with an href, and we need to
- // find the new one. Similar for target.
- if (mNodeInfo->Equals(nsGkAtoms::base) &&
- aNameSpaceID == kNameSpaceID_None &&
- IsInUncomposedDoc()) {
+ if (aNamespaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::href) {
- SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(), nullptr);
+ // If the href attribute of a <base> tag is changing, we may need to
+ // update the document's base URI, which will cause all the links on the
+ // page to be re-resolved given the new base.
+ // If the href is being unset (aValue is null), we will need to find a new
+ // <base>.
+ if (mNodeInfo->Equals(nsGkAtoms::base) && IsInUncomposedDoc()) {
+ SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(),
+ aValue ? this : nullptr);
+ }
} else if (aName == nsGkAtoms::target) {
- SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(), nullptr);
+ // The target attribute is in pretty much the same situation as the href
+ // attribute, above.
+ if (mNodeInfo->Equals(nsGkAtoms::base) && IsInUncomposedDoc()) {
+ SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(),
+ aValue ? this : nullptr);
+ }
}
}
-
- return NS_OK;
+ return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
+ aOldValue, aNotify);
}
nsresult