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

Unified Diff: third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp

Issue 1412713003: Reland 'Use FrameSelection::selectedText where possible.' Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use SelectionEditor::setWithoutValidation. Created 5 years, 2 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/html/HTMLTextFormControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
index b3421b15e87f3c948e148727b9f18a554e1b5353..c445ed8551768421b57b7a95faad70b56a25dd3b 100644
--- a/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp
@@ -377,12 +377,14 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
ASSERT(start == indexForPosition(innerEditor, startPosition));
ASSERT(end == indexForPosition(innerEditor, endPosition));
+#if ENABLE(ASSERT)
// startPosition and endPosition can be null position for example when
// "-webkit-user-select: none" style attribute is specified.
if (startPosition.isNotNull() && endPosition.isNotNull()) {
ASSERT(startPosition.anchorNode()->shadowHost() == this
&& endPosition.anchorNode()->shadowHost() == this);
}
+#endif // ENABLE(ASSERT)
VisibleSelection newSelection;
if (direction == SelectionHasBackwardDirection)
newSelection.setWithoutValidation(endPosition, startPosition);
@@ -390,7 +392,7 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
newSelection.setWithoutValidation(startPosition, endPosition);
newSelection.setIsDirectional(direction != SelectionHasNoDirection);
- frame->selection().setSelection(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | (selectionOption == ChangeSelectionAndFocus ? 0 : FrameSelection::DoNotSetFocus));
+ frame->selection().setSelectionInTextFormControl(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | (selectionOption == ChangeSelectionAndFocus ? 0 : FrameSelection::DoNotSetFocus));
if (eventBehaviour == DispatchSelectEvent)
scheduleSelectEvent();
}

Powered by Google App Engine
This is Rietveld 408576698