Title: [181683] trunk/Source/WebCore
Revision
181683
Author
[email protected]
Date
2015-03-17 21:00:40 -0700 (Tue, 17 Mar 2015)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181682 => 181683)


--- trunk/Source/WebCore/ChangeLog	2015-03-18 03:40:51 UTC (rev 181682)
+++ trunk/Source/WebCore/ChangeLog	2015-03-18 04:00:40 UTC (rev 181683)
@@ -1,5 +1,29 @@
 2015-03-17  Zalan Bujtas  <[email protected]>
 
+        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):
+
+2015-03-17  Zalan Bujtas  <[email protected]>
+
         Simple line layout: Change FlowContents::segmentForPosition() to segmentForRun().
         https://bugs.webkit.org/show_bug.cgi?id=142785
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h (181682 => 181683)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h	2015-03-18 03:40:51 UTC (rev 181682)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h	2015-03-18 04:00:40 UTC (rev 181683)
@@ -46,69 +46,16 @@
     const Segment& segmentForRun(unsigned start, unsigned end) const;
     const Segment& segmentForRenderer(const RenderObject&) const;
 
-    class Iterator {
-    public:
-        Iterator(const FlowContents& flowContents, unsigned segmentIndex)
-            : m_flowContents(flowContents)
-            , m_segmentIndex(segmentIndex)
-        {
-        }
+    typedef Vector<Segment, 8>::const_iterator Iterator;
+    Iterator begin() const { return m_segments.begin(); }
+    Iterator end() const { return m_segments.end(); }
 
-        Iterator& operator++();
-        Iterator& operator--();
-        bool operator==(const Iterator& other) const;
-        bool operator!=(const Iterator& other) const;
-        const Segment& operator*() const;
-        const Segment* operator->() const;
-
-    private:
-        const FlowContents& m_flowContents;
-        unsigned m_segmentIndex;
-    };
-
-    Iterator begin() const { return Iterator(*this, 0); }
-    Iterator end() const { return Iterator(*this, m_segments.size()); }
-
 private:
     unsigned segmentIndexForRunSlow(unsigned start, unsigned end) const;
     const Vector<Segment, 8> m_segments;
     mutable unsigned m_lastSegmentIndex;
 };
 
-inline FlowContents::Iterator& FlowContents::Iterator::operator++()
-{
-    ++m_segmentIndex;
-    return *this;
-}
-
-inline FlowContents::Iterator& FlowContents::Iterator::operator--()
-{
-    --m_segmentIndex;
-    return *this;
-}
-
-inline bool FlowContents::Iterator::operator==(const FlowContents::Iterator& other) const
-{
-    return m_segmentIndex == other.m_segmentIndex;
-}
-
-inline bool FlowContents::Iterator::operator!=(const FlowContents::Iterator& other) const
-{
-    return !(*this == other);
-}
-
-inline const FlowContents::Segment& FlowContents::Iterator::operator*() const
-{
-    ASSERT(m_segmentIndex < m_flowContents.m_segments.size());
-    return m_flowContents.m_segments[m_segmentIndex];
-}
-
-inline const FlowContents::Segment* FlowContents::Iterator::operator->() const
-{
-    ASSERT(m_segmentIndex < m_flowContents.m_segments.size());
-    return &(m_flowContents.m_segments[m_segmentIndex]);
-}
-
 inline const FlowContents::Segment& FlowContents::segmentForRun(unsigned start, unsigned end) const
 {
     ASSERT(start < end);

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (181682 => 181683)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2015-03-18 03:40:51 UTC (rev 181682)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2015-03-18 04:00:40 UTC (rev 181683)
@@ -157,8 +157,7 @@
         nextPosition = m_currentSegment->text.is8Bit() ? nextBreakablePosition<LChar>(*m_currentSegment, currentPosition) : nextBreakablePosition<UChar>(*m_currentSegment, currentPosition);
         // We need to know whether the word actually finishes at the end of this renderer or not.
         if (nextPosition == m_currentSegment->end) {
-            auto nextSegment = m_currentSegment;
-            ++nextSegment;
+            const auto nextSegment = m_currentSegment + 1;
             if (nextSegment != m_flowContents.end())
                 overlappingFragment = nextPosition < (nextSegment->text.is8Bit() ? nextBreakablePosition<LChar>(*nextSegment, nextPosition) : nextBreakablePosition<UChar>(*nextSegment, nextPosition));
         } else if (nextPosition == currentPosition) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to