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

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

Issue 2891203002: Make user-triggered SelectAll act as if there is no selection for hidden selection (Closed)
Patch Set: Created 3 years, 7 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 0d55b251f6344c038f0144e0a244ad50d5f89385..180816a6f0ad817be767bb0d8d932509be565899 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -656,7 +656,7 @@ static Node* NonBoundaryShadowTreeRootNode(const Position& position) {
: nullptr;
}
-void FrameSelection::SelectAll() {
+void FrameSelection::SelectAll(EUserTriggered user_triggered) {
if (isHTMLSelectElement(GetDocument().FocusedElement())) {
HTMLSelectElement* select_element =
toHTMLSelectElement(GetDocument().FocusedElement());
@@ -668,7 +668,12 @@ void FrameSelection::SelectAll() {
Node* root = nullptr;
Node* select_start_target = nullptr;
- if (ComputeVisibleSelectionInDOMTree().IsContentEditable()) {
+ if (user_triggered == kUserTriggered && IsHidden()) {
+ // Hidden selection appears as no selection to user, in which case user-
+ // triggered SelectAll should act as if there is no selection.
+ root = GetDocument().documentElement();
+ select_start_target = GetDocument().body();
+ } else if (ComputeVisibleSelectionInDOMTree().IsContentEditable()) {
root = HighestEditableRoot(ComputeVisibleSelectionInDOMTree().Start());
if (Node* shadow_root = NonBoundaryShadowTreeRootNode(
ComputeVisibleSelectionInDOMTree().Start()))
@@ -703,11 +708,13 @@ void FrameSelection::SelectAll() {
return;
}
+ // TODO(editing-dev): Should we pass in user_triggered?
yosin_UTC9 2017/05/19 02:19:36 Duplicated to L717? Or, do we want to pass |user_t
Xiaocheng 2017/05/19 02:25:51 Not duplicate. SetSelection() takes an |option| wh
SetSelection(SelectionInDOMTree::Builder()
.SelectAllChildren(*root)
.SetIsHandleVisible(IsHandleVisible())
.Build());
SelectFrameElementInParentIfFullySelected();
+ // TODO(editing-dev): Should we pass in user_triggered?
NotifyTextControlOfSelectionChange(kUserTriggered);
}

Powered by Google App Engine
This is Rietveld 408576698