| Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
|
| index 180ac264dabe5954cdc11d1cc588f72befd586c5..fe1b058c8240ac16052a72e2822ff952758e625d 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
|
| @@ -1750,9 +1750,12 @@ static bool ExecuteScrollToEndOfDocument(LocalFrame& frame,
|
|
|
| static bool ExecuteSelectAll(LocalFrame& frame,
|
| Event*,
|
| - EditorCommandSource,
|
| + EditorCommandSource source,
|
| const String&) {
|
| - frame.Selection().SelectAll();
|
| + const EUserTriggered user_triggered = source == kCommandFromMenuOrKeyBinding
|
| + ? kUserTriggered
|
| + : kNotUserTriggered;
|
| + frame.Selection().SelectAll(user_triggered);
|
| return true;
|
| }
|
|
|
| @@ -2159,7 +2162,9 @@ static bool EnabledUnselect(LocalFrame& frame,
|
| selection.IsRange();
|
| }
|
|
|
| -static bool EnabledSelectAll(LocalFrame& frame, Event*, EditorCommandSource) {
|
| +static bool EnabledSelectAll(LocalFrame& frame,
|
| + Event*,
|
| + EditorCommandSource source) {
|
| // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| // needs to be audited. See http://crbug.com/590369 for more details.
|
| frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
|
| @@ -2167,6 +2172,10 @@ static bool EnabledSelectAll(LocalFrame& frame, Event*, EditorCommandSource) {
|
| frame.Selection().ComputeVisibleSelectionInDOMTree();
|
| if (selection.IsNone())
|
| return true;
|
| + // Hidden selection appears as no selection to users, in which case user-
|
| + // triggered SelectAll should be enabled and act as if there is no selection.
|
| + if (source == kCommandFromMenuOrKeyBinding && frame.Selection().IsHidden())
|
| + return true;
|
| if (Node* root = HighestEditableRoot(selection.Start())) {
|
| if (!root->hasChildren())
|
| return false;
|
|
|