Changeset 181682 in webkit
- Timestamp:
- Mar 17, 2015, 8:40:51 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
rendering/SimpleLineLayoutFlowContents.cpp (modified) (1 diff)
-
rendering/SimpleLineLayoutFlowContents.h (modified) (3 diffs)
-
rendering/SimpleLineLayoutResolver.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r181671 r181682 1 2015-03-17 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Change FlowContents::segmentForPosition() to segmentForRun(). 4 https://bugs.webkit.org/show_bug.cgi?id=142785 5 6 Reviewed by Antti Koivisto. 7 8 This is in transition to support <br>. A particular position could point to multiple 9 segments when <br> is directly followed by text. 10 11 No change in functionality. 12 13 * rendering/SimpleLineLayoutFlowContents.cpp: 14 (WebCore::SimpleLineLayout::FlowContents::segmentIndexForRunSlow): 15 (WebCore::SimpleLineLayout::FlowContents::segmentIndexForPositionSlow): Deleted. 16 * rendering/SimpleLineLayoutFlowContents.h: 17 (WebCore::SimpleLineLayout::FlowContents::segmentForRun): 18 (WebCore::SimpleLineLayout::FlowContents::segmentIndexForPosition): Deleted. 19 (WebCore::SimpleLineLayout::FlowContents::segmentForPosition): Deleted. 20 * rendering/SimpleLineLayoutResolver.cpp: 21 (WebCore::SimpleLineLayout::RunResolver::Run::text): 22 1 23 2015-03-17 Chris Dumez <cdumez@apple.com> 2 24 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp
r181290 r181682 52 52 } 53 53 54 unsigned FlowContents::segmentIndexFor PositionSlow(unsigned position) const54 unsigned FlowContents::segmentIndexForRunSlow(unsigned start, unsigned end) const 55 55 { 56 auto it = std::lower_bound(m_segments.begin(), m_segments.end(), position, [](const Segment& segment, unsigned position) {57 return segment.end <= position;56 auto it = std::lower_bound(m_segments.begin(), m_segments.end(), start, [](const Segment& segment, unsigned start) { 57 return segment.end <= start; 58 58 }); 59 59 ASSERT(it != m_segments.end()); 60 ASSERT_UNUSED(end, end <= it->end); 60 61 auto index = it - m_segments.begin(); 61 62 m_lastSegmentIndex = index; -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h
r181667 r181682 44 44 const RenderObject& renderer; 45 45 }; 46 const Segment& segmentFor Position(unsigned) const;46 const Segment& segmentForRun(unsigned start, unsigned end) const; 47 47 const Segment& segmentForRenderer(const RenderObject&) const; 48 48 … … 70 70 Iterator end() const { return Iterator(*this, m_segments.size()); } 71 71 72 unsigned segmentIndexForPosition(unsigned position) const;73 74 72 private: 75 unsigned segmentIndexFor PositionSlow(unsigned position) const;73 unsigned segmentIndexForRunSlow(unsigned start, unsigned end) const; 76 74 const Vector<Segment, 8> m_segments; 77 75 mutable unsigned m_lastSegmentIndex; … … 112 110 } 113 111 114 inline unsigned FlowContents::segmentIndexForPosition(unsigned position) const112 inline const FlowContents::Segment& FlowContents::segmentForRun(unsigned start, unsigned end) const 115 113 { 114 ASSERT(start < end); 116 115 auto& lastSegment = m_segments[m_lastSegmentIndex]; 117 if (lastSegment.start <= position && position < lastSegment.end) 118 return m_lastSegmentIndex; 119 return segmentIndexForPositionSlow(position); 120 } 121 122 inline const FlowContents::Segment& FlowContents::segmentForPosition(unsigned position) const 123 { 124 return m_segments[segmentIndexForPosition(position)]; 116 if (lastSegment.start <= start && end <= lastSegment.end) 117 return m_segments[m_lastSegmentIndex]; 118 return m_segments[segmentIndexForRunSlow(start, end)]; 125 119 } 126 120 -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp
r181290 r181682 77 77 auto& resolver = m_iterator.resolver(); 78 78 auto& run = m_iterator.simpleRun(); 79 auto& segment = resolver.m_flowContents.segmentForPosition(run.start); 79 ASSERT(run.start < run.end); 80 auto& segment = resolver.m_flowContents.segmentForRun(run.start, run.end); 80 81 // We currently split runs on segment boundaries (different RenderObject). 81 82 ASSERT(run.end <= segment.end);
Note:
See TracChangeset
for help on using the changeset viewer.