From d13aaf9ce0de5c15c2d42e752f7477b9066b7430 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Wed, 1 Mar 2017 18:03:14 +0100 Subject: [PATCH] Bug 1340771 part 1 - Rename nsWeakFrame to AutoWeakFrame (automated change). r=tn MozReview-Commit-ID: 8pl4nyeGEkr --- accessible/base/SelectionManager.h | 2 +- accessible/base/nsCoreUtils.cpp | 2 +- accessible/generic/Accessible.cpp | 2 +- dom/base/Element.cpp | 2 +- dom/base/nsFrameLoader.cpp | 2 +- dom/base/nsFrameLoader.h | 2 +- dom/base/nsObjectLoadingContent.h | 2 +- dom/events/EventStateManager.cpp | 16 +++++------ dom/events/EventStateManager.h | 10 +++---- dom/events/WheelHandlingHelper.cpp | 12 ++++---- dom/events/WheelHandlingHelper.h | 10 +++---- dom/html/HTMLInputElement.cpp | 2 +- dom/html/HTMLSelectElement.cpp | 4 +-- dom/html/nsTextEditorState.cpp | 8 +++--- layout/base/AccessibleCaretManager.cpp | 4 +-- layout/base/GeometryUtils.cpp | 4 +-- layout/base/PresShell.cpp | 24 ++++++++-------- layout/base/nsIPresShell.h | 16 +++++------ layout/forms/nsComboboxControlFrame.cpp | 18 ++++++------ layout/forms/nsDateTimeControlFrame.h | 2 +- layout/forms/nsFileControlFrame.h | 2 +- layout/forms/nsListControlFrame.cpp | 30 ++++++++++---------- layout/forms/nsNumberControlFrame.h | 2 +- layout/forms/nsTextControlFrame.cpp | 8 +++--- layout/forms/nsTextControlFrame.h | 2 +- layout/generic/ScrollbarActivity.cpp | 4 +-- layout/generic/nsContainerFrame.cpp | 2 +- layout/generic/nsFrame.cpp | 8 +++--- layout/generic/nsFrameSetFrame.cpp | 2 +- layout/generic/nsGfxScrollFrame.cpp | 16 +++++------ layout/generic/nsIFrame.h | 26 ++++++++--------- layout/generic/nsPluginFrame.cpp | 2 +- layout/generic/nsSelection.cpp | 6 ++-- layout/generic/nsSimplePageSequenceFrame.cpp | 2 +- layout/generic/nsSubDocumentFrame.cpp | 10 +++---- layout/painting/ActiveLayerTracker.cpp | 4 +-- layout/printing/nsPrintEngine.h | 2 +- layout/tables/nsTableFrame.cpp | 2 +- layout/xul/nsListBoxBodyFrame.cpp | 20 ++++++------- layout/xul/nsListBoxBodyFrame.h | 2 +- layout/xul/nsMenuBarFrame.cpp | 2 +- layout/xul/nsMenuFrame.cpp | 16 +++++------ layout/xul/nsMenuPopupFrame.cpp | 4 +-- layout/xul/nsProgressMeterFrame.cpp | 4 +-- layout/xul/nsResizerFrame.cpp | 4 +-- layout/xul/nsScrollbarButtonFrame.cpp | 2 +- layout/xul/nsScrollbarFrame.cpp | 2 +- layout/xul/nsSliderFrame.cpp | 4 +-- layout/xul/nsSplitterFrame.cpp | 4 +-- layout/xul/nsTextBoxFrame.cpp | 4 +-- layout/xul/nsTextBoxFrame.h | 2 +- layout/xul/nsXULPopupManager.cpp | 10 +++---- layout/xul/tree/nsTreeBodyFrame.cpp | 28 +++++++++--------- layout/xul/tree/nsTreeBodyFrame.h | 2 +- 54 files changed, 192 insertions(+), 192 deletions(-) diff --git a/accessible/base/SelectionManager.h b/accessible/base/SelectionManager.h index c24f638f8a4e..5c5e299a31a8 100644 --- a/accessible/base/SelectionManager.h +++ b/accessible/base/SelectionManager.h @@ -121,7 +121,7 @@ protected: private: // Currently focused control. - nsWeakFrame mCurrCtrlFrame; + AutoWeakFrame mCurrCtrlFrame; int32_t mCaretOffset; HyperTextAccessible* mAccWithCaret; }; diff --git a/accessible/base/nsCoreUtils.cpp b/accessible/base/nsCoreUtils.cpp index 73e805dc22ff..71604075fef7 100644 --- a/accessible/base/nsCoreUtils.cpp +++ b/accessible/base/nsCoreUtils.cpp @@ -111,7 +111,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj, tcBoxObj->GetY(&tcY); // Dispatch mouse events. - nsWeakFrame tcFrame = tcContent->GetPrimaryFrame(); + AutoWeakFrame tcFrame = tcContent->GetPrimaryFrame(); nsIFrame* rootFrame = presShell->GetRootFrame(); nsPoint offset; diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index 7df209d17321..2c03d27ed7a9 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -1830,7 +1830,7 @@ Accessible::DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex) nsIPresShell::ScrollAxis(), nsIPresShell::SCROLL_OVERFLOW_HIDDEN); - nsWeakFrame frame = aContent->GetPrimaryFrame(); + AutoWeakFrame frame = aContent->GetPrimaryFrame(); if (!frame) return; diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 845315be50c6..a3c62bd57072 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -858,7 +858,7 @@ Element::ScrollByNoFlush(int32_t aDx, int32_t aDy) return false; } - nsWeakFrame weakRef(sf->GetScrolledFrame()); + AutoWeakFrame weakRef(sf->GetScrolledFrame()); CSSIntPoint before = sf->GetScrollPositionCSSPixels(); sf->ScrollToCSSPixelsApproximate(CSSIntPoint(before.x + aDx, before.y + aDy)); diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index dd70cc9ad516..fa6a20cf6566 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -2699,7 +2699,7 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame) int32_t x = 0; int32_t y = 0; - nsWeakFrame weakFrame(aIFrame); + AutoWeakFrame weakFrame(aIFrame); baseWindow->GetPosition(&x, &y); diff --git a/dom/base/nsFrameLoader.h b/dom/base/nsFrameLoader.h index 518b0df94ec9..15ea49837fa6 100644 --- a/dom/base/nsFrameLoader.h +++ b/dom/base/nsFrameLoader.h @@ -329,7 +329,7 @@ private: // Stores the root frame of the subdocument while the subdocument is being // reframed. Used to restore the presentation after reframing. - nsWeakFrame mDetachedSubdocFrame; + AutoWeakFrame mDetachedSubdocFrame; // Stores the containing document of the frame corresponding to this // frame loader. This is reference is kept valid while the subframe's // presentation is detached and stored in mDetachedSubdocFrame. This diff --git a/dom/base/nsObjectLoadingContent.h b/dom/base/nsObjectLoadingContent.h index 92d880d99b75..0b0839005bcc 100644 --- a/dom/base/nsObjectLoadingContent.h +++ b/dom/base/nsObjectLoadingContent.h @@ -715,7 +715,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent bool mPreferFallback : 1; bool mPreferFallbackKnown : 1; - nsWeakFrame mPrintFrame; + AutoWeakFrame mPrintFrame; RefPtr mInstanceOwner; nsTArray mCachedAttributes; diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index c718b9b0de08..fbd3acf91456 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -115,7 +115,7 @@ static nsITimer* gUserInteractionTimer = nullptr; static nsITimerCallback* gUserInteractionTimerCallback = nullptr; static const double kCursorLoadingTimeout = 1000; // ms -static nsWeakFrame gLastCursorSourceFrame; +static AutoWeakFrame gLastCursorSourceFrame; static TimeStamp gLastCursorUpdateTime; static inline int32_t @@ -283,7 +283,7 @@ int32_t EventStateManager::sUserInputEventDepth = 0; bool EventStateManager::sNormalLMouseEventInProcess = false; EventStateManager* EventStateManager::sActiveESM = nullptr; nsIDocument* EventStateManager::sMouseOverDocument = nullptr; -nsWeakFrame EventStateManager::sLastDragOverFrame = nullptr; +AutoWeakFrame EventStateManager::sLastDragOverFrame = nullptr; LayoutDeviceIntPoint EventStateManager::sPreLockPoint = LayoutDeviceIntPoint(0, 0); LayoutDeviceIntPoint EventStateManager::sLastRefPoint = kInvalidRefPoint; CSSIntPoint EventStateManager::sLastScreenPoint = CSSIntPoint(0, 0); @@ -2237,7 +2237,7 @@ EventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame, // 3. Horizontal scroll (even if #1 and/or #2 are consumed) // 4. Horizontal pixel scroll (even if #3 isn't consumed) - nsWeakFrame targetFrame(aTargetFrame); + AutoWeakFrame targetFrame(aTargetFrame); MOZ_ASSERT(*aStatus != nsEventStatus_eConsumeNoDefault && !aEvent->DefaultPrevented(), @@ -2549,7 +2549,7 @@ EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame, nsIFrame* scrollFrame = do_QueryFrame(aScrollableFrame); MOZ_ASSERT(scrollFrame); - nsWeakFrame scrollFrameWeak(scrollFrame); + AutoWeakFrame scrollFrameWeak(scrollFrame); if (!WheelTransaction::WillHandleDefaultAction(aEvent, scrollFrameWeak)) { return; } @@ -3930,7 +3930,7 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent, CreateMouseOrPointerWidgetEvent(aMouseEvent, aMessage, aRelatedContent, dispatchEvent); - nsWeakFrame previousTarget = mCurrentTarget; + AutoWeakFrame previousTarget = mCurrentTarget; mCurrentTargetContent = aTargetContent; nsIFrame* targetFrame = nullptr; @@ -4502,7 +4502,7 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext, EventMessage aMessage, nsIContent* aRelatedTarget, nsIContent* aTargetContent, - nsWeakFrame& aTargetFrame) + AutoWeakFrame& aTargetFrame) { MOZ_ASSERT(aMessage == eDragLeave || aMessage == eDragExit || aMessage == eDragEnter); @@ -4641,7 +4641,7 @@ EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent, EventMessage aMessage, nsIPresShell* aPresShell, nsIContent* aMouseTarget, - nsWeakFrame aCurrentTarget, + AutoWeakFrame aCurrentTarget, bool aNoContentDispatch) { WidgetMouseEvent event(aEvent->IsTrusted(), aMessage, @@ -4699,7 +4699,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent, } // HandleEvent clears out mCurrentTarget which we might need again - nsWeakFrame currentTarget = mCurrentTarget; + AutoWeakFrame currentTarget = mCurrentTarget; ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseClick, presShell, mouseContent, currentTarget, notDispatchToContents); diff --git a/dom/events/EventStateManager.h b/dom/events/EventStateManager.h index d0461e7faede..e2221311099c 100644 --- a/dom/events/EventStateManager.h +++ b/dom/events/EventStateManager.h @@ -54,7 +54,7 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(OverOutElementsWrapper) - nsWeakFrame mLastOverFrame; + AutoWeakFrame mLastOverFrame; nsCOMPtr mLastOverElement; @@ -408,7 +408,7 @@ protected: EventMessage aMessage, nsIContent* aRelatedTarget, nsIContent* aTargetContent, - nsWeakFrame& aTargetFrame); + AutoWeakFrame& aTargetFrame); /** * Update the initial drag session data transfer with any changes that occur * on cloned data transfer objects used for events. @@ -420,7 +420,7 @@ protected: EventMessage aMessage, nsIPresShell* aPresShell, nsIContent* aMouseTarget, - nsWeakFrame aCurrentTarget, + AutoWeakFrame aCurrentTarget, bool aNoContentDispatch); nsresult SetClickCount(WidgetMouseEvent* aEvent, nsEventStatus* aStatus); nsresult CheckForAndDispatchClick(WidgetMouseEvent* aEvent, @@ -930,9 +930,9 @@ private: // to content. static LayoutDeviceIntPoint sSynthCenteringPoint; - nsWeakFrame mCurrentTarget; + AutoWeakFrame mCurrentTarget; nsCOMPtr mCurrentTargetContent; - static nsWeakFrame sLastDragOverFrame; + static AutoWeakFrame sLastDragOverFrame; // Stores the mRefPoint (the offset from the widget's origin in device // pixels) of the last mouse event. diff --git a/dom/events/WheelHandlingHelper.cpp b/dom/events/WheelHandlingHelper.cpp index 81f2b6bfabf8..4b0cc6b6a36b 100644 --- a/dom/events/WheelHandlingHelper.cpp +++ b/dom/events/WheelHandlingHelper.cpp @@ -83,7 +83,7 @@ WheelHandlingUtils::CanScrollOn(nsIScrollableFrame* aScrollFrame, /* mozilla::WheelTransaction */ /******************************************************************/ -nsWeakFrame WheelTransaction::sTargetFrame(nullptr); +AutoWeakFrame WheelTransaction::sTargetFrame(nullptr); uint32_t WheelTransaction::sTime = 0; uint32_t WheelTransaction::sMouseMoved = 0; nsITimer* WheelTransaction::sTimer = nullptr; @@ -179,7 +179,7 @@ WheelTransaction::EndTransaction() /* static */ bool WheelTransaction::WillHandleDefaultAction(WidgetWheelEvent* aWheelEvent, - nsWeakFrame& aTargetWeakFrame) + AutoWeakFrame& aTargetWeakFrame) { nsIFrame* lastTargetFrame = GetTargetFrame(); if (!lastTargetFrame) { @@ -427,8 +427,8 @@ const DeltaValues ScrollbarsForWheel::directions[kNumberOfTargets] = { DeltaValues(-1, 0), DeltaValues(+1, 0), DeltaValues(0, -1), DeltaValues(0, +1) }; -nsWeakFrame ScrollbarsForWheel::sActiveOwner = nullptr; -nsWeakFrame ScrollbarsForWheel::sActivatedScrollTargets[kNumberOfTargets] = { +AutoWeakFrame ScrollbarsForWheel::sActiveOwner = nullptr; +AutoWeakFrame ScrollbarsForWheel::sActivatedScrollTargets[kNumberOfTargets] = { nullptr, nullptr, nullptr, nullptr }; @@ -520,7 +520,7 @@ ScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets( { for (size_t i = 0; i < kNumberOfTargets; i++) { const DeltaValues *dir = &directions[i]; - nsWeakFrame* scrollTarget = &sActivatedScrollTargets[i]; + AutoWeakFrame* scrollTarget = &sActivatedScrollTargets[i]; MOZ_ASSERT(!*scrollTarget, "scroll target still temporarily activated!"); nsIScrollableFrame* target = do_QueryFrame( aESM->ComputeScrollTarget(aTargetFrame, dir->deltaX, dir->deltaY, aEvent, @@ -538,7 +538,7 @@ ScrollbarsForWheel::TemporarilyActivateAllPossibleScrollTargets( ScrollbarsForWheel::DeactivateAllTemporarilyActivatedScrollTargets() { for (size_t i = 0; i < kNumberOfTargets; i++) { - nsWeakFrame* scrollTarget = &sActivatedScrollTargets[i]; + AutoWeakFrame* scrollTarget = &sActivatedScrollTargets[i]; if (*scrollTarget) { nsIScrollbarMediator* scrollbarMediator = do_QueryFrame(*scrollTarget); if (scrollbarMediator) { diff --git a/dom/events/WheelHandlingHelper.h b/dom/events/WheelHandlingHelper.h index b88aa23b2d4c..b67a35e69981 100644 --- a/dom/events/WheelHandlingHelper.h +++ b/dom/events/WheelHandlingHelper.h @@ -96,8 +96,8 @@ public: protected: static const size_t kNumberOfTargets = 4; static const DeltaValues directions[kNumberOfTargets]; - static nsWeakFrame sActiveOwner; - static nsWeakFrame sActivatedScrollTargets[kNumberOfTargets]; + static AutoWeakFrame sActiveOwner; + static AutoWeakFrame sActivatedScrollTargets[kNumberOfTargets]; static bool sHadWheelStart; static bool sOwnWheelTransaction; @@ -134,11 +134,11 @@ public: * action. Otherwise, true. */ static bool WillHandleDefaultAction(WidgetWheelEvent* aWheelEvent, - nsWeakFrame& aTargetWeakFrame); + AutoWeakFrame& aTargetWeakFrame); static bool WillHandleDefaultAction(WidgetWheelEvent* aWheelEvent, nsIFrame* aTargetFrame) { - nsWeakFrame targetWeakFrame(aTargetFrame); + AutoWeakFrame targetWeakFrame(aTargetFrame); return WillHandleDefaultAction(aWheelEvent, targetWeakFrame); } static void OnEvent(WidgetEvent* aEvent); @@ -169,7 +169,7 @@ protected: static double ComputeAcceleratedWheelDelta(double aDelta, int32_t aFactor); static bool OutOfTime(uint32_t aBaseTime, uint32_t aThreshold); - static nsWeakFrame sTargetFrame; + static AutoWeakFrame sTargetFrame; static uint32_t sTime; // in milliseconds static uint32_t sMouseMoved; // in milliseconds static nsITimer* sTimer; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index fd71a296c33b..d57875ffb218 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -4119,7 +4119,7 @@ HTMLInputElement::PreHandleEvent(EventChainVisitor& aVisitor) nsAutoString value; numberControlFrame->GetValueOfAnonTextControl(value); numberControlFrame->HandlingInputEvent(true); - nsWeakFrame weakNumberControlFrame(numberControlFrame); + AutoWeakFrame weakNumberControlFrame(numberControlFrame); rv = SetValueInternal(value, nsTextEditorState::eSetValue_BySetUserInput | nsTextEditorState::eSetValue_Notify); diff --git a/dom/html/HTMLSelectElement.cpp b/dom/html/HTMLSelectElement.cpp index 5d0b00a69803..fd7bc01eefd8 100644 --- a/dom/html/HTMLSelectElement.cpp +++ b/dom/html/HTMLSelectElement.cpp @@ -278,7 +278,7 @@ HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions, // since if there's no frame for the select yet the select will // get into the right state once it's created. nsISelectControlFrame* selectFrame = nullptr; - nsWeakFrame weakSelectFrame; + AutoWeakFrame weakSelectFrame; bool didGetFrame = false; // Actually select the options if the added options warrant it @@ -931,7 +931,7 @@ HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex, nsISelectControlFrame* selectFrame = nullptr; bool didGetFrame = false; - nsWeakFrame weakSelectFrame; + AutoWeakFrame weakSelectFrame; if (aOptionsMask & IS_SELECTED) { // Setting selectedIndex to an out-of-bounds index means -1. (HTML5) diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp index 6b9c3153c28e..088ebbaa02f9 100644 --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -121,7 +121,7 @@ public: return NS_OK; } - // Let the text editor tell us we're no longer relevant - avoids use of nsWeakFrame + // Let the text editor tell us we're no longer relevant - avoids use of AutoWeakFrame void Revoke() { mFrame = nullptr; mTextEditorState = nullptr; @@ -790,7 +790,7 @@ NS_IMETHODIMP nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* aSel, int16_t aReason) { bool collapsed; - nsWeakFrame weakFrame = mFrame; + AutoWeakFrame weakFrame = mFrame; if (!aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed))) return NS_OK; @@ -941,7 +941,7 @@ nsTextInputListener::EditAction() return NS_OK; } - nsWeakFrame weakFrame = mFrame; + AutoWeakFrame weakFrame = mFrame; nsITextControlFrame* frameBase = do_QueryFrame(mFrame); nsTextControlFrame* frame = static_cast (frameBase); @@ -2126,7 +2126,7 @@ nsTextEditorState::SetValue(const nsAString& aValue, uint32_t aFlags) nsAutoString currentValue; mBoundFrame->GetText(currentValue); - nsWeakFrame weakFrame(mBoundFrame); + AutoWeakFrame weakFrame(mBoundFrame); // this is necessary to avoid infinite recursion if (!currentValue.Equals(newValue)) diff --git a/layout/base/AccessibleCaretManager.cpp b/layout/base/AccessibleCaretManager.cpp index 729076db1c8e..2d8bed21f4c1 100644 --- a/layout/base/AccessibleCaretManager.cpp +++ b/layout/base/AccessibleCaretManager.cpp @@ -588,7 +588,7 @@ AccessibleCaretManager::SelectWordOrShortcut(const nsPoint& aPoint) } // Find the frame under point. - nsWeakFrame ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, aPoint, + AutoWeakFrame ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, aPoint, nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | nsLayoutUtils::IGNORE_CROSS_DOC); if (!ptFrame.IsAlive()) { return NS_ERROR_FAILURE; @@ -1260,7 +1260,7 @@ AccessibleCaretManager::DragCaretInternal(const nsPoint& aPoint) nsIFrame* scrollable = nsLayoutUtils::GetClosestFrameOfType(anchorFrame, nsGkAtoms::scrollFrame); - nsWeakFrame weakScrollable = scrollable; + AutoWeakFrame weakScrollable = scrollable; fs->HandleClick(offsets.content, offsets.StartOffset(), offsets.EndOffset(), GetCaretMode() == CaretMode::Selection, false, offsets.associate); diff --git a/layout/base/GeometryUtils.cpp b/layout/base/GeometryUtils.cpp index 2719ccfcbd71..0de41b2980e6 100644 --- a/layout/base/GeometryUtils.cpp +++ b/layout/base/GeometryUtils.cpp @@ -263,7 +263,7 @@ void GetBoxQuads(nsINode* aNode, // No boxes to return return; } - nsWeakFrame weakFrame(frame); + AutoWeakFrame weakFrame(frame); nsIDocument* ownerDoc = aNode->OwnerDoc(); nsIFrame* relativeToFrame = GetFirstNonAnonymousFrameForGeometryNode(aOptions.mRelativeTo, ownerDoc); @@ -301,7 +301,7 @@ TransformPoints(nsINode* aTo, const GeometryNode& aFrom, CallerType aCallerType, ErrorResult& aRv) { nsIFrame* fromFrame = GetFirstNonAnonymousFrameForGeometryNode(aFrom); - nsWeakFrame weakFrame(fromFrame); + AutoWeakFrame weakFrame(fromFrame); nsIFrame* toFrame = GetFirstNonAnonymousFrameForNode(aTo); // The first frame might be destroyed now if the above call lead to an // EnsureFrameForTextNode call. We need to get the first frame again diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 8b3f6d580018..582086282279 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -665,13 +665,13 @@ nsIPresShell::SetVerifyReflowEnable(bool aEnabled) } /* virtual */ void -nsIPresShell::AddWeakFrameExternal(nsWeakFrame* aWeakFrame) +nsIPresShell::AddWeakFrameExternal(AutoWeakFrame* aWeakFrame) { AddWeakFrameInternal(aWeakFrame); } void -nsIPresShell::AddWeakFrameInternal(nsWeakFrame* aWeakFrame) +nsIPresShell::AddWeakFrameInternal(AutoWeakFrame* aWeakFrame) { if (aWeakFrame->GetFrame()) { aWeakFrame->GetFrame()->AddStateBits(NS_FRAME_EXTERNAL_REFERENCE); @@ -681,19 +681,19 @@ nsIPresShell::AddWeakFrameInternal(nsWeakFrame* aWeakFrame) } /* virtual */ void -nsIPresShell::RemoveWeakFrameExternal(nsWeakFrame* aWeakFrame) +nsIPresShell::RemoveWeakFrameExternal(AutoWeakFrame* aWeakFrame) { RemoveWeakFrameInternal(aWeakFrame); } void -nsIPresShell::RemoveWeakFrameInternal(nsWeakFrame* aWeakFrame) +nsIPresShell::RemoveWeakFrameInternal(AutoWeakFrame* aWeakFrame) { if (mWeakFrames == aWeakFrame) { mWeakFrames = aWeakFrame->GetPreviousWeakFrame(); return; } - nsWeakFrame* nextWeak = mWeakFrames; + AutoWeakFrame* nextWeak = mWeakFrames; while (nextWeak && nextWeak->GetPreviousWeakFrame() != aWeakFrame) { nextWeak = nextWeak->GetPreviousWeakFrame(); } @@ -2949,9 +2949,9 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame) { mPresContext->EventStateManager()->ClearFrameRefs(aFrame); - nsWeakFrame* weakFrame = mWeakFrames; + AutoWeakFrame* weakFrame = mWeakFrames; while (weakFrame) { - nsWeakFrame* prev = weakFrame->GetPreviousWeakFrame(); + AutoWeakFrame* prev = weakFrame->GetPreviousWeakFrame(); if (weakFrame->GetFrame() == aFrame) { // This removes weakFrame from mWeakFrames. weakFrame->Clear(this); @@ -7133,7 +7133,7 @@ PresShell::HandleEvent(nsIFrame* aFrame, NS_ASSERTION(aFrame, "aFrame should be not null"); if (sPointerEventEnabled) { - nsWeakFrame weakFrame(aFrame); + AutoWeakFrame weakFrame(aFrame); nsCOMPtr targetContent; DispatchPointerFromMouseOrTouch(this, aFrame, aEvent, aDontRetargetEvents, aEventStatus, @@ -7295,7 +7295,7 @@ PresShell::HandleEvent(nsIFrame* aFrame, nsIDocument::UnlockPointer(); } - nsWeakFrame weakFrame(frame); + AutoWeakFrame weakFrame(frame); { // scope for scriptBlocker. nsAutoScriptBlocker scriptBlocker; FlushThrottledStyles(GetRootPresShell()->GetDocument(), nullptr); @@ -7516,7 +7516,7 @@ PresShell::HandleEvent(nsIFrame* aFrame, if (WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent()) { // Try to keep frame for following check, because // frame can be damaged during CheckPointerCaptureState. - nsWeakFrame frameKeeper(frame); + AutoWeakFrame frameKeeper(frame); // Handle pending pointer capture before any pointer events except // gotpointercapture / lostpointercapture. CheckPointerCaptureState(pointerEvent->pointerId, @@ -7666,7 +7666,7 @@ PresShell::HandleEvent(nsIFrame* aFrame, // Before HandlePositionedEvent we should save mPointerEventTarget in some // cases - nsWeakFrame weakFrame; + AutoWeakFrame weakFrame; if (sPointerEventEnabled && aTargetContent && ePointerEventClass == aEvent->mClass) { weakFrame = frame; @@ -9527,7 +9527,7 @@ PresShell::Observe(nsISupports* aSubject, if (rootFrame) { NS_ASSERTION(mViewManager, "View manager must exist"); - nsWeakFrame weakRoot(rootFrame); + AutoWeakFrame 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(FlushType::ContentAndNotify); diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index ba0e0b89a628..7d792679ea3a 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -78,7 +78,7 @@ class nsIDOMNode; class nsCSSFrameConstructor; class nsISelection; template class nsCOMArray; -class nsWeakFrame; +class AutoWeakFrame; class nsIScrollableFrame; class gfxContext; class nsIDOMEvent; @@ -1192,10 +1192,10 @@ public: mozilla::LayoutDeviceIntRect* aScreenRect, uint32_t aFlags) = 0; - void AddWeakFrameInternal(nsWeakFrame* aWeakFrame); - virtual void AddWeakFrameExternal(nsWeakFrame* aWeakFrame); + void AddWeakFrameInternal(AutoWeakFrame* aWeakFrame); + virtual void AddWeakFrameExternal(AutoWeakFrame* aWeakFrame); - void AddWeakFrame(nsWeakFrame* aWeakFrame) + void AddWeakFrame(AutoWeakFrame* aWeakFrame) { #ifdef MOZILLA_INTERNAL_API AddWeakFrameInternal(aWeakFrame); @@ -1204,10 +1204,10 @@ public: #endif } - void RemoveWeakFrameInternal(nsWeakFrame* aWeakFrame); - virtual void RemoveWeakFrameExternal(nsWeakFrame* aWeakFrame); + void RemoveWeakFrameInternal(AutoWeakFrame* aWeakFrame); + virtual void RemoveWeakFrameExternal(AutoWeakFrame* aWeakFrame); - void RemoveWeakFrame(nsWeakFrame* aWeakFrame) + void RemoveWeakFrame(AutoWeakFrame* aWeakFrame) { #ifdef MOZILLA_INTERNAL_API RemoveWeakFrameInternal(aWeakFrame); @@ -1816,7 +1816,7 @@ protected: nsSize mScrollPositionClampingScrollPortSize; // A list of weak frames. This is a pointer to the last item in the list. - nsWeakFrame* mWeakFrames; + AutoWeakFrame* mWeakFrames; // Most recent canvas background color. nscolor mCanvasBackgroundColor; diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index dc90e8bf77b2..3be9b301337b 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -268,7 +268,7 @@ nsComboboxControlFrame::AccessibleType() void nsComboboxControlFrame::SetFocus(bool aOn, bool aRepaint) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (aOn) { nsListControlFrame::ComboboxFocusSet(); sFocused = this; @@ -352,7 +352,7 @@ nsComboboxControlFrame::ShowList(bool aShowList) } } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ShowPopup(aShowList); // might destroy us if (!weakFrame.IsAlive()) { return false; @@ -413,7 +413,7 @@ public: return NS_OK; } - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; void @@ -527,7 +527,7 @@ public: } return NS_OK; } - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; class nsAsyncResize : public Runnable @@ -556,7 +556,7 @@ public: } return NS_OK; } - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; void @@ -1025,7 +1025,7 @@ nsComboboxControlFrame::HandleRedisplayTextEvent() // 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); + AutoWeakFrame weakThis(this); PresContext()->Document()-> FlushPendingNotifications(FlushType::ContentAndNotify); if (!weakThis.IsAlive()) @@ -1094,7 +1094,7 @@ nsComboboxControlFrame::AddOption(int32_t aIndex) NS_IMETHODIMP nsComboboxControlFrame::RemoveOption(int32_t aIndex) { - nsWeakFrame weakThis(this); + AutoWeakFrame weakThis(this); if (mListControlFrame->GetNumberOfOptions() > 0) { if (aIndex < mDisplayedIndex) { --mDisplayedIndex; @@ -1460,7 +1460,7 @@ nsComboboxControlFrame::Rollup(uint32_t aCount, bool aFlush, } bool consume = !!COMBOBOX_ROLLUP_CONSUME_EVENT; - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mListControlFrame->AboutToRollup(); // might destroy us if (!weakFrame.IsAlive()) { return consume; @@ -1625,7 +1625,7 @@ nsComboboxControlFrame::OnOptionSelected(int32_t aIndex, bool aSelected) nsAutoScriptBlocker blocker; RedisplayText(aIndex); } else { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); RedisplaySelectedText(); if (weakFrame.IsAlive()) { FireValueChangeEvent(); // Fire after old option is unselected diff --git a/layout/forms/nsDateTimeControlFrame.h b/layout/forms/nsDateTimeControlFrame.h index 5ca599f6f78e..d9a267f468f8 100644 --- a/layout/forms/nsDateTimeControlFrame.h +++ b/layout/forms/nsDateTimeControlFrame.h @@ -103,7 +103,7 @@ private: } private: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; /** diff --git a/layout/forms/nsFileControlFrame.h b/layout/forms/nsFileControlFrame.h index 55c51d426c90..5955b75e1890 100644 --- a/layout/forms/nsFileControlFrame.h +++ b/layout/forms/nsFileControlFrame.h @@ -111,7 +111,7 @@ protected: } private: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; class DnDListener: public MouseListener { diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 47603ab2026b..0622b5d818d4 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -672,7 +672,7 @@ nsListControlFrame::SingleSelection(int32_t aClickedIndex, bool aDoToggle) wasChanged = SetOptionsSelectedFromFrame(aClickedIndex, aClickedIndex, true, true); } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ScrollToIndex(aClickedIndex); if (!weakFrame.IsAlive()) { return wasChanged; @@ -808,7 +808,7 @@ nsListControlFrame::PerformSelection(int32_t aClickedIndex, // Clear only if control was not pressed wasChanged = ExtendedSelection(startIndex, endIndex, !aIsControl); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ScrollToIndex(aClickedIndex); if (!weakFrame.IsAlive()) { return wasChanged; @@ -1056,7 +1056,7 @@ nsListControlFrame::ResetList(bool aAllowScrolling) NS_ASSERTION(selectElement, "No select element!"); if (selectElement) { selectElement->GetSelectedIndex(&indexToSelect); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ScrollToIndex(indexToSelect); if (!weakFrame.IsAlive()) { return; @@ -1329,7 +1329,7 @@ nsListControlFrame::UpdateSelection() { if (mIsAllFramesHere) { // if it's a combobox, display the new text - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (mComboboxFrame) { mComboboxFrame->RedisplaySelectedText(); @@ -1357,7 +1357,7 @@ nsListControlFrame::ComboboxFinish(int32_t aIndex) // Make sure we can always reset to the displayed index mForceSelection = displayIndex == aIndex; - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); PerformSelection(aIndex, false, false); // might destroy us if (!weakFrame.IsAlive() || !mComboboxFrame) { return; @@ -1410,7 +1410,7 @@ nsListControlFrame::OnSetSelectedIndex(int32_t aOldIndex, int32_t aNewIndex) mComboboxFrame->UpdateRecentIndex(NS_SKIP_NOTIFY_INDEX); } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ScrollToIndex(aNewIndex); if (!weakFrame.IsAlive()) { return NS_OK; @@ -1476,7 +1476,7 @@ nsListControlFrame::AboutToDropDown() mLastDropdownBackstopColor); if (mIsAllContentHere && mIsAllFramesHere && mHasBeenInitialized) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ScrollToIndex(GetSelectedIndex()); if (!weakFrame.IsAlive()) { return; @@ -1686,7 +1686,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent) } if (kNothingSelected != selectedIndex) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ComboboxFinish(selectedIndex); if (!weakFrame.IsAlive()) { return NS_OK; @@ -1847,7 +1847,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) // Handle Like List mButtonDown = true; CaptureMouseEvents(true); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); bool change = HandleListSelection(aMouseEvent, selectedIndex); // might destroy us if (!weakFrame.IsAlive()) { @@ -1886,7 +1886,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) { bool isDroppedDown = mComboboxFrame->IsDroppedDown(); nsIFrame* comboFrame = do_QueryFrame(mComboboxFrame); - nsWeakFrame weakFrame(comboFrame); + AutoWeakFrame weakFrame(comboFrame); mComboboxFrame->ShowDropDown(!isDroppedDown); if (!weakFrame.IsAlive()) return NS_OK; @@ -1949,7 +1949,7 @@ nsListControlFrame::DragMove(nsIDOMEvent* aMouseEvent) #else mouseEvent->GetCtrlKey(&isControl); #endif - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); // Turn SHIFT on when you are dragging, unless control is on. bool wasChanged = PerformSelection(selectedIndex, !isControl, isControl); @@ -2121,7 +2121,7 @@ nsListControlFrame::DropDownToggleKey(nsIDOMEvent* aKeyEvent) mComboboxFrame->ShowDropDown(true); } } else { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); // mEndSelectionIndex is the last item that got selected. ComboboxFinish(mEndSelectionIndex); if (weakFrame.IsAlive()) { @@ -2236,7 +2236,7 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent) // consumed while the dropdown is open for security. aKeyEvent->PreventDefault(); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); ComboboxFinish(mEndSelectionIndex); if (!weakFrame.IsAlive()) { return NS_OK; @@ -2448,7 +2448,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent) uint32_t numOptions = options->Length(); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); for (uint32_t i = 0; i < numOptions; ++i) { uint32_t index = (i + startIndex) % numOptions; RefPtr optionElement = @@ -2507,7 +2507,7 @@ nsListControlFrame::PostHandleKeyEvent(int32_t aNewIndex, // If you hold control, but not shift, no key will actually do anything // except space. - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); bool wasChanged = false; if (aIsControlOrMeta && !aIsShift && aCharCode != ' ') { mStartSelectionIndex = aNewIndex; diff --git a/layout/forms/nsNumberControlFrame.h b/layout/forms/nsNumberControlFrame.h index 5396e71703db..26165ed510dd 100644 --- a/layout/forms/nsNumberControlFrame.h +++ b/layout/forms/nsNumberControlFrame.h @@ -192,7 +192,7 @@ private: } private: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; /** diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index d10887d8aad7..50936ac64a15 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -250,7 +250,7 @@ nsTextControlFrame::EnsureEditorInitialized() nsIDocument* doc = mContent->GetComposedDoc(); NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); - nsWeakFrame weakFrame(this); + AutoWeakFrame 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 @@ -711,7 +711,7 @@ nsresult nsTextControlFrame::SetFormProperty(nsIAtom* aName, const nsAString& aV // of select all which merely builds a range that selects // all of the content and adds that to the selection. - nsWeakFrame weakThis = this; + AutoWeakFrame weakThis = this; SelectAllOrCollapseToEndOfText(true); // NOTE: can destroy the world if (!weakThis.IsAlive()) { return NS_OK; @@ -1200,7 +1200,7 @@ nsTextControlFrame::SetValueChanged(bool aValueChanged) NS_ASSERTION(txtCtrl, "Content not a text control element"); if (mUsePlaceholder) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); txtCtrl->UpdatePlaceholderVisibility(true); if (!weakFrame.IsAlive()) { return; @@ -1256,7 +1256,7 @@ nsTextControlFrame::UpdateValueDisplay(bool aNotify, // editor, since EnsureEditorInitialized takes care of this. if (mUsePlaceholder && !aBeforeEditorInit) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); txtCtrl->UpdatePlaceholderVisibility(aNotify); NS_ENSURE_STATE(weakFrame.IsAlive()); } diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index 0ccbcb6531db..7e71dc79ba14 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -240,7 +240,7 @@ protected: NS_IMETHOD Run() override; - // avoids use of nsWeakFrame + // avoids use of AutoWeakFrame void Revoke() { mFrame = nullptr; } diff --git a/layout/generic/ScrollbarActivity.cpp b/layout/generic/ScrollbarActivity.cpp index 1c4adf6cbb2e..ebe6bd0be8bd 100644 --- a/layout/generic/ScrollbarActivity.cpp +++ b/layout/generic/ScrollbarActivity.cpp @@ -374,7 +374,7 @@ ScrollbarActivity::UpdateOpacity(TimeStamp aTime) double opacity = 1.0 - std::max(0.0, std::min(1.0, progress)); // 'this' may be getting destroyed during SetOpacityOnElement calls. - nsWeakFrame weakFrame((do_QueryFrame(mScrollableFrame))); + AutoWeakFrame weakFrame((do_QueryFrame(mScrollableFrame))); SetOpacityOnElement(GetHorizontalScrollbar(), opacity); if (!weakFrame.IsAlive()) { return false; @@ -408,7 +408,7 @@ ScrollbarActivity::SetIsFading(bool aNewFading) if (!mIsFading) { mFadeBeginTime = TimeStamp(); // 'this' may be getting destroyed during UnsetOpacityOnElement calls. - nsWeakFrame weakFrame((do_QueryFrame(mScrollableFrame))); + AutoWeakFrame weakFrame((do_QueryFrame(mScrollableFrame))); UnsetOpacityOnElement(GetHorizontalScrollbar()); if (!weakFrame.IsAlive()) { return false; diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 015d008489a7..aeef0de0bd44 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -686,7 +686,7 @@ nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext, } RefPtr kungFuDeathGrip(aPresContext); - nsWeakFrame weak(rootFrame); + AutoWeakFrame weak(rootFrame); nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(aFrame, rootFrame); int32_t shadow = rootFrame->StyleUIReset()->mWindowShadow; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 9d78524a95e4..7034dbaa4516 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -407,13 +407,13 @@ nsIFrame::ContentStatesChanged(mozilla::EventStates aStates) } void -nsWeakFrame::Init(nsIFrame* aFrame) +AutoWeakFrame::Init(nsIFrame* aFrame) { Clear(mFrame ? mFrame->PresContext()->GetPresShell() : nullptr); mFrame = aFrame; if (mFrame) { nsIPresShell* shell = mFrame->PresContext()->GetPresShell(); - NS_WARNING_ASSERTION(shell, "Null PresShell in nsWeakFrame!"); + NS_WARNING_ASSERTION(shell, "Null PresShell in AutoWeakFrame!"); if (shell) { shell->AddWeakFrame(this); } else { @@ -3420,7 +3420,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext, RefPtr fc = const_cast(frameselection); if (mouseEvent->mClickCount > 1) { // These methods aren't const but can't actually delete anything, - // so no need for nsWeakFrame. + // so no need for AutoWeakFrame. fc->SetDragState(true); fc->SetMouseDoubleDown(true); return HandleMultiplePress(aPresContext, mouseEvent, aEventStatus, control); @@ -3751,7 +3751,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext, getter_AddRefs(parentContent), &contentOffset, &target); - nsWeakFrame weakThis = this; + AutoWeakFrame weakThis = this; if (NS_SUCCEEDED(result) && parentContent) { frameselection->HandleTableSelection(parentContent, contentOffset, target, mouseEvent); diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index a41633e857d4..1fa51cca25c6 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -1256,7 +1256,7 @@ nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext, } int32_t change; // measured positive from left-to-right or top-to-bottom - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (mDragger->mVertical) { change = aPresContext->DevPixelsToAppUnits( aEvent->mRefPoint.x - mFirstDragPoint.x); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index b96ef0d91366..7a27845734d4 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2151,7 +2151,7 @@ ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsIAtom* aOrigin) // Apply desired destination range since this is the last step of scrolling. mAsyncSmoothMSDScroll = nullptr; mAsyncScroll = nullptr; - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); ScrollToImpl(mDestination, aRange, aOrigin); if (!weakFrame.IsAlive()) { return; @@ -2904,7 +2904,7 @@ ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, nsIAtom* aOri { // scope the AutoScrollbarRepaintSuppression AutoScrollbarRepaintSuppression repaintSuppression(this, !schedulePaint); - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); UpdateScrollbarPosition(); if (!weakFrame.IsAlive()) { return; @@ -4017,7 +4017,7 @@ ScrollFrameHelper::ScrollBy(nsIntPoint aDelta, rangeLowerY, rangeUpperX - rangeLowerX, rangeUpperY - rangeLowerY); - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); ScrollToWithOrigin(newPos, aMode, aOrigin, &range); if (!weakFrame.IsAlive()) { return; @@ -4224,7 +4224,7 @@ ScrollFrameHelper::ScrollToRestoredPosition() scrollToPos.x = mScrollPort.x - (mScrollPort.XMost() - scrollToPos.x - mScrolledFrame->GetRect().width); } - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); ScrollToWithOrigin(scrollToPos, nsIScrollableFrame::INSTANT, nsGkAtoms::restore, nullptr); if (!weakFrame.IsAlive()) { @@ -4601,7 +4601,7 @@ ScrollFrameHelper::Destroy() void ScrollFrameHelper::UpdateScrollbarPosition() { - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); mFrameIsUpdatingScrollbar = true; nsPoint pt = GetScrollPosition(); @@ -4673,7 +4673,7 @@ void ScrollFrameHelper::CurPosAttributeChanged(nsIContent* aContent) // didn't actually move yet. We need to make sure other listeners // see that the scroll position is not (yet) what they thought it // was. - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); UpdateScrollbarPosition(); if (!weakFrame.IsAlive()) { return; @@ -5309,7 +5309,7 @@ ScrollFrameHelper::ReflowFinished() // for scrollbars. XXXmats is this still true now that we have a script // blocker in this scope? (if not, remove the weak frame checks below). if (vScroll || hScroll) { - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); nsPoint scrollPos = GetScrollPosition(); nsSize lineScrollAmount = GetLineScrollAmount(); if (vScroll) { @@ -5673,7 +5673,7 @@ ScrollFrameHelper::SetCoordAttribute(nsIContent* aContent, nsIAtom* aAtom, if (aContent->AttrValueIs(kNameSpaceID_None, aAtom, newValue, eCaseMatters)) return; - nsWeakFrame weakFrame(mOuter); + AutoWeakFrame weakFrame(mOuter); nsCOMPtr kungFuDeathGrip = aContent; aContent->SetAttr(kNameSpaceID_None, aAtom, newValue, true); MOZ_ASSERT(ShellIsAlive(weakShell), "pres shell was destroyed by scrolling"); diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index e4c97d04837a..24e8fd5dd34f 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -3816,11 +3816,11 @@ public: //---------------------------------------------------------------------- /** - * nsWeakFrame can be used to keep a reference to a nsIFrame in a safe way. - * Whenever an nsIFrame object is deleted, the nsWeakFrames pointing + * AutoWeakFrame can be used to keep a reference to a nsIFrame in a safe way. + * Whenever an nsIFrame object is deleted, the AutoWeakFrames pointing * to it will be cleared. * - * Create nsWeakFrame object when it is sure that nsIFrame object + * Create AutoWeakFrame object when it is sure that nsIFrame object * is alive and after some operations which may destroy the nsIFrame * (for example any DOM modifications) use IsAlive() or GetFrame() methods to * check whether it is safe to continue to use the nsIFrame object. @@ -3828,26 +3828,26 @@ public: * @note The usage of this class should be kept to a minimum. */ -class nsWeakFrame { +class AutoWeakFrame { public: - nsWeakFrame() : mPrev(nullptr), mFrame(nullptr) { } + AutoWeakFrame() : mPrev(nullptr), mFrame(nullptr) { } - nsWeakFrame(const nsWeakFrame& aOther) : mPrev(nullptr), mFrame(nullptr) + AutoWeakFrame(const AutoWeakFrame& aOther) : mPrev(nullptr), mFrame(nullptr) { Init(aOther.GetFrame()); } - MOZ_IMPLICIT nsWeakFrame(nsIFrame* aFrame) : mPrev(nullptr), mFrame(nullptr) + MOZ_IMPLICIT AutoWeakFrame(nsIFrame* aFrame) : mPrev(nullptr), mFrame(nullptr) { Init(aFrame); } - nsWeakFrame& operator=(nsWeakFrame& aOther) { + AutoWeakFrame& operator=(AutoWeakFrame& aOther) { Init(aOther.GetFrame()); return *this; } - nsWeakFrame& operator=(nsIFrame* aFrame) { + AutoWeakFrame& operator=(nsIFrame* aFrame) { Init(aFrame); return *this; } @@ -3874,18 +3874,18 @@ public: nsIFrame* GetFrame() const { return mFrame; } - nsWeakFrame* GetPreviousWeakFrame() { return mPrev; } + AutoWeakFrame* GetPreviousWeakFrame() { return mPrev; } - void SetPreviousWeakFrame(nsWeakFrame* aPrev) { mPrev = aPrev; } + void SetPreviousWeakFrame(AutoWeakFrame* aPrev) { mPrev = aPrev; } - ~nsWeakFrame() + ~AutoWeakFrame() { Clear(mFrame ? mFrame->PresContext()->GetPresShell() : nullptr); } private: void Init(nsIFrame* aFrame); - nsWeakFrame* mPrev; + AutoWeakFrame* mPrev; nsIFrame* mFrame; }; diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index e65bd06cf5e4..12f3b2805e8b 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -1852,7 +1852,7 @@ nsPluginFrame::EndSwapDocShells(nsISupports* aSupports, void*) nsIWidget* parent = rootPC->PresShell()->GetRootFrame()->GetNearestWidget(); widget->SetParent(parent); - nsWeakFrame weakFrame(objectFrame); + AutoWeakFrame weakFrame(objectFrame); objectFrame->CallSetWindow(); if (!weakFrame.IsAlive()) { return; diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 879f70959054..e6399d832929 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -304,7 +304,7 @@ public: { if (mSelection && mPresContext) { - nsWeakFrame frame = + AutoWeakFrame frame = mContent ? mPresContext->GetPrimaryFrameFor(mContent) : nullptr; if (!frame) return NS_OK; @@ -4860,8 +4860,8 @@ Selection::DoAutoScroll(nsIFrame* aFrame, nsPoint& aPoint) if (!rootPC) return NS_OK; nsIFrame* rootmostFrame = rootPC->PresShell()->FrameManager()->GetRootFrame(); - nsWeakFrame weakRootFrame(rootmostFrame); - nsWeakFrame weakFrame(aFrame); + AutoWeakFrame weakRootFrame(rootmostFrame); + AutoWeakFrame weakFrame(aFrame); // Get the point relative to the root most frame because the scroll we are // about to do will change the coordinates of aFrame. nsPoint globalPoint = aPoint + aFrame->GetOffsetToCrossDoc(rootmostFrame); diff --git a/layout/generic/nsSimplePageSequenceFrame.cpp b/layout/generic/nsSimplePageSequenceFrame.cpp index 0c1ec36a0320..fb0036d5f40f 100644 --- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -661,7 +661,7 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a ctx->InitializeWithDrawTarget(nullptr, WrapNotNull(canvasTarget)); // Start the rendering process. - nsWeakFrame weakFrame = this; + AutoWeakFrame weakFrame = this; canvas->DispatchPrintCallback(aCallback); NS_ENSURE_STATE(weakFrame.IsAlive()); } diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index c816474c7328..11eade3717b9 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -93,7 +93,7 @@ public: return NS_OK; } private: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; static void @@ -181,7 +181,7 @@ nsSubDocumentFrame::ShowViewer() RefPtr frameloader = FrameLoader(); if (frameloader) { CSSIntSize margin = GetMarginAttributes(); - nsWeakFrame weakThis(this); + AutoWeakFrame weakThis(this); mCallingShow = true; const nsAttrValue* attrValue = GetContent()->AsElement()->GetParsedAttr(nsGkAtoms::scrolling); @@ -815,7 +815,7 @@ bool nsSubDocumentFrame::ReflowFinished() { if (mFrameLoader) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mFrameLoader->UpdatePositionAndSize(this); @@ -1182,8 +1182,8 @@ void nsSubDocumentFrame::EndSwapDocShells(nsIFrame* aOther) { nsSubDocumentFrame* other = static_cast(aOther); - nsWeakFrame weakThis(this); - nsWeakFrame weakOther(aOther); + AutoWeakFrame weakThis(this); + AutoWeakFrame weakOther(aOther); if (mInnerView) { ::EndSwapDocShellsForViews(mInnerView->GetFirstChild()); diff --git a/layout/painting/ActiveLayerTracker.cpp b/layout/painting/ActiveLayerTracker.cpp index e3024fe509ab..31e65ae1e446 100644 --- a/layout/painting/ActiveLayerTracker.cpp +++ b/layout/painting/ActiveLayerTracker.cpp @@ -105,7 +105,7 @@ public: // The scroll frame during for which we most recently received a call to // NotifyAnimatedFromScrollHandler. - nsWeakFrame mAnimatingScrollHandlerFrame; + AutoWeakFrame mAnimatingScrollHandlerFrame; // The set of activities that were triggered during // mAnimatingScrollHandlerFrame's scroll event handler. EnumSet mScrollHandlerInducedActivity; @@ -132,7 +132,7 @@ public: virtual void NotifyExpired(LayerActivity* aObject); public: - nsWeakFrame mCurrentScrollHandlerFrame; + AutoWeakFrame mCurrentScrollHandlerFrame; private: bool mDestroying; diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index 2b71433972f5..c12820596edc 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -263,7 +263,7 @@ protected: mozilla::UniquePtr mPrt; nsPagePrintTimer* mPagePrintTimer; - nsWeakFrame mPageSeqFrame; + AutoWeakFrame mPageSeqFrame; // Print Preview mozilla::UniquePtr mPrtPreview; diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 0bf87da6c81d..e480b836db39 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -4861,7 +4861,7 @@ public: return NS_OK; } private: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; bool diff --git a/layout/xul/nsListBoxBodyFrame.cpp b/layout/xul/nsListBoxBodyFrame.cpp index 92d32eea0260..8ec50989aa55 100644 --- a/layout/xul/nsListBoxBodyFrame.cpp +++ b/layout/xul/nsListBoxBodyFrame.cpp @@ -332,7 +332,7 @@ nsListBoxBodyFrame::ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirectio // CSS Scroll Snapping is not enabled for XUL, aSnap is ignored MOZ_ASSERT(aScrollbar != nullptr); aScrollbar->SetIncrementToPage(aDirection); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); int32_t newPos = aScrollbar->MoveToNewPosition(); if (!weakFrame.IsAlive()) { return; @@ -347,7 +347,7 @@ nsListBoxBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirecti // CSS Scroll Snapping is not enabled for XUL, aSnap is ignored MOZ_ASSERT(aScrollbar != nullptr); aScrollbar->SetIncrementToWhole(aDirection); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); int32_t newPos = aScrollbar->MoveToNewPosition(); if (!weakFrame.IsAlive()) { return; @@ -362,7 +362,7 @@ nsListBoxBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirectio // CSS Scroll Snapping is not enabled for XUL, aSnap is ignored MOZ_ASSERT(aScrollbar != nullptr); aScrollbar->SetIncrementToLine(aDirection); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); int32_t newPos = aScrollbar->MoveToNewPosition(); if (!weakFrame.IsAlive()) { return; @@ -373,7 +373,7 @@ nsListBoxBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirectio void nsListBoxBodyFrame::RepeatButtonScroll(nsScrollbarFrame* aScrollbar) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); int32_t newPos = aScrollbar->MoveToNewPosition(); if (!weakFrame.IsAlive()) { return; @@ -790,7 +790,7 @@ nsListBoxBodyFrame::ScrollToIndex(int32_t aRowIndex) mCurrentIndex = newIndex; - nsWeakFrame weak(this); + AutoWeakFrame weak(this); // Since we're going to flush anyway, we need to not do this off an event DoInternalPositionChangedSync(up, delta); @@ -843,7 +843,7 @@ nsListBoxBodyFrame::InternalPositionChanged(bool aUp, int32_t aDelta) nsresult nsListBoxBodyFrame::DoInternalPositionChangedSync(bool aUp, int32_t aDelta) { - nsWeakFrame weak(this); + AutoWeakFrame weak(this); // Process all the pending position changes first nsTArray< RefPtr > temp; @@ -874,7 +874,7 @@ nsListBoxBodyFrame::DoInternalPositionChanged(bool aUp, int32_t aDelta) // begin timing how long it takes to scroll a row PRTime start = PR_Now(); - nsWeakFrame weakThis(this); + AutoWeakFrame weakThis(this); mContent->GetComposedDoc()->FlushPendingNotifications(FlushType::Layout); if (!weakThis.IsAlive()) { return NS_OK; @@ -970,7 +970,7 @@ nsListBoxBodyFrame::VerticalScroll(int32_t aPosition) nsPoint scrollPosition = scrollFrame->GetScrollPosition(); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); scrollFrame->ScrollTo(nsPoint(scrollPosition.x, aPosition), nsIScrollableFrame::INSTANT); if (!weakFrame.IsAlive()) { @@ -1407,7 +1407,7 @@ nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext, NS_PRECONDITION(mCurrentIndex > 0, "mCurrentIndex > 0"); --mCurrentIndex; mYPosition = mCurrentIndex*mRowHeight; - nsWeakFrame weakChildFrame(aChildFrame); + AutoWeakFrame weakChildFrame(aChildFrame); VerticalScroll(mYPosition); if (!weakChildFrame.IsAlive()) { return; @@ -1435,7 +1435,7 @@ nsListBoxBodyFrame::OnContentRemoved(nsPresContext* aPresContext, mRowsToPrepend = 1; --mCurrentIndex; mYPosition = mCurrentIndex*mRowHeight; - nsWeakFrame weakChildFrame(aChildFrame); + AutoWeakFrame weakChildFrame(aChildFrame); VerticalScroll(mYPosition); if (!weakChildFrame.IsAlive()) { return; diff --git a/layout/xul/nsListBoxBodyFrame.h b/layout/xul/nsListBoxBodyFrame.h index 57bbf0257c64..d12b1753c17b 100644 --- a/layout/xul/nsListBoxBodyFrame.h +++ b/layout/xul/nsListBoxBodyFrame.h @@ -185,7 +185,7 @@ protected: nsCOMPtr mBoxObject; // frame markers - nsWeakFrame mTopFrame; + AutoWeakFrame mTopFrame; nsIFrame* mBottomFrame; nsIFrame* mLinkupFrame; diff --git a/layout/xul/nsMenuBarFrame.cpp b/layout/xul/nsMenuBarFrame.cpp index 1ec294047c5d..7f127a492eb0 100644 --- a/layout/xul/nsMenuBarFrame.cpp +++ b/layout/xul/nsMenuBarFrame.cpp @@ -281,7 +281,7 @@ public: } if (mOldMenu) { - nsWeakFrame weakMenuBar(menubar); + AutoWeakFrame weakMenuBar(menubar); pm->HidePopup(mOldMenu, false, false, false, false); // clear the flag again if (mNewMenu && weakMenuBar.IsAlive()) diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index 05ce4b917e43..e8c76dc88a90 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -138,7 +138,7 @@ public: return NS_OK; } protected: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; nsCOMPtr mAttr; }; @@ -379,7 +379,7 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (*aEventStatus == nsEventStatus_eIgnore) *aEventStatus = nsEventStatus_eConsumeDoDefault; @@ -546,7 +546,7 @@ nsMenuFrame::PopupOpened() { gMenuJustOpenedOrClosed = true; - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::open, NS_LITERAL_STRING("true"), true); if (!weakFrame.IsAlive()) @@ -564,7 +564,7 @@ nsMenuFrame::PopupOpened() void nsMenuFrame::PopupClosed(bool aDeselectMenu) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); nsContentUtils::AddScriptRunner( new nsUnsetAttrRunnable(mContent, nsGkAtoms::open)); if (!weakFrame.IsAlive()) @@ -897,7 +897,7 @@ nsMenuFrame::Notify(nsITimer* aTimer) case 1: { // Turn the highlight back on and wait for a while before closing the menu. - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::menuactive, NS_LITERAL_STRING("true"), true); if (weakFrame.IsAlive()) { @@ -942,7 +942,7 @@ nsMenuFrame::UpdateMenuType() default: if (mType != eMenuType_Normal) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::checked, true); ENSURE_TRUE(weakFrame.IsAlive()); @@ -1036,7 +1036,7 @@ nsMenuFrame::BuildAcceleratorText(bool aNotify) AddStateBits(NS_STATE_ACCELTEXT_IS_DERIVED); // If anything below fails, just leave the accelerator text blank. - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::acceltext, aNotify); ENSURE_TRUE(weakFrame.IsAlive()); @@ -1220,7 +1220,7 @@ nsMenuFrame::StartBlinking(WidgetGUIEvent* aEvent, bool aFlipChecked) } // Blink off. - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::menuactive, true); if (!weakFrame.IsAlive()) return; diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 60c5f4204dfe..b6ebec414a58 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -450,7 +450,7 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu, if (mIsOpenChanged && !IsMenuList()) { nsIScrollableFrame *scrollframe = do_QueryFrame(nsBox::GetChildXULBox(this)); if (scrollframe) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); scrollframe->ScrollTo(nsPoint(0,0), nsIScrollableFrame::INSTANT); if (!weakFrame.IsAlive()) { return; @@ -892,7 +892,7 @@ nsMenuPopupFrame::ShowPopup(bool aIsContextMenu) nsMenuFrame* menuFrame = do_QueryFrame(GetParent()); if (menuFrame) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); menuFrame->PopupOpened(); if (!weakFrame.IsAlive()) return; diff --git a/layout/xul/nsProgressMeterFrame.cpp b/layout/xul/nsProgressMeterFrame.cpp index a798d5717828..a300b31d361c 100644 --- a/layout/xul/nsProgressMeterFrame.cpp +++ b/layout/xul/nsProgressMeterFrame.cpp @@ -31,7 +31,7 @@ public: NS_DECL_NSIRUNNABLE - nsWeakFrame mWeakFrame; + AutoWeakFrame mWeakFrame; nsIPresShell::IntrinsicDirty mIntrinsicDirty; nsFrameState mBitToAdd; }; @@ -100,7 +100,7 @@ public: delete this; } - nsWeakFrame mWeakFrame; + AutoWeakFrame mWeakFrame; }; NS_IMETHODIMP diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index 1c8c19fd6b52..774eb02734d5 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -60,7 +60,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); bool doDefault = true; switch (aEvent->mMessage) { @@ -247,7 +247,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext, nsIntRect cssRect = appUnitsRect.ToInsidePixels(nsPresContext::AppUnitsPerCSSPixel()); LayoutDeviceIntRect oldRect; - nsWeakFrame weakFrame(menuPopupFrame); + AutoWeakFrame weakFrame(menuPopupFrame); if (menuPopupFrame) { nsCOMPtr widget = menuPopupFrame->GetWidget(); if (widget) diff --git a/layout/xul/nsScrollbarButtonFrame.cpp b/layout/xul/nsScrollbarButtonFrame.cpp index 206d9717f628..07d4ef2c447e 100644 --- a/layout/xul/nsScrollbarButtonFrame.cpp +++ b/layout/xul/nsScrollbarButtonFrame.cpp @@ -130,7 +130,7 @@ nsScrollbarButtonFrame::HandleButtonPress(nsPresContext* aPresContext, bool repeat = pressedButtonAction != 2; // set this attribute so we can style it later - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::active, NS_LITERAL_STRING("true"), true); nsIPresShell::SetCapturingContent(mContent, CAPTURE_IGNOREALLOWED); diff --git a/layout/xul/nsScrollbarFrame.cpp b/layout/xul/nsScrollbarFrame.cpp index d9c28a2bf90e..5beaf6d1b400 100644 --- a/layout/xul/nsScrollbarFrame.cpp +++ b/layout/xul/nsScrollbarFrame.cpp @@ -268,7 +268,7 @@ nsScrollbarFrame::MoveToNewPosition() nsAutoString curposStr; curposStr.AppendInt(curpos); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (mSmoothScroll) { content->SetAttr(kNameSpaceID_None, nsGkAtoms::smooth, NS_LITERAL_STRING("true"), false); } diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index 8f18a491c6ff..c7b99ecf39ad 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -609,7 +609,7 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext, (uint32_t) ScrollInputMethod::MainThreadScrollbarTrackClick); // set it - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); // should aMaySnap be true here? SetCurrentThumbPosition(scrollbar, pos - thumbLength/2, false, false); NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK); @@ -876,7 +876,7 @@ nsSliderFrame::SetCurrentPositionInternal(nsIContent* aScrollbar, int32_t aNewPo { nsCOMPtr scrollbar = aScrollbar; nsIFrame* scrollbarBox = GetScrollbar(); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mUserChanged = true; diff --git a/layout/xul/nsSplitterFrame.cpp b/layout/xul/nsSplitterFrame.cpp index 231079dc0fff..a1abccee4657 100644 --- a/layout/xul/nsSplitterFrame.cpp +++ b/layout/xul/nsSplitterFrame.cpp @@ -384,7 +384,7 @@ nsSplitterFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); RefPtr inner(mInner); switch (aEvent->mMessage) { case eMouseMove: @@ -976,7 +976,7 @@ nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIFrame* aChil prefValue, eCaseMatters)) return; - nsWeakFrame weakBox(aChildBox); + AutoWeakFrame weakBox(aChildBox); content->SetAttr(kNameSpaceID_None, attribute, prefValue, true); ENSURE_TRUE(weakBox.IsAlive()); aState.PresShell()->FrameNeedsReflow(aChildBox, nsIPresShell::eStyleChange, diff --git a/layout/xul/nsTextBoxFrame.cpp b/layout/xul/nsTextBoxFrame.cpp index c82d3d6b9b02..bf997f7dcebf 100644 --- a/layout/xul/nsTextBoxFrame.cpp +++ b/layout/xul/nsTextBoxFrame.cpp @@ -187,11 +187,11 @@ public: delete this; } - nsWeakFrame mWeakFrame; + AutoWeakFrame mWeakFrame; }; bool -nsTextBoxFrame::UpdateAccesskey(nsWeakFrame& aWeakThis) +nsTextBoxFrame::UpdateAccesskey(AutoWeakFrame& aWeakThis) { nsAutoString accesskey; nsCOMPtr labelElement = do_QueryInterface(mContent); diff --git a/layout/xul/nsTextBoxFrame.h b/layout/xul/nsTextBoxFrame.h index ca1b887484ea..bcd2eecc53ea 100644 --- a/layout/xul/nsTextBoxFrame.h +++ b/layout/xul/nsTextBoxFrame.h @@ -71,7 +71,7 @@ protected: friend class nsDisplayXULTextBox; // Should be called only by nsAsyncAccesskeyUpdate. // Returns true if accesskey was updated. - bool UpdateAccesskey(nsWeakFrame& aWeakThis); + bool UpdateAccesskey(AutoWeakFrame& aWeakThis); void UpdateAccessTitle(); void UpdateAccessIndex(); diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index c797b256e6bd..500405c8a25f 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -936,7 +936,7 @@ nsXULPopupManager::ShowPopupCallback(nsIContent* aPopup, } // use a weak frame as the popup will set an open attribute if it is a menu - nsWeakFrame weakFrame(aPopupFrame); + AutoWeakFrame weakFrame(aPopupFrame); aPopupFrame->ShowPopup(aIsContextMenu); ENSURE_TRUE(weakFrame.IsAlive()); @@ -1187,7 +1187,7 @@ nsXULPopupManager::HidePopupCallback(nsIContent* aPopup, delete item; - nsWeakFrame weakFrame(aPopupFrame); + AutoWeakFrame weakFrame(aPopupFrame); aPopupFrame->HidePopup(aDeselectMenu, ePopupClosed); ENSURE_TRUE(weakFrame.IsAlive()); @@ -1265,10 +1265,10 @@ nsXULPopupManager::HidePopupsInList(const nsTArray &aFrames) // Create a weak frame list. This is done in a separate array with the // right capacity predetermined, otherwise the array would get resized and // move the weak frame pointers around. - nsTArray weakPopups(aFrames.Length()); + nsTArray weakPopups(aFrames.Length()); uint32_t f; for (f = 0; f < aFrames.Length(); f++) { - nsWeakFrame* wframe = weakPopups.AppendElement(); + AutoWeakFrame* wframe = weakPopups.AppendElement(); if (wframe) *wframe = aFrames[f]; } @@ -2902,7 +2902,7 @@ nsXULMenuCommandEvent::Run() nsCOMPtr popup; nsMenuFrame* menuFrame = do_QueryFrame(mMenu->GetPrimaryFrame()); - nsWeakFrame weakFrame(menuFrame); + AutoWeakFrame weakFrame(menuFrame); if (menuFrame && mFlipChecked) { if (menuFrame->IsChecked()) { mMenu->UnsetAttr(kNameSpaceID_None, nsGkAtoms::checked, true); diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index a54818c81dc3..5c3a8fa85981 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -357,7 +357,7 @@ nsTreeBodyFrame::EnsureView() } nsCOMPtr box = do_QueryInterface(mTreeBoxObject); if (box) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); nsCOMPtr treeView; mTreeBoxObject->GetView(getter_AddRefs(treeView)); if (treeView && weakFrame.IsAlive()) { @@ -417,7 +417,7 @@ bool nsTreeBodyFrame::ReflowFinished() { if (!mView) { - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); EnsureView(); NS_ENSURE_TRUE(weakFrame.IsAlive(), false); } @@ -469,7 +469,7 @@ nsresult nsTreeBodyFrame::GetView(nsITreeView * *aView) { *aView = nullptr; - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); EnsureView(); NS_ENSURE_STATE(weakFrame.IsAlive()); NS_IF_ADDREF(*aView = mView); @@ -522,7 +522,7 @@ nsTreeBodyFrame::SetView(nsITreeView * aView) } // View, meet the tree. - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); mView->SetTree(mTreeBoxObject); NS_ENSURE_STATE(weakFrame.IsAlive()); mView->GetRowCount(&mRowCount); @@ -852,7 +852,7 @@ nsTreeBodyFrame::UpdateScrollbars(const ScrollParts& aParts) { nscoord rowHeightAsPixels = nsPresContext::AppUnitsToIntCSSPixels(mRowHeight); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (aParts.mVScrollbar) { nsAutoString curPos; @@ -907,7 +907,7 @@ nsTreeBodyFrame::CheckOverflow(const ScrollParts& aParts) } } - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); RefPtr presContext = PresContext(); nsCOMPtr presShell = presContext->GetPresShell(); @@ -947,11 +947,11 @@ nsTreeBodyFrame::CheckOverflow(const ScrollParts& aParts) } void -nsTreeBodyFrame::InvalidateScrollbars(const ScrollParts& aParts, nsWeakFrame& aWeakColumnsFrame) +nsTreeBodyFrame::InvalidateScrollbars(const ScrollParts& aParts, AutoWeakFrame& aWeakColumnsFrame) { if (mUpdateBatchNest || !mView) return; - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (aParts.mVScrollbar) { // Do Vertical Scrollbar @@ -4365,7 +4365,7 @@ nsTreeBodyFrame::ScrollHorzInternal(const ScrollParts& aParts, int32_t aPosition Invalidate(); // Update the column scroll view - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); aParts.mColumnsScrollFrame->ScrollTo(nsPoint(mHorzPosition, 0), nsIScrollableFrame::INSTANT); if (!weakFrame.IsAlive()) { @@ -4417,7 +4417,7 @@ nsTreeBodyFrame::RepeatButtonScroll(nsScrollbarFrame* aScrollbar) } bool isHorizontal = aScrollbar->IsXULHorizontal(); - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); if (isHorizontal) { int32_t curpos = aScrollbar->MoveToNewPosition(); if (weakFrame.IsAlive()) { @@ -4445,7 +4445,7 @@ nsTreeBodyFrame::ThumbMoved(nsScrollbarFrame* aScrollbar, if (aOldPos == aNewPos) return; - nsWeakFrame weakFrame(this); + AutoWeakFrame weakFrame(this); // Vertical Scrollbar if (parts.mVScrollbar == aScrollbar) { @@ -4906,15 +4906,15 @@ public: return NS_OK; } private: - nsWeakFrame mFrame; + AutoWeakFrame mFrame; }; bool nsTreeBodyFrame::FullScrollbarsUpdate(bool aNeedsFullInvalidation) { ScrollParts parts = GetScrollParts(); - nsWeakFrame weakFrame(this); - nsWeakFrame weakColumnsFrame(parts.mColumnsFrame); + AutoWeakFrame weakFrame(this); + AutoWeakFrame weakColumnsFrame(parts.mColumnsFrame); UpdateScrollbars(parts); NS_ENSURE_TRUE(weakFrame.IsAlive(), false); if (aNeedsFullInvalidation) { diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index 9620c8ccb3c6..6e5b6e19cf1a 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -374,7 +374,7 @@ protected: void UpdateScrollbars(const ScrollParts& aParts); // Update the maxpos of the scrollbar. - void InvalidateScrollbars(const ScrollParts& aParts, nsWeakFrame& aWeakColumnsFrame); + void InvalidateScrollbars(const ScrollParts& aParts, AutoWeakFrame& aWeakColumnsFrame); // Check overflow and generate events. void CheckOverflow(const ScrollParts& aParts);