Changeset 217019 in webkit
- Timestamp:
- May 17, 2017 5:29:07 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r217014 r217019 1 2017-05-17 Zalan Bujtas <zalan@apple.com> 2 3 Tighten TextIterator::handleTextNode run-renderer mapping logic. 4 https://bugs.webkit.org/show_bug.cgi?id=172174 5 6 Reviewed by Antti Koivisto. 7 8 * fast/shadow-dom/slot-crash-expected.txt: 9 1 10 2017-05-17 John Wilander <wilander@apple.com> 2 11 -
trunk/Source/WebCore/ChangeLog
r217014 r217019 1 2017-05-17 Zalan Bujtas <zalan@apple.com> 2 3 Tighten TextIterator::handleTextNode run-renderer mapping logic. 4 https://bugs.webkit.org/show_bug.cgi?id=172174 5 6 Reviewed by Antti Koivisto. 7 8 This patch ensure that when runs and renderers are getting out of sync 9 we don't run into problems like webkit.org/b/172113 (where we end up 10 using incorrect content start/end positions). 11 12 * editing/TextIterator.cpp: 13 (WebCore::TextIterator::handleTextNode): 14 1 15 2017-05-17 John Wilander <wilander@apple.com> 2 16 -
trunk/Source/WebCore/editing/TextIterator.cpp
r216966 r217019 649 649 auto it = range.begin(); 650 650 auto end = range.end(); 651 while (it != end && (*it).end() <= (static_cast<unsigned>(m_offset) + m_accumulatedSimpleTextLengthInFlow)) 651 auto startPosition = static_cast<unsigned>(m_offset) + m_accumulatedSimpleTextLengthInFlow; 652 while (it != end && (*it).end() <= startPosition) 652 653 ++it; 653 654 if (m_nextRunNeedsWhitespace && rendererText[m_offset - 1] == '\n') { … … 665 666 return false; 666 667 } 667 const auto run = *it; 668 // If the position we are looking for is to the left of the renderer's first run, it could mean that 669 // the runs and the renderers are out of sync (e.g. we skipped a renderer in between). 670 // Better bail out at this point. 671 auto run = *it; 672 if (run.start() > startPosition) { 673 ASSERT(m_flowRunResolverCache); 674 if (&(rendererForPosition(m_flowRunResolverCache->flowContents(), startPosition)) != &renderer) { 675 ASSERT_NOT_REACHED(); 676 return true; 677 } 678 } 668 679 ASSERT(run.end() - run.start() <= rendererText.length()); 669 680 // contentStart skips leading whitespace. -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h
r215054 r217019 51 51 }; 52 52 const Segment& segmentForRun(unsigned start, unsigned end) const; 53 const Segment& segmentForPosition(unsigned) const; 53 54 54 55 typedef Vector<Segment, 8>::const_iterator Iterator; … … 71 72 } 72 73 74 inline const FlowContents::Segment& FlowContents::segmentForPosition(unsigned position) const 75 { 76 auto it = std::lower_bound(m_segments.begin(), m_segments.end(), position, [](const Segment& segment, unsigned position) { 77 return segment.end <= position; 78 }); 79 ASSERT(it != m_segments.end()); 80 return m_segments[it - m_segments.begin()]; 81 } 82 73 83 } 74 84 } -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
r215878 r217019 41 41 #include "RenderView.h" 42 42 #include "Settings.h" 43 #include "SimpleLineLayoutFlowContents.h" 43 44 #include "SimpleLineLayoutResolver.h" 44 45 #include "Text.h" … … 255 256 } 256 257 258 const RenderObject& rendererForPosition(const FlowContents& flowContents, unsigned position) 259 { 260 return flowContents.segmentForPosition(position).renderer; 261 } 262 257 263 #if ENABLE(TREE_DEBUGGING) 258 264 static void printPrefix(int& printedCharacters, int depth) -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
r213723 r217019 40 40 41 41 namespace SimpleLineLayout { 42 class FlowContents; 42 43 43 44 LayoutUnit computeFlowHeight(const RenderBlockFlow&, const Layout&); … … 64 65 LayoutUnit lineHeightFromFlow(const RenderBlockFlow&); 65 66 LayoutUnit baselineFromFlow(const RenderBlockFlow&); 67 68 const RenderObject& rendererForPosition(const FlowContents&, unsigned); 66 69 67 70 #if ENABLE(TREE_DEBUGGING)
Note: See TracChangeset
for help on using the changeset viewer.