summaryrefslogtreecommitdiffstats
path: root/dom/html/nsGenericHTMLElement.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /dom/html/nsGenericHTMLElement.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/html/nsGenericHTMLElement.cpp')
-rw-r--r--dom/html/nsGenericHTMLElement.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp
index de29276fdc..1014ba2a25 100644
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -18,7 +18,6 @@
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TextEvents.h"
-#include "mozilla/StaticPrefs_html5.h"
#include "mozilla/StaticPrefs_accessibility.h"
#include "mozilla/dom/FetchPriority.h"
#include "mozilla/dom/FormData.h"
@@ -29,6 +28,7 @@
#include "nsQueryObject.h"
#include "mozilla/dom/BindContext.h"
#include "mozilla/dom/Document.h"
+#include "mozilla/dom/UnbindContext.h"
#include "nsPIDOMWindow.h"
#include "nsIFrameInlines.h"
#include "nsIScrollableFrame.h"
@@ -524,7 +524,7 @@ nsresult nsGenericHTMLElement::BindToTree(BindContext& aContext,
return rv;
}
-void nsGenericHTMLElement::UnbindFromTree(bool aNullParent) {
+void nsGenericHTMLElement::UnbindFromTree(UnbindContext& aContext) {
if (IsInComposedDoc()) {
// https://html.spec.whatwg.org/#dom-trees:hide-popover-algorithm
// If removedNode's popover attribute is not in the no popover state, then
@@ -544,7 +544,7 @@ void nsGenericHTMLElement::UnbindFromTree(bool aNullParent) {
}
}
- nsStyledElement::UnbindFromTree(aNullParent);
+ nsStyledElement::UnbindFromTree(aContext);
// Invalidate .labels list. It will be repopulated when used the next time.
nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
@@ -745,6 +745,16 @@ void nsGenericHTMLElement::AfterSetPopoverAttr() {
}
}
+void nsGenericHTMLElement::OnAttrSetButNotChanged(
+ int32_t aNamespaceID, nsAtom* aName, const nsAttrValueOrString& aValue,
+ bool aNotify) {
+ if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::popovertarget) {
+ ClearExplicitlySetAttrElement(aName);
+ }
+ return nsGenericHTMLElementBase::OnAttrSetButNotChanged(aNamespaceID, aName,
+ aValue, aNotify);
+}
+
void nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
@@ -763,7 +773,7 @@ void nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
NewRunnableMethod("nsGenericHTMLElement::AfterSetPopoverAttr", this,
&nsGenericHTMLElement::AfterSetPopoverAttr));
} else if (aName == nsGkAtoms::popovertarget) {
- ClearExplicitlySetAttrElement(nsGkAtoms::popovertarget);
+ ClearExplicitlySetAttrElement(aName);
} else if (aName == nsGkAtoms::dir) {
auto dir = Directionality::Ltr;
// A boolean tracking whether we need to recompute our directionality.
@@ -1259,25 +1269,24 @@ bool nsGenericHTMLElement::ParseImageAttribute(nsAtom* aAttribute,
bool nsGenericHTMLElement::ParseReferrerAttribute(const nsAString& aString,
nsAttrValue& aResult) {
using mozilla::dom::ReferrerInfo;
+ // This is a bit sketchy, we assume GetEnumString(…).get() points to a static
+ // buffer, relying on the fact that GetEnumString(…) returns a literal string.
static const nsAttrValue::EnumTable kReferrerPolicyTable[] = {
- {ReferrerInfo::ReferrerPolicyToString(ReferrerPolicy::No_referrer),
+ {GetEnumString(ReferrerPolicy::No_referrer).get(),
static_cast<int16_t>(ReferrerPolicy::No_referrer)},
- {ReferrerInfo::ReferrerPolicyToString(ReferrerPolicy::Origin),
+ {GetEnumString(ReferrerPolicy::Origin).get(),
static_cast<int16_t>(ReferrerPolicy::Origin)},
- {ReferrerInfo::ReferrerPolicyToString(
- ReferrerPolicy::Origin_when_cross_origin),
+ {GetEnumString(ReferrerPolicy::Origin_when_cross_origin).get(),
static_cast<int16_t>(ReferrerPolicy::Origin_when_cross_origin)},
- {ReferrerInfo::ReferrerPolicyToString(
- ReferrerPolicy::No_referrer_when_downgrade),
+ {GetEnumString(ReferrerPolicy::No_referrer_when_downgrade).get(),
static_cast<int16_t>(ReferrerPolicy::No_referrer_when_downgrade)},
- {ReferrerInfo::ReferrerPolicyToString(ReferrerPolicy::Unsafe_url),
+ {GetEnumString(ReferrerPolicy::Unsafe_url).get(),
static_cast<int16_t>(ReferrerPolicy::Unsafe_url)},
- {ReferrerInfo::ReferrerPolicyToString(ReferrerPolicy::Strict_origin),
+ {GetEnumString(ReferrerPolicy::Strict_origin).get(),
static_cast<int16_t>(ReferrerPolicy::Strict_origin)},
- {ReferrerInfo::ReferrerPolicyToString(ReferrerPolicy::Same_origin),
+ {GetEnumString(ReferrerPolicy::Same_origin).get(),
static_cast<int16_t>(ReferrerPolicy::Same_origin)},
- {ReferrerInfo::ReferrerPolicyToString(
- ReferrerPolicy::Strict_origin_when_cross_origin),
+ {GetEnumString(ReferrerPolicy::Strict_origin_when_cross_origin).get(),
static_cast<int16_t>(ReferrerPolicy::Strict_origin_when_cross_origin)},
{nullptr, ReferrerPolicy::_empty}};
return aResult.ParseEnumValue(aString, kReferrerPolicyTable, false);
@@ -1811,14 +1820,14 @@ nsresult nsGenericHTMLFormElement::BindToTree(BindContext& aContext,
return NS_OK;
}
-void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {
+void nsGenericHTMLFormElement::UnbindFromTree(UnbindContext& aContext) {
// Save state before doing anything else.
SaveState();
if (IsFormAssociatedElement()) {
if (HTMLFormElement* form = GetFormInternal()) {
// Might need to unset form
- if (aNullParent) {
+ if (aContext.IsUnbindRoot(this)) {
// No more parent means no more form
ClearForm(true, true);
} else {
@@ -1839,7 +1848,7 @@ void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {
}
}
- nsGenericHTMLElement::UnbindFromTree(aNullParent);
+ nsGenericHTMLElement::UnbindFromTree(aContext);
// The element might not have a fieldset anymore.
UpdateFieldSet(false);