Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2642913003: Select All should show handles if they were already present (Closed)
Patch Set: forgot to change enum name in test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 0238e0b185480ab4010b2ce338dc56d0336b45ea..d34e44394e65f0dff87a43f28f6769db8438935f 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -170,7 +170,7 @@ void FrameSelection::moveCaretSelection(const IntPoint& point) {
if (position.isNotNull())
builder.collapse(position.toPositionWithAffinity());
setSelection(builder.build(),
- CloseTyping | ClearTypingStyle | UserTriggered | HandleVisible);
+ CloseTyping | ClearTypingStyle | UserTriggered | ShowHandle);
}
template <typename Strategy>
@@ -187,9 +187,13 @@ void FrameSelection::setSelectionAlgorithm(
m_granularityStrategy->Clear();
bool closeTyping = options & CloseTyping;
bool shouldClearTypingStyle = options & ClearTypingStyle;
- const HandleVisibility handleVisibility = options & HandleVisible
- ? HandleVisibility::Visible
- : HandleVisibility::NotVisible;
+ bool showHandle = options & ShowHandle;
+ bool preserveHandle = options & PreserveHandle;
+ DCHECK(!(showHandle && preserveHandle));
+ const HandleVisibility handleVisibility =
+ showHandle || (preserveHandle && isHandleVisible())
+ ? HandleVisibility::Visible
+ : HandleVisibility::NotVisible;
EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
// TODO(editing-dev): We should rename variable |s| to another name to avoid
@@ -913,7 +917,8 @@ void FrameSelection::selectAll() {
return;
}
- setSelection(SelectionInDOMTree::Builder().selectAllChildren(*root).build());
+ setSelection(SelectionInDOMTree::Builder().selectAllChildren(*root).build(),
+ CloseTyping | ClearTypingStyle | PreserveHandle);
selectFrameElementInParentIfFullySelected();
notifyLayoutObjectOfSelectionChange(UserTriggered);
}
@@ -1354,7 +1359,7 @@ void FrameSelection::moveRangeSelectionExtent(const IntPoint& contentsPoint) {
setSelection(newSelection,
FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle |
FrameSelection::DoNotClearStrategy | UserTriggered |
- FrameSelection::HandleVisible,
+ FrameSelection::ShowHandle,
CursorAlignOnScroll::IfNeeded, CharacterGranularity);
}
@@ -1375,9 +1380,7 @@ void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition,
if (newSelection.isNone())
return;
- SetSelectionOptions options = CloseTyping | ClearTypingStyle;
- if (isHandleVisible())
- options |= HandleVisible;
+ SetSelectionOptions options = CloseTyping | ClearTypingStyle | PreserveHandle;
setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded,
granularity);
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.h ('k') | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698