Skip to content

Commit

Permalink
Bug 1340771 part 1 - Rename nsWeakFrame to AutoWeakFrame (automated c…
Browse files Browse the repository at this point in the history
…hange). r=tn

MozReview-Commit-ID: 8pl4nyeGEkr
  • Loading branch information
Mats Palmgren committed Mar 1, 2017
1 parent a6aa945 commit d13aaf9
Show file tree
Hide file tree
Showing 54 changed files with 192 additions and 192 deletions.
2 changes: 1 addition & 1 deletion accessible/base/SelectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class SelectionManager : public nsISelectionListener

private:
// Currently focused control.
nsWeakFrame mCurrCtrlFrame;
AutoWeakFrame mCurrCtrlFrame;
int32_t mCaretOffset;
HyperTextAccessible* mAccWithCaret;
};
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/nsCoreUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion accessible/generic/Accessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsFrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsFrameLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class nsFrameLoader final : public nsIFrameLoader,

// 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
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsObjectLoadingContent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions dom/events/EventStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -3930,7 +3930,7 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
CreateMouseOrPointerWidgetEvent(aMouseEvent, aMessage,
aRelatedContent, dispatchEvent);

nsWeakFrame previousTarget = mCurrentTarget;
AutoWeakFrame previousTarget = mCurrentTarget;
mCurrentTargetContent = aTargetContent;

nsIFrame* targetFrame = nullptr;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions dom/events/EventStateManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class OverOutElementsWrapper final : public nsISupports
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(OverOutElementsWrapper)

nsWeakFrame mLastOverFrame;
AutoWeakFrame mLastOverFrame;

nsCOMPtr<nsIContent> mLastOverElement;

Expand Down Expand Up @@ -408,7 +408,7 @@ class EventStateManager : public nsSupportsWeakReference,
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.
Expand All @@ -420,7 +420,7 @@ class EventStateManager : public nsSupportsWeakReference,
EventMessage aMessage,
nsIPresShell* aPresShell,
nsIContent* aMouseTarget,
nsWeakFrame aCurrentTarget,
AutoWeakFrame aCurrentTarget,
bool aNoContentDispatch);
nsresult SetClickCount(WidgetMouseEvent* aEvent, nsEventStatus* aStatus);
nsresult CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
Expand Down Expand Up @@ -930,9 +930,9 @@ class EventStateManager : public nsSupportsWeakReference,
// 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.
Expand Down
12 changes: 6 additions & 6 deletions dom/events/WheelHandlingHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -179,7 +179,7 @@ WheelTransaction::EndTransaction()

/* static */ bool
WheelTransaction::WillHandleDefaultAction(WidgetWheelEvent* aWheelEvent,
nsWeakFrame& aTargetWeakFrame)
AutoWeakFrame& aTargetWeakFrame)
{
nsIFrame* lastTargetFrame = GetTargetFrame();
if (!lastTargetFrame) {
Expand Down Expand Up @@ -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
};

Expand Down Expand Up @@ -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,
Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions dom/events/WheelHandlingHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class ScrollbarsForWheel
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;

Expand Down Expand Up @@ -134,11 +134,11 @@ class WheelTransaction
* 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);
Expand Down Expand Up @@ -169,7 +169,7 @@ class WheelTransaction
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;
Expand Down
2 changes: 1 addition & 1 deletion dom/html/HTMLInputElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions dom/html/HTMLSelectElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions dom/html/nsTextEditorState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class RestoreSelectionState : public Runnable {
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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions layout/base/AccessibleCaretManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions layout/base/GeometryUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit d13aaf9

Please sign in to comment.