Changeset 85669 in webkit
- Timestamp:
- May 3, 2011 3:14:46 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 16 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85666 r85669 1 2011-05-03 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 WebKit allows selection that crosses the shadow boundary of a readonly input element 6 https://bugs.webkit.org/show_bug.cgi?id=60000 7 8 Added pixel tests to ensure WebKit doesn't create a selection that spans across 9 the shadow DOM boundary of a readonly input element. Also rebaselined a test that 10 previously exhibited this behavior. 11 12 * editing/selection/resources/select-across-readonly-input.js: Added. 13 (moveMouseToMiddleOfElement): 14 * editing/selection/select-across-readonly-input-1.html: Added. 15 * editing/selection/select-across-readonly-input-2.html: Added. 16 * editing/selection/select-across-readonly-input-3.html: Added. 17 * editing/selection/select-across-readonly-input-4.html: Added. 18 * editing/selection/select-across-readonly-input-5.html: Added. 19 * platform/mac/editing/selection/select-across-readonly-input-1-expected.png: Added. 20 * platform/mac/editing/selection/select-across-readonly-input-1-expected.txt: Added. 21 * platform/mac/editing/selection/select-across-readonly-input-2-expected.png: Added. 22 * platform/mac/editing/selection/select-across-readonly-input-2-expected.txt: Added. 23 * platform/mac/editing/selection/select-across-readonly-input-3-expected.png: Added. 24 * platform/mac/editing/selection/select-across-readonly-input-3-expected.txt: Added. 25 * platform/mac/editing/selection/select-across-readonly-input-4-expected.png: Added. 26 * platform/mac/editing/selection/select-across-readonly-input-4-expected.txt: Added. 27 * platform/mac/editing/selection/select-across-readonly-input-5-expected.png: Added. 28 * platform/mac/editing/selection/select-across-readonly-input-5-expected.txt: Added. 29 * platform/mac/fast/forms/input-readonly-autoscroll-expected.txt: 30 1 31 2011-05-03 Alpha Lam <hclam@chromium.org> 2 32 -
trunk/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.txt
r63291 r85669 27 27 text run at (1,0) width 158: "abcdefghijklmnopqrstuvwxyz" 28 28 selection start: position 1 of child 0 {#text} of child 0 {DIV} of child 5 {INPUT} of body 29 selection end: position 1of child 5 {INPUT} of body29 selection end: position 26 of child 0 {#text} of child 0 {DIV} of child 5 {INPUT} of body -
trunk/Source/WebCore/ChangeLog
r85668 r85669 1 2011-05-03 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 WebKit allows selection that crosses the shadow boundary of a readonly input element 6 https://bugs.webkit.org/show_bug.cgi?id=60000 7 8 The bug was caused by VisibleSelection's not validating shadow DOM boundaries. 9 Fixed the bug by adding an extra adjustment, adjustSelectionToAvoidCrossingShadowBoundaries, 10 in its validation process. 11 12 Tests: editing/selection/select-across-readonly-input-1.html 13 editing/selection/select-across-readonly-input-2.html 14 editing/selection/select-across-readonly-input-3.html 15 editing/selection/select-across-readonly-input-4.html 16 editing/selection/select-across-readonly-input-5.html 17 18 * editing/VisibleSelection.cpp: 19 (WebCore::VisibleSelection::validate): Calls adjustSelectionToAvoidCrossingShadowBoundaries. 20 (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries): Added. 21 * editing/VisibleSelection.h: 22 1 23 2011-05-03 Eric Seidel <eric@webkit.org> 2 24 -
trunk/Source/WebCore/editing/VisibleSelection.cpp
r82588 r85669 411 411 setBaseAndExtentToDeepEquivalents(); 412 412 setStartAndEndFromBaseAndExtentRespectingGranularity(granularity); 413 adjustSelectionToAvoidCrossingShadowBoundaries(); 413 414 adjustSelectionToAvoidCrossingEditingBoundaries(); 414 415 updateSelectionType(); … … 450 451 } 451 452 m_selectionType = base == extent ? CaretSelection : RangeSelection; 453 } 454 455 void VisibleSelection::adjustSelectionToAvoidCrossingShadowBoundaries() 456 { 457 if (m_base.isNull() || m_start.isNull() || m_end.isNull()) 458 return; 459 460 Node* startRootNode = m_start.anchorNode()->shadowTreeRootNode(); 461 Node* endRootNode = m_end.anchorNode()->shadowTreeRootNode(); 462 463 if (!startRootNode && !endRootNode) 464 return; 465 466 if (startRootNode == endRootNode) 467 return; 468 469 if (m_baseIsFirst) { 470 m_extent = startRootNode ? lastPositionInNode(startRootNode) : positionBeforeNode(endRootNode->shadowHost()); 471 m_end = m_extent; 472 } else { 473 m_extent = endRootNode ? firstPositionInNode(endRootNode) : positionAfterNode(startRootNode->shadowHost()); 474 m_start = m_extent; 475 } 452 476 } 453 477 -
trunk/Source/WebCore/editing/VisibleSelection.h
r80752 r85669 113 113 void setBaseAndExtentToDeepEquivalents(); 114 114 void setStartAndEndFromBaseAndExtentRespectingGranularity(TextGranularity); 115 void adjustSelectionToAvoidCrossingShadowBoundaries(); 115 116 void adjustSelectionToAvoidCrossingEditingBoundaries(); 116 117 void updateSelectionType();
Note: See TracChangeset
for help on using the changeset viewer.