Changeset 164194 in webkit
- Timestamp:
- Feb 16, 2014 2:00:21 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r164192 r164194 1 2014-02-16 Ryosuke Niwa <rniwa@webkit.org> 2 3 setSelectionRange shouldn't directly instantiate VisibleSelection 4 https://bugs.webkit.org/show_bug.cgi?id=128881 5 6 Reviewed by Andreas Kling. 7 8 Added a new version of moveTo for setSelectionRange. 9 10 * editing/FrameSelection.cpp: 11 (WebCore::FrameSelection::moveTo): Added. 12 * editing/FrameSelection.h: 13 * html/HTMLTextFormControlElement.cpp: 14 (WebCore::HTMLTextFormControlElement::setSelectionRange): Use the newly added FrameSelection::moveTo 15 instead of manually instantiating VisibleSelection here. 16 1 17 2014-02-16 Dan Bernstein <mitz@apple.com> 2 18 -
trunk/Source/WebCore/editing/FrameSelection.cpp
r164186 r164194 163 163 const bool selectionHasDirection = true; 164 164 setSelection(VisibleSelection(base, extent, affinity, selectionHasDirection), defaultSetSelectionOptions(userTriggered)); 165 } 166 167 void FrameSelection::moveTo(const Position& base, const Position& extent, bool selectionHasDirection, bool shouldSetFocus) 168 { 169 setSelection(VisibleSelection(base, extent, DOWNSTREAM, selectionHasDirection), 170 defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus)); 165 171 } 166 172 -
trunk/Source/WebCore/editing/FrameSelection.h
r164186 r164194 141 141 void moveTo(const Position&, EAffinity, EUserTriggered = NotUserTriggered); 142 142 void moveTo(const Position&, const Position&, EAffinity, EUserTriggered = NotUserTriggered); 143 void moveTo(const Position&, const Position&, bool selectionHasDirection, bool shouldSetFocus); 143 144 144 145 const VisibleSelection& selection() const { return m_selection; } -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r164183 r164194 307 307 if (start == end) 308 308 endPosition = startPosition; 309 else 310 endPosition = positionForIndex(innerText, end); 311 312 VisibleSelection newSelection; 313 if (direction == SelectionHasBackwardDirection) 314 newSelection = VisibleSelection(endPosition, startPosition); 315 else 316 newSelection = VisibleSelection(startPosition, endPosition); 317 newSelection.setIsDirectional(direction != SelectionHasNoDirection); 318 319 FrameSelection::SetSelectionOptions options = FrameSelection::defaultSetSelectionOptions(); 320 if (hasFocus) 321 options |= FrameSelection::DoNotSetFocus; 309 else { 310 if (direction == SelectionHasBackwardDirection) { 311 endPosition = startPosition; 312 startPosition = positionForIndex(innerText, end); 313 } else 314 endPosition = positionForIndex(innerText, end); 315 } 316 322 317 if (Frame* frame = document().frame()) 323 frame->selection(). setSelection(newSelection, options);318 frame->selection().moveTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus); 324 319 } 325 320
Note: See TracChangeset
for help on using the changeset viewer.