Changeset 181683 in webkit
- Timestamp:
- Mar 17, 2015, 9:00:40 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
rendering/SimpleLineLayoutFlowContents.h (modified) (2 diffs)
-
rendering/SimpleLineLayoutTextFragmentIterator.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r181682 r181683 1 2015-03-17 Zalan Bujtas <zalan@apple.com> 2 3 Simple line layout: Use Vector<>::const_iterator instead of custom FlowContents::Iterator. 4 https://bugs.webkit.org/show_bug.cgi?id=142809 5 6 Reviewed by Antti Koivisto. 7 8 FlowContents::Iterator simply iterates on a vector<>. No need to custom implement it. 9 10 No change in functionality. 11 12 * rendering/SimpleLineLayoutFlowContents.h: 13 (WebCore::SimpleLineLayout::FlowContents::begin): 14 (WebCore::SimpleLineLayout::FlowContents::end): 15 (WebCore::SimpleLineLayout::FlowContents::Iterator::Iterator): Deleted. 16 (WebCore::SimpleLineLayout::FlowContents::Iterator::operator++): Deleted. 17 (WebCore::SimpleLineLayout::FlowContents::Iterator::operator--): Deleted. 18 (WebCore::SimpleLineLayout::FlowContents::Iterator::operator==): Deleted. 19 (WebCore::SimpleLineLayout::FlowContents::Iterator::operator!=): Deleted. 20 (WebCore::SimpleLineLayout::FlowContents::Iterator::operator*): Deleted. 21 (WebCore::SimpleLineLayout::FlowContents::Iterator::operator->): Deleted. 22 * rendering/SimpleLineLayoutTextFragmentIterator.cpp: 23 (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition): 24 1 25 2015-03-17 Zalan Bujtas <zalan@apple.com> 2 26 -
trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h
r181682 r181683 47 47 const Segment& segmentForRenderer(const RenderObject&) const; 48 48 49 class Iterator { 50 public: 51 Iterator(const FlowContents& flowContents, unsigned segmentIndex) 52 : m_flowContents(flowContents) 53 , m_segmentIndex(segmentIndex) 54 { 55 } 56 57 Iterator& operator++(); 58 Iterator& operator--(); 59 bool operator==(const Iterator& other) const; 60 bool operator!=(const Iterator& other) const; 61 const Segment& operator*() const; 62 const Segment* operator->() const; 63 64 private: 65 const FlowContents& m_flowContents; 66 unsigned m_segmentIndex; 67 }; 68 69 Iterator begin() const { return Iterator(*this, 0); } 70 Iterator end() const { return Iterator(*this, m_segments.size()); } 49 typedef Vector<Segment, 8>::const_iterator Iterator; 50 Iterator begin() const { return m_segments.begin(); } 51 Iterator end() const { return m_segments.end(); } 71 52 72 53 private: … … 75 56 mutable unsigned m_lastSegmentIndex; 76 57 }; 77 78 inline FlowContents::Iterator& FlowContents::Iterator::operator++()79 {80 ++m_segmentIndex;81 return *this;82 }83 84 inline FlowContents::Iterator& FlowContents::Iterator::operator--()85 {86 --m_segmentIndex;87 return *this;88 }89 90 inline bool FlowContents::Iterator::operator==(const FlowContents::Iterator& other) const91 {92 return m_segmentIndex == other.m_segmentIndex;93 }94 95 inline bool FlowContents::Iterator::operator!=(const FlowContents::Iterator& other) const96 {97 return !(*this == other);98 }99 100 inline const FlowContents::Segment& FlowContents::Iterator::operator*() const101 {102 ASSERT(m_segmentIndex < m_flowContents.m_segments.size());103 return m_flowContents.m_segments[m_segmentIndex];104 }105 106 inline const FlowContents::Segment* FlowContents::Iterator::operator->() const107 {108 ASSERT(m_segmentIndex < m_flowContents.m_segments.size());109 return &(m_flowContents.m_segments[m_segmentIndex]);110 }111 58 112 59 inline const FlowContents::Segment& FlowContents::segmentForRun(unsigned start, unsigned end) const -
trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp
r181667 r181683 158 158 // We need to know whether the word actually finishes at the end of this renderer or not. 159 159 if (nextPosition == m_currentSegment->end) { 160 auto nextSegment = m_currentSegment; 161 ++nextSegment; 160 const auto nextSegment = m_currentSegment + 1; 162 161 if (nextSegment != m_flowContents.end()) 163 162 overlappingFragment = nextPosition < (nextSegment->text.is8Bit() ? nextBreakablePosition<LChar>(*nextSegment, nextPosition) : nextBreakablePosition<UChar>(*nextSegment, nextPosition));
Note:
See TracChangeset
for help on using the changeset viewer.