Bug 1340771 part 1 - Rename nsWeakFrame to AutoWeakFrame (automated change). r=tn

MozReview-Commit-ID: 8pl4nyeGEkr
This commit is contained in:
Mats Palmgren 2017-03-01 18:03:14 +01:00
Родитель a6aa945d09
Коммит d13aaf9ce0
54 изменённых файлов: 192 добавлений и 192 удалений

Просмотреть файл

@ -121,7 +121,7 @@ protected:
private:
// Currently focused control.
nsWeakFrame mCurrCtrlFrame;
AutoWeakFrame mCurrCtrlFrame;
int32_t mCaretOffset;
HyperTextAccessible* mAccWithCaret;
};

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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));

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -715,7 +715,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
bool mPreferFallback : 1;
bool mPreferFallbackKnown : 1;
nsWeakFrame mPrintFrame;
AutoWeakFrame mPrintFrame;
RefPtr<nsPluginInstanceOwner> mInstanceOwner;
nsTArray<mozilla::dom::MozPluginParameter> mCachedAttributes;

Просмотреть файл

@ -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);

Просмотреть файл

@ -54,7 +54,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(OverOutElementsWrapper)
nsWeakFrame mLastOverFrame;
AutoWeakFrame mLastOverFrame;
nsCOMPtr<nsIContent> 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<nsIContent> 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.

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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<nsTextControlFrame*> (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))

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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<nsIContent> 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);

Просмотреть файл

@ -78,7 +78,7 @@ class nsIDOMNode;
class nsCSSFrameConstructor;
class nsISelection;
template<class E> 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;

Просмотреть файл

@ -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

Просмотреть файл

@ -103,7 +103,7 @@ private:
}
private:
nsWeakFrame mFrame;
AutoWeakFrame mFrame;
};
/**

Просмотреть файл

@ -111,7 +111,7 @@ protected:
}
private:
nsWeakFrame mFrame;
AutoWeakFrame mFrame;
};
class DnDListener: public MouseListener {

Просмотреть файл

@ -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<dom::HTMLOptionElement> 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;

Просмотреть файл

@ -192,7 +192,7 @@ private:
}
private:
nsWeakFrame mFrame;
AutoWeakFrame mFrame;
};
/**

Просмотреть файл

@ -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());
}

Просмотреть файл

@ -240,7 +240,7 @@ protected:
NS_IMETHOD Run() override;
// avoids use of nsWeakFrame
// avoids use of AutoWeakFrame
void Revoke() {
mFrame = nullptr;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -686,7 +686,7 @@ nsContainerFrame::SyncWindowProperties(nsPresContext* aPresContext,
}
RefPtr<nsPresContext> kungFuDeathGrip(aPresContext);
nsWeakFrame weak(rootFrame);
AutoWeakFrame weak(rootFrame);
nsTransparencyMode mode = nsLayoutUtils::GetFrameTransparency(aFrame, rootFrame);
int32_t shadow = rootFrame->StyleUIReset()->mWindowShadow;

Просмотреть файл

@ -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<nsFrameSelection> fc = const_cast<nsFrameSelection*>(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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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<nsIContent> kungFuDeathGrip = aContent;
aContent->SetAttr(kNameSpaceID_None, aAtom, newValue, true);
MOZ_ASSERT(ShellIsAlive(weakShell), "pres shell was destroyed by scrolling");

Просмотреть файл

@ -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;
};

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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());
}

Просмотреть файл

@ -93,7 +93,7 @@ public:
return NS_OK;
}
private:
nsWeakFrame mFrame;
AutoWeakFrame mFrame;
};
static void
@ -181,7 +181,7 @@ nsSubDocumentFrame::ShowViewer()
RefPtr<nsFrameLoader> 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<nsSubDocumentFrame*>(aOther);
nsWeakFrame weakThis(this);
nsWeakFrame weakOther(aOther);
AutoWeakFrame weakThis(this);
AutoWeakFrame weakOther(aOther);
if (mInnerView) {
::EndSwapDocShellsForViews(mInnerView->GetFirstChild());

Просмотреть файл

@ -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<ActivityIndex> mScrollHandlerInducedActivity;
@ -132,7 +132,7 @@ public:
virtual void NotifyExpired(LayerActivity* aObject);
public:
nsWeakFrame mCurrentScrollHandlerFrame;
AutoWeakFrame mCurrentScrollHandlerFrame;
private:
bool mDestroying;

Просмотреть файл

@ -263,7 +263,7 @@ protected:
mozilla::UniquePtr<nsPrintData> mPrt;
nsPagePrintTimer* mPagePrintTimer;
nsWeakFrame mPageSeqFrame;
AutoWeakFrame mPageSeqFrame;
// Print Preview
mozilla::UniquePtr<nsPrintData> mPrtPreview;

Просмотреть файл

@ -4861,7 +4861,7 @@ public:
return NS_OK;
}
private:
nsWeakFrame mFrame;
AutoWeakFrame mFrame;
};
bool

Просмотреть файл

@ -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<nsPositionChangedEvent> > 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;

Просмотреть файл

@ -185,7 +185,7 @@ protected:
nsCOMPtr<nsPIBoxObject> mBoxObject;
// frame markers
nsWeakFrame mTopFrame;
AutoWeakFrame mTopFrame;
nsIFrame* mBottomFrame;
nsIFrame* mLinkupFrame;

Просмотреть файл

@ -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())

Просмотреть файл

@ -138,7 +138,7 @@ public:
return NS_OK;
}
protected:
nsWeakFrame mFrame;
AutoWeakFrame mFrame;
nsCOMPtr<nsIAtom> 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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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<nsIWidget> widget = menuPopupFrame->GetWidget();
if (widget)

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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<nsIContent> scrollbar = aScrollbar;
nsIFrame* scrollbarBox = GetScrollbar();
nsWeakFrame weakFrame(this);
AutoWeakFrame weakFrame(this);
mUserChanged = true;

Просмотреть файл

@ -384,7 +384,7 @@ nsSplitterFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
nsWeakFrame weakFrame(this);
AutoWeakFrame weakFrame(this);
RefPtr<nsSplitterFrameInner> 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,

Просмотреть файл

@ -187,11 +187,11 @@ public:
delete this;
}
nsWeakFrame mWeakFrame;
AutoWeakFrame mWeakFrame;
};
bool
nsTextBoxFrame::UpdateAccesskey(nsWeakFrame& aWeakThis)
nsTextBoxFrame::UpdateAccesskey(AutoWeakFrame& aWeakThis)
{
nsAutoString accesskey;
nsCOMPtr<nsIDOMXULLabelElement> labelElement = do_QueryInterface(mContent);

Просмотреть файл

@ -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();

Просмотреть файл

@ -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<nsMenuPopupFrame *> &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<nsWeakFrame> weakPopups(aFrames.Length());
nsTArray<AutoWeakFrame> 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<nsIContent> 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);

Просмотреть файл

@ -357,7 +357,7 @@ nsTreeBodyFrame::EnsureView()
}
nsCOMPtr<nsIBoxObject> box = do_QueryInterface(mTreeBoxObject);
if (box) {
nsWeakFrame weakFrame(this);
AutoWeakFrame weakFrame(this);
nsCOMPtr<nsITreeView> 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<nsPresContext> presContext = PresContext();
nsCOMPtr<nsIPresShell> 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) {

Просмотреть файл

@ -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);