summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2015-12-19 10:52:33 +0100
committerPale Moon <git-repo@palemoon.org>2015-12-19 10:52:33 +0100
commit394832c129eb9e8cec6608a35de38b2e548e95aa (patch)
tree0187c541f25faf293ab1d68e29622ec78c9463a9 /content
parent10760beba88fa6e3b7ab7746c4846f7b8048751b (diff)
downloadpalemoon-gre-394832c129eb9e8cec6608a35de38b2e548e95aa.tar.gz
Make parser tree notifications spec-compliant.
Diffstat (limited to 'content')
-rw-r--r--content/base/public/nsINode.h4
-rw-r--r--content/html/content/src/HTMLOutputElement.cpp14
-rw-r--r--content/html/content/src/HTMLOutputElement.h6
3 files changed, 20 insertions, 4 deletions
diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h
index f17ff9099..e321b1ac4 100644
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -1323,6 +1323,8 @@ private:
// Set if the element has a parser insertion mode other than "in body"
// See: HTML5 draft "parser state" section
ElementInsertsOOB,
+ // Set if the parser has notified about the node.
+ ParserHasNotified,
// Guard value
BooleanFlagCount
};
@@ -1459,6 +1461,8 @@ public:
bool IsScopedStyleRoot() { return GetBoolFlag(ElementIsScopedStyleRoot); }
bool HasRelevantHoverRules() const { return GetBoolFlag(NodeHasRelevantHoverRules); }
void SetHasRelevantHoverRules() { SetBoolFlag(NodeHasRelevantHoverRules); }
+ void SetParserHasNotified() { SetBoolFlag(ParserHasNotified); };
+ bool HasParserNotified() { return GetBoolFlag(ParserHasNotified); }
bool HasOOBInsertion() const { return GetBoolFlag(ElementInsertsOOB); }
protected:
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
diff --git a/content/html/content/src/HTMLOutputElement.cpp b/content/html/content/src/HTMLOutputElement.cpp
index 8809b628d..7b9ad19b6 100644
--- a/content/html/content/src/HTMLOutputElement.cpp
+++ b/content/html/content/src/HTMLOutputElement.cpp
@@ -12,14 +12,16 @@
#include "mozAutoDocUpdate.h"
#include "mozilla/dom/HTMLFormElement.h"
-NS_IMPL_NS_NEW_HTML_ELEMENT(Output)
+NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output)
namespace mozilla {
namespace dom {
-HTMLOutputElement::HTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+HTMLOutputElement::HTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
+ FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo)
, mValueModeFlag(eModeDefault)
+ , mIsDoneAddingChildren(!aFromParser)
{
SetIsDOMBinding();
@@ -109,6 +111,12 @@ HTMLOutputElement::ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
aValue, aResult);
}
+void
+HTMLOutputElement::DoneAddingChildren(bool aHaveNotified)
+{
+ mIsDoneAddingChildren = true;
+}
+
nsEventStates
HTMLOutputElement::IntrinsicState() const
{
@@ -214,7 +222,7 @@ HTMLOutputElement::GetHtmlFor(nsISupports** aResult)
void HTMLOutputElement::DescendantsChanged()
{
- if (mValueModeFlag == eModeDefault) {
+ if (mIsDoneAddingChildren && mValueModeFlag == eModeDefault) {
nsContentUtils::GetNodeTextContent(this, true, mDefaultValue);
}
}
diff --git a/content/html/content/src/HTMLOutputElement.h b/content/html/content/src/HTMLOutputElement.h
index 89067a33b..de20fcb7f 100644
--- a/content/html/content/src/HTMLOutputElement.h
+++ b/content/html/content/src/HTMLOutputElement.h
@@ -23,7 +23,8 @@ class HTMLOutputElement : public nsGenericHTMLFormElement,
public:
using nsIConstraintValidation::GetValidationMessage;
- HTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+ HTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
+ FromParser aFromParser = NOT_FROM_PARSER);
virtual ~HTMLOutputElement();
// nsISupports
@@ -53,6 +54,8 @@ public:
bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) MOZ_OVERRIDE;
+ virtual void DoneAddingChildren(bool aHaveNotified) MOZ_OVERRIDE;
+
nsEventStates IntrinsicState() const MOZ_OVERRIDE;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
@@ -112,6 +115,7 @@ protected:
};
ValueModeFlag mValueModeFlag;
+ bool mIsDoneAddingChildren;
nsString mDefaultValue;
nsRefPtr<nsDOMSettableTokenList> mTokenList;
};