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

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

Issue 2840423002: Merge "Selection API: type attribute should return 'Range' for range-selection in text controls." t… (Closed)
Patch Set: Created 3 years, 8 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/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 3296ed44fca660a76f2a77dcfda3a3103a3cd807..90dc0379be7f40986f8fb36f15287371557c8b2b 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -205,7 +205,9 @@ String DOMSelection::type() const {
// http://msdn.microsoft.com/en-us/library/ms534692(VS.85).aspx
if (rangeCount() == 0)
return "None";
- if (isCollapsed())
+ // Do not use isCollapsed() here. We'd like to return "Range" for
+ // range-selection in text control elements.
+ if (GetFrame()->Selection().GetSelectionInDOMTree().IsCaret())
return "Caret";
return "Range";
}

Powered by Google App Engine
This is Rietveld 408576698