Changeset 155058 in webkit
- Timestamp:
- Sep 4, 2013 12:52:25 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r155051 r155058 1 2013-09-04 Javier Fernandez <jfernandez@igalia.com> 2 3 <https://webkit.org/b/119622> [CSSRegions] Not possible to clear the selection when mixing content from different FlowThreads 4 5 Reviewed by David Hyatt. 6 7 * fast/regions/selecting-text-through-different-region-flows-2-expected.html: Added. 8 * fast/regions/selecting-text-through-different-region-flows-2.html: Added. 9 1 10 2013-09-04 Oliver Hunt <oliver@apple.com> 2 11 -
trunk/Source/WebCore/ChangeLog
r155057 r155058 1 2013-09-04 Javier Fernandez <jfernandez@igalia.com> 2 3 <https://webkit.org/b/119622> [CSSRegions] Not possible to clear the selection when mixing content from different FlowThreads 4 5 Reviewed by David Hyatt. 6 7 When using CSS Regions is usual that the RenderTree doesn't match 8 the DOM Tree in terms of relative position of the nodes. Besides, 9 usually the content of a certain node is split and spread across 10 multiple blocks, rendered in different positions. 11 12 Regarding the Selection, this problem is even more important; the 13 selection direction changes when crossing the FlowThread 14 boundaries. This weird behavior is also present in other layouts 15 using non-regular positioning mechanisms, like absolute, 16 static. However, for those layouts the RenderTree preserves the 17 order of the nodes, unlike the CSS Regions layout model. 18 19 Because of how the RenderTree is generated with CSS Regions, the 20 RenderView::setSelection algorithm is not able to repaint some of 21 the rectangles defined during the selection process. In order to 22 face this issue, the proposed fix determines whether it should 23 backwards traversing the RenderTree, from the "stop" node to the 24 RenderView node. 25 26 Test: fast/regions/selecting-text-through-different-region-flows-2.html 27 28 * rendering/RenderView.cpp: 29 (WebCore::getNextOrPrevRenderObjectBasedOnDirection): Added. 30 (WebCore::RenderView::setSelection): 31 1 32 2013-09-04 Eric Carlson <eric.carlson@apple.com> 2 33 -
trunk/Source/WebCore/rendering/RenderView.cpp
r154877 r155058 737 737 #endif 738 738 739 // When exploring the RenderTree looking for the nodes involved in the Selection, sometimes it's 740 // required to change the traversing direction because the "start" position is below the "end" one. 741 static inline RenderObject* getNextOrPrevRenderObjectBasedOnDirection(const RenderObject* o, const RenderObject* stop, bool& continueExploring, bool& exploringBackwards) 742 { 743 RenderObject* next; 744 if (exploringBackwards) { 745 next = o->previousInPreOrder(); 746 continueExploring = next && !(next)->isRenderView(); 747 } else { 748 next = o->nextInPreOrder(); 749 continueExploring = next && next != stop; 750 exploringBackwards = !next && (next != stop); 751 if (exploringBackwards) { 752 next = stop->previousInPreOrder(); 753 continueExploring = next && !next->isRenderView(); 754 } 755 } 756 757 return next; 758 } 759 739 760 void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode) 740 761 { … … 749 770 if (m_selectionStart == start && m_selectionStartPos == startPos && 750 771 m_selectionEnd == end && m_selectionEndPos == endPos && !caretChanged) 751 return;752 753 if ((start && end) && (start->flowThreadContainingBlock() != end->flowThreadContainingBlock()))754 772 return; 755 773 … … 773 791 RenderObject* os = m_selectionStart; 774 792 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos); 775 while (os && os != stop) { 793 bool exploringBackwards = false; 794 bool continueExploring = os && (os != stop); 795 while (continueExploring) { 776 796 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) { 777 797 // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well. … … 789 809 } 790 810 791 os = os->nextInPreOrder();811 os = getNextOrPrevRenderObjectBasedOnDirection(os, stop, continueExploring, exploringBackwards); 792 812 } 793 813 … … 828 848 // put them in the new objects list. 829 849 o = start; 830 while (o && o != stop) { 850 exploringBackwards = false; 851 continueExploring = o && (o != stop); 852 while (continueExploring) { 831 853 if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) { 832 854 newSelectedObjects.set(o, adoptPtr(new RenderSelectionInfo(o, true))); … … 841 863 } 842 864 843 o = o->nextInPreOrder();865 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring, exploringBackwards); 844 866 } 845 867
Note: See TracChangeset
for help on using the changeset viewer.