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

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

Issue 1668453002: Make empty selection behavior behave like Android EditText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error in WebViewTest Created 4 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/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index 60f179a96509fb54c23b1de1396f1530119f9c9c..e7e1b6240842ef49dbdd122c763c023f77c07d31 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -304,14 +304,12 @@ void SelectionController::selectClosestWordFromHitTestResult(const HitTestResult
}
#if OS(ANDROID)
- // If node is not editable and doesn't have text except space, tab or
- // line break, do not select that 'empty' area.
- if (!innerNode->hasEditableStyle()) {
- EphemeralRangeTemplate<Strategy> range = EphemeralRangeTemplate<Strategy>(newSelection.start(), newSelection.end());
- String str = plainText(range, TextIteratorDefaultBehavior);
- if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace())
- return;
- }
+ // If node doesn't have text except space, tab or line break, do not
+ // select that 'empty' area.
+ EphemeralRangeTemplate<Strategy> range = EphemeralRangeTemplate<Strategy>(newSelection.start(), newSelection.end());
+ String str = plainText(range, TextIteratorDefaultBehavior);
yosin_UTC9 2016/02/03 06:49:28 nit: |const String&| to avoid unnecessary copy of
+ if (str.isEmpty() || str.simplifyWhiteSpace().containsOnlyWhitespace())
+ return;
#endif
if (appendTrailingWhitespace == AppendTrailingWhitespace::ShouldAppend && newSelection.isRange())

Powered by Google App Engine
This is Rietveld 408576698