summaryrefslogtreecommitdiffstats
path: root/dom/mathml
diff options
context:
space:
mode:
Diffstat (limited to 'dom/mathml')
-rw-r--r--dom/mathml/moz.build1
-rw-r--r--dom/mathml/nsMathMLElement.cpp52
-rw-r--r--dom/mathml/nsMathMLElement.h18
-rw-r--r--dom/mathml/nsMathMLElementFactory.cpp1
4 files changed, 20 insertions, 52 deletions
diff --git a/dom/mathml/moz.build b/dom/mathml/moz.build
index d483008aa..6a3fb14bc 100644
--- a/dom/mathml/moz.build
+++ b/dom/mathml/moz.build
@@ -1,5 +1,4 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
diff --git a/dom/mathml/nsMathMLElement.cpp b/dom/mathml/nsMathMLElement.cpp
index 2be931682..d28182ae3 100644
--- a/dom/mathml/nsMathMLElement.cpp
+++ b/dom/mathml/nsMathMLElement.cpp
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -919,12 +918,12 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
}
nsresult
-nsMathMLElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
+nsMathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
{
- nsresult rv = Element::PreHandleEvent(aVisitor);
+ nsresult rv = Element::GetEventTargetParent(aVisitor);
NS_ENSURE_SUCCESS(rv, rv);
- return PreHandleEventForLinks(aVisitor);
+ return GetEventTargetParentForLinks(aVisitor);
}
nsresult
@@ -1085,50 +1084,27 @@ nsMathMLElement::GetHrefURI() const
}
nsresult
-nsMathMLElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
- nsIAtom* aPrefix, const nsAString& aValue,
- bool aNotify)
+nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+ const nsAttrValue* aValue,
+ const nsAttrValue* aOldValue, bool aNotify)
{
- nsresult rv = nsMathMLElementBase::SetAttr(aNameSpaceID, aName, aPrefix,
- aValue, aNotify);
-
- // The ordering of the parent class's SetAttr call and Link::ResetLinkState
- // is important here! The attribute is not set until SetAttr returns, and
- // we will need the updated attribute value because notifying the document
+ // It is important that this be done after the attribute is set/unset.
+ // We will need the updated attribute value because notifying the document
// that content states have changed will call IntrinsicState, which will try
// to get updated information about the visitedness from Link.
if (aName == nsGkAtoms::href &&
(aNameSpaceID == kNameSpaceID_None ||
aNameSpaceID == kNameSpaceID_XLink)) {
- if (aNameSpaceID == kNameSpaceID_XLink) {
+ if (aValue && aNameSpaceID == kNameSpaceID_XLink) {
WarnDeprecated(u"xlink:href", u"href", OwnerDoc());
}
- Link::ResetLinkState(!!aNotify, true);
- }
-
- return rv;
-}
-
-nsresult
-nsMathMLElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
- bool aNotify)
-{
- nsresult rv = nsMathMLElementBase::UnsetAttr(aNameSpaceID, aAttr, aNotify);
-
- // The ordering of the parent class's UnsetAttr call and Link::ResetLinkState
- // is important here! The attribute is not unset until UnsetAttr returns, and
- // we will need the updated attribute value because notifying the document
- // that content states have changed will call IntrinsicState, which will try
- // to get updated information about the visitedness from Link.
- if (aAttr == nsGkAtoms::href &&
- (aNameSpaceID == kNameSpaceID_None ||
- aNameSpaceID == kNameSpaceID_XLink)) {
- // Note: just because we removed a single href attr doesn't mean there's no href,
- // since there are 2 possible namespaces.
- Link::ResetLinkState(!!aNotify, Link::ElementHasHref());
+ // Note: When unsetting href, there may still be another href since there
+ // are 2 possible namespaces.
+ Link::ResetLinkState(aNotify, aValue || Link::ElementHasHref());
}
- return rv;
+ return nsMathMLElementBase::AfterSetAttr(aNameSpaceID, aName, aValue,
+ aOldValue, aNotify);
}
JSObject*
diff --git a/dom/mathml/nsMathMLElement.h b/dom/mathml/nsMathMLElement.h
index 47ed8b165..d3a9f5556 100644
--- a/dom/mathml/nsMathMLElement.h
+++ b/dom/mathml/nsMathMLElement.h
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -74,7 +73,7 @@ public:
static void MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
nsRuleData* aRuleData);
- virtual nsresult PreHandleEvent(
+ virtual nsresult GetEventTargetParent(
mozilla::EventChainPreVisitor& aVisitor) override;
virtual nsresult PostHandleEvent(
mozilla::EventChainPostVisitor& aVisitor) override;
@@ -93,16 +92,6 @@ public:
virtual bool IsLink(nsIURI** aURI) const override;
virtual void GetLinkTarget(nsAString& aTarget) override;
virtual already_AddRefed<nsIURI> GetHrefURI() const override;
- nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
- const nsAString& aValue, bool aNotify)
- {
- return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
- }
- virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
- nsIAtom* aPrefix, const nsAString& aValue,
- bool aNotify) override;
- virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
- bool aNotify) override;
virtual nsIDOMNode* AsDOMNode() override { return this; }
@@ -111,6 +100,11 @@ protected:
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
+ virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+ const nsAttrValue* aValue,
+ const nsAttrValue* aOldValue,
+ bool aNotify) override;
+
private:
bool mIncrementScriptLevel;
};
diff --git a/dom/mathml/nsMathMLElementFactory.cpp b/dom/mathml/nsMathMLElementFactory.cpp
index 9f45afec8..f31894b3d 100644
--- a/dom/mathml/nsMathMLElementFactory.cpp
+++ b/dom/mathml/nsMathMLElementFactory.cpp
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */