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

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

Issue 2835063002: Selection API: type attribute should return 'Range' for range-selection in text controls. (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 07702b4d928d495df4253bb303f5b2e652da7bc2..ceb2bb8af05f1009d9d4d88b30510d1838e20744 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