Changeset 83967 in webkit
- Timestamp:
- Apr 15, 2011 6:44:54 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r83966 r83967 1 2011-04-15 Alice Boxhall <aboxhall@chromium.org> 2 3 Reviewed by Ryosuke Niwa. 4 5 Text selection changes unexpectedly when dragging out of the <input> 6 https://bugs.webkit.org/show_bug.cgi?id=55552 7 8 Tests that dragging outside of a contenteditable, input or textarea selects to the end of the 9 element, rather than jumping back to the beginning. 10 11 * editing/selection/resources/select-out-of-floated-editable.js: Added. 12 (log): 13 (else.window.onmouseup): 14 (getSelectionStart): 15 (getSelectionEnd): 16 (checkSelection): 17 * editing/selection/select-out-of-editable-expected.txt: Added. 18 * editing/selection/select-out-of-editable.html: Added. 19 * editing/selection/select-out-of-floated-contenteditable-expected.txt: Added. 20 * editing/selection/select-out-of-floated-contenteditable.html: Added. 21 * editing/selection/select-out-of-floated-input-expected.txt: Added. 22 * editing/selection/select-out-of-floated-input.html: Added. 23 * editing/selection/select-out-of-floated-textarea-expected.txt: Added. 24 * editing/selection/select-out-of-floated-textarea.html: Added. 25 1 26 2011-04-15 Adam Roben <aroben@apple.com> 2 27 -
trunk/Source/WebCore/ChangeLog
r83963 r83967 1 2011-04-15 Alice Boxhall <aboxhall@chromium.org> 2 3 Reviewed by Ryosuke Niwa. 4 5 Text selection changes unexpectedly when dragging out of the <input> 6 https://bugs.webkit.org/show_bug.cgi?id=55552 7 8 Tests: editing/selection/select-out-of-editable.html 9 editing/selection/select-out-of-floated-contenteditable.html 10 editing/selection/select-out-of-floated-input.html 11 editing/selection/select-out-of-floated-textarea.html 12 13 * page/EventHandler.cpp: 14 (WebCore::selectionExtentRespectingEditingBoundary): When dragging from an editable element, check that 15 the endpoint is not outside the element. If it is, translate the point into a local point within 16 the editable element. 17 (WebCore::EventHandler::updateSelectionForMouseDrag): Call targetPositionForSelectionEndpoint() to 18 calculate the selection endpoint. 19 1 20 2011-04-15 Adam Roben <aroben@apple.com> 2 21 -
trunk/Source/WebCore/page/EventHandler.cpp
r83832 r83967 623 623 } 624 624 625 static VisiblePosition selectionExtentRespectingEditingBoundary(const VisibleSelection& selection, const IntPoint& localPoint, Node* targetNode) 626 { 627 IntPoint selectionEndPoint = localPoint; 628 Element* editableElement = selection.rootEditableElement(); 629 Node* selectionEndNode = targetNode; 630 631 if (editableElement && !editableElement->contains(targetNode)) { 632 selectionEndNode = editableElement; 633 634 if (!selectionEndNode->renderer()) 635 return VisiblePosition(); 636 637 FloatPoint absolutePoint = targetNode->renderer()->localToAbsolute(FloatPoint(selectionEndPoint)); 638 selectionEndPoint = roundedIntPoint(selectionEndNode->renderer()->absoluteToLocal(absolutePoint)); 639 } 640 641 if (!selectionEndNode->renderer()) 642 return VisiblePosition(); 643 644 return selectionEndNode->renderer()->positionForPoint(selectionEndPoint); 645 } 646 625 647 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResult) 626 648 { … … 635 657 return; 636 658 637 RenderObject* targetRenderer = target->renderer(); 638 if (!targetRenderer) 639 return; 640 641 VisiblePosition targetPosition = targetRenderer->positionForPoint(hitTestResult.localPoint()); 659 VisiblePosition targetPosition = selectionExtentRespectingEditingBoundary(m_frame->selection()->selection(), hitTestResult.localPoint(), target); 642 660 643 661 // Don't modify the selection if we're not on a node.
Note: See TracChangeset
for help on using the changeset viewer.