mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1829225 - Make BeforeSetAttr take the parsed nsAttrValue. r=smaug
ParseAttribute ideally would be const (see bug 1829138), but the SVG and SMIL code is rather messy. Still, now that BeforeSetAttr can't really fail, swapping the order of ParseAttribute and BeforeSetAttr shouldn't really change behavior. Sorry for the extra `virtual` keyword removal and such. I had to do this one by hand unlike the dependent bugs, and I went a bit drive-by, lmk if you want me to split those changes. Differential Revision: https://phabricator.services.mozilla.com/D176086
This commit is contained in:
parent
d516ab3acb
commit
25b79c7b15
@ -2469,14 +2469,17 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
|
||||
|
||||
uint8_t modType;
|
||||
bool hasListeners;
|
||||
nsAttrValueOrString value(aValue);
|
||||
nsAttrValue oldValue;
|
||||
bool oldValueSet;
|
||||
|
||||
if (OnlyNotifySameValueSet(aNamespaceID, aName, aPrefix, value, aNotify,
|
||||
oldValue, &modType, &hasListeners, &oldValueSet)) {
|
||||
OnAttrSetButNotChanged(aNamespaceID, aName, value, aNotify);
|
||||
return NS_OK;
|
||||
{
|
||||
const nsAttrValueOrString value(aValue);
|
||||
if (OnlyNotifySameValueSet(aNamespaceID, aName, aPrefix, value, aNotify,
|
||||
oldValue, &modType, &hasListeners,
|
||||
&oldValueSet)) {
|
||||
OnAttrSetButNotChanged(aNamespaceID, aName, value, aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Hold a script blocker while calling ParseAttribute since that can call
|
||||
@ -2489,15 +2492,15 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
|
||||
modType);
|
||||
}
|
||||
|
||||
BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
|
||||
|
||||
nsAttrValue attrValue;
|
||||
if (!ParseAttribute(aNamespaceID, aName, aValue, aSubjectPrincipal,
|
||||
attrValue)) {
|
||||
attrValue.SetTo(aValue);
|
||||
}
|
||||
|
||||
PreIdMaybeChange(aNamespaceID, aName, &value);
|
||||
BeforeSetAttr(aNamespaceID, aName, &attrValue, aNotify);
|
||||
|
||||
PreIdMaybeChange(aNamespaceID, aName, &attrValue);
|
||||
|
||||
return SetAttrAndNotify(aNamespaceID, aName, aPrefix,
|
||||
oldValueSet ? &oldValue : nullptr, attrValue,
|
||||
@ -2516,14 +2519,17 @@ nsresult Element::SetParsedAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
|
||||
uint8_t modType;
|
||||
bool hasListeners;
|
||||
nsAttrValueOrString value(aParsedValue);
|
||||
nsAttrValue oldValue;
|
||||
bool oldValueSet;
|
||||
|
||||
if (OnlyNotifySameValueSet(aNamespaceID, aName, aPrefix, value, aNotify,
|
||||
oldValue, &modType, &hasListeners, &oldValueSet)) {
|
||||
OnAttrSetButNotChanged(aNamespaceID, aName, value, aNotify);
|
||||
return NS_OK;
|
||||
{
|
||||
const nsAttrValueOrString value(aParsedValue);
|
||||
if (OnlyNotifySameValueSet(aNamespaceID, aName, aPrefix, value, aNotify,
|
||||
oldValue, &modType, &hasListeners,
|
||||
&oldValueSet)) {
|
||||
OnAttrSetButNotChanged(aNamespaceID, aName, value, aNotify);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
Document* document = GetComposedDoc();
|
||||
@ -2534,9 +2540,9 @@ nsresult Element::SetParsedAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
modType);
|
||||
}
|
||||
|
||||
BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
|
||||
BeforeSetAttr(aNamespaceID, aName, &aParsedValue, aNotify);
|
||||
|
||||
PreIdMaybeChange(aNamespaceID, aName, &value);
|
||||
PreIdMaybeChange(aNamespaceID, aName, &aParsedValue);
|
||||
|
||||
return SetAttrAndNotify(aNamespaceID, aName, aPrefix,
|
||||
oldValueSet ? &oldValue : nullptr, aParsedValue,
|
||||
@ -2731,7 +2737,7 @@ bool Element::SetAndSwapMappedAttribute(nsAtom* aName, nsAttrValue& aValue,
|
||||
}
|
||||
|
||||
void Element::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::_class && aValue) {
|
||||
// Note: This flag is asymmetrical. It is never unset and isn't exact.
|
||||
@ -2775,7 +2781,7 @@ void Element::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
}
|
||||
|
||||
void Element::PreIdMaybeChange(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue) {
|
||||
const nsAttrValue* aValue) {
|
||||
if (aNamespaceID != kNameSpaceID_None || aName != nsGkAtoms::id) {
|
||||
return;
|
||||
}
|
||||
|
@ -1928,7 +1928,7 @@ class Element : public FragmentOrElement {
|
||||
* @param aNotify Whether we plan to notify document observers.
|
||||
*/
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify);
|
||||
const nsAttrValue* aValue, bool aNotify);
|
||||
|
||||
/**
|
||||
* Hook that is called by Element::SetAttr to allow subclasses to
|
||||
@ -1974,7 +1974,7 @@ class Element : public FragmentOrElement {
|
||||
* @param aValue the new id value. Will be null if the id is being unset.
|
||||
*/
|
||||
void PreIdMaybeChange(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue);
|
||||
const nsAttrValue* aValue);
|
||||
|
||||
/**
|
||||
* This function shall be called just after the id attribute changes. It will
|
||||
|
@ -45,8 +45,6 @@ class MutationObservers {
|
||||
* @param aNameSpaceID Namespace of changing attribute
|
||||
* @param aAttribute Local-name of changing attribute
|
||||
* @param aModType Type of change (add/change/removal)
|
||||
* @param aNewValue The parsed new value, but only if BeforeSetAttr
|
||||
* preparsed it!!!
|
||||
* @see nsIMutationObserver::AttributeWillChange
|
||||
*/
|
||||
static void NotifyAttributeWillChange(mozilla::dom::Element* aElement,
|
||||
|
@ -168,8 +168,6 @@ class nsIMutationObserver
|
||||
* @param aModType Whether or not the attribute will be added, changed, or
|
||||
* removed. The constants are defined in
|
||||
* MutationEvent.webidl.
|
||||
* @param aNewValue The new value, IF it has been preparsed by
|
||||
* BeforeSetAttr, otherwise null.
|
||||
*
|
||||
* @note Callers of this method might not hold a strong reference to the
|
||||
* observer. The observer is responsible for making sure it stays
|
||||
|
@ -52,14 +52,10 @@ bool nsStyledElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
}
|
||||
|
||||
void nsStyledElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::style) {
|
||||
if (aValue) {
|
||||
SetMayHaveStyle();
|
||||
}
|
||||
}
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::style &&
|
||||
aValue) {
|
||||
SetMayHaveStyle();
|
||||
}
|
||||
|
||||
return nsStyledElementBase::BeforeSetAttr(aNamespaceID, aName, aValue,
|
||||
|
@ -76,10 +76,10 @@ class nsStyledElement : public nsStyledElementBase {
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult, bool aForceInDataDoc);
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
|
||||
friend class mozilla::dom::Element;
|
||||
|
||||
@ -91,9 +91,8 @@ class nsStyledElement : public nsStyledElementBase {
|
||||
*/
|
||||
nsresult ReparseStyleAttribute(bool aForceInDataDoc);
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsStyledElement, NS_STYLED_ELEMENT_IID)
|
||||
|
@ -187,14 +187,10 @@ already_AddRefed<nsIURI> HTMLAnchorElement::GetHrefURI() const {
|
||||
}
|
||||
|
||||
void HTMLAnchorElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::href) {
|
||||
CancelDNSPrefetch(*this);
|
||||
}
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::href) {
|
||||
CancelDNSPrefetch(*this);
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::BeforeSetAttr(aNamespaceID, aName, aValue,
|
||||
aNotify);
|
||||
}
|
||||
|
@ -39,19 +39,19 @@ class HTMLAnchorElement final : public nsGenericHTMLElement,
|
||||
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLAnchorElement, a);
|
||||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
virtual bool Draggable() const override;
|
||||
int32_t TabIndexDefault() override;
|
||||
bool Draggable() const override;
|
||||
|
||||
// Element
|
||||
virtual bool IsInteractiveHTMLContent() const override;
|
||||
bool IsInteractiveHTMLContent() const override;
|
||||
|
||||
// DOM memory reporter participant
|
||||
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
|
||||
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
@ -60,18 +60,15 @@ class HTMLAnchorElement final : public nsGenericHTMLElement,
|
||||
void GetLinkTarget(nsAString& aTarget) override;
|
||||
already_AddRefed<nsIURI> GetHrefURI() const override;
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
virtual void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
virtual ElementState IntrinsicState() const override;
|
||||
ElementState IntrinsicState() const override;
|
||||
|
||||
// WebIDL API
|
||||
|
||||
@ -198,8 +195,7 @@ class HTMLAnchorElement final : public nsGenericHTMLElement,
|
||||
protected:
|
||||
virtual ~HTMLAnchorElement();
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
RefPtr<nsDOMTokenList> mRelList;
|
||||
};
|
||||
|
||||
|
@ -336,8 +336,7 @@ void HTMLButtonElement::DoneCreatingElement() {
|
||||
}
|
||||
|
||||
void HTMLButtonElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNotify && aName == nsGkAtoms::disabled &&
|
||||
aNameSpaceID == kNameSpaceID_None) {
|
||||
mDisabledChanged = true;
|
||||
|
@ -32,12 +32,12 @@ class HTMLButtonElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
int32_t TabIndexDefault() override;
|
||||
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLButtonElement, button)
|
||||
|
||||
// Element
|
||||
virtual bool IsInteractiveHTMLContent() const override { return true; }
|
||||
bool IsInteractiveHTMLContent() const override { return true; }
|
||||
|
||||
// nsGenericHTMLFormElement
|
||||
void SaveState() override;
|
||||
@ -47,22 +47,21 @@ class HTMLButtonElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
NS_IMETHOD Reset() override;
|
||||
NS_IMETHOD SubmitNamesValues(FormData* aFormData) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
// EventTarget
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
// nsINode
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
virtual void DoneCreatingElement() override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
void DoneCreatingElement() override;
|
||||
|
||||
void UpdateBarredFromConstraintValidation();
|
||||
// Element
|
||||
@ -70,26 +69,23 @@ class HTMLButtonElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
/**
|
||||
* Called when an attribute is about to be changed
|
||||
*/
|
||||
virtual void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
/**
|
||||
* Called when an attribute has just been changed
|
||||
*/
|
||||
virtual void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
|
||||
// nsGenericHTMLElement
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
virtual bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
||||
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
||||
|
||||
// WebIDL
|
||||
bool Disabled() const { return GetBoolAttr(nsGkAtoms::disabled); }
|
||||
|
@ -180,8 +180,7 @@ NS_IMPL_ELEMENT_CLONE(HTMLFormElement)
|
||||
nsIHTMLCollection* HTMLFormElement::Elements() { return mControls; }
|
||||
|
||||
void HTMLFormElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::action || aName == nsGkAtoms::target) {
|
||||
// Don't forget we've notified the password manager already if the
|
||||
|
@ -71,32 +71,30 @@ class HTMLFormElement final : public nsGenericHTMLElement,
|
||||
HTMLInputElement* aRadio) override;
|
||||
void RemoveFromRadioGroup(const nsAString& aName,
|
||||
HTMLInputElement* aRadio) override;
|
||||
virtual uint32_t GetRequiredRadioCount(const nsAString& aName) const override;
|
||||
virtual void RadioRequiredWillChange(const nsAString& aName,
|
||||
bool aRequiredAdded) override;
|
||||
virtual bool GetValueMissingState(const nsAString& aName) const override;
|
||||
virtual void SetValueMissingState(const nsAString& aName,
|
||||
bool aValue) override;
|
||||
uint32_t GetRequiredRadioCount(const nsAString& aName) const override;
|
||||
void RadioRequiredWillChange(const nsAString& aName,
|
||||
bool aRequiredAdded) override;
|
||||
bool GetValueMissingState(const nsAString& aName) const override;
|
||||
void SetValueMissingState(const nsAString& aName, bool aValue) override;
|
||||
|
||||
virtual ElementState IntrinsicState() const override;
|
||||
ElementState IntrinsicState() const override;
|
||||
|
||||
// EventTarget
|
||||
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
|
||||
void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
|
||||
|
||||
// nsIContent
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
void WillHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
|
||||
/**
|
||||
* Forget all information about the current submission (and the fact that we
|
||||
@ -104,7 +102,7 @@ class HTMLFormElement final : public nsGenericHTMLElement,
|
||||
*/
|
||||
void ForgetCurrentSubmission();
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLFormElement,
|
||||
nsGenericHTMLElement)
|
||||
@ -395,8 +393,7 @@ class HTMLFormElement final : public nsGenericHTMLElement,
|
||||
JS::ExpandoAndGeneration mExpandoAndGeneration;
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
void PostPasswordEvent();
|
||||
void PostPossibleUsernameEvent();
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/dom/EventHandlerBinding.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(FrameSet)
|
||||
|
||||
@ -26,7 +25,7 @@ JSObject* HTMLFrameSetElement::WrapNode(JSContext* aCx,
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLFrameSetElement)
|
||||
|
||||
void HTMLFrameSetElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify) {
|
||||
/* The main goal here is to see whether the _number_ of rows or
|
||||
* columns has changed. If it has, we need to reframe; otherwise
|
||||
@ -45,8 +44,7 @@ void HTMLFrameSetElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
if (aName == nsGkAtoms::rows) {
|
||||
if (aValue) {
|
||||
int32_t oldRows = mNumRows;
|
||||
ParseRowCol(aValue->String(), mNumRows, &mRowSpecs);
|
||||
|
||||
ParseRowCol(*aValue, mNumRows, &mRowSpecs);
|
||||
if (mNumRows != oldRows) {
|
||||
mCurrentRowColHint = nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
@ -54,8 +52,7 @@ void HTMLFrameSetElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
} else if (aName == nsGkAtoms::cols) {
|
||||
if (aValue) {
|
||||
int32_t oldCols = mNumCols;
|
||||
ParseRowCol(aValue->String(), mNumCols, &mColSpecs);
|
||||
|
||||
ParseRowCol(*aValue, mNumCols, &mColSpecs);
|
||||
if (mNumCols != oldCols) {
|
||||
mCurrentRowColHint = nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
@ -75,10 +72,8 @@ nsresult HTMLFrameSetElement::GetRowSpec(int32_t* aNumValues,
|
||||
*aSpecs = nullptr;
|
||||
|
||||
if (!mRowSpecs) {
|
||||
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::rows);
|
||||
if (value && value->Type() == nsAttrValue::eString) {
|
||||
nsresult rv = ParseRowCol(value->GetStringValue(), mNumRows, &mRowSpecs);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (const nsAttrValue* value = GetParsedAttr(nsGkAtoms::rows)) {
|
||||
MOZ_TRY(ParseRowCol(*value, mNumRows, &mRowSpecs));
|
||||
}
|
||||
|
||||
if (!mRowSpecs) { // we may not have had an attr or had an empty attr
|
||||
@ -102,9 +97,8 @@ nsresult HTMLFrameSetElement::GetColSpec(int32_t* aNumValues,
|
||||
*aSpecs = nullptr;
|
||||
|
||||
if (!mColSpecs) {
|
||||
const nsAttrValue* value = GetParsedAttr(nsGkAtoms::cols);
|
||||
if (value && value->Type() == nsAttrValue::eString) {
|
||||
nsresult rv = ParseRowCol(value->GetStringValue(), mNumCols, &mColSpecs);
|
||||
if (const nsAttrValue* value = GetParsedAttr(nsGkAtoms::rows)) {
|
||||
nsresult rv = ParseRowCol(*value, mNumCols, &mColSpecs);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -155,20 +149,22 @@ nsChangeHint HTMLFrameSetElement::GetAttributeChangeHint(
|
||||
/**
|
||||
* Translate a "rows" or "cols" spec into an array of nsFramesetSpecs
|
||||
*/
|
||||
nsresult HTMLFrameSetElement::ParseRowCol(const nsAString& aValue,
|
||||
nsresult HTMLFrameSetElement::ParseRowCol(const nsAttrValue& aValue,
|
||||
int32_t& aNumSpecs,
|
||||
UniquePtr<nsFramesetSpec[]>* aSpecs) {
|
||||
if (aValue.IsEmpty()) {
|
||||
if (aValue.IsEmptyString()) {
|
||||
aNumSpecs = 0;
|
||||
*aSpecs = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aValue.Type() == nsAttrValue::eString);
|
||||
|
||||
static const char16_t sAster('*');
|
||||
static const char16_t sPercent('%');
|
||||
static const char16_t sComma(',');
|
||||
|
||||
nsAutoString spec(aValue);
|
||||
nsAutoString spec(aValue.GetStringValue());
|
||||
// remove whitespace (Bug 33699) and quotation marks (bug 224598)
|
||||
// also remove leading/trailing commas (bug 31482)
|
||||
spec.StripChars(u" \n\r\t\"\'");
|
||||
|
@ -68,7 +68,7 @@ class HTMLFrameSetElement final : public nsGenericHTMLElement {
|
||||
SetHTMLAttr(nsGkAtoms::rows, aRows, aError);
|
||||
}
|
||||
|
||||
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
|
||||
bool IsEventAttributeNameInternal(nsAtom* aName) override;
|
||||
|
||||
// Event listener stuff; we need to declare only the ones we need to
|
||||
// forward to window that don't come from nsIDOMHTMLFrameSetElement.
|
||||
@ -104,27 +104,25 @@ class HTMLFrameSetElement final : public nsGenericHTMLElement {
|
||||
*/
|
||||
nsresult GetColSpec(int32_t* aNumValues, const nsFramesetSpec** aSpecs);
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
protected:
|
||||
virtual ~HTMLFrameSetElement();
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
|
||||
private:
|
||||
nsresult ParseRowCol(const nsAString& aValue, int32_t& aNumSpecs,
|
||||
nsresult ParseRowCol(const nsAttrValue& aValue, int32_t& aNumSpecs,
|
||||
UniquePtr<nsFramesetSpec[]>* aSpecs);
|
||||
|
||||
/**
|
||||
|
@ -296,16 +296,13 @@ nsMapRuleToAttributesFunc HTMLImageElement::GetAttributeMappingFunction()
|
||||
}
|
||||
|
||||
void HTMLImageElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNameSpaceID == kNameSpaceID_None && mForm &&
|
||||
(aName == nsGkAtoms::name || aName == nsGkAtoms::id)) {
|
||||
// remove the image from the hashtable as needed
|
||||
nsAutoString tmp;
|
||||
GetAttr(kNameSpaceID_None, aName, tmp);
|
||||
|
||||
if (!tmp.IsEmpty()) {
|
||||
mForm->RemoveImageElementFromTable(this, tmp);
|
||||
if (auto* old = GetParsedAttr(aName); old && !old->IsEmptyString()) {
|
||||
mForm->RemoveImageElementFromTable(
|
||||
this, nsDependentAtomString(old->GetAtomValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -812,8 +809,8 @@ void HTMLImageElement::ClearForm(bool aRemoveFromForm) {
|
||||
|
||||
if (aRemoveFromForm) {
|
||||
nsAutoString nameVal, idVal;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::name, nameVal);
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::id, idVal);
|
||||
GetAttr(nsGkAtoms::name, nameVal);
|
||||
GetAttr(nsGkAtoms::id, idVal);
|
||||
|
||||
mForm->RemoveImageElement(this);
|
||||
|
||||
|
@ -356,18 +356,16 @@ class HTMLImageElement final : public nsGenericHTMLElement,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
void UpdateFormOwner();
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
|
||||
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify) override;
|
||||
virtual void OnAttrSetButNotChanged(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString& aValue,
|
||||
bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
bool aNotify) override;
|
||||
void OnAttrSetButNotChanged(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString& aValue,
|
||||
bool aNotify) override;
|
||||
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include "nsRangeFrame.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#include "nsIPromptCollection.h"
|
||||
|
||||
#include "mozilla/PresState.h"
|
||||
@ -1175,8 +1174,7 @@ nsresult HTMLInputElement::Clone(dom::NodeInfo* aNodeInfo,
|
||||
}
|
||||
|
||||
void HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aNotify && aName == nsGkAtoms::disabled) {
|
||||
mDisabledChanged = true;
|
||||
|
@ -940,7 +940,7 @@ class HTMLInputElement final : public TextControlElement,
|
||||
* Called when an attribute is about to be changed
|
||||
*/
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) override;
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
/**
|
||||
* Called when an attribute has just been changed
|
||||
*/
|
||||
|
@ -196,8 +196,7 @@ void HTMLLinkElement::CreateAndDispatchEvent(Document* aDoc,
|
||||
}
|
||||
|
||||
void HTMLLinkElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNameSpaceID == kNameSpaceID_None &&
|
||||
(aName == nsGkAtoms::href || aName == nsGkAtoms::rel)) {
|
||||
CancelDNSPrefetch(*this);
|
||||
|
@ -51,7 +51,7 @@ class HTMLLinkElement final : public nsGenericHTMLElement,
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) override;
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
@ -143,8 +143,7 @@ nsChangeHint HTMLOptionElement::GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
}
|
||||
|
||||
void HTMLOptionElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
nsGenericHTMLElement::BeforeSetAttr(aNamespaceID, aName, aValue, aNotify);
|
||||
|
||||
if (aNamespaceID != kNameSpaceID_None || aName != nsGkAtoms::selected ||
|
||||
|
@ -37,17 +37,14 @@ class HTMLOptionElement final : public nsGenericHTMLElement {
|
||||
|
||||
void SetSelectedChanged(bool aValue) { mSelectedChanged = aValue; }
|
||||
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
void SetSelectedInternal(bool aValue, bool aNotify);
|
||||
|
||||
@ -64,13 +61,13 @@ class HTMLOptionElement final : public nsGenericHTMLElement {
|
||||
*/
|
||||
void UpdateDisabledState(bool aNotify);
|
||||
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
|
||||
// nsIContent
|
||||
virtual ElementState IntrinsicState() const override;
|
||||
ElementState IntrinsicState() const override;
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
||||
|
||||
@ -122,8 +119,7 @@ class HTMLOptionElement final : public nsGenericHTMLElement {
|
||||
protected:
|
||||
virtual ~HTMLOptionElement();
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
/**
|
||||
* Get the select content element that contains this option, this
|
||||
|
@ -1051,8 +1051,7 @@ void HTMLSelectElement::UnbindFromTree(bool aNullParent) {
|
||||
}
|
||||
|
||||
void HTMLSelectElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNameSpaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::disabled) {
|
||||
if (aNotify) {
|
||||
|
@ -115,10 +115,10 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
int32_t TabIndexDefault() override;
|
||||
|
||||
// Element
|
||||
virtual bool IsInteractiveHTMLContent() const override { return true; }
|
||||
bool IsInteractiveHTMLContent() const override { return true; }
|
||||
|
||||
// WebIdl HTMLSelectElement
|
||||
void GetAutocomplete(DOMString& aValue);
|
||||
@ -188,22 +188,21 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
using nsINode::Remove;
|
||||
|
||||
// nsINode
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
// nsIContent
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
virtual void InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
|
||||
bool aNotify, ErrorResult& aRv) override;
|
||||
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
|
||||
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
void InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
|
||||
bool aNotify, ErrorResult& aRv) override;
|
||||
void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
|
||||
|
||||
// nsGenericHTMLElement
|
||||
virtual bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
||||
bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
||||
|
||||
// nsGenericHTMLFormElement
|
||||
void SaveState() override;
|
||||
@ -213,7 +212,7 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
NS_IMETHOD Reset() override;
|
||||
NS_IMETHOD SubmitNamesValues(FormData* aFormData) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
ElementState IntrinsicState() const override;
|
||||
|
||||
@ -269,31 +268,27 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
/**
|
||||
* Called when an attribute is about to be changed
|
||||
*/
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent) override;
|
||||
virtual void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
virtual void DoneAddingChildren(bool aHaveNotified) override;
|
||||
virtual bool IsDoneAddingChildren() override { return mIsDoneAddingChildren; }
|
||||
void DoneAddingChildren(bool aHaveNotified) override;
|
||||
bool IsDoneAddingChildren() override { return mIsDoneAddingChildren; }
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction()
|
||||
const override;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
||||
nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(
|
||||
HTMLSelectElement, nsGenericHTMLFormControlElementWithState)
|
||||
|
@ -75,8 +75,7 @@ void HTMLSlotElement::UnbindFromTree(bool aNullParent) {
|
||||
}
|
||||
|
||||
void HTMLSlotElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::name) {
|
||||
if (ShadowRoot* containingShadow = GetContainingShadow()) {
|
||||
containingShadow->RemoveSlot(this);
|
||||
|
@ -22,20 +22,17 @@ class HTMLSlotElement final : public nsGenericHTMLElement {
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSlotElement,
|
||||
nsGenericHTMLElement)
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent) override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent) override;
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
// WebIDL
|
||||
void SetName(const nsAString& aName, ErrorResult& aRv) {
|
||||
|
@ -1005,8 +1005,7 @@ void HTMLTableElement::UnbindFromTree(bool aNullParent) {
|
||||
}
|
||||
|
||||
void HTMLTableElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aName == nsGkAtoms::cellpadding && aNameSpaceID == kNameSpaceID_None) {
|
||||
ReleaseInheritedAttributes();
|
||||
}
|
||||
|
@ -146,32 +146,28 @@ class HTMLTableElement final : public nsGenericHTMLElement {
|
||||
SetHTMLAttr(nsGkAtoms::cellspacing, aCellSpacing, aError);
|
||||
}
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction()
|
||||
const override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
/**
|
||||
* Called when an attribute is about to be changed
|
||||
*/
|
||||
virtual void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
/**
|
||||
* Called when an attribute has just been changed
|
||||
*/
|
||||
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTableElement,
|
||||
nsGenericHTMLElement)
|
||||
@ -180,8 +176,7 @@ class HTMLTableElement final : public nsGenericHTMLElement {
|
||||
protected:
|
||||
virtual ~HTMLTableElement();
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
nsIContent* GetChild(nsAtom* aTag) const {
|
||||
for (nsIContent* cur = nsINode::GetFirstChild(); cur;
|
||||
|
@ -823,7 +823,7 @@ void HTMLTextAreaElement::UnbindFromTree(bool aNullParent) {
|
||||
}
|
||||
|
||||
void HTMLTextAreaElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify) {
|
||||
if (aNotify && aName == nsGkAtoms::disabled &&
|
||||
aNameSpaceID == kNameSpaceID_None) {
|
||||
|
@ -50,13 +50,13 @@ class HTMLTextAreaElement final : public TextControlElement,
|
||||
|
||||
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLTextAreaElement, textarea)
|
||||
|
||||
virtual int32_t TabIndexDefault() override;
|
||||
int32_t TabIndexDefault() override;
|
||||
|
||||
// Element
|
||||
virtual bool IsInteractiveHTMLContent() const override { return true; }
|
||||
bool IsInteractiveHTMLContent() const override { return true; }
|
||||
|
||||
// nsGenericHTMLElement
|
||||
virtual bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
||||
bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
||||
|
||||
// nsGenericHTMLFormElement
|
||||
void SaveState() override;
|
||||
@ -67,80 +67,74 @@ class HTMLTextAreaElement final : public TextControlElement,
|
||||
NS_IMETHOD Reset() override;
|
||||
NS_IMETHOD SubmitNamesValues(FormData* aFormData) override;
|
||||
|
||||
virtual void FieldSetDisabledChanged(bool aNotify) override;
|
||||
void FieldSetDisabledChanged(bool aNotify) override;
|
||||
|
||||
virtual ElementState IntrinsicState() const override;
|
||||
ElementState IntrinsicState() const override;
|
||||
|
||||
void SetLastValueChangeWasInteractive(bool);
|
||||
|
||||
// TextControlElement
|
||||
virtual nsresult SetValueChanged(bool aValueChanged) override;
|
||||
virtual bool IsSingleLineTextControl() const override;
|
||||
virtual bool IsTextArea() const override;
|
||||
virtual bool IsPasswordTextControl() const override;
|
||||
virtual int32_t GetCols() override;
|
||||
virtual int32_t GetWrapCols() override;
|
||||
virtual int32_t GetRows() override;
|
||||
virtual void GetDefaultValueFromContent(nsAString& aValue) override;
|
||||
virtual bool ValueChanged() const override;
|
||||
virtual void GetTextEditorValue(nsAString& aValue,
|
||||
bool aIgnoreWrap) const override;
|
||||
MOZ_CAN_RUN_SCRIPT virtual TextEditor* GetTextEditor() override;
|
||||
virtual TextEditor* GetTextEditorWithoutCreation() override;
|
||||
virtual nsISelectionController* GetSelectionController() override;
|
||||
virtual nsFrameSelection* GetConstFrameSelection() override;
|
||||
virtual TextControlState* GetTextControlState() const override {
|
||||
return mState;
|
||||
}
|
||||
virtual nsresult BindToFrame(nsTextControlFrame* aFrame) override;
|
||||
MOZ_CAN_RUN_SCRIPT virtual void UnbindFromFrame(
|
||||
nsTextControlFrame* aFrame) override;
|
||||
MOZ_CAN_RUN_SCRIPT virtual nsresult CreateEditor() override;
|
||||
virtual void SetPreviewValue(const nsAString& aValue) override;
|
||||
virtual void GetPreviewValue(nsAString& aValue) override;
|
||||
virtual void EnablePreview() override;
|
||||
virtual bool IsPreviewEnabled() override;
|
||||
virtual void InitializeKeyboardEventListeners() override;
|
||||
virtual void OnValueChanged(ValueChangeKind) override;
|
||||
virtual void GetValueFromSetRangeText(nsAString& aValue) override;
|
||||
MOZ_CAN_RUN_SCRIPT virtual nsresult SetValueFromSetRangeText(
|
||||
const nsAString& aValue) override;
|
||||
virtual bool HasCachedSelection() override;
|
||||
nsresult SetValueChanged(bool aValueChanged) override;
|
||||
bool IsSingleLineTextControl() const override;
|
||||
bool IsTextArea() const override;
|
||||
bool IsPasswordTextControl() const override;
|
||||
int32_t GetCols() override;
|
||||
int32_t GetWrapCols() override;
|
||||
int32_t GetRows() override;
|
||||
void GetDefaultValueFromContent(nsAString& aValue) override;
|
||||
bool ValueChanged() const override;
|
||||
void GetTextEditorValue(nsAString& aValue, bool aIgnoreWrap) const override;
|
||||
MOZ_CAN_RUN_SCRIPT TextEditor* GetTextEditor() override;
|
||||
TextEditor* GetTextEditorWithoutCreation() override;
|
||||
nsISelectionController* GetSelectionController() override;
|
||||
nsFrameSelection* GetConstFrameSelection() override;
|
||||
TextControlState* GetTextControlState() const override { return mState; }
|
||||
nsresult BindToFrame(nsTextControlFrame* aFrame) override;
|
||||
MOZ_CAN_RUN_SCRIPT void UnbindFromFrame(nsTextControlFrame* aFrame) override;
|
||||
MOZ_CAN_RUN_SCRIPT nsresult CreateEditor() override;
|
||||
void SetPreviewValue(const nsAString& aValue) override;
|
||||
void GetPreviewValue(nsAString& aValue) override;
|
||||
void EnablePreview() override;
|
||||
bool IsPreviewEnabled() override;
|
||||
void InitializeKeyboardEventListeners() override;
|
||||
void OnValueChanged(ValueChangeKind) override;
|
||||
void GetValueFromSetRangeText(nsAString& aValue) override;
|
||||
MOZ_CAN_RUN_SCRIPT nsresult
|
||||
SetValueFromSetRangeText(const nsAString& aValue) override;
|
||||
bool HasCachedSelection() override;
|
||||
|
||||
// nsIContent
|
||||
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction()
|
||||
const override;
|
||||
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
||||
nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PreHandleEvent(EventChainVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
nsresult PreHandleEvent(EventChainVisitor& aVisitor) override;
|
||||
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
|
||||
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
|
||||
virtual void DoneAddingChildren(bool aHaveNotified) override;
|
||||
virtual bool IsDoneAddingChildren() override;
|
||||
void DoneAddingChildren(bool aHaveNotified) override;
|
||||
bool IsDoneAddingChildren() override;
|
||||
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
nsresult CopyInnerTo(Element* aDest);
|
||||
|
||||
/**
|
||||
* Called when an attribute is about to be changed
|
||||
*/
|
||||
virtual void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
|
||||
// nsIMutationObserver
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
||||
@ -290,8 +284,7 @@ class HTMLTextAreaElement final : public TextControlElement,
|
||||
// get rid of the compiler warning
|
||||
using nsGenericHTMLFormControlElementWithState::IsSingleLineTextControl;
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
nsCOMPtr<nsIControllers> mControllers;
|
||||
/** Whether or not the value has changed since its default value was given. */
|
||||
@ -349,11 +342,9 @@ class HTMLTextAreaElement final : public TextControlElement,
|
||||
*/
|
||||
void ContentChanged(nsIContent* aContent);
|
||||
|
||||
virtual void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
/**
|
||||
* Return if an element should have a specific validity UI
|
||||
|
@ -66,7 +66,6 @@
|
||||
#include "nsIFormControl.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "nsDOMStringMap.h"
|
||||
@ -620,7 +619,7 @@ already_AddRefed<nsIURI> nsGenericHTMLElement::GetHrefURIForAnchors() const {
|
||||
}
|
||||
|
||||
void nsGenericHTMLElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::accesskey) {
|
||||
@ -632,7 +631,7 @@ void nsGenericHTMLElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
} else if (aName == nsGkAtoms::name) {
|
||||
// Have to do this before clearing flag. See RemoveFromNameTable
|
||||
RemoveFromNameTable();
|
||||
if (!aValue || aValue->IsEmpty()) {
|
||||
if (!aValue || aValue->IsEmptyString()) {
|
||||
ClearHasName();
|
||||
}
|
||||
} else if (aName == nsGkAtoms::contenteditable) {
|
||||
@ -1835,7 +1834,7 @@ void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {
|
||||
|
||||
void nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID,
|
||||
nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
const nsAttrValue* aValue,
|
||||
bool aNotify) {
|
||||
if (aNameSpaceID == kNameSpaceID_None && IsFormAssociatedElement()) {
|
||||
nsAutoString tmp;
|
||||
|
@ -751,7 +751,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase {
|
||||
|
||||
protected:
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) override;
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
// TODO: Convert AfterSetAttr to MOZ_CAN_RUN_SCRIPT and get rid of
|
||||
// kungFuDeathGrip in it.
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY void AfterSetAttr(
|
||||
@ -1054,8 +1054,8 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement {
|
||||
protected:
|
||||
virtual ~nsGenericHTMLFormElement() = default;
|
||||
|
||||
void BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
|
@ -698,8 +698,7 @@ bool MathMLElement::IsEventAttributeNameInternal(nsAtom* aName) {
|
||||
}
|
||||
|
||||
void MathMLElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (!aValue && IsEventAttributeName(aName)) {
|
||||
if (EventListenerManager* manager = GetExistingListenerManager()) {
|
||||
|
@ -35,16 +35,15 @@ class MathMLElement final : public MathMLElementBase,
|
||||
NS_IMPL_FROMNODE(MathMLElement, kNameSpaceID_MathML)
|
||||
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
virtual void UnbindFromTree(bool aNullParent = true) override;
|
||||
void UnbindFromTree(bool aNullParent = true) override;
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction()
|
||||
const override;
|
||||
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
||||
|
||||
enum {
|
||||
PARSE_ALLOW_NEGATIVE = 0x02,
|
||||
@ -95,16 +94,13 @@ class MathMLElement final : public MathMLElementBase,
|
||||
protected:
|
||||
virtual ~MathMLElement() = default;
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) final;
|
||||
virtual void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
const nsAttrValue* aValue, bool aNotify) final;
|
||||
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
private:
|
||||
bool mIncrementScriptLevel;
|
||||
|
@ -901,8 +901,7 @@ void SVGElement::UnsetAttrInternal(int32_t aNamespaceID, nsAtom* aName,
|
||||
}
|
||||
|
||||
void SVGElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (!aValue) {
|
||||
UnsetAttrInternal(aNamespaceID, aName, aNotify);
|
||||
}
|
||||
@ -1363,10 +1362,8 @@ nsAttrValue SVGElement::WillChangeValue(
|
||||
// allocating, e.g. an extra SVGAnimatedLength, and isn't necessary at the
|
||||
// moment since no SVG elements overload BeforeSetAttr. For now we just pass
|
||||
// the current value.
|
||||
nsAttrValueOrString attrStringOrValue(attrValue ? *attrValue
|
||||
: emptyOrOldAttrValue);
|
||||
BeforeSetAttr(kNameSpaceID_None, aName, &attrStringOrValue,
|
||||
kNotifyDocumentObservers);
|
||||
const nsAttrValue* value = attrValue ? attrValue : &emptyOrOldAttrValue;
|
||||
BeforeSetAttr(kNameSpaceID_None, aName, value, kNotifyDocumentObservers);
|
||||
return emptyOrOldAttrValue;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ class SVGElement : public SVGElementBase // nsIContent
|
||||
// BeforeSetAttr since it would involve allocating extra SVG value types.
|
||||
// See the comment in SVGElement::WillChangeValue.
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue, bool aNotify) final;
|
||||
const nsAttrValue* aValue, bool aNotify) final;
|
||||
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
@ -70,7 +70,6 @@
|
||||
#include "mozilla/fallible.h"
|
||||
#include "nsAtom.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsAttrValueOrString.h"
|
||||
#include "nsCaseTreatment.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -772,8 +771,7 @@ bool nsXULElement::SupportsAccessKey() const {
|
||||
}
|
||||
|
||||
void nsXULElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) {
|
||||
const nsAttrValue* aValue, bool aNotify) {
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aName == nsGkAtoms::accesskey || aName == nsGkAtoms::control ||
|
||||
aName == nsGkAtoms::value) {
|
||||
@ -796,10 +794,8 @@ void nsXULElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
}
|
||||
#ifdef DEBUG
|
||||
} else if (aName == nsGkAtoms::usercontextid) {
|
||||
nsAutoString oldValue;
|
||||
bool hasAttribute =
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::usercontextid, oldValue);
|
||||
if (hasAttribute && (!aValue || !aValue->String().Equals(oldValue))) {
|
||||
const nsAttrValue* oldValue = GetParsedAttr(aName);
|
||||
if (oldValue && (!aValue || !aValue->Equals(*oldValue))) {
|
||||
MOZ_ASSERT(false,
|
||||
"Changing usercontextid doesn't really work properly.");
|
||||
}
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "nscore.h"
|
||||
|
||||
class JSObject;
|
||||
class nsAttrValueOrString;
|
||||
class nsIControllers;
|
||||
class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
@ -476,23 +475,20 @@ class nsXULElement : public nsStyledElement {
|
||||
*/
|
||||
nsresult MakeHeavyweight(nsXULPrototypeElement* aPrototype);
|
||||
|
||||
virtual void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValueOrString* aValue,
|
||||
bool aNotify) override;
|
||||
virtual void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue,
|
||||
const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
bool aNotify) override;
|
||||
void BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
||||
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
||||
nsIPrincipal* aSubjectPrincipal, bool aNotify) override;
|
||||
|
||||
virtual void UpdateEditableState(bool aNotify) override;
|
||||
void UpdateEditableState(bool aNotify) override;
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsIPrincipal* aMaybeScriptedPrincipal,
|
||||
nsAttrValue& aResult) override;
|
||||
|
||||
virtual mozilla::EventListenerManager* GetEventListenerManagerForAttr(
|
||||
mozilla::EventListenerManager* GetEventListenerManagerForAttr(
|
||||
nsAtom* aAttrName, bool* aDefer) override;
|
||||
|
||||
/**
|
||||
@ -530,8 +526,7 @@ class nsXULElement : public nsStyledElement {
|
||||
nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo* aNodeInfo,
|
||||
bool aIsScriptable, bool aIsRoot);
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
bool IsEventStoppedFromAnonymousScrollbar(mozilla::EventMessage aMessage);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user