--- a/dom/base/CharacterData.cpp
+++ b/dom/base/CharacterData.cpp
@@ -261,17 +261,17 @@ CharacterData::SetTextInternal(uint32_t
uint32_t endOffset = aOffset + aCount;
// Make sure the text fragment can hold the new data.
if (aLength > aCount && !mText.CanGrowBy(aLength - aCount)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsIDocument *document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(document, aNotify);
bool haveMutationListeners = aNotify &&
nsContentUtils::HasMutationListeners(this,
NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED,
this);
RefPtr<nsAtom> oldValue;
if (haveMutationListeners) {
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -2450,17 +2450,17 @@ Element::SetSingleClassFromParser(nsAtom
if (!mAttrsAndChildren.CanFitMoreAttrs()) {
return NS_ERROR_FAILURE;
}
nsAttrValue value(aSingleClassName);
nsIDocument* document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, false);
+ mozAutoDocUpdate updateBatch(document, false);
// In principle, BeforeSetAttr should be called here if a node type
// existed that wanted to do something special for class, but there
// is no such node type, so calling SetMayHaveClass() directly.
SetMayHaveClass();
return SetAttrAndNotify(kNameSpaceID_None,
nsGkAtoms::_class,
@@ -2520,17 +2520,17 @@ Element::SetAttr(int32_t aNamespaceID, n
if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNamespaceID, aName, modType,
preparsedAttrValue);
}
// Hold a script blocker while calling ParseAttribute since that can call
// out to id-observers
nsIDocument* document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(document, aNotify);
nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
if (!preparsedAttrValue &&
!ParseAttribute(aNamespaceID, aName, aValue, aSubjectPrincipal,
attrValue)) {
attrValue.SetTo(aValue);
@@ -2578,17 +2578,17 @@ Element::SetParsedAttr(int32_t aNamespac
}
nsresult rv = BeforeSetAttr(aNamespaceID, aName, &value, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
PreIdMaybeChange(aNamespaceID, aName, &value);
nsIDocument* document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(document, aNotify);
return SetAttrAndNotify(aNamespaceID, aName, aPrefix,
oldValueSet ? &oldValue : nullptr,
aParsedValue, nullptr, modType, hasListeners, aNotify,
kCallAfterSetAttr, document, updateBatch);
}
nsresult
Element::SetAttrAndNotify(int32_t aNamespaceID,
@@ -2910,17 +2910,17 @@ Element::UnsetAttr(int32_t aNameSpaceID,
NS_ASSERTION(nullptr != aName, "must have attribute name");
int32_t index = mAttrsAndChildren.IndexOfAttr(aName, aNameSpaceID);
if (index < 0) {
return NS_OK;
}
nsIDocument *document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(document, aNotify);
if (aNotify) {
nsNodeUtils::AttributeWillChange(this, aNameSpaceID, aName,
MutationEventBinding::REMOVAL,
nullptr);
}
nsresult rv = BeforeSetAttr(aNameSpaceID, aName, nullptr, aNotify);
@@ -3911,17 +3911,17 @@ Element::InsertAdjacentHTML(const nsAStr
}
} else {
destination = this;
}
nsIDocument* doc = OwnerDoc();
// Needed when insertAdjacentHTML is used in combination with contenteditable
- mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(doc, true);
nsAutoScriptLoaderDisabler sld(doc);
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(doc, nullptr);
// Parse directly into destination if possible
if (doc->IsHTMLDocument() && !OwnerDoc()->MayHaveDOMMutationObservers() &&
(position == eBeforeEnd ||
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -2274,17 +2274,17 @@ FragmentOrElement::SetInnerHTMLInternal(
nsIDocument* doc = target->OwnerDoc();
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(doc, nullptr);
target->FireNodeRemovedForChildren();
// Needed when innerHTML is used in combination with contenteditable
- mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(doc, true);
// Remove childnodes.
nsAutoMutationBatch mb(target, true, false);
while (target->HasChildren()) {
target->RemoveChildNode(target->GetFirstChild(), true);
}
mb.RemovalDone();
--- a/dom/base/Text.cpp
+++ b/dom/base/Text.cpp
@@ -25,17 +25,17 @@ Text::SplitText(uint32_t aOffset, ErrorR
uint32_t cutStartOffset = aOffset;
uint32_t cutLength = length - aOffset;
SubstringData(cutStartOffset, cutLength, cutText, aRv);
if (aRv.Failed()) {
return nullptr;
}
nsIDocument* document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(document, true);
// Use Clone for creating the new node so that the new node is of same class
// as this node!
RefPtr<CharacterData> clone = CloneDataNode(mNodeInfo, false);
MOZ_ASSERT(clone && clone->IsText());
RefPtr<Text> newContent = static_cast<Text*>(clone.get());
// nsRange expects the CharacterDataChanged notification is followed
--- a/dom/base/mozAutoDocUpdate.h
+++ b/dom/base/mozAutoDocUpdate.h
@@ -16,50 +16,45 @@
* class will call BeginUpdate on construction and EndUpdate on destruction on
* the given document with the given update type. The document could be null,
* in which case no updates will be called. The constructor also takes a
* boolean that can be set to false to prevent notifications.
*/
class MOZ_STACK_CLASS mozAutoDocUpdate
{
public:
- mozAutoDocUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType,
- bool aNotify) :
- mDocument(aNotify ? aDocument : nullptr),
- mUpdateType(aUpdateType)
+ mozAutoDocUpdate(nsIDocument* aDocument, bool aNotify)
+ : mDocument(aNotify ? aDocument : nullptr)
{
if (mDocument) {
- mDocument->BeginUpdate(mUpdateType);
- }
- else {
+ mDocument->BeginUpdate();
+ } else {
nsContentUtils::AddScriptBlocker();
}
}
~mozAutoDocUpdate()
{
if (mDocument) {
- mDocument->EndUpdate(mUpdateType);
- }
- else {
+ mDocument->EndUpdate();
+ } else {
nsContentUtils::RemoveScriptBlocker();
}
}
private:
nsCOMPtr<nsIDocument> mDocument;
- nsUpdateType mUpdateType;
};
#define MOZ_AUTO_DOC_UPDATE_PASTE2(tok,line) tok##line
#define MOZ_AUTO_DOC_UPDATE_PASTE(tok,line) \
MOZ_AUTO_DOC_UPDATE_PASTE2(tok,line)
-#define MOZ_AUTO_DOC_UPDATE(doc,type,notify) \
+#define MOZ_AUTO_DOC_UPDATE(doc,notify) \
mozAutoDocUpdate MOZ_AUTO_DOC_UPDATE_PASTE(_autoDocUpdater_, __LINE__) \
- (doc,type,notify)
+ (doc,notify)
/**
* Creates an update batch only under certain conditions.
* Use this rather than mozAutoDocUpdate when you expect inner updates
* to notify but you don't always want to spec cycles creating a batch.
* This is needed to avoid having this batch always create a blocker,
* but then have inner mozAutoDocUpdate call the last EndUpdate before.
@@ -68,24 +63,24 @@ private:
class MOZ_STACK_CLASS mozAutoDocConditionalContentUpdateBatch
{
public:
mozAutoDocConditionalContentUpdateBatch(nsIDocument* aDocument,
bool aNotify) :
mDocument(aNotify ? aDocument : nullptr)
{
if (mDocument) {
- mDocument->BeginUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->BeginUpdate();
}
}
~mozAutoDocConditionalContentUpdateBatch()
{
if (mDocument) {
- mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->EndUpdate();
}
}
private:
nsCOMPtr<nsIDocument> mDocument;
};
#endif
--- a/dom/base/nsContentSink.cpp
+++ b/dom/base/nsContentSink.cpp
@@ -1290,17 +1290,17 @@ nsContentSink::NotifyAppend(nsIContent*
// here; notifying on our document for this append would be wrong.
return;
}
mInNotification++;
{
// Scope so we call EndUpdate before we decrease mInNotification
- MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_CONTENT_MODEL, !mBeganUpdate);
+ MOZ_AUTO_DOC_UPDATE(mDocument, !mBeganUpdate);
nsNodeUtils::ContentAppended(aContainer,
aContainer->GetChildAt_Deprecated(aStartIndex));
mLastNotificationTime = PR_Now();
}
mInNotification--;
}
@@ -1482,17 +1482,17 @@ nsContentSink::FavorPerformanceHint(bool
{
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
if (appShell)
appShell->FavorPerformanceHint(perfOverStarvation, starvationDelay);
}
void
-nsContentSink::BeginUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
+nsContentSink::BeginUpdate(nsIDocument* aDocument)
{
// Remember nested updates from updates that we started.
if (mInNotification > 0 && mUpdatesInNotification < 2) {
++mUpdatesInNotification;
}
// If we're in a script and we didn't do the notification,
// something else in the script processing caused the
@@ -1501,17 +1501,17 @@ nsContentSink::BeginUpdate(nsIDocument *
// continue.
if (!mInNotification++) {
FlushTags();
}
}
void
-nsContentSink::EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType)
+nsContentSink::EndUpdate(nsIDocument* aDocument)
{
// If we're in a script and we didn't do the notification,
// something else in the script processing caused the
// notification to occur. Update our notion of how much
// has been flushed to include any new content if ending
// this update leaves us not inside a notification.
if (!--mInNotification) {
UpdateChildCounts();
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5266,18 +5266,17 @@ nsContentUtils::SetNodeTextContent(nsICo
}
nsContentUtils::MaybeFireNodeRemoved(child, aContent);
}
}
}
// Might as well stick a batch around this since we're performing several
// mutations.
- mozAutoDocUpdate updateBatch(aContent->GetComposedDoc(),
- UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(aContent->GetComposedDoc(), true);
nsAutoMutationBatch mb;
if (aTryReuse && !aValue.IsEmpty()) {
// Let's remove nodes until we find a eTEXT.
while (aContent->HasChildren()) {
nsIContent* child = aContent->GetFirstChild();
if (child->IsText()) {
break;
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -2241,17 +2241,17 @@ nsIDocument::ResetToURI(nsIURI* aURI,
// Destroy link map now so we don't waste time removing
// links one by one
DestroyElementMaps();
bool oldVal = mInUnlinkOrDeletion;
mInUnlinkOrDeletion = true;
uint32_t count = mChildren.ChildCount();
{ // Scope for update
- MOZ_AUTO_DOC_UPDATE(this, UPDATE_CONTENT_MODEL, true);
+ MOZ_AUTO_DOC_UPDATE(this, true);
// Invalidate cached array of child nodes
InvalidateChildNodes();
for (int32_t i = int32_t(count) - 1; i >= 0; i--) {
nsCOMPtr<nsIContent> content = mChildren.ChildAt(i);
nsIContent* previousSibling = content->GetPreviousSibling();
@@ -5007,17 +5007,17 @@ nsIDocument::MaybeEndOutermostXBLUpdate(
&nsDocument::MaybeEndOutermostXBLUpdate);
}
nsContentUtils::AddScriptRunner(mMaybeEndOutermostXBLUpdateRunner);
}
}
}
void
-nsIDocument::BeginUpdate(nsUpdateType aUpdateType)
+nsIDocument::BeginUpdate()
{
// If the document is going away, then it's probably okay to do things to it
// in the wrong DocGroup. We're unlikely to run JS or do anything else
// observable at this point. We reach this point when cycle collecting a
// <link> element and the unlink code removes a style sheet.
//
// TODO(emilio): Style updates are gone, can this happen now?
if (mDocGroup && !mIsGoingAway && !mInUnlinkOrDeletion && !mIgnoreDocGroupMismatches) {
@@ -5026,23 +5026,23 @@ nsIDocument::BeginUpdate(nsUpdateType aU
if (mUpdateNestLevel == 0 && !mInXBLUpdate) {
mInXBLUpdate = true;
BindingManager()->BeginOutermostUpdate();
}
++mUpdateNestLevel;
nsContentUtils::AddScriptBlocker();
- NS_DOCUMENT_NOTIFY_OBSERVERS(BeginUpdate, (this, aUpdateType));
-}
-
-void
-nsDocument::EndUpdate(nsUpdateType aUpdateType)
-{
- NS_DOCUMENT_NOTIFY_OBSERVERS(EndUpdate, (this, aUpdateType));
+ NS_DOCUMENT_NOTIFY_OBSERVERS(BeginUpdate, (this));
+}
+
+void
+nsDocument::EndUpdate()
+{
+ NS_DOCUMENT_NOTIFY_OBSERVERS(EndUpdate, (this));
nsContentUtils::RemoveScriptBlocker();
--mUpdateNestLevel;
// This set of updates may have created XBL bindings. Let the
// binding manager know we're done.
MaybeEndOutermostXBLUpdate();
@@ -6361,17 +6361,17 @@ nsIDocument::SetTitle(const nsAString& a
aRv = rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::title,
aTitle, true);
return;
}
#endif
// Batch updates so that mutation events don't change "the title
// element" under us
- mozAutoDocUpdate updateBatch(this, UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(this, true);
nsCOMPtr<Element> title = GetTitleElement();
if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
if (!title) {
RefPtr<mozilla::dom::NodeInfo> titleInfo =
mNodeInfoManager->GetNodeInfo(nsGkAtoms::title, nullptr,
kNameSpaceID_SVG,
ELEMENT_NODE);
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -160,17 +160,17 @@ public:
virtual void StopDocumentLoad() override;
static bool CallerIsTrustedAboutPage(JSContext* aCx, JSObject* aObject);
static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject);
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
static bool IsWebAnimationsEnabled(mozilla::dom::CallerType aCallerType);
- virtual void EndUpdate(nsUpdateType aUpdateType) override;
+ virtual void EndUpdate() override;
virtual void BeginLoad() override;
virtual void EndLoad() override;
// nsIRadioGroupContainer
NS_IMETHOD WalkRadioGroup(const nsAString& aName,
nsIRadioVisitor* aVisitor,
bool aFlushContent) override;
virtual void
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -11,17 +11,16 @@
#include "nsAutoPtr.h" // for member
#include "nsCOMArray.h" // for member
#include "nsCompatibility.h" // for member
#include "nsCOMPtr.h" // for member
#include "nsGkAtoms.h" // for static class members
#include "nsIApplicationCache.h"
#include "nsIApplicationCacheContainer.h"
#include "nsIContentViewer.h"
-#include "nsIDocumentObserver.h" // for typedef (nsUpdateType)
#include "nsIInterfaceRequestor.h"
#include "nsILoadContext.h"
#include "nsILoadGroup.h" // for member (in nsCOMPtr)
#include "nsINode.h" // for base class
#include "nsIParser.h"
#include "nsIPresShell.h"
#include "nsIChannelEventSink.h"
#include "nsIProgressEventSink.h"
@@ -1855,18 +1854,18 @@ public:
* return false if the observer cannot be found.
*/
bool RemoveObserver(nsIDocumentObserver* aObserver);
// Observation hooks used to propagate notifications to document observers.
// BeginUpdate must be called before any batch of modifications of the
// content model or of style data, EndUpdate must be called afterward.
// To make this easy and painless, use the mozAutoDocUpdate helper class.
- void BeginUpdate(nsUpdateType aUpdateType);
- virtual void EndUpdate(nsUpdateType aUpdateType) = 0;
+ void BeginUpdate();
+ virtual void EndUpdate() = 0;
virtual void BeginLoad() = 0;
virtual void EndLoad() = 0;
enum ReadyState { READYSTATE_UNINITIALIZED = 0, READYSTATE_LOADING = 1, READYSTATE_INTERACTIVE = 3, READYSTATE_COMPLETE = 4};
void SetReadyStateInternal(ReadyState rs);
ReadyState GetReadyStateEnum()
{
--- a/dom/base/nsIDocumentObserver.h
+++ b/dom/base/nsIDocumentObserver.h
@@ -13,50 +13,45 @@
class nsIContent;
class nsIDocument;
#define NS_IDOCUMENT_OBSERVER_IID \
{ 0x71041fa3, 0x6dd7, 0x4cde, \
{ 0xbb, 0x76, 0xae, 0xcc, 0x69, 0xe1, 0x75, 0x78 } }
-typedef uint32_t nsUpdateType;
-
-#define UPDATE_CONTENT_MODEL 0x00000001
-
// Document observer interface
class nsIDocumentObserver : public nsIMutationObserver
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_OBSERVER_IID)
/**
* Notify that a content model update is beginning. This call can be
* nested.
*/
- virtual void BeginUpdate(nsIDocument *aDocument,
- nsUpdateType aUpdateType) = 0;
+ virtual void BeginUpdate(nsIDocument* aDocument) = 0;
/**
* Notify that a content model update is finished. This call can be
* nested.
*/
- virtual void EndUpdate(nsIDocument *aDocument, nsUpdateType aUpdateType) = 0;
+ virtual void EndUpdate(nsIDocument* aDocument) = 0;
/**
* Notify the observer that a document load is beginning.
*/
- virtual void BeginLoad(nsIDocument *aDocument) = 0;
+ virtual void BeginLoad(nsIDocument* aDocument) = 0;
/**
* Notify the observer that a document load has finished. Note that
* the associated reflow of the document will be done <b>before</b>
* EndLoad is invoked, not after.
*/
- virtual void EndLoad(nsIDocument *aDocument) = 0;
+ virtual void EndLoad(nsIDocument* aDocument) = 0;
/**
* Notification that the state of a content node has changed.
* (ie: gained or lost focus, became active or hovered over)
* This method is called automatically by content objects
* when their state is changed (therefore there is normally
* no need to invoke this method directly). The notification
* is passed to any IDocumentObservers. The notification is
@@ -81,21 +76,20 @@ public:
*/
virtual void DocumentStatesChanged(nsIDocument* aDocument,
mozilla::EventStates aStateMask) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
#define NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
- virtual void BeginUpdate(nsIDocument* aDocument, \
- nsUpdateType aUpdateType) override;
+ virtual void BeginUpdate(nsIDocument* aDocument) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE \
- virtual void EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType) override;
+ virtual void EndUpdate(nsIDocument* aDocument) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD \
virtual void BeginLoad(nsIDocument* aDocument) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \
virtual void EndLoad(nsIDocument* aDocument) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \
@@ -114,21 +108,21 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumen
NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD \
NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED \
NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED \
NS_DECL_NSIMUTATIONOBSERVER
#define NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(_class) \
void \
-_class::BeginUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType) \
+_class::BeginUpdate(nsIDocument* aDocument) \
{ \
} \
void \
-_class::EndUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType) \
+_class::EndUpdate(nsIDocument* aDocument) \
{ \
} \
NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class)
#define NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(_class) \
void \
_class::BeginLoad(nsIDocument* aDocument) \
{ \
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -592,17 +592,17 @@ nsINode::Normalize()
for (uint32_t i = 0; i < nodes.Length(); ++i) {
nsINode* parentNode = nodes[i]->GetParentNode();
if (parentNode) { // Node may have already been removed.
nsContentUtils::MaybeFireNodeRemoved(nodes[i], parentNode);
}
}
}
- mozAutoDocUpdate batch(doc, UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate batch(doc, true);
// Merge and remove all nodes
nsAutoString tmpStr;
for (uint32_t i = 0; i < nodes.Length(); ++i) {
nsIContent* node = nodes[i];
// Merge with previous node unless empty
const nsTextFragment* text = node->GetText();
if (text->GetLength()) {
@@ -1290,17 +1290,17 @@ nsINode::doInsertChildAt(nsIContent* aKi
MOZ_ASSERT(!IsAttr());
// The id-handling code, and in the future possibly other code, need to
// react to unexpected attribute changes.
nsMutationGuard::DidMutate();
// Do this before checking the child-count since this could cause mutations
nsIDocument* doc = GetUncomposedDoc();
- mozAutoDocUpdate updateBatch(GetComposedDoc(), UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(GetComposedDoc(), aNotify);
if (OwnerDoc() != aKid->OwnerDoc()) {
ErrorResult error;
AdoptNodeIntoOwnerDoc(this, aKid, error);
// Need to WouldReportJSException() if our callee can throw a JS
// exception (which it can) and we're neither propagating the
// error out nor unconditionally suppressing it.
@@ -1639,17 +1639,17 @@ nsINode::doRemoveChildAt(uint32_t aIndex
// value for our cached root element, per note in
// nsDocument::RemoveChildNode().
MOZ_ASSERT(aKid && aKid->GetParentNode() == this &&
aKid == GetChildAt_Deprecated(aIndex) &&
ComputeIndexOf(aKid) == (int32_t)aIndex, "Bogus aKid");
MOZ_ASSERT(!IsAttr());
nsMutationGuard::DidMutate();
- mozAutoDocUpdate updateBatch(GetComposedDoc(), UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(GetComposedDoc(), aNotify);
nsIContent* previousSibling = aKid->GetPreviousSibling();
if (GetFirstChild() == aKid) {
mFirstChild = aKid->GetNextSibling();
}
aChildArray.RemoveChildAt(aIndex);
@@ -1960,18 +1960,17 @@ nsINode::ReplaceOrInsertBefore(bool aRep
nsCOMPtr<nsINode> kungFuDeathGrip = nodeToInsertBefore;
// Removing a child can run script, via XBL destructors.
nsMutationGuard guard;
// Scope for the mutation batch and scriptblocker, so they go away
// while kungFuDeathGrip is still alive.
{
- mozAutoDocUpdate batch(newContent->GetComposedDoc(),
- UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate batch(newContent->GetComposedDoc(), true);
nsAutoMutationBatch mb(oldParent, true, true);
oldParent->RemoveChildAt_Deprecated(removeIndex, true);
if (nsAutoMutationBatch::GetCurrentBatch() == &mb) {
mb.RemovalDone();
mb.SetPrevSibling(oldParent->GetChildAt_Deprecated(removeIndex - 1));
mb.SetNextSibling(oldParent->GetChildAt_Deprecated(removeIndex));
}
}
@@ -2038,18 +2037,17 @@ nsINode::ReplaceOrInsertBefore(bool aRep
// Hold a strong ref to nodeToInsertBefore across the removals
nsCOMPtr<nsINode> kungFuDeathGrip = nodeToInsertBefore;
nsMutationGuard guard;
// Scope for the mutation batch and scriptblocker, so they go away
// while kungFuDeathGrip is still alive.
{
- mozAutoDocUpdate batch(newContent->GetComposedDoc(),
- UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate batch(newContent->GetComposedDoc(), true);
nsAutoMutationBatch mb(newContent, false, true);
for (uint32_t i = count; i > 0;) {
newContent->RemoveChildAt_Deprecated(--i, true);
}
}
// We expect |count| removals
@@ -2109,17 +2107,17 @@ nsINode::ReplaceOrInsertBefore(bool aRep
aError.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
return nullptr;
}
}
}
}
}
- mozAutoDocUpdate batch(GetComposedDoc(), UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate batch(GetComposedDoc(), true);
nsAutoMutationBatch mb;
// Figure out which index we want to insert at. Note that we use
// nodeToInsertBefore to determine this, because it's possible that
// aRefChild == aNewChild, in which case we just removed it from the
// parent list.
int32_t insPos;
if (nodeToInsertBefore) {
--- a/dom/base/nsStyledElement.cpp
+++ b/dom/base/nsStyledElement.cpp
@@ -102,17 +102,17 @@ nsStyledElement::SetInlineStyleDeclarati
nsAttrValue attrValue(do_AddRef(aDeclaration), aSerialized);
// XXXbz do we ever end up with ADDITION here? I doubt it.
uint8_t modType = modification ?
static_cast<uint8_t>(MutationEventBinding::MODIFICATION) :
static_cast<uint8_t>(MutationEventBinding::ADDITION);
nsIDocument* document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);
+ mozAutoDocUpdate updateBatch(document, aNotify);
return SetAttrAndNotify(kNameSpaceID_None, nsGkAtoms::style, nullptr,
oldValueSet ? &oldValue : nullptr, attrValue,
nullptr, modType,
hasListeners, aNotify, kDontCallAfterSetAttr,
document, updateBatch);
}
// ---------------------------------------------------------------
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -2287,29 +2287,27 @@ IMEContentObserver::DocumentObserver::St
void
IMEContentObserver::DocumentObserver::Destroy()
{
StopObserving();
mIMEContentObserver = nullptr;
}
void
-IMEContentObserver::DocumentObserver::BeginUpdate(nsIDocument* aDocument,
- nsUpdateType aUpdateType)
+IMEContentObserver::DocumentObserver::BeginUpdate(nsIDocument* aDocument)
{
if (NS_WARN_IF(Destroyed()) || NS_WARN_IF(!IsObserving())) {
return;
}
mDocumentUpdating++;
mIMEContentObserver->BeginDocumentUpdate();
}
void
-IMEContentObserver::DocumentObserver::EndUpdate(nsIDocument* aDocument,
- nsUpdateType aUpdateType)
+IMEContentObserver::DocumentObserver::EndUpdate(nsIDocument* aDocument)
{
if (NS_WARN_IF(Destroyed()) || NS_WARN_IF(!IsObserving()) ||
NS_WARN_IF(!IsUpdating())) {
return;
}
mDocumentUpdating--;
mIMEContentObserver->EndDocumentUpdate();
}
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -2954,18 +2954,17 @@ void
nsGenericHTMLElement::SetInnerText(const nsAString& aValue)
{
// Batch possible DOMSubtreeModified events.
mozAutoSubtreeModified subtree(OwnerDoc(), nullptr);
FireNodeRemovedForChildren();
// Might as well stick a batch around this since we're performing several
// mutations.
- mozAutoDocUpdate updateBatch(GetComposedDoc(),
- UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(GetComposedDoc(), true);
nsAutoMutationBatch mb;
mb.Init(this, true, false);
while (HasChildren()) {
RemoveChildNode(nsINode::GetFirstChild(), true);
}
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -488,18 +488,17 @@ SinkContext::FlushTags()
mSink->mDeferredFlushTags = false;
bool oldBeganUpdate = mSink->mBeganUpdate;
uint32_t oldUpdates = mSink->mUpdatesInNotification;
++(mSink->mInNotification);
mSink->mUpdatesInNotification = 0;
{
// Scope so we call EndUpdate before we decrease mInNotification
- mozAutoDocUpdate updateBatch(mSink->mDocument, UPDATE_CONTENT_MODEL,
- true);
+ mozAutoDocUpdate updateBatch(mSink->mDocument, true);
mSink->mBeganUpdate = true;
// Start from the base of the stack (growing downward) and do
// a notification from the node that is closest to the root of
// tree for any content that has been added.
// Note that we can start at stackPos == 0 here, because it's the caller's
// responsibility to handle flushing interactions between contexts (see
@@ -950,17 +949,17 @@ HTMLContentSink::NotifyInsert(nsIContent
// here; notifying on our document for this insert would be wrong.
return;
}
mInNotification++;
{
// Scope so we call EndUpdate before we decrease mInNotification
- MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_CONTENT_MODEL, !mBeganUpdate);
+ MOZ_AUTO_DOC_UPDATE(mDocument, !mBeganUpdate);
nsNodeUtils::ContentInserted(NODE_FROM(aContent, mDocument),
aChildContent);
mLastNotificationTime = PR_Now();
}
mInNotification--;
}
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -2106,21 +2106,21 @@ nsHTMLDocument::MaybeEditingStateChanged
NewRunnableMethod("nsHTMLDocument::MaybeEditingStateChanged",
this,
&nsHTMLDocument::MaybeEditingStateChanged));
}
}
}
void
-nsHTMLDocument::EndUpdate(nsUpdateType aUpdateType)
+nsHTMLDocument::EndUpdate()
{
const bool reset = !mPendingMaybeEditingStateChanged;
mPendingMaybeEditingStateChanged = true;
- nsDocument::EndUpdate(aUpdateType);
+ nsDocument::EndUpdate();
if (reset) {
mPendingMaybeEditingStateChanged = false;
}
MaybeEditingStateChanged();
}
void
nsHTMLDocument::SetMayStartLayout(bool aMayStartLayout)
--- a/dom/html/nsHTMLDocument.h
+++ b/dom/html/nsHTMLDocument.h
@@ -118,17 +118,17 @@ public:
mDoc->mEditingState = mSavedState;
}
private:
nsHTMLDocument* mDoc;
EditingState mSavedState;
};
friend class nsAutoEditingState;
- void EndUpdate(nsUpdateType aUpdateType) override;
+ void EndUpdate() override;
virtual void SetMayStartLayout(bool aMayStartLayout) override;
virtual nsresult SetEditingState(EditingState aState) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -1428,18 +1428,17 @@ nsSVGElement::DidChangeValue(nsAtom* aNa
nsContentUtils::HasMutationListeners(this,
NS_EVENT_BITS_MUTATION_ATTRMODIFIED,
this);
uint8_t modType = HasAttr(kNameSpaceID_None, aName)
? static_cast<uint8_t>(MutationEventBinding::MODIFICATION)
: static_cast<uint8_t>(MutationEventBinding::ADDITION);
nsIDocument* document = GetComposedDoc();
- mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL,
- kNotifyDocumentObservers);
+ mozAutoDocUpdate updateBatch(document, kNotifyDocumentObservers);
// XXX Really, the fourth argument to SetAttrAndNotify should be null if
// aEmptyOrOldValue does not represent the actual previous value of the
// attribute, but currently SVG elements do not even use the old attribute
// value in |AfterSetAttr|, so this should be ok.
SetAttrAndNotify(kNameSpaceID_None, aName, nullptr, &aEmptyOrOldValue,
aNewValue, nullptr, modType, hasListeners, kNotifyDocumentObservers,
kCallAfterSetAttr, document, updateBatch);
}
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -396,19 +396,19 @@ nsXMLContentSink::OnTransformDone(nsresu
// Notify document observers that all the content has been stuck
// into the document.
// XXX do we need to notify for things like PIs? Or just the
// documentElement?
nsIContent *rootElement = mDocument->GetRootElement();
if (rootElement) {
NS_ASSERTION(mDocument->ComputeIndexOf(rootElement) != -1,
"rootElement not in doc?");
- mDocument->BeginUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->BeginUpdate();
nsNodeUtils::ContentInserted(mDocument, rootElement);
- mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->EndUpdate();
}
// Start the layout process
StartLayout(false);
ScrollToRef();
originalDocument->EndLoad();
@@ -1534,17 +1534,17 @@ nsXMLContentSink::FlushTags()
mDeferredFlushTags = false;
bool oldBeganUpdate = mBeganUpdate;
uint32_t oldUpdates = mUpdatesInNotification;
mUpdatesInNotification = 0;
++mInNotification;
{
// Scope so we call EndUpdate before we decrease mInNotification
- mozAutoDocUpdate updateBatch(mDocument, UPDATE_CONTENT_MODEL, true);
+ mozAutoDocUpdate updateBatch(mDocument, true);
mBeganUpdate = true;
// Don't release last text node in case we need to add to it again
FlushText(false);
// Start from the base of the stack (growing downward) and do
// a notification from the node that is closest to the root of
// tree for any content that has been added.
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -2889,20 +2889,19 @@ XULDocument::MaybeBroadcast()
delayedBroadcasters[i].mAttr);
}
mHandlingDelayedBroadcasters = oldValue;
}
}
}
void
-XULDocument::EndUpdate(nsUpdateType aUpdateType)
+XULDocument::EndUpdate()
{
- XMLDocument::EndUpdate(aUpdateType);
-
+ XMLDocument::EndUpdate();
MaybeBroadcast();
}
void
XULDocument::ReportMissingOverlay(nsIURI* aURI)
{
MOZ_ASSERT(aURI, "Must have a URI");
--- a/dom/xul/XULDocument.h
+++ b/dom/xul/XULDocument.h
@@ -115,17 +115,17 @@ public:
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;
- virtual void EndUpdate(nsUpdateType aUpdateType) override;
+ virtual void EndUpdate() override;
virtual bool IsDocumentRightToLeft() override;
/**
* Reset the document direction so that it is recomputed.
*/
void ResetDocumentDirection();
--- a/editor/libeditor/HTMLAnonymousNodeEditor.cpp
+++ b/editor/libeditor/HTMLAnonymousNodeEditor.cpp
@@ -270,31 +270,22 @@ HTMLEditor::DeleteRefToAnonymousNode(Man
// Need to check whether aShell has been destroyed (but not yet deleted).
// See bug 338129.
if (aContent->IsInComposedDoc() && aShell && !aShell->IsDestroying()) {
// Call BeginUpdate() so that the nsCSSFrameConstructor/PresShell
// knows we're messing with the frame tree.
//
// FIXME(emilio): Shouldn't this use the document update mechanism instead?
// Also, is it really needed? This is NAC anyway.
- nsCOMPtr<nsIDocument> document = GetDocument();
- if (document) {
- aShell->BeginUpdate(document, UPDATE_CONTENT_MODEL);
- }
-
MOZ_ASSERT(aContent->IsRootOfAnonymousSubtree());
MOZ_ASSERT(!aContent->GetPreviousSibling(), "NAC has no siblings");
// FIXME(emilio): This is the only caller to PresShell::ContentRemoved that
// passes NAC into it. This is not great!
aShell->ContentRemoved(aContent, nullptr);
-
- if (document) {
- aShell->EndUpdate(document, UPDATE_CONTENT_MODEL);
- }
}
// The ManualNACPtr destructor will invoke UnbindFromTree.
}
// The following method is mostly called by a selection listener. When a
// selection change is notified, the method is called to check if resizing
// handles, a grabber and/or inline table editing UI need to be displayed
--- a/parser/html/nsHtml5DocumentBuilder.h
+++ b/parser/html/nsHtml5DocumentBuilder.h
@@ -64,25 +64,25 @@ public:
inline bool IsComplete() { return !mParser; }
inline void BeginDocUpdate()
{
MOZ_RELEASE_ASSERT(IsInFlush(), "Tried to double-open doc update.");
MOZ_RELEASE_ASSERT(mParser, "Started doc update without parser.");
mFlushState = eInDocUpdate;
- mDocument->BeginUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->BeginUpdate();
}
inline void EndDocUpdate()
{
MOZ_RELEASE_ASSERT(IsInDocUpdate(),
"Tried to end doc update without one open.");
mFlushState = eInFlush;
- mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->EndUpdate();
}
inline void BeginFlush()
{
MOZ_RELEASE_ASSERT(mFlushState == eNotFlushing,
"Tried to start a flush when already flushing.");
MOZ_RELEASE_ASSERT(mParser, "Started a flush without parser.");
mFlushState = eInFlush;
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -58,24 +58,24 @@ public:
nsHtml5OtherDocUpdate(nsIDocument* aCurrentDoc, nsIDocument* aExecutorDoc)
{
MOZ_ASSERT(aCurrentDoc, "Node has no doc?");
MOZ_ASSERT(aExecutorDoc, "Executor has no doc?");
if (MOZ_LIKELY(aCurrentDoc == aExecutorDoc)) {
mDocument = nullptr;
} else {
mDocument = aCurrentDoc;
- aCurrentDoc->BeginUpdate(UPDATE_CONTENT_MODEL);
+ aCurrentDoc->BeginUpdate();
}
}
~nsHtml5OtherDocUpdate()
{
if (MOZ_UNLIKELY(mDocument)) {
- mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
+ mDocument->EndUpdate();
}
}
private:
nsCOMPtr<nsIDocument> mDocument;
};
nsHtml5TreeOperation::nsHtml5TreeOperation()