--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -75,17 +75,17 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(N
////////////////////////////////////////////////////////////////////////////////
// NotificationCollector: public
void
NotificationController::Shutdown()
{
if (mObservingState != eNotObservingRefresh &&
- mPresShell->RemoveRefreshObserver(this, Flush_Display)) {
+ mPresShell->RemoveRefreshObserver(this, FlushType::Display)) {
mObservingState = eNotObservingRefresh;
}
// Shutdown handling child documents.
int32_t childDocCount = mHangingChildDocuments.Length();
for (int32_t idx = childDocCount - 1; idx >= 0; idx--) {
if (!mHangingChildDocuments[idx]->IsDefunct())
mHangingChildDocuments[idx]->Shutdown();
@@ -432,17 +432,17 @@ NotificationController::ScheduleContentI
}
void
NotificationController::ScheduleProcessing()
{
// If notification flush isn't planed yet start notification flush
// asynchronously (after style and layout).
if (mObservingState == eNotObservingRefresh) {
- if (mPresShell->AddRefreshObserver(this, Flush_Display))
+ if (mPresShell->AddRefreshObserver(this, FlushType::Display))
mObservingState = eRefreshObserving;
}
}
////////////////////////////////////////////////////////////////////////////////
// NotificationCollector: protected
bool
@@ -880,17 +880,17 @@ NotificationController::WillRefresh(mozi
return;
// Stop further processing if there are no new notifications of any kind or
// events and document load is processed.
if (mContentInsertions.Count() == 0 && mNotifications.IsEmpty() &&
mEvents.IsEmpty() && mTextHash.Count() == 0 &&
mHangingChildDocuments.IsEmpty() &&
mDocument->HasLoadState(DocAccessible::eCompletelyLoaded) &&
- mPresShell->RemoveRefreshObserver(this, Flush_Display)) {
+ mPresShell->RemoveRefreshObserver(this, FlushType::Display)) {
mObservingState = eNotObservingRefresh;
}
}
void
NotificationController::EventMap::PutEvent(AccTreeMutationEvent* aEvent)
{
EventType type = GetEventType(aEvent);
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5970,17 +5970,17 @@ nsDocShell::GetPositionAndSize(int32_t*
// We should really consider just getting this information from
// our window instead of duplicating the storage and code...
if (aWidth || aHeight) {
// Caller wants to know our size; make sure to give them up to
// date information.
nsCOMPtr<nsIDocument> doc(do_GetInterface(GetAsSupports(mParent)));
if (doc) {
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
}
}
DoGetPositionAndSize(aX, aY, aWidth, aHeight);
return NS_OK;
}
void
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -1272,17 +1272,17 @@ Animation::UpdateEffect()
}
}
void
Animation::FlushStyle() const
{
nsIDocument* doc = GetRenderedDocument();
if (doc) {
- doc->FlushPendingNotifications(Flush_Style);
+ doc->FlushPendingNotifications(FlushType::Style);
}
}
void
Animation::PostUpdate()
{
if (!mEffect) {
return;
--- a/dom/animation/CSSPseudoElement.cpp
+++ b/dom/animation/CSSPseudoElement.cpp
@@ -50,17 +50,17 @@ CSSPseudoElement::WrapObject(JSContext*
}
void
CSSPseudoElement::GetAnimations(const AnimationFilter& filter,
nsTArray<RefPtr<Animation>>& aRetVal)
{
nsIDocument* doc = mParentElement->GetComposedDoc();
if (doc) {
- doc->FlushPendingNotifications(Flush_Style);
+ doc->FlushPendingNotifications(FlushType::Style);
}
Element::GetAnimationsUnsorted(mParentElement, mPseudoType, aRetVal);
aRetVal.Sort(AnimationPtrComparator<RefPtr<Animation>>());
}
already_AddRefed<Animation>
CSSPseudoElement::Animate(
--- a/dom/animation/DocumentTimeline.cpp
+++ b/dom/animation/DocumentTimeline.cpp
@@ -135,17 +135,17 @@ DocumentTimeline::NotifyAnimationUpdated
AnimationTimeline::NotifyAnimationUpdated(aAnimation);
if (!mIsObservingRefreshDriver) {
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (refreshDriver) {
MOZ_ASSERT(isInList(),
"We should not register with the refresh driver if we are not"
" in the document's list of timelines");
- refreshDriver->AddRefreshObserver(this, Flush_Style);
+ refreshDriver->AddRefreshObserver(this, FlushType::Style);
mIsObservingRefreshDriver = true;
}
}
}
void
DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime)
{
@@ -202,29 +202,29 @@ DocumentTimeline::NotifyRefreshDriverCre
MOZ_ASSERT(!mIsObservingRefreshDriver,
"Timeline should not be observing the refresh driver before"
" it is created");
if (!mAnimationOrder.isEmpty()) {
MOZ_ASSERT(isInList(),
"We should not register with the refresh driver if we are not"
" in the document's list of timelines");
- aDriver->AddRefreshObserver(this, Flush_Style);
+ aDriver->AddRefreshObserver(this, FlushType::Style);
mIsObservingRefreshDriver = true;
}
}
void
DocumentTimeline::NotifyRefreshDriverDestroying(nsRefreshDriver* aDriver)
{
if (!mIsObservingRefreshDriver) {
return;
}
- aDriver->RemoveRefreshObserver(this, Flush_Style);
+ aDriver->RemoveRefreshObserver(this, FlushType::Style);
mIsObservingRefreshDriver = false;
}
void
DocumentTimeline::RemoveAnimation(Animation* aAnimation)
{
AnimationTimeline::RemoveAnimation(aAnimation);
@@ -270,14 +270,14 @@ DocumentTimeline::UnregisterFromRefreshD
return;
}
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (!refreshDriver) {
return;
}
- refreshDriver->RemoveRefreshObserver(this, Flush_Style);
+ refreshDriver->RemoveRefreshObserver(this, FlushType::Style);
mIsObservingRefreshDriver = false;
}
} // namespace dom
} // namespace mozilla
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -620,33 +620,34 @@ Element::GetElementsByTagName(const nsAS
nsIDOMHTMLCollection** aResult)
{
*aResult = GetElementsByTagName(aLocalName).take();
}
nsIFrame*
Element::GetStyledFrame()
{
- nsIFrame *frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame *frame = GetPrimaryFrame(FlushType::Layout);
return frame ? nsLayoutUtils::GetStyleFrame(frame) : nullptr;
}
nsIScrollableFrame*
Element::GetScrollFrame(nsIFrame **aStyledFrame, bool aFlushLayout)
{
// it isn't clear what to return for SVG nodes, so just return nothing
if (IsSVGElement()) {
if (aStyledFrame) {
*aStyledFrame = nullptr;
}
return nullptr;
}
- // Inline version of GetStyledFrame to use Flush_None if needed.
- nsIFrame* frame = GetPrimaryFrame(aFlushLayout ? Flush_Layout : Flush_None);
+ // Inline version of GetStyledFrame to use FlushType::None if needed.
+ nsIFrame* frame =
+ GetPrimaryFrame(aFlushLayout ? FlushType::Layout : FlushType::None);
if (frame) {
frame = nsLayoutUtils::GetStyleFrame(frame);
}
if (aStyledFrame) {
*aStyledFrame = frame;
}
if (!frame) {
@@ -966,17 +967,17 @@ Element::GetClientAreaRect()
return nsRect(0, 0, 0, 0);
}
already_AddRefed<DOMRect>
Element::GetBoundingClientRect()
{
RefPtr<DOMRect> rect = new DOMRect(this);
- nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
if (!frame) {
// display:none, perhaps? Return the empty rect
return rect.forget();
}
nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(frame,
nsLayoutUtils::GetContainingBlockForClientRect(frame),
nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
@@ -984,17 +985,17 @@ Element::GetBoundingClientRect()
return rect.forget();
}
already_AddRefed<DOMRectList>
Element::GetClientRects()
{
RefPtr<DOMRectList> rectList = new DOMRectList(this);
- nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
if (!frame) {
// display:none, perhaps? Return an empty list
return rectList.forget();
}
nsLayoutUtils::RectListBuilder builder(rectList);
nsLayoutUtils::GetAllInFlowRects(frame,
nsLayoutUtils::GetContainingBlockForClientRect(frame), &builder,
@@ -2162,26 +2163,26 @@ Element::DispatchClickEvent(nsPresContex
// Be careful not to overwrite existing flags!
event.mFlags.Union(*aExtraEventFlags);
}
return DispatchEvent(aPresContext, &event, aTarget, aFullDispatch, aStatus);
}
nsIFrame*
-Element::GetPrimaryFrame(mozFlushType aType)
+Element::GetPrimaryFrame(FlushType aType)
{
nsIDocument* doc = GetComposedDoc();
if (!doc) {
return nullptr;
}
// Cause a flush, so we get up-to-date frame
// information
- if (aType != Flush_None) {
+ if (aType != FlushType::None) {
doc->FlushPendingNotifications(aType);
}
return GetPrimaryFrame();
}
//----------------------------------------------------------------------
nsresult
@@ -3426,17 +3427,17 @@ Element::Animate(const Nullable<ElementO
}
void
Element::GetAnimations(const AnimationFilter& filter,
nsTArray<RefPtr<Animation>>& aAnimations)
{
nsIDocument* doc = GetComposedDoc();
if (doc) {
- doc->FlushPendingNotifications(Flush_Style);
+ doc->FlushPendingNotifications(FlushType::Style);
}
Element* elem = this;
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
// For animations on generated-content elements, the animations are stored
// on the parent element.
if (IsGeneratedContentContainerForBefore()) {
elem = GetParentElement();
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -1005,21 +1005,21 @@ public:
WidgetEvent* aEvent,
nsIContent* aTarget,
bool aFullDispatch,
nsEventStatus* aStatus);
/**
* Get the primary frame for this content with flushing
*
- * @param aType the kind of flush to do, typically Flush_Frames or
- * Flush_Layout
+ * @param aType the kind of flush to do, typically FlushType::Frames or
+ * FlushType::Layout
* @return the primary frame
*/
- nsIFrame* GetPrimaryFrame(mozFlushType aType);
+ nsIFrame* GetPrimaryFrame(FlushType aType);
// Work around silly C++ name hiding stuff
nsIFrame* GetPrimaryFrame() const { return nsIContent::GetPrimaryFrame(); }
const nsAttrValue* GetParsedAttr(nsIAtom* aAttr) const
{
return mAttrsAndChildren.GetAttr(aAttr);
}
--- a/dom/base/FlushType.h
+++ b/dom/base/FlushType.h
@@ -1,46 +1,52 @@
/* -*- 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/. */
-#ifndef mozFlushType_h___
-#define mozFlushType_h___
+
+#ifndef mozilla_FlushType_h
+#define mozilla_FlushType_h
+
+#include <stdint.h>
+#include "X11UndefineNone.h"
+
+namespace mozilla {
/**
* This is the enum used by nsIDocument::FlushPendingNotifications to
* decide what to flush.
*
* Please note that if you change these values, you should sync it with the
* flushTypeNames array inside PresShell::FlushPendingNotifications.
*/
-enum mozFlushType {
- Flush_None = 0, /* Actually don't flush anything */
- Flush_Content = 1, /* flush the content model construction */
- Flush_ContentAndNotify = 2, /* As above, plus flush the frame model
- construction and other nsIMutationObserver
- notifications. */
- Flush_Style = 3, /* As above, plus flush style reresolution */
- Flush_Frames = Flush_Style,
- Flush_InterruptibleLayout = 4, /* As above, plus flush reflow,
- but allow it to be interrupted (so
- an incomplete layout may result) */
- Flush_Layout = 5, /* As above, but layout must run to
- completion */
- Flush_Display = 6 /* As above, plus flush painting */
+enum class FlushType : uint8_t {
+ None = 0, /* Actually don't flush anything */
+ Content = 1, /* flush the content model construction */
+ ContentAndNotify = 2, /* As above, plus flush the frame model
+ construction and other nsIMutationObserver
+ notifications. */
+ Style = 3, /* As above, plus flush style reresolution */
+ Frames = Style,
+ InterruptibleLayout = 4, /* As above, plus flush reflow,
+ but allow it to be interrupted (so
+ an incomplete layout may result) */
+ Layout = 5, /* As above, but layout must run to
+ completion */
+ Display = 6, /* As above, plus flush painting */
+
+ Count
};
-namespace mozilla {
-
struct ChangesToFlush {
- ChangesToFlush(mozFlushType aFlushType, bool aFlushAnimations)
+ ChangesToFlush(FlushType aFlushType, bool aFlushAnimations)
: mFlushType(aFlushType)
, mFlushAnimations(aFlushAnimations)
{}
- mozFlushType mFlushType;
+ FlushType mFlushType;
bool mFlushAnimations;
};
} // namespace mozilla
-#endif /* mozFlushType_h___ */
+#endif // mozilla_FlushType_h
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -485,17 +485,17 @@ nsContentList::Length(bool aDoFlush)
nsIContent *
nsContentList::Item(uint32_t aIndex, bool aDoFlush)
{
if (mRootNode && aDoFlush && mFlushesNeeded) {
// XXX sXBL/XBL2 issue
nsIDocument* doc = mRootNode->GetUncomposedDoc();
if (doc) {
// Flush pending content changes Bug 4891.
- doc->FlushPendingNotifications(Flush_ContentAndNotify);
+ doc->FlushPendingNotifications(FlushType::ContentAndNotify);
}
}
if (mState != LIST_UP_TO_DATE)
PopulateSelf(std::min(aIndex, UINT32_MAX - 1) + 1);
ASSERT_IN_SYNC;
NS_ASSERTION(!mRootNode || mState != LIST_DIRTY,
@@ -979,17 +979,17 @@ nsContentList::RemoveFromHashtable()
void
nsContentList::BringSelfUpToDate(bool aDoFlush)
{
if (mRootNode && aDoFlush && mFlushesNeeded) {
// XXX sXBL/XBL2 issue
nsIDocument* doc = mRootNode->GetUncomposedDoc();
if (doc) {
// Flush pending content changes Bug 4891.
- doc->FlushPendingNotifications(Flush_ContentAndNotify);
+ doc->FlushPendingNotifications(FlushType::ContentAndNotify);
}
}
if (mState != LIST_UP_TO_DATE)
PopulateSelf(uint32_t(-1));
ASSERT_IN_SYNC;
NS_ASSERTION(!mRootNode || mState == LIST_UP_TO_DATE,
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -2631,17 +2631,17 @@ nsContentUtils::GenerateStateKey(nsICont
KeyAppendInt(partID, aKey); // first append a partID
bool generatedUniqueKey = false;
if (htmlDocument) {
// Flush our content model so it'll be up to date
// If this becomes unnecessary and the following line is removed,
// please also remove the corresponding flush operation from
// nsHtml5TreeBuilderCppSupplement.h. (Look for "See bug 497861." there.)
- aContent->GetUncomposedDoc()->FlushPendingNotifications(Flush_Content);
+ aContent->GetUncomposedDoc()->FlushPendingNotifications(FlushType::Content);
nsContentList *htmlForms = htmlDocument->GetForms();
nsContentList *htmlFormControls = htmlDocument->GetFormControls();
NS_ENSURE_TRUE(htmlForms && htmlFormControls, NS_ERROR_OUT_OF_MEMORY);
// If we have a form control and can calculate form information, use that
// as the key - it is more reliable than just recording position in the
@@ -6456,17 +6456,17 @@ nsContentUtils::FlushLayoutForTree(nsPID
return;
}
// Note that because FlushPendingNotifications flushes parents, this
// is O(N^2) in docshell tree depth. However, the docshell tree is
// usually pretty shallow.
if (nsCOMPtr<nsIDocument> doc = aWindow->GetDoc()) {
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
}
if (nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell()) {
int32_t i = 0, i_end;
docShell->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
docShell->GetChildAt(i, getter_AddRefs(item));
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -838,17 +838,17 @@ nsCopySupport::FireClipboardEvent(EventM
if (aActionTaken) {
*aActionTaken = true;
}
return doDefault;
}
// Update the presentation in case the event handler modified the selection,
// see bug 602231.
- presShell->FlushPendingNotifications(Flush_Frames);
+ presShell->FlushPendingNotifications(FlushType::Frames);
if (presShell->IsDestroying())
return false;
// if the event was not cancelled, do the default copy. If the event was cancelled,
// use the data added to the data transfer and copy that instead.
uint32_t count = 0;
if (doDefault) {
// find the focused node
--- a/dom/base/nsDOMWindowList.cpp
+++ b/dom/base/nsDOMWindowList.cpp
@@ -51,17 +51,17 @@ nsDOMWindowList::EnsureFresh()
if (shellAsNav) {
nsCOMPtr<nsIDOMDocument> domdoc;
shellAsNav->GetDocument(getter_AddRefs(domdoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
if (doc) {
- doc->FlushPendingNotifications(Flush_ContentAndNotify);
+ doc->FlushPendingNotifications(FlushType::ContentAndNotify);
}
}
}
uint32_t
nsDOMWindowList::GetLength()
{
EnsureFresh();
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -325,17 +325,17 @@ nsDOMWindowUtils::Redraw(uint32_t aCount
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsDOMWindowUtils::UpdateLayerTree()
{
if (nsIPresShell* presShell = GetPresShell()) {
- presShell->FlushPendingNotifications(Flush_Display);
+ presShell->FlushPendingNotifications(FlushType::Display);
RefPtr<nsViewManager> vm = presShell->GetViewManager();
nsView* view = vm->GetRootView();
if (view) {
presShell->Paint(view, view->GetBounds(),
nsIPresShell::PAINT_LAYERS | nsIPresShell::PAINT_SYNC_DECODE_IMAGES);
}
}
return NS_OK;
@@ -1670,17 +1670,17 @@ nsDOMWindowUtils::SuppressEventHandling(
static nsresult
getScrollXYAppUnits(const nsWeakPtr& aWindow, bool aFlushLayout, nsPoint& aScrollPos) {
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(aWindow);
nsCOMPtr<nsIDocument> doc = window ? window->GetExtantDoc() : nullptr;
NS_ENSURE_STATE(doc);
if (aFlushLayout) {
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell *presShell = doc->GetShell();
if (presShell) {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
if (sf) {
aScrollPos = sf->GetScrollPosition();
}
@@ -1718,17 +1718,17 @@ nsDOMWindowUtils::GetScrollbarSize(bool
{
*aWidth = 0;
*aHeight = 0;
nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc);
if (aFlushLayout) {
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell* presShell = doc->GetShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
nsIScrollableFrame* scrollFrame = presShell->GetRootScrollFrameAsScrollable();
NS_ENSURE_TRUE(scrollFrame, NS_OK);
@@ -1894,17 +1894,17 @@ nsDOMWindowUtils::DispatchDOMEventViaPre
if (content->OwnerDoc()->GetWindow() != window) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsCOMPtr<nsIDocument> targetDoc = content->GetUncomposedDoc();
NS_ENSURE_STATE(targetDoc);
RefPtr<nsIPresShell> targetShell = targetDoc->GetShell();
NS_ENSURE_STATE(targetShell);
- targetDoc->FlushPendingNotifications(Flush_Layout);
+ targetDoc->FlushPendingNotifications(FlushType::Layout);
nsEventStatus status = nsEventStatus_eIgnore;
targetShell->HandleEventWithTarget(internalEvent, nullptr, content, &status);
*aRetVal = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
}
static void
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3262,17 +3262,17 @@ nsDocument::ElementsFromPointHelper(floa
nscoord x = nsPresContext::CSSPixelsToAppUnits(aX);
nscoord y = nsPresContext::CSSPixelsToAppUnits(aY);
nsPoint pt(x, y);
// Make sure the layout information we get is up-to-date, and
// ensure we get a root frame (for everything but XUL)
if (aFlags & nsIDocument::FLUSH_LAYOUT) {
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell *ps = GetShell();
if (!ps) {
return;
}
nsIFrame *rootFrame = ps->GetRootFrame();
@@ -3344,17 +3344,17 @@ nsDocument::NodesFromRectHelper(float aX
nscoord w = nsPresContext::CSSPixelsToAppUnits(aLeftSize + aRightSize) + 1;
nscoord h = nsPresContext::CSSPixelsToAppUnits(aTopSize + aBottomSize) + 1;
nsRect rect(x, y, w, h);
// Make sure the layout information we get is up-to-date, and
// ensure we get a root frame (for everything but XUL)
if (aFlushLayout) {
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
}
nsIPresShell *ps = GetShell();
NS_ENSURE_STATE(ps);
nsIFrame *rootFrame = ps->GetRootFrame();
// XUL docs, unlike HTML, have no frame tree until everything's done loading
if (!rootFrame)
@@ -7734,83 +7734,83 @@ nsIDocument::CreateEvent(const nsAString
}
WidgetEvent* e = ev->WidgetEventPtr();
e->mFlags.mBubbles = false;
e->mFlags.mCancelable = false;
return ev.forget();
}
void
-nsDocument::FlushPendingNotifications(mozFlushType aType)
+nsDocument::FlushPendingNotifications(FlushType aType)
{
nsDocumentOnStack dos(this);
// We need to flush the sink for non-HTML documents (because the XML
// parser still does insertion with deferred notifications). We
// also need to flush the sink if this is a layout-related flush, to
// make sure that layout is started as needed. But we can skip that
// part if we have no presshell or if it's already done an initial
// reflow.
if ((!IsHTMLDocument() ||
- (aType > Flush_ContentAndNotify && mPresShell &&
+ (aType > FlushType::ContentAndNotify && mPresShell &&
!mPresShell->DidInitialize())) &&
(mParser || mWeakSink)) {
nsCOMPtr<nsIContentSink> sink;
if (mParser) {
sink = mParser->GetContentSink();
} else {
sink = do_QueryReferent(mWeakSink);
if (!sink) {
mWeakSink = nullptr;
}
}
// Determine if it is safe to flush the sink notifications
// by determining if it safe to flush all the presshells.
- if (sink && (aType == Flush_Content || IsSafeToFlush())) {
+ if (sink && (aType == FlushType::Content || IsSafeToFlush())) {
sink->FlushPendingNotifications(aType);
}
}
// Should we be flushing pending binding constructors in here?
- if (aType <= Flush_ContentAndNotify) {
+ if (aType <= FlushType::ContentAndNotify) {
// Nothing to do here
return;
}
// If we have a parent we must flush the parent too to ensure that our
// container is reflowed if its size was changed. But if it's not safe to
// flush ourselves, then don't flush the parent, since that can cause things
// like resizes of our frame's widget, which we can't handle while flushing
// is unsafe.
// Since media queries mean that a size change of our container can
// affect style, we need to promote a style flush on ourself to a
// layout flush on our parent, since we need our container to be the
// correct size to determine the correct style.
if (mParentDocument && IsSafeToFlush()) {
- mozFlushType parentType = aType;
- if (aType >= Flush_Style)
- parentType = std::max(Flush_Layout, aType);
+ FlushType parentType = aType;
+ if (aType >= FlushType::Style)
+ parentType = std::max(FlushType::Layout, aType);
mParentDocument->FlushPendingNotifications(parentType);
}
// We can optimize away getting our presshell and calling
// FlushPendingNotifications on it if we don't need a flush of the sort we're
// looking at. The one exception is if mInFlush is true, because in that
// case we might have set mNeedStyleFlush and mNeedLayoutFlush to false
// already but the presshell hasn't actually done the corresponding work yet.
// So if mInFlush and reentering this code, we need to flush the presshell.
if (mNeedStyleFlush ||
- (mNeedLayoutFlush && aType >= Flush_InterruptibleLayout) ||
- aType >= Flush_Display ||
+ (mNeedLayoutFlush && aType >= FlushType::InterruptibleLayout) ||
+ aType >= FlushType::Display ||
mInFlush) {
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
mNeedStyleFlush = false;
- mNeedLayoutFlush = mNeedLayoutFlush && (aType < Flush_InterruptibleLayout);
+ mNeedLayoutFlush = mNeedLayoutFlush && (aType < FlushType::InterruptibleLayout);
// mInFlush is a bitfield, so can't us AutoRestore here. But we
// need to keep track of multi-level reentry correctly, so need
// to restore the old mInFlush value.
bool oldInFlush = mInFlush;
mInFlush = true;
shell->FlushPendingNotifications(aType);
mInFlush = oldInFlush;
}
@@ -7822,19 +7822,19 @@ Copy(nsIDocument* aDocument, void* aData
{
nsTArray<nsCOMPtr<nsIDocument> >* resources =
static_cast<nsTArray<nsCOMPtr<nsIDocument> >* >(aData);
resources->AppendElement(aDocument);
return true;
}
void
-nsDocument::FlushExternalResources(mozFlushType aType)
-{
- NS_ASSERTION(aType >= Flush_Style,
+nsDocument::FlushExternalResources(FlushType aType)
+{
+ NS_ASSERTION(aType >= FlushType::Style,
"should only need to flush for style or higher in external resources");
if (GetDisplayDocument()) {
return;
}
nsTArray<nsCOMPtr<nsIDocument> > resources;
EnumerateExternalResources(Copy, &resources);
for (uint32_t i = 0; i < resources.Length(); i++) {
@@ -10212,17 +10212,17 @@ nsIDocument::CreateTouchList(const Seque
already_AddRefed<nsDOMCaretPosition>
nsIDocument::CaretPositionFromPoint(float aX, float aY)
{
nscoord x = nsPresContext::CSSPixelsToAppUnits(aX);
nscoord y = nsPresContext::CSSPixelsToAppUnits(aY);
nsPoint pt(x, y);
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIPresShell *ps = GetShell();
if (!ps) {
return nullptr;
}
nsIFrame *rootFrame = ps->GetRootFrame();
@@ -10321,17 +10321,17 @@ IsPotentiallyScrollable(HTMLBodyElement*
return true;
}
Element*
nsIDocument::GetScrollingElement()
{
if (GetCompatibilityMode() == eCompatibility_NavQuirks) {
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
HTMLBodyElement* body = GetBodyElement();
if (body && !IsPotentiallyScrollable(body)) {
return body;
}
return nullptr;
}
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -709,18 +709,18 @@ public:
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
- virtual void FlushPendingNotifications(mozFlushType aType) override;
- virtual void FlushExternalResources(mozFlushType aType) override;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override;
+ virtual void FlushExternalResources(mozilla::FlushType aType) override;
virtual void SetXMLDeclaration(const char16_t *aVersion,
const char16_t *aEncoding,
const int32_t aStandalone) override;
virtual void GetXMLDeclaration(nsAString& aVersion,
nsAString& aEncoding,
nsAString& Standalone) override;
virtual bool IsScriptEnabled() override;
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1542,17 +1542,17 @@ nsFocusManager::CheckIfFocusable(nsICont
nsCOMPtr<nsIDocument> doc = aContent->GetComposedDoc();
// can't focus elements that are not in documents
if (!doc) {
LOGCONTENT("Cannot focus %s because content not in document", aContent)
return nullptr;
}
// Make sure that our frames are up to date
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
nsIPresShell *shell = doc->GetShell();
if (!shell)
return nullptr;
// the root content can always be focused,
// except in userfocusignored context.
if (aContent == doc->GetRootElement())
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1464,18 +1464,18 @@ nsFrameLoader::SwapWithOtherRemoteLoader
aThisOwner->InternalSetFrameLoader(aOther);
aOtherOwner->InternalSetFrameLoader(kungFuDeathGrip);
ourFrameFrame->EndSwapDocShells(otherFrame);
ourShell->BackingScaleFactorChanged();
otherShell->BackingScaleFactorChanged();
- ourDoc->FlushPendingNotifications(Flush_Layout);
- otherDoc->FlushPendingNotifications(Flush_Layout);
+ ourDoc->FlushPendingNotifications(FlushType::Layout);
+ otherDoc->FlushPendingNotifications(FlushType::Layout);
// Initialize browser API if needed now that owner content has changed.
InitializeBrowserAPI();
aOther->InitializeBrowserAPI();
mInSwap = aOther->mInSwap = false;
// Send an updated tab context since owner content type may have changed.
@@ -1893,18 +1893,18 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
// If the content being swapped came from windows on two screens with
// incompatible backing resolution (e.g. dragging a tab between windows on
// hi-dpi and low-dpi screens), it will have style data that is based on
// the wrong appUnitsPerDevPixel value. So we tell the PresShells that their
// backing scale factor may have changed. (Bug 822266)
ourShell->BackingScaleFactorChanged();
otherShell->BackingScaleFactorChanged();
- ourParentDocument->FlushPendingNotifications(Flush_Layout);
- otherParentDocument->FlushPendingNotifications(Flush_Layout);
+ ourParentDocument->FlushPendingNotifications(FlushType::Layout);
+ otherParentDocument->FlushPendingNotifications(FlushType::Layout);
// Initialize browser API if needed now that owner content has changed
InitializeBrowserAPI();
aOther->InitializeBrowserAPI();
return NS_OK;
}
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -5282,17 +5282,17 @@ nsGlobalWindow::GetOuterSize(CallerType
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
if (!treeOwnerAsWin) {
aError.Throw(NS_ERROR_FAILURE);
return nsIntSize(0, 0);
}
nsGlobalWindow* rootWindow = nsGlobalWindow::Cast(GetPrivateRoot());
if (rootWindow) {
- rootWindow->FlushPendingNotifications(Flush_Layout);
+ rootWindow->FlushPendingNotifications(FlushType::Layout);
}
nsIntSize sizeDevPixels;
aError = treeOwnerAsWin->GetSize(&sizeDevPixels.width, &sizeDevPixels.height);
if (aError.Failed()) {
return nsIntSize();
}
@@ -5514,17 +5514,17 @@ nsGlobalWindow::GetInnerScreenRect()
MOZ_ASSERT(IsOuterWindow());
if (!mDocShell) {
return nsRect();
}
nsGlobalWindow* rootWindow = nsGlobalWindow::Cast(GetPrivateRoot());
if (rootWindow) {
- rootWindow->FlushPendingNotifications(Flush_Layout);
+ rootWindow->FlushPendingNotifications(FlushType::Layout);
}
if (!mDocShell) {
return nsRect();
}
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell) {
@@ -5883,17 +5883,17 @@ nsGlobalWindow::CheckSecurityLeftAndTop(
if (aCallerType != CallerType::System) {
#ifdef MOZ_XUL
// if attempting to move the window, hide any open popups
nsContentUtils::HidePopupsInDocument(mDoc);
#endif
if (nsGlobalWindow* rootWindow = nsGlobalWindow::Cast(GetPrivateRoot())) {
- rootWindow->FlushPendingNotifications(Flush_Layout);
+ rootWindow->FlushPendingNotifications(FlushType::Layout);
}
nsCOMPtr<nsIBaseWindow> treeOwner = GetTreeOwnerWindow();
nsCOMPtr<nsIDOMScreen> screen = GetScreen();
if (treeOwner && screen) {
int32_t screenLeft, screenTop, screenWidth, screenHeight;
@@ -5948,17 +5948,17 @@ nsGlobalWindow::CheckSecurityLeftAndTop(
}
}
int32_t
nsGlobalWindow::GetScrollBoundaryOuter(Side aSide)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
if (nsIScrollableFrame *sf = GetScrollFrame()) {
return nsPresContext::
AppUnitsToIntCSSPixels(sf->GetScrollRange().Edge(aSide));
}
return 0;
}
int32_t
@@ -5990,17 +5990,17 @@ nsGlobalWindow::GetScrollMaxY(ErrorResul
}
CSSIntPoint
nsGlobalWindow::GetScrollXY(bool aDoFlush)
{
MOZ_ASSERT(IsOuterWindow());
if (aDoFlush) {
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
} else {
EnsureSizeUpToDate();
}
nsIScrollableFrame *sf = GetScrollFrame();
if (!sf) {
return CSSIntPoint(0, 0);
}
@@ -6800,17 +6800,17 @@ nsGlobalWindow::EnsureReflowFlushAndPain
nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
if (!presShell)
return;
// Flush pending reflows.
if (mDoc) {
- mDoc->FlushPendingNotifications(Flush_Layout);
+ mDoc->FlushPendingNotifications(FlushType::Layout);
}
// Unsuppress painting.
presShell->UnsuppressPainting();
}
// static
void
@@ -7871,17 +7871,17 @@ nsGlobalWindow::ScrollTo(double aXScroll
auto scrollPos = CSSIntPoint::Truncate(mozilla::ToZeroIfNonfinite(aXScroll),
mozilla::ToZeroIfNonfinite(aYScroll));
ScrollTo(scrollPos, ScrollOptions());
}
void
nsGlobalWindow::ScrollTo(const ScrollToOptions& aOptions)
{
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
CSSIntPoint scrollPos = sf->GetScrollPositionCSSPixels();
if (aOptions.mLeft.WasPassed()) {
scrollPos.x = mozilla::ToZeroIfNonfinite(aOptions.mLeft.Value());
}
if (aOptions.mTop.WasPassed()) {
@@ -7897,17 +7897,17 @@ nsGlobalWindow::Scroll(const ScrollToOpt
{
ScrollTo(aOptions);
}
void
nsGlobalWindow::ScrollTo(const CSSIntPoint& aScroll,
const ScrollOptions& aOptions)
{
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
// Here we calculate what the max pixel value is that we can
// scroll to, we do this by dividing maxint with the pixel to
// twips conversion factor, and subtracting 4, the 4 comes from
// experimenting with this value, anything less makes the view
// code not scroll correctly, I have no idea why. -- jst
@@ -7928,34 +7928,34 @@ nsGlobalWindow::ScrollTo(const CSSIntPoi
? nsIScrollableFrame::SMOOTH_MSD
: nsIScrollableFrame::INSTANT);
}
}
void
nsGlobalWindow::ScrollBy(double aXScrollDif, double aYScrollDif)
{
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
// Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast.
auto scrollDif = CSSIntPoint::Truncate(mozilla::ToZeroIfNonfinite(aXScrollDif),
mozilla::ToZeroIfNonfinite(aYScrollDif));
// It seems like it would make more sense for ScrollBy to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
// Perhaps Web content does too.
ScrollTo(sf->GetScrollPositionCSSPixels() + scrollDif, ScrollOptions());
}
}
void
nsGlobalWindow::ScrollBy(const ScrollToOptions& aOptions)
{
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
CSSIntPoint scrollPos = sf->GetScrollPositionCSSPixels();
if (aOptions.mLeft.WasPassed()) {
scrollPos.x += mozilla::ToZeroIfNonfinite(aOptions.mLeft.Value());
}
if (aOptions.mTop.WasPassed()) {
@@ -7967,17 +7967,17 @@ nsGlobalWindow::ScrollBy(const ScrollToO
}
void
nsGlobalWindow::ScrollByLines(int32_t numLines,
const ScrollOptions& aOptions)
{
MOZ_ASSERT(IsInnerWindow());
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
// It seems like it would make more sense for ScrollByLines to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
// Perhaps Web content does too.
bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
sf->ScrollBy(nsIntPoint(0, numLines), nsIScrollableFrame::LINES,
@@ -7988,17 +7988,17 @@ nsGlobalWindow::ScrollByLines(int32_t nu
}
void
nsGlobalWindow::ScrollByPages(int32_t numPages,
const ScrollOptions& aOptions)
{
MOZ_ASSERT(IsInnerWindow());
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
// It seems like it would make more sense for ScrollByPages to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
// Perhaps Web content does too.
bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
sf->ScrollBy(nsIntPoint(0, numPages), nsIScrollableFrame::PAGES,
@@ -8008,17 +8008,17 @@ nsGlobalWindow::ScrollByPages(int32_t nu
}
}
void
nsGlobalWindow::MozScrollSnap()
{
MOZ_ASSERT(IsInnerWindow());
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame *sf = GetScrollFrame();
if (sf) {
sf->ScrollSnap();
}
}
void
nsGlobalWindow::MozRequestOverfill(OverfillCallback& aCallback,
@@ -8373,17 +8373,17 @@ nsGlobalWindow::OpenDialog(JSContext* aC
(aCx, aUrl, aName, aOptions, aExtraArgument, aError),
aError, nullptr);
}
already_AddRefed<nsPIDOMWindowOuter>
nsGlobalWindow::GetFramesOuter()
{
RefPtr<nsPIDOMWindowOuter> frames(AsOuter());
- FlushPendingNotifications(Flush_ContentAndNotify);
+ FlushPendingNotifications(FlushType::ContentAndNotify);
return frames.forget();
}
already_AddRefed<nsPIDOMWindowOuter>
nsGlobalWindow::GetFrames(ErrorResult& aError)
{
FORWARD_TO_OUTER_OR_THROW(GetFramesOuter, (), aError, nullptr);
}
@@ -10586,17 +10586,17 @@ nsGlobalWindow::GetComputedStyleHelperOu
if (!presShell) {
// Try flushing frames on our parent in case there's a pending
// style change that will create the presshell.
auto* parent = nsGlobalWindow::Cast(GetPrivateParent());
if (!parent) {
return nullptr;
}
- parent->FlushPendingNotifications(Flush_Frames);
+ parent->FlushPendingNotifications(FlushType::Frames);
// Might have killed mDocShell
if (!mDocShell) {
return nullptr;
}
presShell = mDocShell->GetPresShell();
if (!presShell) {
@@ -12765,34 +12765,34 @@ nsGlobalWindow::SecurityCheckURL(const c
bool
nsGlobalWindow::IsPrivateBrowsing()
{
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(GetDocShell());
return loadContext && loadContext->UsePrivateBrowsing();
}
void
-nsGlobalWindow::FlushPendingNotifications(mozFlushType aType)
+nsGlobalWindow::FlushPendingNotifications(FlushType aType)
{
if (mDoc) {
mDoc->FlushPendingNotifications(aType);
}
}
void
nsGlobalWindow::EnsureSizeUpToDate()
{
MOZ_ASSERT(IsOuterWindow());
// If we're a subframe, make sure our size is up to date. It's OK that this
// crosses the content/chrome boundary, since chrome can have pending reflows
// too.
nsGlobalWindow *parent = nsGlobalWindow::Cast(GetPrivateParent());
if (parent) {
- parent->FlushPendingNotifications(Flush_Layout);
+ parent->FlushPendingNotifications(FlushType::Layout);
}
}
already_AddRefed<nsISupports>
nsGlobalWindow::SaveWindowState()
{
NS_PRECONDITION(IsOuterWindow(), "Can't save the inner window's state");
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -1570,17 +1570,17 @@ public:
virtual nsresult RegisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
nsresult FindIndexOfElementToRemove(nsIIdleObserver* aIdleObserver,
int32_t* aRemoveElementIndex);
virtual nsresult UnregisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
// Inner windows only.
nsresult FireHashchange(const nsAString &aOldURL, const nsAString &aNewURL);
- void FlushPendingNotifications(mozFlushType aType);
+ void FlushPendingNotifications(mozilla::FlushType aType);
// Outer windows only.
void EnsureReflowFlushAndPaint();
void CheckSecurityWidthAndHeight(int32_t* width, int32_t* height,
mozilla::dom::CallerType aCallerType);
void CheckSecurityLeftAndTop(int32_t* left, int32_t* top,
mozilla::dom::CallerType aCallerType);
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1509,25 +1509,25 @@ public:
mozilla::css::Rule* aStyleRule) = 0;
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
/**
* Flush notifications for this document and its parent documents
* (since those may affect the layout of this one).
*/
- virtual void FlushPendingNotifications(mozFlushType aType) = 0;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) = 0;
/**
* Calls FlushPendingNotifications on any external resources this document
* has. If this document has no external resources or is an external resource
* itself this does nothing. This should only be called with
- * aType >= Flush_Style.
+ * aType >= FlushType::Style.
*/
- virtual void FlushExternalResources(mozFlushType aType) = 0;
+ virtual void FlushExternalResources(mozilla::FlushType aType) = 0;
nsBindingManager* BindingManager() const
{
return mNodeInfoManager->GetBindingManager();
}
/**
* Only to be used inside Gecko, you can't really do anything with the
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -231,17 +231,17 @@ CheckPluginStopEvent::Run()
return NS_OK;
}
// In an active document, but still no frame. Flush layout to see if we can
// regain a frame now.
LOG(("OBJLC [%p]: CheckPluginStopEvent - No frame, flushing layout", this));
nsIDocument* composedDoc = content->GetComposedDoc();
if (composedDoc) {
- composedDoc->FlushPendingNotifications(Flush_Layout);
+ composedDoc->FlushPendingNotifications(FlushType::Layout);
if (objLC->mPendingCheckPluginStopEvent != this) {
LOG(("OBJLC [%p]: CheckPluginStopEvent - superseded in layout flush",
this));
return NS_OK;
} else if (content->GetPrimaryFrame()) {
LOG(("OBJLC [%p]: CheckPluginStopEvent - frame gained in layout flush",
this));
objLC->mPendingCheckPluginStopEvent = nullptr;
@@ -712,17 +712,17 @@ nsObjectLoadingContent::InstantiatePlugi
// Instantiating an instance can result in script execution, which
// can destroy this DOM object. Don't allow that for the scope
// of this method.
nsCOMPtr<nsIObjectLoadingContent> kungFuDeathGrip = this;
// Flush layout so that the frame is created if possible and the plugin is
// initialized with the latest information.
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
// Flushing layout may have re-entered and loaded something underneath us
NS_ENSURE_TRUE(mInstantiating, NS_OK);
if (!thisContent->GetPrimaryFrame()) {
LOG(("OBJLC [%p]: Not instantiating plugin with no frame", this));
return NS_OK;
}
@@ -2741,17 +2741,17 @@ nsObjectLoadingContent::NotifyStateChang
{
nsAutoScriptBlocker scriptBlocker;
doc->ContentStateChanged(thisContent, changedBits);
}
if (aSync) {
NS_ASSERTION(InActiveDocument(thisContent), "Something is confused");
// Make sure that frames are actually constructed immediately.
- doc->FlushPendingNotifications(Flush_Frames);
+ doc->FlushPendingNotifications(FlushType::Frames);
}
} else if (aOldType != mType) {
// If our state changed, then we already recreated frames
// Otherwise, need to do that here
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell) {
shell->RecreateFramesFor(thisContent);
}
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -2882,17 +2882,17 @@ static nsTextFrame*
GetTextFrameForContent(nsIContent* aContent, bool aFlushLayout)
{
nsIPresShell* presShell = aContent->OwnerDoc()->GetShell();
if (presShell) {
presShell->FrameConstructor()->EnsureFrameForTextNode(
static_cast<nsGenericDOMDataNode*>(aContent));
if (aFlushLayout) {
- aContent->OwnerDoc()->FlushPendingNotifications(Flush_Layout);
+ aContent->OwnerDoc()->FlushPendingNotifications(FlushType::Layout);
}
nsIFrame* frame = aContent->GetPrimaryFrame();
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
return static_cast<nsTextFrame*>(frame);
}
}
return nullptr;
@@ -2967,17 +2967,17 @@ nsRange::CollectClientRectsAndText(nsLay
nsCOMPtr<nsINode> endContainer = aEndParent;
// Flush out layout so our frames are up to date.
if (!aStartParent->IsInUncomposedDoc()) {
return;
}
if (aFlushLayout) {
- aStartParent->OwnerDoc()->FlushPendingNotifications(Flush_Layout);
+ aStartParent->OwnerDoc()->FlushPendingNotifications(FlushType::Layout);
// Recheck whether we're still in the document
if (!aStartParent->IsInUncomposedDoc()) {
return;
}
}
RangeSubtreeIterator iter;
@@ -3113,17 +3113,17 @@ nsRange::GetUsedFontFaces(nsIDOMFontFace
NS_ENSURE_TRUE(mStartParent, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsINode> startContainer = do_QueryInterface(mStartParent);
nsCOMPtr<nsINode> endContainer = do_QueryInterface(mEndParent);
// Flush out layout so our frames are up to date.
nsIDocument* doc = mStartParent->OwnerDoc();
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
- doc->FlushPendingNotifications(Flush_Frames);
+ doc->FlushPendingNotifications(FlushType::Frames);
// Recheck whether we're still in the document
NS_ENSURE_TRUE(mStartParent->IsInUncomposedDoc(), NS_ERROR_UNEXPECTED);
RefPtr<nsFontFaceList> fontFaceList = new nsFontFaceList();
RangeSubtreeIterator iter;
nsresult rv = iter.Init(this);
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -2906,17 +2906,17 @@ CanvasRenderingContext2D::UpdateFilter()
CurrentState().filterSourceGraphicTainted =
(mCanvasElement && mCanvasElement->IsWriteOnly());
return;
}
// The filter might reference an SVG filter that is declared inside this
// document. Flush frames so that we'll have an nsSVGFilterFrame to work
// with.
- presShell->FlushPendingNotifications(Flush_Frames);
+ presShell->FlushPendingNotifications(FlushType::Frames);
bool sourceGraphicIsTainted =
(mCanvasElement && mCanvasElement->IsWriteOnly());
CurrentState().filter =
nsFilterInstance::GetFilterDescription(mCanvasElement,
CurrentState().filterChain,
sourceGraphicIsTainted,
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -112,17 +112,17 @@ ContentEventHandler::ContentEventHandler
nsresult
ContentEventHandler::InitBasic()
{
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
// If text frame which has overflowing selection underline is dirty,
// we need to flush the pending reflow here.
- mPresShell->FlushPendingNotifications(Flush_Layout);
+ mPresShell->FlushPendingNotifications(FlushType::Layout);
// Flushing notifications can cause mPresShell to be destroyed (bug 577963).
NS_ENSURE_TRUE(!mPresShell->IsDestroying(), NS_ERROR_FAILURE);
return NS_OK;
}
nsresult
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -1028,17 +1028,17 @@ Event::GetOffsetCoords(nsPresContext* aP
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->mTarget);
if (!content || !aPresContext) {
return CSSIntPoint(0, 0);
}
nsCOMPtr<nsIPresShell> shell = aPresContext->GetPresShell();
if (!shell) {
return CSSIntPoint(0, 0);
}
- shell->FlushPendingNotifications(Flush_Layout);
+ shell->FlushPendingNotifications(FlushType::Layout);
nsIFrame* frame = content->GetPrimaryFrame();
if (!frame) {
return CSSIntPoint(0, 0);
}
nsIFrame* rootFrame = shell->GetRootFrame();
if (!rootFrame) {
return CSSIntPoint(0, 0);
}
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -5165,17 +5165,17 @@ EventStateManager::EnsureDocument(nsPres
}
void
EventStateManager::FlushPendingEvents(nsPresContext* aPresContext)
{
NS_PRECONDITION(nullptr != aPresContext, "nullptr ptr");
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
- shell->FlushPendingNotifications(Flush_InterruptibleLayout);
+ shell->FlushPendingNotifications(FlushType::InterruptibleLayout);
}
}
nsIContent*
EventStateManager::GetFocusedContent()
{
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
EnsureDocument(mPresContext);
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -152,30 +152,30 @@ public:
void Register()
{
if (mRegistered) {
return;
}
MOZ_ASSERT(mRefreshDriver);
if (mRefreshDriver) {
- mRefreshDriver->AddRefreshObserver(this, Flush_Display);
+ mRefreshDriver->AddRefreshObserver(this, FlushType::Display);
mRegistered = true;
}
}
void Unregister()
{
if (!mRegistered) {
return;
}
MOZ_ASSERT(mRefreshDriver);
if (mRefreshDriver) {
- mRefreshDriver->RemoveRefreshObserver(this, Flush_Display);
+ mRefreshDriver->RemoveRefreshObserver(this, FlushType::Display);
mRegistered = false;
}
}
private:
virtual ~RequestedFrameRefreshObserver()
{
MOZ_ASSERT(!mRefreshDriver);
--- a/dom/html/HTMLFormControlsCollection.cpp
+++ b/dom/html/HTMLFormControlsCollection.cpp
@@ -113,17 +113,17 @@ HTMLFormControlsCollection::Clear()
}
void
HTMLFormControlsCollection::FlushPendingNotifications()
{
if (mForm) {
nsIDocument* doc = mForm->GetUncomposedDoc();
if (doc) {
- doc->FlushPendingNotifications(Flush_Content);
+ doc->FlushPendingNotifications(FlushType::Content);
}
}
}
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLFormControlsCollection)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(HTMLFormControlsCollection)
// Note: We intentionally don't set tmp->mForm to nullptr here, since doing
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -582,17 +582,17 @@ HTMLFormElement::PostHandleEvent(EventCh
nsresult
HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
EventMessage aMessage)
{
// Make sure the presentation is up-to-date
nsIDocument* doc = GetComposedDoc();
if (doc) {
- doc->FlushPendingNotifications(Flush_ContentAndNotify);
+ doc->FlushPendingNotifications(FlushType::ContentAndNotify);
}
// JBK Don't get form frames anymore - bug 34297
// Submit or Reset the form
if (eFormReset == aMessage) {
return DoReset();
}
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -222,17 +222,17 @@ HTMLImageElement::GetComplete(bool* aCom
*aComplete = Complete();
return NS_OK;
}
CSSIntPoint
HTMLImageElement::GetXY()
{
- nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
if (!frame) {
return CSSIntPoint(0, 0);
}
nsIFrame* layer = nsLayoutUtils::GetClosestLayer(frame->GetParent());
return CSSIntPoint::FromAppUnitsRounded(frame->GetOffsetTo(layer));
}
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -2589,17 +2589,17 @@ HTMLInputElement::StepUp(int32_t n, uint
{
return ApplyStep(optional_argc ? n : 1);
}
void
HTMLInputElement::FlushFrames()
{
if (GetComposedDoc()) {
- GetComposedDoc()->FlushPendingNotifications(Flush_Frames);
+ GetComposedDoc()->FlushPendingNotifications(FlushType::Frames);
}
}
void
HTMLInputElement::MozGetFileNameArray(nsTArray<nsString>& aArray,
ErrorResult& aRv)
{
for (uint32_t i = 0; i < mFilesOrDirectories.Length(); i++) {
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2121,17 +2121,17 @@ void HTMLMediaElement::LoadFromSourceChi
{
NS_ASSERTION(mDelayingLoadEvent,
"Should delay load event (if in document) during load");
NS_ASSERTION(mIsLoadingFromSourceChildren,
"Must remember we're loading from source children");
nsIDocument* parentDoc = OwnerDoc()->GetParentDocument();
if (parentDoc) {
- parentDoc->FlushPendingNotifications(Flush_Layout);
+ parentDoc->FlushPendingNotifications(FlushType::Layout);
}
while (true) {
nsIContent* child = GetNextSource();
if (!child) {
// Exhausted candidates, wait for more candidates to be appended to
// the media element.
mLoadWaitStatus = WAITING_FOR_SOURCE;
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -390,17 +390,17 @@ ImageDocument::DOMRestoreImageTo(int32_t
void
ImageDocument::ScrollImageTo(int32_t aX, int32_t aY, bool restoreImage)
{
float ratio = GetRatio();
if (restoreImage) {
RestoreImage();
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
}
nsCOMPtr<nsIPresShell> shell = GetShell();
if (!shell) {
return;
}
nsIScrollableFrame* sf = shell->GetRootScrollFrameAsScrollable();
@@ -617,17 +617,17 @@ void
ImageDocument::UpdateSizeFromLayout()
{
// Pull an updated size from the content frame to account for any size
// change due to CSS properties like |image-orientation|.
if (!mImageContent) {
return;
}
- nsIFrame* contentFrame = mImageContent->GetPrimaryFrame(Flush_Frames);
+ nsIFrame* contentFrame = mImageContent->GetPrimaryFrame(FlushType::Frames);
if (!contentFrame) {
return;
}
nsIntSize oldSize(mImageWidth, mImageHeight);
IntrinsicSize newSize = contentFrame->GetIntrinsicSize();
if (newSize.width.GetUnit() == eStyleUnit_Coord) {
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -994,17 +994,17 @@ nsGenericHTMLElement::GetAttributeMappin
return &MapCommonAttributesInto;
}
nsIFormControlFrame*
nsGenericHTMLElement::GetFormControlFrame(bool aFlushFrames)
{
if (aFlushFrames && IsInComposedDoc()) {
// Cause a flush of the frames, so we get up-to-date frame information
- GetComposedDoc()->FlushPendingNotifications(Flush_Frames);
+ GetComposedDoc()->FlushPendingNotifications(FlushType::Frames);
}
nsIFrame* frame = GetPrimaryFrame();
if (frame) {
nsIFormControlFrame* form_frame = do_QueryFrame(frame);
if (form_frame) {
return form_frame;
}
@@ -2840,17 +2840,17 @@ nsGenericHTMLFormElementWithState::NodeI
mStateKey.SetIsVoid(true);
}
nsSize
nsGenericHTMLElement::GetWidthHeightForImage(RefPtr<imgRequestProxy>& aImageRequest)
{
nsSize size(0,0);
- nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
if (frame) {
size = frame->GetContentRect().Size();
size.width = nsPresContext::AppUnitsToIntCSSPixels(size.width);
size.height = nsPresContext::AppUnitsToIntCSSPixels(size.height);
} else {
const nsAttrValue* value;
@@ -2955,17 +2955,17 @@ IsOrHasAncestorWithDisplayNone(Element*
return false;
}
void
nsGenericHTMLElement::GetInnerText(mozilla::dom::DOMString& aValue,
mozilla::ErrorResult& aError)
{
- if (!GetPrimaryFrame(Flush_Layout)) {
+ if (!GetPrimaryFrame(FlushType::Layout)) {
nsIPresShell* presShell = nsComputedDOMStyle::GetPresShellForContent(this);
if (!presShell || IsOrHasAncestorWithDisplayNone(this, presShell)) {
GetTextContentInternal(aValue, aError);
return;
}
}
nsRange::GetInnerTextNoFlush(aValue, aError, this, 0, this, GetChildCount());
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1069,17 +1069,17 @@ protected:
* to get the editor affected by changing the spellcheck attribute on this
* node.
*/
virtual already_AddRefed<nsIEditor> GetAssociatedEditor();
/**
* Get the frame's offset information for offsetTop/Left/Width/Height.
* Returns the parent the offset is relative to.
- * @note This method flushes pending notifications (Flush_Layout).
+ * @note This method flushes pending notifications (FlushType::Layout).
* @param aRect the offset information [OUT]
*/
mozilla::dom::Element* GetOffsetRect(mozilla::CSSIntRect& aRect);
/**
* Returns true if this is the current document's body element
*/
bool IsCurrentBodyElement();
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -132,17 +132,17 @@ public:
// nsIContentSink
NS_IMETHOD WillParse(void) override;
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
NS_IMETHOD DidBuildModel(bool aTerminated) override;
NS_IMETHOD WillInterrupt(void) override;
NS_IMETHOD WillResume(void) override;
NS_IMETHOD SetParser(nsParserBase* aParser) override;
- virtual void FlushPendingNotifications(mozFlushType aType) override;
+ virtual void FlushPendingNotifications(FlushType aType) override;
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override;
virtual nsISupports *GetTarget() override;
virtual bool IsScriptExecuting() override;
// nsIHTMLContentSink
NS_IMETHOD OpenContainer(ElementType aNodeType) override;
NS_IMETHOD CloseContainer(ElementType aTag) override;
@@ -1048,29 +1048,29 @@ HTMLContentSink::UpdateChildCounts()
sc->UpdateChildCounts();
}
mCurrentContext->UpdateChildCounts();
}
void
-HTMLContentSink::FlushPendingNotifications(mozFlushType aType)
+HTMLContentSink::FlushPendingNotifications(FlushType aType)
{
// Only flush tags if we're not doing the notification ourselves
// (since we aren't reentrant)
if (!mInNotification) {
// Only flush if we're still a document observer (so that our child counts
// should be correct).
if (mIsDocumentObserver) {
- if (aType >= Flush_ContentAndNotify) {
+ if (aType >= FlushType::ContentAndNotify) {
FlushTags();
}
}
- if (aType >= Flush_InterruptibleLayout) {
+ if (aType >= FlushType::InterruptibleLayout) {
// Make sure that layout has started so that the reflow flush
// will actually happen.
StartLayout(true);
}
}
}
nsresult
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1778,17 +1778,17 @@ nsHTMLDocument::Close(ErrorResult& rv)
// XXXbz as far as I can tell this may not be needed anymore; all
// the testcases in bug 57636 pass without this line... Leaving
// it be for now, though. In any case, there's no reason to do
// this if we have no presshell, since in that case none of the
// above about reusing frames applies.
//
// XXXhsivonen keeping this around for bug 577508 / 253951 still :-(
if (GetShell()) {
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
}
// Removing the wyciwygChannel here is wrong when document.close() is
// called from within the document itself. However, legacy requires the
// channel to be removed here. Otherwise, the load event never fires.
NS_ASSERTION(mWyciwygChannel, "nsHTMLDocument::Close(): Trying to remove "
"nonexistent wyciwyg channel!");
RemoveWyciwygChannel();
@@ -2633,17 +2633,17 @@ nsHTMLDocument::EditingStateChanged()
nsAutoScriptBlocker scriptBlocker;
NotifyEditableStateChange(this, this);
return TurnEditingOff();
}
// Flush out style changes on our _parent_ document, if any, so that
// our check for a presshell won't get stale information.
if (mParentDocument) {
- mParentDocument->FlushPendingNotifications(Flush_Style);
+ mParentDocument->FlushPendingNotifications(FlushType::Style);
}
// get editing session, make sure this is a strong reference so the
// window can't get deleted during the rest of this call.
nsCOMPtr<nsPIDOMWindowOuter> window = GetWindow();
if (!window)
return NS_ERROR_FAILURE;
@@ -3574,17 +3574,17 @@ nsHTMLDocument::Clone(mozilla::dom::Node
bool
nsHTMLDocument::IsEditingOnAfterFlush()
{
nsIDocument* doc = GetParentDocument();
if (doc) {
// Make sure frames are up to date, since that can affect whether
// we're editable.
- doc->FlushPendingNotifications(Flush_Frames);
+ doc->FlushPendingNotifications(FlushType::Frames);
}
return IsEditingOn();
}
void
nsHTMLDocument::RemovedFromDocShell()
{
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/nsSMILAnimationController.cpp
@@ -259,30 +259,30 @@ nsSMILAnimationController::StartSampling
if (aRefreshDriver) {
MOZ_ASSERT(!mRegisteredWithRefreshDriver,
"Redundantly registering with refresh driver");
MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
"Starting sampling with wrong refresh driver");
// We're effectively resuming from a pause so update our current sample time
// or else it will confuse our "average time between samples" calculations.
mCurrentSampleTime = mozilla::TimeStamp::Now();
- aRefreshDriver->AddRefreshObserver(this, Flush_Style);
+ aRefreshDriver->AddRefreshObserver(this, FlushType::Style);
mRegisteredWithRefreshDriver = true;
}
}
void
nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver)
{
if (aRefreshDriver && mRegisteredWithRefreshDriver) {
// NOTE: The document might already have been detached from its PresContext
// (and RefreshDriver), which would make GetRefreshDriver() return null.
MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
"Stopping sampling with wrong refresh driver");
- aRefreshDriver->RemoveRefreshObserver(this, Flush_Style);
+ aRefreshDriver->RemoveRefreshObserver(this, FlushType::Style);
mRegisteredWithRefreshDriver = false;
}
}
void
nsSMILAnimationController::MaybeStartSampling(nsRefreshDriver* aRefreshDriver)
{
if (mDeferredStartSampling) {
@@ -427,17 +427,17 @@ nsSMILAnimationController::DoSample(bool
// return early if there are no active animations to avoid a style flush
if (currentCompositorTable->Count() == 0) {
mLastCompositorTable = nullptr;
return;
}
nsCOMPtr<nsIDocument> document(mDocument); // keeps 'this' alive too
if (isStyleFlushNeeded) {
- document->FlushPendingNotifications(Flush_Style);
+ document->FlushPendingNotifications(FlushType::Style);
}
// WARNING:
// WARNING: the above flush may have destroyed the pres shell and/or
// WARNING: frames and other layout related objects.
// WARNING:
// STEP 5: Compose currently-animated attributes.
--- a/dom/svg/SVGTextContentElement.cpp
+++ b/dom/svg/SVGTextContentElement.cpp
@@ -26,17 +26,17 @@ nsSVGElement::EnumInfo SVGTextContentEle
nsSVGElement::LengthInfo SVGTextContentElement::sLengthInfo[1] =
{
{ &nsGkAtoms::textLength, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::XY }
};
SVGTextFrame*
SVGTextContentElement::GetSVGTextFrame()
{
- nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
while (frame) {
SVGTextFrame* textFrame = do_QueryFrame(frame);
if (textFrame) {
return textFrame;
}
frame = frame->GetParent();
}
return nullptr;
--- a/dom/svg/SVGTransformableElement.cpp
+++ b/dom/svg/SVGTransformableElement.cpp
@@ -167,17 +167,17 @@ SVGTransformableElement::GetFarthestView
{
return SVGContentUtils::GetOuterSVGElement(this);
}
already_AddRefed<SVGIRect>
SVGTransformableElement::GetBBox(const SVGBoundingBoxOptions& aOptions,
ErrorResult& rv)
{
- nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
+ nsIFrame* frame = GetPrimaryFrame(FlushType::Layout);
if (!frame || (frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
rv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
nsISVGChildFrame* svgframe = do_QueryFrame(frame);
if (!svgframe) {
rv.Throw(NS_ERROR_NOT_IMPLEMENTED); // XXX: outer svg
@@ -212,30 +212,30 @@ SVGTransformableElement::GetBBox(const S
}
already_AddRefed<SVGMatrix>
SVGTransformableElement::GetCTM()
{
nsIDocument* currentDoc = GetComposedDoc();
if (currentDoc) {
// Flush all pending notifications so that our frames are up to date
- currentDoc->FlushPendingNotifications(Flush_Layout);
+ currentDoc->FlushPendingNotifications(FlushType::Layout);
}
gfx::Matrix m = SVGContentUtils::GetCTM(this, false);
RefPtr<SVGMatrix> mat = m.IsSingular() ? nullptr : new SVGMatrix(ThebesMatrix(m));
return mat.forget();
}
already_AddRefed<SVGMatrix>
SVGTransformableElement::GetScreenCTM()
{
nsIDocument* currentDoc = GetComposedDoc();
if (currentDoc) {
// Flush all pending notifications so that our frames are up to date
- currentDoc->FlushPendingNotifications(Flush_Layout);
+ currentDoc->FlushPendingNotifications(FlushType::Layout);
}
gfx::Matrix m = SVGContentUtils::GetCTM(this, true);
RefPtr<SVGMatrix> mat = m.IsSingular() ? nullptr : new SVGMatrix(ThebesMatrix(m));
return mat.forget();
}
already_AddRefed<SVGMatrix>
SVGTransformableElement::GetTransformToElement(SVGGraphicsElement& aElement,
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ b/dom/xbl/nsXBLResourceLoader.cpp
@@ -227,17 +227,17 @@ nsXBLResourceLoader::NotifyBoundElements
if (ready) {
// We need the document to flush out frame construction and
// such, so we want to use the current document.
nsIDocument* doc = content->GetUncomposedDoc();
if (doc) {
// Flush first to make sure we can get the frame for content
- doc->FlushPendingNotifications(Flush_Frames);
+ doc->FlushPendingNotifications(FlushType::Frames);
// If |content| is (in addition to having binding |mBinding|)
// also a descendant of another element with binding |mBinding|,
// then we might have just constructed it due to the
// notification of its parent. (We can know about both if the
// binding loads were triggered from the DOM rather than frame
// construction.) So we have to check both whether the element
// has a primary frame and whether it's in the undisplayed map
@@ -254,17 +254,17 @@ nsXBLResourceLoader::NotifyBoundElements
if (!sc) {
shell->RecreateFramesFor(content);
}
}
}
// Flush again
// XXXbz why is this needed?
- doc->FlushPendingNotifications(Flush_ContentAndNotify);
+ doc->FlushPendingNotifications(FlushType::ContentAndNotify);
}
}
}
// Clear out the whole array.
mBoundElements.Clear();
// Delete ourselves.
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -314,17 +314,17 @@ nsXBLStreamListener::HandleEvent(nsIDOME
// to notifications related to our children (e.g., if you bind to the
// <body> tag) that result in duplication of content.
// We need to get the sink's notifications flushed and then make the binding
// ready.
if (count > 0) {
nsXBLBindingRequest* req = mBindingRequests.ElementAt(0);
nsIDocument* document = req->mBoundElement->GetUncomposedDoc();
if (document)
- document->FlushPendingNotifications(Flush_ContentAndNotify);
+ document->FlushPendingNotifications(FlushType::ContentAndNotify);
}
// Remove ourselves from the set of pending docs.
nsBindingManager *bindingManager = doc->BindingManager();
nsIURI* documentURI = bindingDocument->GetDocumentURI();
bindingManager->RemoveLoadingDocListener(documentURI);
if (!bindingDocument->GetRootElement()) {
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -1433,32 +1433,32 @@ nsXMLContentSink::AddText(const char16_t
offset += amount;
aLength -= amount;
}
return NS_OK;
}
void
-nsXMLContentSink::FlushPendingNotifications(mozFlushType aType)
+nsXMLContentSink::FlushPendingNotifications(FlushType aType)
{
// Only flush tags if we're not doing the notification ourselves
// (since we aren't reentrant)
if (!mInNotification) {
if (mIsDocumentObserver) {
// Only flush if we're still a document observer (so that our child
// counts should be correct).
- if (aType >= Flush_ContentAndNotify) {
+ if (aType >= FlushType::ContentAndNotify) {
FlushTags();
}
else {
FlushText(false);
}
}
- if (aType >= Flush_InterruptibleLayout) {
+ if (aType >= FlushType::InterruptibleLayout) {
// Make sure that layout has started so that the reflow flush
// will actually happen.
MaybeStartLayout(true);
}
}
}
/**
--- a/dom/xml/nsXMLContentSink.h
+++ b/dom/xml/nsXMLContentSink.h
@@ -64,17 +64,17 @@ public:
// nsIContentSink
NS_IMETHOD WillParse(void) override;
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
NS_IMETHOD DidBuildModel(bool aTerminated) override;
NS_IMETHOD WillInterrupt(void) override;
NS_IMETHOD WillResume(void) override;
NS_IMETHOD SetParser(nsParserBase* aParser) override;
- virtual void FlushPendingNotifications(mozFlushType aType) override;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override;
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override;
virtual nsISupports *GetTarget() override;
virtual bool IsScriptExecuting() override;
virtual void ContinueInterruptedParsingAsync() override;
// nsITransformObserver
NS_IMETHOD OnDocumentCreated(nsIDocument *aResultDocument) override;
NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument) override;
--- a/dom/xslt/xpath/XPathResult.cpp
+++ b/dom/xslt/xpath/XPathResult.cpp
@@ -96,17 +96,17 @@ nsINode*
XPathResult::IterateNext(ErrorResult& aRv)
{
if (!isIterator()) {
aRv.Throw(NS_ERROR_DOM_TYPE_ERR);
return nullptr;
}
if (mDocument) {
- mDocument->FlushPendingNotifications(Flush_Content);
+ mDocument->FlushPendingNotifications(FlushType::Content);
}
if (mInvalidIteratorState) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return nullptr;
}
return mResultNodes.SafeObjectAt(mCurrentPos++);
--- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
@@ -79,17 +79,17 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
// nsIContentSink
NS_IMETHOD WillParse(void) override { return NS_OK; }
NS_IMETHOD DidBuildModel(bool aTerminated) override;
NS_IMETHOD WillInterrupt(void) override { return NS_OK; }
NS_IMETHOD WillResume(void) override { return NS_OK; }
NS_IMETHOD SetParser(nsParserBase* aParser) override { return NS_OK; }
- virtual void FlushPendingNotifications(mozFlushType aType) override { }
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override { return NS_OK; }
virtual nsISupports *GetTarget() override { return nullptr; }
private:
RefPtr<txStylesheetCompiler> mCompiler;
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsIParser> mParser;
bool mCheckedForXML;
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -1332,17 +1332,17 @@ XULDocument::Persist(nsIContent* aElemen
nsresult
XULDocument::GetViewportSize(int32_t* aWidth,
int32_t* aHeight)
{
*aWidth = *aHeight = 0;
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
nsIPresShell *shell = GetShell();
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame* frame = shell->GetRootFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsSize size = frame->GetSize();
--- a/dom/xul/nsXULContentSink.h
+++ b/dom/xul/nsXULContentSink.h
@@ -35,17 +35,17 @@ public:
// nsIContentSink
NS_IMETHOD WillParse(void) override { return NS_OK; }
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
NS_IMETHOD DidBuildModel(bool aTerminated) override;
NS_IMETHOD WillInterrupt(void) override;
NS_IMETHOD WillResume(void) override;
NS_IMETHOD SetParser(nsParserBase* aParser) override;
- virtual void FlushPendingNotifications(mozFlushType aType) override { }
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override;
virtual nsISupports *GetTarget() override;
/**
* Initialize the content sink, giving it an nsIDocument object
* with which to communicate with the outside world, and an
* nsXULPrototypeDocument to build.
*/
--- a/editor/composer/nsEditingSession.cpp
+++ b/editor/composer/nsEditingSession.cpp
@@ -2,17 +2,17 @@
/* vim: set ts=2 sw=2 et tw=78: */
/* 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/. */
#include <string.h> // for nullptr, strcmp
#include "imgIContainer.h" // for imgIContainer, etc
-#include "mozilla/FlushType.h" // for mozFlushType::Flush_Frames
+#include "mozilla/FlushType.h" // for FlushType::FlushType::Frames
#include "mozilla/mozalloc.h" // for operator new
#include "nsAString.h"
#include "nsComponentManagerUtils.h" // for do_CreateInstance
#include "nsComposerCommandsUpdater.h" // for nsComposerCommandsUpdater
#include "nsDebug.h" // for NS_ENSURE_SUCCESS, etc
#include "nsEditingSession.h"
#include "nsError.h" // for NS_ERROR_FAILURE, NS_OK, etc
#include "nsIChannel.h" // for nsIChannel
@@ -329,17 +329,17 @@ nsEditingSession::SetupEditorOnWindow(mo
mEditorType.AssignLiteral("html");
mimeCType.AssignLiteral("text/html");
}
// Flush out frame construction to make sure that the subframe's
// presshell is set up if it needs to be.
nsCOMPtr<nsIDocument> document = do_QueryInterface(doc);
if (document) {
- document->FlushPendingNotifications(Flush_Frames);
+ document->FlushPendingNotifications(mozilla::FlushType::Frames);
if (mMakeWholeDocumentEditable) {
document->SetEditableFlag(true);
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(document);
if (htmlDocument) {
// Enable usage of the execCommand API
htmlDocument->SetEditingState(nsIHTMLDocument::eDesignMode);
}
}
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -24,17 +24,17 @@
#include "PlaceholderTransaction.h" // for PlaceholderTransaction
#include "SplitNodeTransaction.h" // for SplitNodeTransaction
#include "StyleSheetTransactions.h" // for AddStyleSheetTransaction, etc.
#include "TextEditUtils.h" // for TextEditUtils
#include "mozInlineSpellChecker.h" // for mozInlineSpellChecker
#include "mozilla/CheckedInt.h" // for CheckedInt
#include "mozilla/EditorUtils.h" // for AutoRules, etc.
#include "mozilla/EditTransactionBase.h" // for EditTransactionBase
-#include "mozilla/FlushType.h" // for mozFlushType::Flush_Frames
+#include "mozilla/FlushType.h" // for FlushType::FlushType::Frames
#include "mozilla/IMEStateManager.h" // for IMEStateManager
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/dom/Selection.h" // for Selection, etc.
#include "mozilla/Services.h" // for GetObserverService
#include "mozilla/TextComposition.h" // for TextComposition
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Element.h" // for Element, nsINode::AsElement
#include "mozilla/dom/Text.h"
@@ -2783,17 +2783,17 @@ EditorBase::SplitNodeImpl(nsIContent& aE
break;
}
}
}
// Handle selection
nsCOMPtr<nsIPresShell> ps = GetPresShell();
if (ps) {
- ps->FlushPendingNotifications(Flush_Frames);
+ ps->FlushPendingNotifications(FlushType::Frames);
}
bool shouldSetSelection = GetShouldTxnSetSelection();
RefPtr<Selection> previousSelection;
for (size_t i = 0; i < savedRanges.Length(); ++i) {
// Adjust the selection if needed.
SavedRange& range = savedRanges[i];
--- a/editor/libeditor/EditorCommands.cpp
+++ b/editor/libeditor/EditorCommands.cpp
@@ -862,17 +862,17 @@ SelectionMoveCommands::DoCommand(const c
NS_ENSURE_TRUE(editor, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocument> domDoc;
editor->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
// Most of the commands below (possibly all of them) need layout to
// be up to date.
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
}
nsCOMPtr<nsISelectionController> selCont;
nsresult rv = editor->GetSelectionController(getter_AddRefs(selCont));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(selCont, NS_ERROR_FAILURE);
// scroll commands
--- a/embedding/components/find/nsWebBrowserFind.cpp
+++ b/embedding/components/find/nsWebBrowserFind.cpp
@@ -718,17 +718,17 @@ nsWebBrowserFind::SearchInFrame(nsPIDOMW
(void)find->SetCaseSensitive(mMatchCase);
(void)find->SetFindBackwards(mFindBackwards);
(void)find->SetEntireWord(mEntireWord);
// Now make sure the content (for actual finding) and frame (for
// selection) models are up to date.
- theDoc->FlushPendingNotifications(Flush_Frames);
+ theDoc->FlushPendingNotifications(FlushType::Frames);
nsCOMPtr<nsISelection> sel = GetFrameSelection(aWindow);
NS_ENSURE_ARG_POINTER(sel);
nsCOMPtr<nsIDOMRange> searchRange = nsFind::CreateRange(theDoc);
NS_ENSURE_ARG_POINTER(searchRange);
nsCOMPtr<nsIDOMRange> startPt = nsFind::CreateRange(theDoc);
NS_ENSURE_ARG_POINTER(startPt);
--- a/gfx/layers/apz/util/DoubleTapToZoom.cpp
+++ b/gfx/layers/apz/util/DoubleTapToZoom.cpp
@@ -87,17 +87,17 @@ IsRectZoomedIn(const CSSRect& aRect, con
return showing > 0.9 && (ratioW > 0.9 || ratioH > 0.9);
}
CSSRect
CalculateRectToZoomTo(const nsCOMPtr<nsIDocument>& aRootContentDocument,
const CSSPoint& aPoint)
{
// Ensure the layout information we get is up-to-date.
- aRootContentDocument->FlushPendingNotifications(Flush_Layout);
+ aRootContentDocument->FlushPendingNotifications(FlushType::Layout);
// An empty rect as return value is interpreted as "zoom out".
const CSSRect zoomOut;
nsCOMPtr<nsIPresShell> shell = aRootContentDocument->GetShell();
if (!shell) {
return zoomOut;
}
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -160,17 +160,17 @@ gfxSVGGlyphsDocument::SetupPresentation(
presContext->SetIsGlyph(true);
if (!presShell->DidInitialize()) {
nsRect rect = presContext->GetVisibleArea();
rv = presShell->Initialize(rect.width, rect.height);
NS_ENSURE_SUCCESS(rv, rv);
}
- mDocument->FlushPendingNotifications(Flush_Layout);
+ mDocument->FlushPendingNotifications(FlushType::Layout);
nsSMILAnimationController* controller = mDocument->GetAnimationController();
if (controller) {
controller->Resume(nsSMILTimeContainer::PAUSE_IMAGE);
}
mDocument->ImageTracker()->SetAnimatingState(true);
mViewer = viewer;
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -417,17 +417,17 @@ SVGDocumentWrapper::UnregisterForXPCOMSh
}
void
SVGDocumentWrapper::FlushLayout()
{
nsCOMPtr<nsIPresShell> presShell;
mViewer->GetPresShell(getter_AddRefs(presShell));
if (presShell) {
- presShell->FlushPendingNotifications(Flush_Layout);
+ presShell->FlushPendingNotifications(FlushType::Layout);
}
}
nsIDocument*
SVGDocumentWrapper::GetDocument()
{
if (!mViewer) {
return nullptr;
--- a/image/SVGDocumentWrapper.h
+++ b/image/SVGDocumentWrapper.h
@@ -77,17 +77,17 @@ public:
*
* @return NS_OK on success, or an error code on failure.
*/
inline nsresult GetPresShell(nsIPresShell** aPresShell)
{ return mViewer->GetPresShell(aPresShell); }
/**
* Modifier to update the viewport dimensions of the wrapped document. This
- * method performs a synchronous "Flush_Layout" on the wrapped document,
+ * method performs a synchronous "FlushType::Layout" on the wrapped document,
* since a viewport-change affects layout.
*
* @param aViewportSize The new viewport dimensions.
*/
void UpdateViewportBounds(const nsIntSize& aViewportSize);
/**
* If an SVG image's helper document has a pending notification for an
--- a/layout/base/AccessibleCaretManager.cpp
+++ b/layout/base/AccessibleCaretManager.cpp
@@ -989,17 +989,17 @@ AccessibleCaretManager::ClearMaintainedS
fs->MaintainSelection(eSelectNoAmount);
}
}
void
AccessibleCaretManager::FlushLayout() const
{
if (mPresShell) {
- mPresShell->FlushPendingNotifications(Flush_Layout);
+ mPresShell->FlushPendingNotifications(FlushType::Layout);
}
}
nsIFrame*
AccessibleCaretManager::GetFrameForFirstRangeStartOrLastRangeEnd(
nsDirection aDirection, int32_t* aOutOffset, nsINode** aOutNode,
int32_t* aOutNodeOffset) const
{
--- a/layout/base/GeometryUtils.cpp
+++ b/layout/base/GeometryUtils.cpp
@@ -29,17 +29,17 @@ enum GeometryNodeType {
GEOMETRY_NODE_TEXT,
GEOMETRY_NODE_DOCUMENT
};
static nsIFrame*
GetFrameForNode(nsINode* aNode, GeometryNodeType aType)
{
nsIDocument* doc = aNode->OwnerDoc();
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
switch (aType) {
case GEOMETRY_NODE_ELEMENT:
return aNode->AsContent()->GetPrimaryFrame();
case GEOMETRY_NODE_TEXT: {
nsIPresShell* presShell = doc->GetShell();
if (presShell) {
return presShell->FrameConstructor()->EnsureFrameForTextNode(
static_cast<nsGenericDOMDataNode*>(aNode));
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -503,17 +503,17 @@ public:
if (aVisitor.mPresContext && aVisitor.mEvent->mClass != eBasicEventClass) {
if (aVisitor.mEvent->mMessage == eMouseDown ||
aVisitor.mEvent->mMessage == eMouseUp) {
// Mouse-up and mouse-down events call nsFrame::HandlePress/Release
// which call GetContentOffsetsFromPoint which requires up-to-date layout.
// Bring layout up-to-date now so that GetCurrentEventFrame() below
// will return a real frame and we don't have to worry about
// destroying it by flushing later.
- mPresShell->FlushPendingNotifications(Flush_Layout);
+ mPresShell->FlushPendingNotifications(FlushType::Layout);
} else if (aVisitor.mEvent->mMessage == eWheel &&
aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault) {
nsIFrame* frame = mPresShell->GetCurrentEventFrame();
if (frame) {
// chrome (including addons) should be able to know if content
// handles both D3E "wheel" event and legacy mouse scroll events.
// We should dispatch legacy mouse events before dispatching the
// "wheel" event into system group.
@@ -1877,17 +1877,17 @@ PresShell::ResizeReflowIgnoreOverride(ns
RefPtr<nsViewManager> viewManager = mViewManager;
// Take this ref after viewManager so it'll make sure to go away first.
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
if (!GetPresContext()->SuppressingResizeReflow()) {
// Have to make sure that the content notifications are flushed before we
// start messing with the frame model; otherwise we can get content doubling.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
// Make sure style is up to date
{
nsAutoScriptBlocker scriptBlocker;
mPresContext->RestyleManager()->ProcessPendingRestyles();
}
rootFrame = mFrameConstructor->GetRootFrame();
@@ -2838,17 +2838,17 @@ PresShell::CreateFramesFor(nsIContent* a
// Don't call RecreateFramesForContent since that is not exported and we want
// to keep the number of entrypoints down.
NS_ASSERTION(mViewManager, "Should have view manager");
MOZ_ASSERT(aContent);
// Have to make sure that the content notifications are flushed before we
// start messing with the frame model; otherwise we can get content doubling.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
nsAutoScriptBlocker scriptBlocker;
// Mark ourselves as not safe to flush while we're doing frame construction.
++mChangeNestCount;
nsCSSFrameConstructor* fc = FrameConstructor();
nsILayoutHistoryState* layoutState = fc->GetLastCapturedLayoutHistoryState();
@@ -2871,17 +2871,17 @@ PresShell::RecreateFramesFor(nsIContent*
// Don't call RecreateFramesForContent since that is not exported and we want
// to keep the number of entrypoints down.
NS_ASSERTION(mViewManager, "Should have view manager");
// Have to make sure that the content notifications are flushed before we
// start messing with the frame model; otherwise we can get content doubling.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
nsAutoScriptBlocker scriptBlocker;
nsStyleChangeList changeList;
changeList.AppendChange(nullptr, aContent, nsChangeHint_ReconstructFrame);
// Mark ourselves as not safe to flush while we're doing frame construction.
++mChangeNestCount;
@@ -3421,17 +3421,17 @@ PresShell::ScrollContentIntoView(nsICont
data->mContentToScrollToFlags = aFlags;
if (NS_FAILED(mContentToScrollTo->SetProperty(nsGkAtoms::scrolling, data,
nsINode::DeleteProperty<PresShell::ScrollIntoViewData>))) {
mContentToScrollTo = nullptr;
}
// Flush layout and attempt to scroll in the process.
composedDoc->SetNeedLayoutFlush();
- composedDoc->FlushPendingNotifications(Flush_InterruptibleLayout);
+ composedDoc->FlushPendingNotifications(FlushType::InterruptibleLayout);
// If mContentToScrollTo is non-null, that means we interrupted the reflow
// (or suppressed it altogether because we're suppressing interruptible
// flushes right now) and won't necessarily get the position correct, but do
// a best-effort scroll here. The other option would be to do this inside
// FlushPendingNotifications, but I'm not sure the repeated scrolling that
// could trigger if reflows keep getting interrupted would be more desirable
// than a single best-effort scroll followed by one final scroll on the first
@@ -3659,17 +3659,17 @@ PresShell::ScheduleViewManagerFlush(Pain
bool
FlushLayoutRecursive(nsIDocument* aDocument,
void* aData = nullptr)
{
MOZ_ASSERT(!aData);
nsCOMPtr<nsIDocument> kungFuDeathGrip(aDocument);
aDocument->EnumerateSubDocuments(FlushLayoutRecursive, nullptr);
- aDocument->FlushPendingNotifications(Flush_Layout);
+ aDocument->FlushPendingNotifications(FlushType::Layout);
return true;
}
void
PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent,
bool aFlushOnHoverChange)
{
RestyleManagerHandle restyleManager = mPresContext->RestyleManager();
@@ -3943,18 +3943,18 @@ PresShell::HandlePostedReflowCallbacks(b
FreeMisc(sizeof(nsCallbackEventRequest), node);
if (callback) {
if (callback->ReflowFinished()) {
shouldFlush = true;
}
}
}
- mozFlushType flushType =
- aInterruptible ? Flush_InterruptibleLayout : Flush_Layout;
+ FlushType flushType =
+ aInterruptible ? FlushType::InterruptibleLayout : FlushType::Layout;
if (shouldFlush && !mIsDestroying) {
FlushPendingNotifications(flushType);
}
}
bool
PresShell::IsSafeToFlush() const
{
@@ -3974,61 +3974,62 @@ PresShell::IsSafeToFlush() const
}
}
return isSafeToFlush;
}
void
-PresShell::FlushPendingNotifications(mozFlushType aType)
-{
- // by default, flush animations if aType >= Flush_Style
- mozilla::ChangesToFlush flush(aType, aType >= Flush_Style);
+PresShell::FlushPendingNotifications(FlushType aType)
+{
+ // by default, flush animations if aType >= FlushType::Style
+ mozilla::ChangesToFlush flush(aType, aType >= FlushType::Style);
FlushPendingNotifications(flush);
}
void
PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
{
/**
* VERY IMPORTANT: If you add some sort of new flushing to this
* method, make sure to add the relevant SetNeedLayoutFlush or
* SetNeedStyleFlush calls on the document.
*/
- mozFlushType flushType = aFlush.mFlushType;
+ FlushType flushType = aFlush.mFlushType;
#ifdef MOZ_ENABLE_PROFILER_SPS
- static const char flushTypeNames[][20] = {
+ static const EnumeratedArray<FlushType,
+ FlushType::Count,
+ const char*> flushTypeNames = {
+ "",
"Content",
"ContentAndNotify",
"Style",
"InterruptibleLayout",
"Layout",
"Display"
};
- // Make sure that we don't miss things added to mozFlushType!
- MOZ_ASSERT(static_cast<uint32_t>(flushType) <= ArrayLength(flushTypeNames));
-
PROFILER_LABEL_PRINTF("PresShell", "Flush",
- js::ProfileEntry::Category::GRAPHICS, "(Flush_%s)", flushTypeNames[flushType - 1]);
+ js::ProfileEntry::Category::GRAPHICS, "(FlushType::%s)",
+ flushTypeNames[flushType]);
#endif
#ifdef ACCESSIBILITY
#ifdef DEBUG
nsAccessibilityService* accService = GetAccService();
if (accService) {
NS_ASSERTION(!accService->IsProcessingRefreshDriverNotification(),
"Flush during accessible tree update!");
}
#endif
#endif
- NS_ASSERTION(flushType >= Flush_Frames, "Why did we get called?");
+ NS_ASSERTION(flushType >= FlushType::Frames, "Why did we get called?");
bool isSafeToFlush = IsSafeToFlush();
// If layout could possibly trigger scripts, then it's only safe to flush if
// it's safe to run script.
bool hasHadScriptObject;
if (mDocument->GetScriptHandlingObject(hasHadScriptObject) ||
hasHadScriptObject) {
@@ -4052,25 +4053,25 @@ PresShell::FlushPendingNotifications(moz
return;
}
}
// We need to make sure external resource documents are flushed too (for
// example, svg filters that reference a filter in an external document
// need the frames in the external document to be constructed for the
// filter to work). We only need external resources to be flushed when the
- // main document is flushing >= Flush_Frames, so we flush external
+ // main document is flushing >= FlushType::Frames, so we flush external
// resources here instead of nsDocument::FlushPendingNotifications.
mDocument->FlushExternalResources(flushType);
// Force flushing of any pending content notifications that might have
// queued up while our event was pending. That will ensure that we don't
// construct frames for content right now that's still waiting to be
// notified on,
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
// Process pending restyles, since any flush of the presshell wants
// up-to-date style data.
if (!mIsDestroying) {
viewManager->FlushDelayedResize(false);
mPresContext->FlushPendingMediaFeatureValuesChanged();
// Flush any pending update of the user font set, since that could
@@ -4117,45 +4118,49 @@ PresShell::FlushPendingNotifications(moz
didStyleFlush = true;
// There might be more pending constructors now, but we're not going to
// worry about them. They can't be triggered during reflow, so we should
// be good.
- if (flushType >= (mSuppressInterruptibleReflows ? Flush_Layout : Flush_InterruptibleLayout) &&
+ if (flushType >= (mSuppressInterruptibleReflows
+ ? FlushType::Layout
+ : FlushType::InterruptibleLayout) &&
!mIsDestroying) {
didLayoutFlush = true;
mFrameConstructor->RecalcQuotesAndCounters();
viewManager->FlushDelayedResize(true);
- if (ProcessReflowCommands(flushType < Flush_Layout) && mContentToScrollTo) {
+ if (ProcessReflowCommands(flushType < FlushType::Layout) &&
+ mContentToScrollTo) {
// We didn't get interrupted. Go ahead and scroll to our content
DoScrollContentIntoView();
if (mContentToScrollTo) {
mContentToScrollTo->DeleteProperty(nsGkAtoms::scrolling);
mContentToScrollTo = nullptr;
}
}
}
- if (flushType >= Flush_Layout) {
+ if (flushType >= FlushType::Layout) {
if (!mIsDestroying) {
viewManager->UpdateWidgetGeometry();
}
}
}
- if (!didStyleFlush && flushType >= Flush_Style && !mIsDestroying) {
+ if (!didStyleFlush && flushType >= FlushType::Style && !mIsDestroying) {
mDocument->SetNeedStyleFlush();
}
if (!didLayoutFlush && !mIsDestroying &&
(flushType >=
- (mSuppressInterruptibleReflows ? Flush_Layout : Flush_InterruptibleLayout))) {
+ (mSuppressInterruptibleReflows ? FlushType::Layout
+ : FlushType::InterruptibleLayout))) {
// We suppressed this flush due to mSuppressInterruptibleReflows or
// !isSafeToFlush, but the document thinks it doesn't
// need to flush anymore. Let it know what's really going on.
mDocument->SetNeedLayoutFlush();
}
}
void
@@ -4441,17 +4446,17 @@ PresShell::ReconstructFrames(void)
// Nothing to do here
return NS_OK;
}
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
// Have to make sure that the content notifications are flushed before we
// start messing with the frame model; otherwise we can get content doubling.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
if (mIsDestroying) {
return NS_OK;
}
nsAutoCauseReflowNotifier crNotifier(this);
mFrameConstructor->BeginUpdate();
nsresult rv = mFrameConstructor->ReconstructDocElementHierarchy();
@@ -5470,18 +5475,18 @@ void PresShell::SynthesizeMouseMove(bool
if (mMouseLocation == nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE))
return;
if (!mSynthMouseMoveEvent.IsPending()) {
RefPtr<nsSynthMouseMoveEvent> ev =
new nsSynthMouseMoveEvent(this, aFromScroll);
- if (!GetPresContext()->RefreshDriver()->AddRefreshObserver(ev,
- Flush_Display)) {
+ if (!GetPresContext()->RefreshDriver()
+ ->AddRefreshObserver(ev, FlushType::Display)) {
NS_WARNING("failed to dispatch nsSynthMouseMoveEvent");
return;
}
mSynthMouseMoveEvent = ev;
}
}
@@ -8643,17 +8648,17 @@ PresShell::WillPaint()
rootPresContext->FlushWillPaintObservers();
if (mIsDestroying)
return;
// Process reflows, if we have them, to reduce flicker due to invalidates and
// reflow being interspersed. Note that we _do_ allow this to be
// interruptible; if we can't do all the reflows it's better to flicker a bit
// than to freeze up.
- FlushPendingNotifications(ChangesToFlush(Flush_InterruptibleLayout, false));
+ FlushPendingNotifications(ChangesToFlush(FlushType::InterruptibleLayout, false));
}
void
PresShell::WillPaintWindow()
{
nsRootPresContext* rootPresContext = mPresContext->GetRootPresContext();
if (rootPresContext != mPresContext) {
// This could be a popup's presshell. We don't allow plugins in popups
@@ -9206,17 +9211,17 @@ void
PresShell::DoVerifyReflow()
{
if (GetVerifyReflowEnable()) {
// First synchronously render what we have so far so that we can
// see it.
nsView* rootView = mViewManager->GetRootView();
mViewManager->InvalidateView(rootView);
- FlushPendingNotifications(Flush_Layout);
+ FlushPendingNotifications(FlushType::Layout);
mInVerifyReflow = true;
bool ok = VerifyIncrementalReflow();
mInVerifyReflow = false;
if (VERIFY_REFLOW_ALL & gVerifyReflowFlags) {
printf("ProcessReflowCommands: finished (%s)\n",
ok ? "ok" : "failed");
}
@@ -9425,17 +9430,17 @@ PresShell::Observe(nsISupports* aSubject
// Need to null-check because "chrome-flush-skin-caches" can happen
// at interesting times during startup.
if (rootFrame) {
NS_ASSERTION(mViewManager, "View manager must exist");
nsWeakFrame weakRoot(rootFrame);
// Have to make sure that the content notifications are flushed before we
// start messing with the frame model; otherwise we can get content doubling.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
if (weakRoot.IsAlive()) {
WalkFramesThroughPlaceholders(mPresContext, rootFrame,
&ReResolveMenusAndTrees, nullptr);
// Because "chrome:" URL equality is messy, reframe image box
// frames (hack!).
nsStyleChangeList changeList;
@@ -9511,42 +9516,42 @@ PresShell::Observe(nsISupports* aSubject
}
NS_WARNING("unrecognized topic in PresShell::Observe");
return NS_ERROR_FAILURE;
}
bool
nsIPresShell::AddRefreshObserverInternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
nsPresContext* presContext = GetPresContext();
return presContext &&
presContext->RefreshDriver()->AddRefreshObserver(aObserver, aFlushType);
}
/* virtual */ bool
nsIPresShell::AddRefreshObserverExternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
return AddRefreshObserverInternal(aObserver, aFlushType);
}
bool
nsIPresShell::RemoveRefreshObserverInternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
nsPresContext* presContext = GetPresContext();
return presContext &&
presContext->RefreshDriver()->RemoveRefreshObserver(aObserver, aFlushType);
}
/* virtual */ bool
nsIPresShell::RemoveRefreshObserverExternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
return RemoveRefreshObserverInternal(aObserver, aFlushType);
}
/* virtual */ bool
nsIPresShell::AddPostRefreshObserver(nsAPostRefreshObserver* aObserver)
{
nsPresContext* presContext = GetPresContext();
@@ -9944,17 +9949,17 @@ PresShell::VerifyIncrementalReflow()
// Note that after we create the shell, we must make sure to destroy it
sh->SetVerifyReflowEnable(false); // turn off verify reflow while we're reflowing the test frame tree
vm->SetPresShell(sh);
{
nsAutoCauseReflowNotifier crNotifier(this);
sh->Initialize(r.width, r.height);
}
mDocument->BindingManager()->ProcessAttachedQueue();
- sh->FlushPendingNotifications(Flush_Layout);
+ sh->FlushPendingNotifications(FlushType::Layout);
sh->SetVerifyReflowEnable(true); // turn on verify reflow again now that we're done reflowing the test frame tree
// Force the non-primary presshell to unsuppress; it doesn't want to normally
// because it thinks it's hidden
((PresShell*)sh.get())->mPaintingSuppressed = false;
if (VERIFY_REFLOW_NOISY & gVerifyReflowFlags) {
printf("Verification Tree built, comparing...\n");
}
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -123,17 +123,17 @@ public:
virtual nsIFrame* GetPlaceholderFrameFor(nsIFrame* aFrame) const override;
virtual void FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
nsFrameState aBitToAdd,
ReflowRootHandling aRootHandling =
eInferFromBitToAdd) override;
virtual void FrameNeedsToContinueReflow(nsIFrame *aFrame) override;
virtual void CancelAllPendingReflows() override;
virtual bool IsSafeToFlush() const override;
- virtual void FlushPendingNotifications(mozFlushType aType) override;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override;
virtual void FlushPendingNotifications(mozilla::ChangesToFlush aType) override;
virtual void DestroyFramesFor(nsIContent* aContent,
nsIContent** aDestroyedFramesFor) override;
virtual void CreateFramesFor(nsIContent* aContent) override;
/**
* Recreates the frames for a node
*/
@@ -643,17 +643,17 @@ protected:
}
public:
NS_INLINE_DECL_REFCOUNTING(nsSynthMouseMoveEvent, override)
void Revoke() {
if (mPresShell) {
mPresShell->GetPresContext()->RefreshDriver()->
- RemoveRefreshObserver(this, Flush_Display);
+ RemoveRefreshObserver(this, FlushType::Display);
mPresShell = nullptr;
}
}
virtual void WillRefresh(mozilla::TimeStamp aTime) override {
if (mPresShell) {
RefPtr<PresShell> shell = mPresShell;
shell->ProcessSynthMouseMoveEvent(mFromScroll);
}
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -695,17 +695,17 @@ RestyleManager::RebuildAllStyleData(nsCh
}
// Make sure that the viewmanager will outlive the presshell
RefPtr<nsViewManager> vm = presShell->GetViewManager();
mozilla::Unused << vm; // Not used within this function
// We may reconstruct frames below and hence process anything that is in the
// tree. We don't want to get notified to process those items again after.
- presShell->GetDocument()->FlushPendingNotifications(Flush_ContentAndNotify);
+ presShell->GetDocument()->FlushPendingNotifications(FlushType::ContentAndNotify);
nsAutoScriptBlocker scriptBlocker;
mDoRebuildAllStyleData = true;
ProcessPendingRestyles();
}
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -671,17 +671,17 @@ nsDocumentViewer::InitPresentationStuff(
// that are currently in the document tree, we need to flush
// any pending notifications to prevent the content sink from
// duplicating layout frames for content it has added to the tree
// but hasn't notified the document about. (Bug 154018)
//
// Note that we are flushing before we add mPresShell as an observer
// to avoid bogus notifications.
- mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
+ mDocument->FlushPendingNotifications(FlushType::ContentAndNotify);
}
mPresShell->BeginObservingDocument();
// Initialize our view manager
int32_t p2a = mPresContext->AppUnitsPerDevPixel();
MOZ_ASSERT(p2a ==
mPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
@@ -945,17 +945,17 @@ nsDocumentViewer::LoadComplete(nsresult
RefPtr<nsDocumentViewer> kungFuDeathGrip(this);
// Flush out layout so it's up-to-date by the time onload is called.
// Note that this could destroy the window, so do this before
// checking for our mDocument and its window.
if (mPresShell && !mStopped) {
// Hold strong ref because this could conceivably run script
nsCOMPtr<nsIPresShell> shell = mPresShell;
- shell->FlushPendingNotifications(Flush_Layout);
+ shell->FlushPendingNotifications(FlushType::Layout);
}
nsresult rv = NS_OK;
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
// First, get the window from the document...
nsCOMPtr<nsPIDOMWindowOuter> window = mDocument->GetWindow();
@@ -3398,17 +3398,17 @@ nsDocumentViewer::GetContentSizeInternal
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
nsCOMPtr<nsIPresShell> presShell;
GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
// Flush out all content and style updates. We can't use a resize reflow
// because it won't change some sizes that a style change reflow will.
- mDocument->FlushPendingNotifications(Flush_Layout);
+ mDocument->FlushPendingNotifications(FlushType::Layout);
nsIFrame *root = presShell->GetRootFrame();
NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
nscoord prefWidth;
{
nsRenderingContext rcx(presShell->CreateReferenceRenderingContext());
prefWidth = root->GetPrefISize(&rcx);
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -575,17 +575,17 @@ public:
* Flush pending notifications of the type specified. This method
* will not affect the content model; it'll just affect style and
* frames. Callers that actually want up-to-date presentation (other
* than the document itself) should probably be calling
* nsIDocument::FlushPendingNotifications.
*
* @param aType the type of notifications to flush
*/
- virtual void FlushPendingNotifications(mozFlushType aType) = 0;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) = 0;
virtual void FlushPendingNotifications(mozilla::ChangesToFlush aType) = 0;
/**
* Callbacks will be called even if reflow itself fails for
* some reason.
*/
virtual nsresult PostReflowCallback(nsIReflowCallback* aCallback) = 0;
virtual void CancelReflowCallback(nsIReflowCallback* aCallback) = 0;
@@ -1613,23 +1613,23 @@ public:
nsresult HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
bool* aRetVal);
/**
* Refresh observer management.
*/
protected:
virtual bool AddRefreshObserverExternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
bool AddRefreshObserverInternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
virtual bool RemoveRefreshObserverExternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
bool RemoveRefreshObserverInternal(nsARefreshObserver* aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
/**
* Do computations necessary to determine if font size inflation is enabled.
* This value is cached after computation, as the computation is somewhat
* expensive.
*/
void RecomputeFontSizeInflationEnabled();
@@ -1644,26 +1644,26 @@ protected:
#ifdef DEBUG
MOZ_ASSERT(mAllocatedPointers.Contains(aPtr));
mAllocatedPointers.RemoveEntry(aPtr);
#endif
}
public:
bool AddRefreshObserver(nsARefreshObserver* aObserver,
- mozFlushType aFlushType) {
+ mozilla::FlushType aFlushType) {
#ifdef MOZILLA_INTERNAL_API
return AddRefreshObserverInternal(aObserver, aFlushType);
#else
return AddRefreshObserverExternal(aObserver, aFlushType);
#endif
}
bool RemoveRefreshObserver(nsARefreshObserver* aObserver,
- mozFlushType aFlushType) {
+ mozilla::FlushType aFlushType) {
#ifdef MOZILLA_INTERNAL_API
return RemoveRefreshObserverInternal(aObserver, aFlushType);
#else
return RemoveRefreshObserverExternal(aObserver, aFlushType);
#endif
}
virtual bool AddPostRefreshObserver(nsAPostRefreshObserver* aObserver);
--- a/layout/base/nsIReflowCallback.h
+++ b/layout/base/nsIReflowCallback.h
@@ -14,17 +14,17 @@
* whichever happens first. If the object is explicitly removed from the shell
* (using nsIPresShell::CancelReflowCallback()) before that occurs then neither
* of the callback methods are called.
*/
class nsIReflowCallback {
public:
/**
* The presshell calls this when reflow has finished. Return true if
- * you need a Flush_Layout to happen after this.
+ * you need a FlushType::Layout to happen after this.
*/
virtual bool ReflowFinished() = 0;
/**
* The presshell calls this on outstanding callback requests in its
* Destroy() method. The shell removes the request after calling
* ReflowCallbackCanceled().
*/
virtual void ReflowCallbackCanceled() = 0;
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1134,17 +1134,17 @@ nsRefreshDriver::~nsRefreshDriver()
MOZ_ASSERT(ObserverCount() == 0,
"observers should have unregistered");
MOZ_ASSERT(!mActiveTimer, "timer should be gone");
MOZ_ASSERT(!mPresContext,
"Should have called Disconnect() and decremented "
"sRefreshDriverCount!");
if (mRootRefresh) {
- mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
+ mRootRefresh->RemoveRefreshObserver(this, FlushType::Style);
mRootRefresh = nullptr;
}
for (nsIPresShell* shell : mPresShellsToInvalidateIfHidden) {
shell->InvalidatePresShellIfHidden();
}
mPresShellsToInvalidateIfHidden.Clear();
profiler_free_backtrace(mStyleCause);
@@ -1200,27 +1200,27 @@ nsRefreshDriver::MostRecentRefreshEpochT
{
const_cast<nsRefreshDriver*>(this)->EnsureTimerStarted();
return mMostRecentRefreshEpochTime;
}
bool
nsRefreshDriver::AddRefreshObserver(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
ObserverArray& array = ArrayFor(aFlushType);
bool success = array.AppendElement(aObserver) != nullptr;
EnsureTimerStarted();
return success;
}
bool
nsRefreshDriver::RemoveRefreshObserver(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
ObserverArray& array = ArrayFor(aFlushType);
return array.RemoveElement(aObserver);
}
void
nsRefreshDriver::AddPostRefreshObserver(nsAPostRefreshObserver* aObserver)
{
@@ -1451,24 +1451,24 @@ nsRefreshDriver::ImageRequestCount() con
uint32_t count = 0;
for (auto iter = mStartTable.ConstIter(); !iter.Done(); iter.Next()) {
count += iter.UserData()->mEntries.Count();
}
return count + mRequests.Count();
}
nsRefreshDriver::ObserverArray&
-nsRefreshDriver::ArrayFor(mozFlushType aFlushType)
+nsRefreshDriver::ArrayFor(FlushType aFlushType)
{
switch (aFlushType) {
- case Flush_Style:
+ case FlushType::Style:
return mObservers[0];
- case Flush_Layout:
+ case FlushType::Layout:
return mObservers[1];
- case Flush_Display:
+ case FlushType::Display:
return mObservers[2];
default:
MOZ_CRASH("We don't track refresh observers for this flush type");
}
}
/*
* nsITimerCallback implementation
@@ -1749,17 +1749,17 @@ nsRefreshDriver::Tick(int64_t aNowEpoch,
if (IsWaitingForPaint(aNowTime)) {
// We're currently suspended waiting for earlier Tick's to
// be completed (on the Compositor). Mark that we missed the paint
// and keep waiting.
return;
}
mMostRecentTick = aNowTime;
if (mRootRefresh) {
- mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
+ mRootRefresh->RemoveRefreshObserver(this, FlushType::Style);
mRootRefresh = nullptr;
}
mSkippedPaints = false;
mWarningThreshold = 1;
nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
if (!presShell || (ObserverCount() == 0 && ImageRequestCount() == 0)) {
// Things are being destroyed, or we no longer have any observers.
@@ -1804,17 +1804,17 @@ nsRefreshDriver::Tick(int64_t aNowEpoch,
if (!mPresContext || !mPresContext->GetPresShell()) {
StopTimer();
return;
}
}
if (i == 0) {
- // This is the Flush_Style case.
+ // This is the FlushType::Style case.
DispatchAnimationEvents();
DispatchPendingEvents();
RunFrameRequestCallbacks(aNowTime);
if (mPresContext && mPresContext->GetPresShell()) {
bool tracingStyleFlush = false;
AutoTArray<nsIPresShell*, 16> observers;
@@ -1833,34 +1833,34 @@ nsRefreshDriver::Tick(int64_t aNowEpoch,
mStyleCause = nullptr;
}
nsCOMPtr<nsIPresShell> shellKungFuDeathGrip(shell);
mStyleFlushObservers.RemoveElement(shell);
RestyleManagerHandle restyleManager =
shell->GetPresContext()->RestyleManager();
restyleManager->SetObservingRefreshDriver(false);
- shell->FlushPendingNotifications(ChangesToFlush(Flush_Style, false));
+ shell->FlushPendingNotifications(ChangesToFlush(FlushType::Style, false));
// Inform the FontFaceSet that we ticked, so that it can resolve its
// ready promise if it needs to (though it might still be waiting on
// a layout flush).
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
presContext->NotifyFontFaceSetOnRefresh();
}
mNeedToRecomputeVisibility = true;
}
if (tracingStyleFlush) {
profiler_tracing("Paint", "Styles", TRACING_INTERVAL_END);
}
}
} else if (i == 1) {
- // This is the Flush_Layout case.
+ // This is the FlushType::Layout case.
bool tracingLayoutFlush = false;
AutoTArray<nsIPresShell*, 16> observers;
observers.AppendElements(mLayoutFlushObservers);
for (uint32_t j = observers.Length();
j && mPresContext && mPresContext->GetPresShell(); --j) {
// Make sure to not process observers which might have been removed
// during previous iterations.
nsIPresShell* shell = observers[j - 1];
@@ -1872,19 +1872,19 @@ nsRefreshDriver::Tick(int64_t aNowEpoch,
profiler_tracing("Paint", "Reflow", mReflowCause, TRACING_INTERVAL_START);
mReflowCause = nullptr;
}
nsCOMPtr<nsIPresShell> shellKungFuDeathGrip(shell);
mLayoutFlushObservers.RemoveElement(shell);
shell->mReflowScheduled = false;
shell->mSuppressInterruptibleReflows = false;
- mozFlushType flushType = HasPendingAnimations(shell)
- ? Flush_Layout
- : Flush_InterruptibleLayout;
+ FlushType flushType = HasPendingAnimations(shell)
+ ? FlushType::Layout
+ : FlushType::InterruptibleLayout;
shell->FlushPendingNotifications(ChangesToFlush(flushType, false));
// Inform the FontFaceSet that we ticked, so that it can resolve its
// ready promise if it needs to.
nsPresContext* presContext = shell->GetPresContext();
if (presContext) {
presContext->NotifyFontFaceSetOnRefresh();
}
mNeedToRecomputeVisibility = true;
@@ -2169,17 +2169,17 @@ nsRefreshDriver::NotifyTransactionComple
mCompletedTransaction = aTransactionId;
}
}
}
void
nsRefreshDriver::WillRefresh(mozilla::TimeStamp aTime)
{
- mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
+ mRootRefresh->RemoveRefreshObserver(this, FlushType::Style);
mRootRefresh = nullptr;
if (mSkippedPaints) {
DoRefresh();
}
}
bool
nsRefreshDriver::IsWaitingForPaint(mozilla::TimeStamp aTime)
@@ -2206,19 +2206,19 @@ nsRefreshDriver::IsWaitingForPaint(mozil
nsPresContext* pc = GetPresContext();
nsPresContext* rootContext = pc ? pc->GetRootPresContext() : nullptr;
if (rootContext) {
nsRefreshDriver *rootRefresh = rootContext->RefreshDriver();
if (rootRefresh && rootRefresh != this) {
if (rootRefresh->IsWaitingForPaint(aTime)) {
if (mRootRefresh != rootRefresh) {
if (mRootRefresh) {
- mRootRefresh->RemoveRefreshObserver(this, Flush_Style);
+ mRootRefresh->RemoveRefreshObserver(this, FlushType::Style);
}
- rootRefresh->AddRefreshObserver(this, Flush_Style);
+ rootRefresh->AddRefreshObserver(this, FlushType::Style);
mRootRefresh = rootRefresh;
}
mSkippedPaints = true;
return true;
}
}
}
return false;
@@ -2261,17 +2261,17 @@ nsRefreshDriver::DoRefresh()
if (!IsFrozen() && mPresContext && mActiveTimer) {
DoTick();
}
}
#ifdef DEBUG
bool
nsRefreshDriver::IsRefreshObserver(nsARefreshObserver* aObserver,
- mozFlushType aFlushType)
+ FlushType aFlushType)
{
ObserverArray& array = ArrayFor(aFlushType);
return array.Contains(aObserver);
}
#endif
void
nsRefreshDriver::ScheduleViewManagerFlush()
--- a/layout/base/nsRefreshDriver.h
+++ b/layout/base/nsRefreshDriver.h
@@ -108,27 +108,27 @@ public:
*
* The flush type affects:
* + the order in which the observers are notified (lowest flush
* type to highest, in order registered)
* + (in the future) which observers are suppressed when the display
* doesn't require current position data or isn't currently
* painting, and, correspondingly, which get notified when there
* is a flush during such suppression
- * and it must be either Flush_Style, Flush_Layout, or Flush_Display.
+ * and it must be either FlushType::Style, Flush_Layout, or Flush_Display.
*
* The refresh driver does NOT own a reference to these observers;
* they must remove themselves before they are destroyed.
*
* The observer will be called even if there is no other activity.
*/
bool AddRefreshObserver(nsARefreshObserver *aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
bool RemoveRefreshObserver(nsARefreshObserver *aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
/**
* Add an observer that will be called after each refresh. The caller
* must remove the observer before it is deleted. This does not trigger
* refresh driver ticks.
*/
void AddPostRefreshObserver(nsAPostRefreshObserver *aObserver);
void RemovePostRefreshObserver(nsAPostRefreshObserver *aObserver);
@@ -283,17 +283,17 @@ public:
*/
static void PVsyncActorCreated(mozilla::layout::VsyncChild* aVsyncChild);
#ifdef DEBUG
/**
* Check whether the given observer is an observer for the given flush type
*/
bool IsRefreshObserver(nsARefreshObserver *aObserver,
- mozFlushType aFlushType);
+ mozilla::FlushType aFlushType);
#endif
/**
* Default interval the refresh driver uses, in ms.
*/
static int32_t DefaultInterval();
bool IsInRefresh() { return mInRefresh; }
@@ -394,17 +394,17 @@ private:
eAllowTimeToGoBackwards = 1 << 1,
eNeverAdjustTimer = 1 << 2,
};
void EnsureTimerStarted(EnsureTimerStartedFlags aFlags = eNone);
void StopTimer();
uint32_t ObserverCount() const;
uint32_t ImageRequestCount() const;
- ObserverArray& ArrayFor(mozFlushType aFlushType);
+ ObserverArray& ArrayFor(mozilla::FlushType aFlushType);
// Trigger a refresh immediately, if haven't been disconnected or frozen.
void DoRefresh();
double GetRefreshTimerInterval() const;
double GetRegularTimerInterval(bool *outIsDefault = nullptr) const;
static double GetThrottledTimerInterval();
static mozilla::TimeDuration GetMinRecomputeVisibilityInterval();
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -538,17 +538,17 @@ public:
if (mFrame.IsAlive()) {
nsComboboxControlFrame* combo =
static_cast<nsComboboxControlFrame*>(mFrame.GetFrame());
static_cast<nsListControlFrame*>(combo->mDropdownFrame)->
SetSuppressScrollbarUpdate(true);
nsCOMPtr<nsIPresShell> shell = mFrame->PresContext()->PresShell();
shell->FrameNeedsReflow(combo->mDropdownFrame, nsIPresShell::eResize,
NS_FRAME_IS_DIRTY);
- shell->FlushPendingNotifications(Flush_Layout);
+ shell->FlushPendingNotifications(FlushType::Layout);
if (mFrame.IsAlive()) {
combo = static_cast<nsComboboxControlFrame*>(mFrame.GetFrame());
static_cast<nsListControlFrame*>(combo->mDropdownFrame)->
SetSuppressScrollbarUpdate(false);
if (combo->mDelayedShowDropDown) {
combo->ShowDropDown(true);
}
}
@@ -1021,17 +1021,17 @@ nsComboboxControlFrame::HandleRedisplayT
// First, make sure that the content model is up to date and we've
// constructed the frames for all our content in the right places.
// Otherwise they'll end up under the wrong insertion frame when we
// ActuallyDisplayText, since that flushes out the content sink by
// calling SetText on a DOM node with aNotify set to true. See bug
// 289730.
nsWeakFrame weakThis(this);
PresContext()->Document()->
- FlushPendingNotifications(Flush_ContentAndNotify);
+ FlushPendingNotifications(FlushType::ContentAndNotify);
if (!weakThis.IsAlive())
return;
// Redirect frame insertions during this method (see GetContentInsertionFrame())
// so that any reframing that the frame constructor forces upon us is inserted
// into the correct parent (mDisplayFrame). See bug 282607.
NS_PRECONDITION(!mInRedisplayText, "Nested RedisplayText");
mInRedisplayText = true;
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -249,17 +249,17 @@ nsTextControlFrame::EnsureEditorInitiali
nsIDocument* doc = mContent->GetComposedDoc();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsWeakFrame weakFrame(this);
// Flush out content on our document. Have to do this, because script
// blockers don't prevent the sink flushing out content and notifying in the
// process, which can destroy frames.
- doc->FlushPendingNotifications(Flush_ContentAndNotify);
+ doc->FlushPendingNotifications(FlushType::ContentAndNotify);
NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_ERROR_FAILURE);
// Make sure that editor init doesn't do things that would kill us off
// (especially off the script blockers it'll create for its DOM mutations).
{
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
MOZ_ASSERT(txtCtrl, "Content not a text control element");
--- a/layout/generic/ScrollbarActivity.cpp
+++ b/layout/generic/ScrollbarActivity.cpp
@@ -303,26 +303,26 @@ ScrollbarActivity::EndFade()
NS_ASSERTION(!mIsFading, "shouldn't be fading anymore");
}
void
ScrollbarActivity::RegisterWithRefreshDriver()
{
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (refreshDriver) {
- refreshDriver->AddRefreshObserver(this, Flush_Style);
+ refreshDriver->AddRefreshObserver(this, FlushType::Style);
}
}
void
ScrollbarActivity::UnregisterFromRefreshDriver()
{
nsRefreshDriver* refreshDriver = GetRefreshDriver();
if (refreshDriver) {
- refreshDriver->RemoveRefreshObserver(this, Flush_Style);
+ refreshDriver->RemoveRefreshObserver(this, FlushType::Style);
}
}
static void
SetBooleanAttribute(nsIContent* aContent, nsIAtom* aAttribute, bool aValue)
{
if (aContent) {
if (aValue) {
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1761,17 +1761,17 @@ public:
/*
* Set a refresh observer for smooth scroll iterations (and start observing).
* Should be used at most once during the lifetime of this object.
* Return value: true on success, false otherwise.
*/
bool SetRefreshObserver(ScrollFrameHelper *aCallee) {
NS_ASSERTION(aCallee && !mCallee, "AsyncSmoothMSDScroll::SetRefreshObserver - Invalid usage.");
- if (!RefreshDriver(aCallee)->AddRefreshObserver(this, Flush_Style)) {
+ if (!RefreshDriver(aCallee)->AddRefreshObserver(this, FlushType::Style)) {
return false;
}
mCallee = aCallee;
return true;
}
private:
@@ -1788,17 +1788,17 @@ private:
/*
* The refresh driver doesn't hold a reference to its observers,
* so releasing this object can (and is) used to remove the observer on DTOR.
* Currently, this object is released once the scrolling ends.
*/
void RemoveObserver() {
if (mCallee) {
- RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Style);
+ RefreshDriver(mCallee)->RemoveRefreshObserver(this, FlushType::Style);
}
}
mozilla::layers::AxisPhysicsMSDModel mXAxisModel, mYAxisModel;
nsRect mRange;
mozilla::TimeStamp mLastRefreshTime;
ScrollFrameHelper *mCallee;
nscoord mOneDevicePixelInAppUnits;
@@ -1855,17 +1855,17 @@ public:
/*
* Set a refresh observer for smooth scroll iterations (and start observing).
* Should be used at most once during the lifetime of this object.
* Return value: true on success, false otherwise.
*/
bool SetRefreshObserver(ScrollFrameHelper *aCallee) {
NS_ASSERTION(aCallee && !mCallee, "AsyncScroll::SetRefreshObserver - Invalid usage.");
- if (!RefreshDriver(aCallee)->AddRefreshObserver(this, Flush_Style)) {
+ if (!RefreshDriver(aCallee)->AddRefreshObserver(this, FlushType::Style)) {
return false;
}
mCallee = aCallee;
APZCCallbackHelper::SuppressDisplayport(true, mCallee->mOuter->PresContext()->PresShell());
return true;
}
@@ -1884,17 +1884,17 @@ private:
/*
* The refresh driver doesn't hold a reference to its observers,
* so releasing this object can (and is) used to remove the observer on DTOR.
* Currently, this object is released once the scrolling ends.
*/
void RemoveObserver() {
if (mCallee) {
- RefreshDriver(mCallee)->RemoveRefreshObserver(this, Flush_Style);
+ RefreshDriver(mCallee)->RemoveRefreshObserver(this, FlushType::Style);
APZCCallbackHelper::SuppressDisplayport(false, mCallee->mOuter->PresContext()->PresShell());
}
}
};
/*
* Calculate duration, possibly dynamically according to events rate and event origin.
* (also maintain previous timestamps - which are only used here).
@@ -4681,31 +4681,31 @@ void ScrollFrameHelper::CurPosAttributeC
}
/* ============= Scroll events ========== */
ScrollFrameHelper::ScrollEvent::ScrollEvent(ScrollFrameHelper* aHelper)
: mHelper(aHelper)
{
mDriver = mHelper->mOuter->PresContext()->RefreshDriver();
- mDriver->AddRefreshObserver(this, Flush_Layout);
+ mDriver->AddRefreshObserver(this, FlushType::Layout);
}
ScrollFrameHelper::ScrollEvent::~ScrollEvent()
{
if (mDriver) {
- mDriver->RemoveRefreshObserver(this, Flush_Layout);
+ mDriver->RemoveRefreshObserver(this, FlushType::Layout);
mDriver = nullptr;
}
}
void
ScrollFrameHelper::ScrollEvent::WillRefresh(mozilla::TimeStamp aTime)
{
- mDriver->RemoveRefreshObserver(this, Flush_Layout);
+ mDriver->RemoveRefreshObserver(this, FlushType::Layout);
mDriver = nullptr;
mHelper->FireScrollEvent();
}
void
ScrollFrameHelper::FireScrollEvent()
{
MOZ_ASSERT(mScrollEvent);
@@ -4743,17 +4743,17 @@ ScrollFrameHelper::PostScrollEvent()
mScrollEvent = new ScrollEvent(this);
}
NS_IMETHODIMP
ScrollFrameHelper::AsyncScrollPortEvent::Run()
{
if (mHelper) {
mHelper->mOuter->PresContext()->GetPresShell()->
- FlushPendingNotifications(Flush_InterruptibleLayout);
+ FlushPendingNotifications(FlushType::InterruptibleLayout);
}
return mHelper ? mHelper->FireScrollPortEvent() : NS_OK;
}
bool
nsXULScrollFrame::AddHorizontalScrollbar(nsBoxLayoutState& aState, bool aOnBottom)
{
if (!mHelper.mHScrollbarBox)
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -98,30 +98,30 @@ public:
void FireScrolledAreaEvent();
bool IsSmoothScrollingEnabled();
/**
* This class handles the dispatching of scroll events to content.
*
* nsRefreshDriver maintains three lists of refresh observers, one for each
- * flush type: Flush_Style, Flush_Layout, and Flush_Display.
+ * flush type: FlushType::Style, Flush_Layout, and Flush_Display.
*
* During a tick, it runs through each list of observers, in order, and runs
* them. To iterate over each list, it uses an EndLimitedIterator, which is
* designed to iterate only over elements present when the iterator was
* created, not elements added afterwards. This means that, for a given flush
* type, a refresh observer added during the execution of another refresh
* observer of that flush type, will not run until the next tick.
*
* During main-thread animation-driven scrolling, ScrollEvents are *posted*
- * by AsyncScroll::WillRefresh(). AsyncScroll registers itself as a Flush_Style
+ * by AsyncScroll::WillRefresh(). AsyncScroll registers itself as a FlushType::Style
* refresh observer.
*
- * Posting a scroll event, as of bug 1250550, registers a Flush_Layout
+ * Posting a scroll event, as of bug 1250550, registers a FlushType::Layout
* refresh observer, which *fires* the event when run. This allows the event
* to be fired to content in the same refresh driver tick as it is posted.
* This is an important invariant to maintain to reduce scroll event latency
* for main-thread scrolling.
*/
class ScrollEvent : public nsARefreshObserver {
public:
NS_INLINE_DECL_REFCOUNTING(ScrollEvent, override)
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -7075,17 +7075,17 @@ nsGridContainerFrame::GetGridFrameWithCo
if (reflowNeeded) {
// Trigger a reflow that generates additional grid property data.
nsIPresShell* shell = gridFrame->PresContext()->PresShell();
gridFrame->AddStateBits(NS_STATE_GRID_GENERATE_COMPUTED_VALUES);
shell->FrameNeedsReflow(gridFrame,
nsIPresShell::eResize,
NS_FRAME_IS_DIRTY);
- shell->FlushPendingNotifications(Flush_Layout);
+ shell->FlushPendingNotifications(FlushType::Layout);
// Since the reflow may have side effects, get the grid frame again.
gridFrame = GetGridContainerFrame(aFrame);
// Assert the grid properties are present
MOZ_ASSERT(!gridFrame ||
gridFrame->Properties().Has(GridColTrackInfo()));
MOZ_ASSERT(!gridFrame ||
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -962,17 +962,17 @@ nsFrameSelection::MoveCaret(nsDirection
bool visualMovement = aMovementStyle == eVisual ||
(aMovementStyle == eUsePrefStyle &&
(mCaretMovementStyle == 1 ||
(mCaretMovementStyle == 2 && !aContinueSelection)));
NS_ENSURE_STATE(mShell);
// Flush out layout, since we need it to be up to date to do caret
// positioning.
- mShell->FlushPendingNotifications(Flush_Layout);
+ mShell->FlushPendingNotifications(FlushType::Layout);
if (!mShell) {
return NS_OK;
}
nsPresContext *context = mShell->GetPresContext();
if (!context)
return NS_ERROR_FAILURE;
@@ -1186,26 +1186,26 @@ nsFrameSelection::MoveCaret(nsDirection
//END nsFrameSelection methods
//BEGIN nsFrameSelection methods
NS_IMETHODIMP
Selection::ToString(nsAString& aReturn)
{
- // We need Flush_Style here to make sure frames have been created for
+ // We need FlushType::Style here to make sure frames have been created for
// the selected content. Use mFrameSelection->GetShell() which returns
// null if the Selection has been disconnected (the shell is Destroyed).
nsCOMPtr<nsIPresShell> shell =
mFrameSelection ? mFrameSelection->GetShell() : nullptr;
if (!shell) {
aReturn.Truncate();
return NS_OK;
}
- shell->FlushPendingNotifications(Flush_Style);
+ shell->FlushPendingNotifications(FlushType::Style);
return ToStringWithFormat("text/plain",
nsIDocumentEncoder::SkipInvisibleContent,
0, aReturn);
}
void
Selection::Stringify(nsAString& aResult)
@@ -2214,17 +2214,17 @@ nsFrameSelection::CommonPageMove(bool aF
nsresult
nsFrameSelection::PhysicalMove(int16_t aDirection, int16_t aAmount,
bool aExtend)
{
NS_ENSURE_STATE(mShell);
// Flush out layout, since we need it to be up to date to do caret
// positioning.
- mShell->FlushPendingNotifications(Flush_Layout);
+ mShell->FlushPendingNotifications(FlushType::Layout);
if (!mShell) {
return NS_OK;
}
// Check that parameters are safe
if (aDirection < 0 || aDirection > 3 || aAmount < 0 || aAmount > 1) {
return NS_ERROR_FAILURE;
@@ -6129,17 +6129,17 @@ Selection::ScrollIntoView(SelectionRegio
aVertical, aHorizontal);
// Now that text frame character offsets are always valid (though not
// necessarily correct), the worst that will happen if we don't flush here
// is that some callers might scroll to the wrong place. Those should
// either manually flush if they're in a safe position for it or use the
// async version of this method.
if (aFlags & Selection::SCROLL_DO_FLUSH) {
- presShell->FlushPendingNotifications(Flush_Layout);
+ presShell->FlushPendingNotifications(FlushType::Layout);
// Reget the presshell, since it might have been Destroy'ed.
presShell = mFrameSelection ? mFrameSelection->GetShell() : nullptr;
if (!presShell)
return NS_OK;
}
//
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -908,17 +908,17 @@ public:
}
NS_IMETHOD Run() override
{
// Flush frames, to ensure any pending display:none changes are made.
// Note it can be unsafe to flush if we've destroyed the presentation
// for some other reason, like if we're shutting down.
if (!mPresShell->IsDestroying()) {
- mPresShell->FlushPendingNotifications(Flush_Frames);
+ mPresShell->FlushPendingNotifications(FlushType::Frames);
}
// Either the frame has been constructed by now, or it never will be,
// either way we want to clear the stashed views.
mFrameLoader->SetDetachedSubdocFrame(nullptr, nullptr);
nsSubDocumentFrame* frame = do_QueryFrame(mFrameElement->GetPrimaryFrame());
if ((!frame && mHideViewerIfFrameless) ||
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -1596,17 +1596,17 @@ nsPrintEngine::ReconstructAndReflow(bool
MOZ_ASSERT(!documentIsTopLevel, "How could this happen?");
if (NS_FAILED(rv) || doReturn) {
return rv;
}
}
- po->mPresShell->FlushPendingNotifications(Flush_Layout);
+ po->mPresShell->FlushPendingNotifications(FlushType::Layout);
nsresult rv = UpdateSelectionAndShrinkPrintObject(po, documentIsTopLevel);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
//-------------------------------------------------------
@@ -2174,17 +2174,17 @@ nsPrintEngine::ReflowPrintObject(nsPrint
}
rv = aPO->mPresShell->Initialize(adjSize.width, adjSize.height);
NS_ENSURE_SUCCESS(rv, rv);
NS_ASSERTION(aPO->mPresShell, "Presshell should still be here");
// Process the reflow event Initialize posted
- aPO->mPresShell->FlushPendingNotifications(Flush_Layout);
+ aPO->mPresShell->FlushPendingNotifications(FlushType::Layout);
rv = UpdateSelectionAndShrinkPrintObject(aPO, documentIsTopLevel);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef EXTENDED_DEBUG_PRINTING
if (kPrintingLogMod && kPrintingLogMod->level == DUMP_LAYOUT_LEVEL) {
nsAutoCString docStr;
nsAutoCString urlStr;
--- a/layout/style/MediaQueryList.cpp
+++ b/layout/style/MediaQueryList.cpp
@@ -141,17 +141,17 @@ MediaQueryList::RecomputeMatches()
{
if (!mDocument) {
return;
}
if (mDocument->GetParentDocument()) {
// Flush frames on the parent so our prescontext will get
// recreated as needed.
- mDocument->GetParentDocument()->FlushPendingNotifications(Flush_Frames);
+ mDocument->GetParentDocument()->FlushPendingNotifications(FlushType::Frames);
// That might have killed our document, so recheck that.
if (!mDocument) {
return;
}
}
nsIPresShell* shell = mDocument->GetShell();
if (!shell) {
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -437,17 +437,17 @@ nsComputedDOMStyle::GetStyleContextForEl
// correct document.
nsCOMPtr<nsIPresShell> presShell = GetPresShellForContent(aElement);
if (!presShell) {
presShell = aPresShell;
if (!presShell)
return nullptr;
}
- presShell->FlushPendingNotifications(Flush_Style);
+ presShell->FlushPendingNotifications(FlushType::Style);
return GetStyleContextForElementNoFlush(aElement, aPseudo, presShell,
aStyleType);
}
/* static */
already_AddRefed<nsStyleContext>
nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
@@ -660,17 +660,17 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
document->FlushPendingLinkUpdates();
// Flush _before_ getting the presshell, since that could create a new
// presshell. Also note that we want to flush the style on the document
// we're computing style in, not on the document mContent is in -- the two
// may be different.
document->FlushPendingNotifications(
- aNeedsLayoutFlush ? Flush_Layout : Flush_Style);
+ aNeedsLayoutFlush ? FlushType::Layout : FlushType::Style);
#ifdef DEBUG
mFlushedPendingReflows = aNeedsLayoutFlush;
#endif
mPresShell = document->GetShell();
if (!mPresShell || !mPresShell->GetPresContext()) {
ClearStyleContext();
return;
--- a/layout/xul/BoxObject.cpp
+++ b/layout/xul/BoxObject.cpp
@@ -111,17 +111,17 @@ BoxObject::GetFrame(bool aFlushLayout)
if (!shell)
return nullptr;
if (!aFlushLayout) {
// If we didn't flush layout when getting the presshell, we should at least
// flush to make sure our frame model is up to date.
// XXXbz should flush on document, no? Except people call this from
// frame code, maybe?
- shell->FlushPendingNotifications(Flush_Frames);
+ shell->FlushPendingNotifications(FlushType::Frames);
}
// The flush might have killed mContent.
if (!mContent) {
return nullptr;
}
return mContent->GetPrimaryFrame();
@@ -135,17 +135,17 @@ BoxObject::GetPresShell(bool aFlushLayou
}
nsCOMPtr<nsIDocument> doc = mContent->GetUncomposedDoc();
if (!doc) {
return nullptr;
}
if (aFlushLayout) {
- doc->FlushPendingNotifications(Flush_Layout);
+ doc->FlushPendingNotifications(FlushType::Layout);
}
return doc->GetShell();
}
nsresult
BoxObject::GetOffsetRect(nsIntRect& aRect)
{
--- a/layout/xul/ListBoxObject.cpp
+++ b/layout/xul/ListBoxObject.cpp
@@ -168,17 +168,17 @@ ListBoxObject::GetListBoxBody(bool aFlus
}
nsIPresShell* shell = GetPresShell(false);
if (!shell) {
return nullptr;
}
nsIFrame* frame = aFlush ?
- GetFrame(false) /* does Flush_Frames */ :
+ GetFrame(false) /* does FlushType::Frames */ :
mContent->GetPrimaryFrame();
if (!frame) {
return nullptr;
}
// Iterate over our content model children looking for the body.
nsCOMPtr<nsIContent> content = FindBodyContent(frame->GetContent());
--- a/layout/xul/nsListBoxBodyFrame.cpp
+++ b/layout/xul/nsListBoxBodyFrame.cpp
@@ -798,17 +798,17 @@ nsListBoxBodyFrame::ScrollToIndex(int32_
if (!weak.IsAlive()) {
return NS_OK;
}
// This change has to happen immediately.
// Flush any pending reflow commands.
// XXXbz why, exactly?
- mContent->GetComposedDoc()->FlushPendingNotifications(Flush_Layout);
+ mContent->GetComposedDoc()->FlushPendingNotifications(FlushType::Layout);
return NS_OK;
}
nsresult
nsListBoxBodyFrame::InternalPositionChangedCallback()
{
nsListScrollSmoother* smoother = GetSmoother();
@@ -871,17 +871,17 @@ nsListBoxBodyFrame::DoInternalPositionCh
RefPtr<nsPresContext> presContext(PresContext());
nsBoxLayoutState state(presContext);
// begin timing how long it takes to scroll a row
PRTime start = PR_Now();
nsWeakFrame weakThis(this);
- mContent->GetComposedDoc()->FlushPendingNotifications(Flush_Layout);
+ mContent->GetComposedDoc()->FlushPendingNotifications(FlushType::Layout);
if (!weakThis.IsAlive()) {
return NS_OK;
}
{
nsAutoScriptBlocker scriptBlocker;
int32_t visibleRows = 0;
@@ -924,17 +924,17 @@ nsListBoxBodyFrame::DoInternalPositionCh
presContext->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (!weakThis.IsAlive()) {
return NS_OK;
}
// Flush calls CreateRows
// XXXbz there has to be a better way to do this than flushing!
- presContext->PresShell()->FlushPendingNotifications(Flush_Layout);
+ presContext->PresShell()->FlushPendingNotifications(FlushType::Layout);
if (!weakThis.IsAlive()) {
return NS_OK;
}
mScrolling = false;
VerticalScroll(mYPosition);
--- a/layout/xul/nsPIListBoxObject.h
+++ b/layout/xul/nsPIListBoxObject.h
@@ -15,16 +15,16 @@ class nsListBoxBodyFrame;
#include "nsIListBoxObject.h"
class nsPIListBoxObject : public nsIListBoxObject {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PILISTBOXOBJECT_IID)
/**
* Get the list box body. This will search for it as needed.
- * If aFlush is false we don't Flush_Frames though.
+ * If aFlush is false we don't FlushType::Frames though.
*/
virtual nsListBoxBodyFrame* GetListBoxBody(bool aFlush) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIListBoxObject, NS_PILISTBOXOBJECT_IID)
#endif // nsPIListBoxObject_h__
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -550,17 +550,17 @@ nsXULPopupManager::PopupResized(nsIFrame
nsMenuPopupFrame*
nsXULPopupManager::GetPopupFrameForContent(nsIContent* aContent, bool aShouldFlush)
{
if (aShouldFlush) {
nsIDocument *document = aContent->GetUncomposedDoc();
if (document) {
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
if (presShell)
- presShell->FlushPendingNotifications(Flush_Layout);
+ presShell->FlushPendingNotifications(FlushType::Layout);
}
}
return do_QueryFrame(aContent->GetPrimaryFrame());
}
nsMenuChainItem*
nsXULPopupManager::GetTopVisibleMenu()
@@ -1592,17 +1592,17 @@ nsXULPopupManager::FirePopupHidingEvent(
// If animate="false" then don't transition at all. If animate="cancel",
// only show the transition if cancelling the popup or rolling up.
// Otherwise, always show the transition.
nsAutoString animate;
aPopup->GetAttr(kNameSpaceID_None, nsGkAtoms::animate, animate);
if (!animate.EqualsLiteral("false") &&
(!animate.EqualsLiteral("cancel") || aIsCancel)) {
- presShell->FlushPendingNotifications(Flush_Layout);
+ presShell->FlushPendingNotifications(FlushType::Layout);
// Get the frame again in case the flush caused it to go away
popupFrame = do_QueryFrame(aPopup->GetPrimaryFrame());
if (!popupFrame)
return;
if (nsLayoutUtils::HasCurrentTransitions(popupFrame)) {
RefPtr<TransitionEnder> ender = new TransitionEnder(aPopup, aDeselectMenu);
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -934,17 +934,17 @@ nsTreeBodyFrame::CheckOverflow(const Scr
// recursion. See bug 905909.
if (!weakFrame.IsAlive()) {
return;
}
NS_ASSERTION(!mCheckingOverflow, "mCheckingOverflow should not already be set");
// Don't use AutoRestore since we want to not touch mCheckingOverflow if we fail
// the weakFrame.IsAlive() check below
mCheckingOverflow = true;
- presShell->FlushPendingNotifications(Flush_Layout);
+ presShell->FlushPendingNotifications(FlushType::Layout);
if (!weakFrame.IsAlive()) {
return;
}
mCheckingOverflow = false;
}
void
nsTreeBodyFrame::InvalidateScrollbars(const ScrollParts& aParts, nsWeakFrame& aWeakColumnsFrame)
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -202,19 +202,19 @@ nsHtml5TreeOpExecutor::WillResume()
NS_IMETHODIMP
nsHtml5TreeOpExecutor::SetParser(nsParserBase* aParser)
{
mParser = aParser;
return NS_OK;
}
void
-nsHtml5TreeOpExecutor::FlushPendingNotifications(mozFlushType aType)
+nsHtml5TreeOpExecutor::FlushPendingNotifications(FlushType aType)
{
- if (aType >= Flush_InterruptibleLayout) {
+ if (aType >= FlushType::InterruptibleLayout) {
// Bug 577508 / 253951
nsContentSink::StartLayout(true);
}
}
nsISupports*
nsHtml5TreeOpExecutor::GetTarget()
{
--- a/parser/html/nsHtml5TreeOpExecutor.h
+++ b/parser/html/nsHtml5TreeOpExecutor.h
@@ -131,17 +131,17 @@ class nsHtml5TreeOpExecutor final : publ
/**
* Sets the parser.
*/
NS_IMETHOD SetParser(nsParserBase* aParser) override;
/**
* No-op for backwards compat.
*/
- virtual void FlushPendingNotifications(mozFlushType aType) override;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override;
/**
* Don't call. For interface compat only.
*/
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override {
NS_NOTREACHED("No one should call this.");
return NS_ERROR_NOT_IMPLEMENTED;
}
--- a/parser/htmlparser/nsIContentSink.h
+++ b/parser/htmlparser/nsIContentSink.h
@@ -92,17 +92,17 @@ public:
NS_IMETHOD SetParser(nsParserBase* aParser)=0;
/**
* Flush content so that the content model is in sync with the state
* of the sink.
*
* @param aType the type of flush to perform
*/
- virtual void FlushPendingNotifications(mozFlushType aType)=0;
+ virtual void FlushPendingNotifications(mozilla::FlushType aType)=0;
/**
* Set the document character set. This should be passed on to the
* document itself.
*/
NS_IMETHOD SetDocumentCharset(nsACString& aCharset)=0;
/**
--- a/parser/xml/nsSAXXMLReader.h
+++ b/parser/xml/nsSAXXMLReader.h
@@ -55,17 +55,17 @@ public:
return NS_OK;
}
NS_IMETHOD WillResume() override
{
return NS_OK;
}
- virtual void FlushPendingNotifications(mozFlushType aType) override
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override
{
}
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override
{
return NS_OK;
}
--- a/rdf/base/nsRDFContentSink.cpp
+++ b/rdf/base/nsRDFContentSink.cpp
@@ -109,17 +109,17 @@ public:
// nsIContentSink
NS_IMETHOD WillParse(void) override;
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override;
NS_IMETHOD DidBuildModel(bool aTerminated) override;
NS_IMETHOD WillInterrupt(void) override;
NS_IMETHOD WillResume(void) override;
NS_IMETHOD SetParser(nsParserBase* aParser) override;
- virtual void FlushPendingNotifications(mozFlushType aType) override { }
+ virtual void FlushPendingNotifications(mozilla::FlushType aType) override { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) override { return NS_OK; }
virtual nsISupports *GetTarget() override { return nullptr; }
// nsIRDFContentSink
NS_IMETHOD Init(nsIURI* aURL) override;
NS_IMETHOD SetDataSource(nsIRDFDataSource* aDataSource) override;
NS_IMETHOD GetDataSource(nsIRDFDataSource*& aDataSource) override;
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -333,17 +333,17 @@ nsTypeAheadFind::FindItNow(nsIPresShell
presShell = startingPresShell; // this is the current document
if (!presShell)
return NS_ERROR_FAILURE;
}
// There could be unflushed notifications which hide textareas or other
// elements that we don't want to find text in.
- presShell->FlushPendingNotifications(Flush_Layout);
+ presShell->FlushPendingNotifications(mozilla::FlushType::Layout);
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
if (!presContext)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISelection> selection;
nsCOMPtr<nsISelectionController> selectionController =
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -665,23 +665,23 @@ void nsDocLoader::DocLoaderIsEmpty(bool
// The load group for this DocumentLoader is idle. Flush if we need to.
if (aFlushLayout && !mDontFlushLayout) {
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(GetAsSupports(this));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
if (doc) {
// We start loads from style resolution, so we need to flush out style
// no matter what. If we have user fonts, we also need to flush layout,
// since the reflow is what starts font loads.
- mozFlushType flushType = Flush_Style;
+ mozilla::FlushType flushType = mozilla::FlushType::Style;
nsIPresShell* shell = doc->GetShell();
if (shell) {
// Be safe in case this presshell is in teardown now
nsPresContext* presContext = shell->GetPresContext();
if (presContext && presContext->GetUserFontSet()) {
- flushType = Flush_Layout;
+ flushType = mozilla::FlushType::Layout;
}
}
mDontFlushLayout = mIsFlushingLayout = true;
doc->FlushPendingNotifications(flushType);
mDontFlushLayout = mIsFlushingLayout = false;
}
}
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -513,17 +513,17 @@ static nsIPresShell*
GetPresShellForContent(nsIDOMNode* aDOMNode)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(aDOMNode);
if (!content)
return nullptr;
nsCOMPtr<nsIDocument> document = content->GetUncomposedDoc();
if (document) {
- document->FlushPendingNotifications(Flush_Display);
+ document->FlushPendingNotifications(FlushType::Display);
return document->GetShell();
}
return nullptr;
}
nsresult