author | Mirko Brodesser <mbrodesser@mozilla.com> |
Mon, 25 May 2020 13:54:30 +0000 | |
changeset 531904 | 9c52c330dd88edf25b46c77a4d79cdfa5dcc2456 |
parent 531903 | 14275b5ea171abcb976800662a21309716a22f24 |
child 531905 | df5bfb667b9d2fee068861b5c6129bcbbff95cce |
push id | 37448 |
push user | ncsoregi@mozilla.com |
push date | Mon, 25 May 2020 21:44:09 +0000 |
treeherder | mozilla-central@df5bfb667b9d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | masayuki |
bugs | 1635709 |
milestone | 78.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/generic/nsFrameSelection.cpp +++ b/layout/generic/nsFrameSelection.cpp @@ -1425,36 +1425,41 @@ nsresult nsFrameSelection::TakeFocus(nsI NS_ENSURE_STATE(mPresShell); bool editableCell = false; mTableSelection.mClosestInclusiveTableCellAncestor = nullptr; RefPtr<nsPresContext> context = mPresShell->GetPresContext(); if (context) { RefPtr<HTMLEditor> htmlEditor = nsContentUtils::GetHTMLEditor(context); if (htmlEditor) { - nsINode* cellparent = GetClosestInclusiveTableCellAncestor(aNewFocus); + nsINode* inclusiveTableCellAncestor = + GetClosestInclusiveTableCellAncestor(aNewFocus); nsCOMPtr<nsINode> editorHostNode = htmlEditor->GetActiveEditingHost(); - editableCell = cellparent && editorHostNode && - cellparent->IsInclusiveDescendantOf(editorHostNode); + editableCell = inclusiveTableCellAncestor && editorHostNode && + inclusiveTableCellAncestor->IsInclusiveDescendantOf( + editorHostNode); if (editableCell) { - mTableSelection.mClosestInclusiveTableCellAncestor = cellparent; + mTableSelection.mClosestInclusiveTableCellAncestor = + inclusiveTableCellAncestor; #ifdef DEBUG_TABLE_SELECTION printf(" * TakeFocus - Collapsing into new cell\n"); #endif } } } break; } case FocusMode::kExtendSelection: { // Now update the range list: int32_t offset; - nsINode* cellparent = GetClosestInclusiveTableCellAncestor(aNewFocus); - if (mTableSelection.mClosestInclusiveTableCellAncestor && cellparent && - cellparent != + nsINode* inclusiveTableCellAncestor = + GetClosestInclusiveTableCellAncestor(aNewFocus); + if (mTableSelection.mClosestInclusiveTableCellAncestor && + inclusiveTableCellAncestor && + inclusiveTableCellAncestor != mTableSelection .mClosestInclusiveTableCellAncestor) // switch to cell // selection mode { #ifdef DEBUG_TABLE_SELECTION printf(" * TakeFocus - moving into new cell\n"); #endif WidgetMouseEvent event(false, eVoidEvent, nullptr, @@ -1467,23 +1472,24 @@ nsresult nsFrameSelection::TakeFocus(nsI const nsresult result = HandleTableSelection( parent, offset, TableSelectionMode::Cell, &event); if (NS_WARN_IF(NS_FAILED(result))) { return result; } } // Find the parent of this new cell and extend selection to it - parent = ParentOffset(cellparent, &offset); + parent = ParentOffset(inclusiveTableCellAncestor, &offset); // XXXX We need to REALLY get the current key shift state // (we'd need to add event listener -- let's not bother for now) event.mModifiers &= ~MODIFIER_SHIFT; // aContinueSelection; if (parent) { - mTableSelection.mClosestInclusiveTableCellAncestor = cellparent; + mTableSelection.mClosestInclusiveTableCellAncestor = + inclusiveTableCellAncestor; // Continue selection into next cell const nsresult result = HandleTableSelection( parent, offset, TableSelectionMode::Cell, &event); if (NS_WARN_IF(NS_FAILED(result))) { return result; } } } else {