⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181683 in webkit


Ignore:
Timestamp:
Mar 17, 2015, 9:00:40 PM (11 years ago)
Author:
Alan Bujtas
Message:

Simple line layout: Use Vector<>::const_iterator instead of custom FlowContents::Iterator.
https://bugs.webkit.org/show_bug.cgi?id=142809

Reviewed by Antti Koivisto.

FlowContents::Iterator simply iterates on a vector<>. No need to custom implement it.

No change in functionality.

  • rendering/SimpleLineLayoutFlowContents.h:

(WebCore::SimpleLineLayout::FlowContents::begin):
(WebCore::SimpleLineLayout::FlowContents::end):
(WebCore::SimpleLineLayout::FlowContents::Iterator::Iterator): Deleted.
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator++): Deleted.
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator--): Deleted.
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator==): Deleted.
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator!=): Deleted.
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator*): Deleted.
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator->): Deleted.

  • rendering/SimpleLineLayoutTextFragmentIterator.cpp:

(WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181682 r181683  
     12015-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
    1252015-03-17  Zalan Bujtas  <zalan@apple.com>
    226
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h

    r181682 r181683  
    4747    const Segment& segmentForRenderer(const RenderObject&) const;
    4848
    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(); }
    7152
    7253private:
     
    7556    mutable unsigned m_lastSegmentIndex;
    7657};
    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) const
    91 {
    92     return m_segmentIndex == other.m_segmentIndex;
    93 }
    94 
    95 inline bool FlowContents::Iterator::operator!=(const FlowContents::Iterator& other) const
    96 {
    97     return !(*this == other);
    98 }
    99 
    100 inline const FlowContents::Segment& FlowContents::Iterator::operator*() const
    101 {
    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->() const
    107 {
    108     ASSERT(m_segmentIndex < m_flowContents.m_segments.size());
    109     return &(m_flowContents.m_segments[m_segmentIndex]);
    110 }
    11158
    11259inline const FlowContents::Segment& FlowContents::segmentForRun(unsigned start, unsigned end) const
  • trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp

    r181667 r181683  
    158158        // We need to know whether the word actually finishes at the end of this renderer or not.
    159159        if (nextPosition == m_currentSegment->end) {
    160             auto nextSegment = m_currentSegment;
    161             ++nextSegment;
     160            const auto nextSegment = m_currentSegment + 1;
    162161            if (nextSegment != m_flowContents.end())
    163162                overlappingFragment = nextPosition < (nextSegment->text.is8Bit() ? nextBreakablePosition<LChar>(*nextSegment, nextPosition) : nextBreakablePosition<UChar>(*nextSegment, nextPosition));
Note: See TracChangeset for help on using the changeset viewer.