From d5b4e47993634be2ebf3ff3c2e6043c84c1bf9ce Mon Sep 17 00:00:00 2001 From: Mirko Brodesser Date: Mon, 25 May 2020 13:54:20 +0000 Subject: [PATCH] Bug 1635709: part 21) Rename `TableSelection::mCellParent` to `mClosestInclusiveTableCellAncestor`. r=masayuki Differential Revision: https://phabricator.services.mozilla.com/D75564 --- layout/generic/nsFrameSelection.cpp | 21 +++++++++++++-------- layout/generic/nsFrameSelection.h | 3 ++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp index 2723d7dcc17e..e407fb8cf6ea 100644 --- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -400,7 +400,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFrameSelection) tmp->mDomSelections[i] = nullptr; } - NS_IMPL_CYCLE_COLLECTION_UNLINK(mTableSelection.mCellParent) + NS_IMPL_CYCLE_COLLECTION_UNLINK( + mTableSelection.mClosestInclusiveTableCellAncestor) tmp->mTableSelection.mMode = TableSelectionMode::None; tmp->mTableSelection.mDragSelectingCells = false; NS_IMPL_CYCLE_COLLECTION_UNLINK(mTableSelection.mStartSelectedCell) @@ -421,7 +422,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameSelection) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDomSelections[i]) } - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTableSelection.mCellParent) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE( + mTableSelection.mClosestInclusiveTableCellAncestor) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTableSelection.mStartSelectedCell) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTableSelection.mEndSelectedCell) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTableSelection.mAppendStartSelectedCell) @@ -1423,7 +1425,7 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, NS_ENSURE_STATE(mPresShell); bool editableCell = false; - mTableSelection.mCellParent = nullptr; + mTableSelection.mClosestInclusiveTableCellAncestor = nullptr; RefPtr context = mPresShell->GetPresContext(); if (context) { RefPtr htmlEditor = nsContentUtils::GetHTMLEditor(context); @@ -1433,7 +1435,7 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, editableCell = cellparent && editorHostNode && cellparent->IsInclusiveDescendantOf(editorHostNode); if (editableCell) { - mTableSelection.mCellParent = cellparent; + mTableSelection.mClosestInclusiveTableCellAncestor = cellparent; #ifdef DEBUG_TABLE_SELECTION printf(" * TakeFocus - Collapsing into new cell\n"); #endif @@ -1446,9 +1448,11 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, // Now update the range list: int32_t offset; nsINode* cellparent = GetClosestInclusiveTableCellAncestor(aNewFocus); - if (mTableSelection.mCellParent && cellparent && + if (mTableSelection.mClosestInclusiveTableCellAncestor && cellparent && cellparent != - mTableSelection.mCellParent) // switch to cell selection mode + mTableSelection + .mClosestInclusiveTableCellAncestor) // switch to cell + // selection mode { #ifdef DEBUG_TABLE_SELECTION printf(" * TakeFocus - moving into new cell\n"); @@ -1457,7 +1461,8 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, WidgetMouseEvent::eReal); // Start selecting in the cell we were in before - nsINode* parent = ParentOffset(mTableSelection.mCellParent, &offset); + nsINode* parent = ParentOffset( + mTableSelection.mClosestInclusiveTableCellAncestor, &offset); if (parent) { const nsresult result = HandleTableSelection( parent, offset, TableSelectionMode::Cell, &event); @@ -1473,7 +1478,7 @@ nsresult nsFrameSelection::TakeFocus(nsIContent* const aNewFocus, // (we'd need to add event listener -- let's not bother for now) event.mModifiers &= ~MODIFIER_SHIFT; // aContinueSelection; if (parent) { - mTableSelection.mCellParent = cellparent; + mTableSelection.mClosestInclusiveTableCellAncestor = cellparent; // Continue selection into next cell const nsresult result = HandleTableSelection( parent, offset, TableSelectionMode::Cell, &event); diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h index 77d0b1fad1b6..f0bf5a866dbc 100644 --- a/layout/generic/nsFrameSelection.h +++ b/layout/generic/nsFrameSelection.h @@ -919,7 +919,8 @@ class nsFrameSelection final { int32_t aEndColumnIndex, bool aRemoveOutsideOfCellRange, mozilla::dom::Selection& aNormalSelection); - nsCOMPtr mCellParent; // used to snap to table selection + nsCOMPtr + mClosestInclusiveTableCellAncestor; // used to snap to table selection nsCOMPtr mStartSelectedCell; nsCOMPtr mEndSelectedCell; nsCOMPtr mAppendStartSelectedCell;