[LFC][Floating] Remove redundant LayoutContext member variable.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 23:46:10 +0000 (23:46 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Aug 2018 23:46:10 +0000 (23:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188286

Reviewed by Simon Fraser.

* layout/FloatingContext.cpp:
(WebCore::Layout::begin):
(WebCore::Layout::end):
(WebCore::Layout::FloatingContext::floatingPosition const):
(WebCore::Layout::FloatingPair::FloatingPair):
(WebCore::Layout::Iterator::Iterator):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234524 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/layout/FloatingContext.cpp

index 4ede1f5..363bbae 100644 (file)
@@ -1,3 +1,17 @@
+2018-08-02  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][Floating] Remove redundant LayoutContext member variable.
+        https://bugs.webkit.org/show_bug.cgi?id=188286
+
+        Reviewed by Simon Fraser.
+
+        * layout/FloatingContext.cpp:
+        (WebCore::Layout::begin):
+        (WebCore::Layout::end):
+        (WebCore::Layout::FloatingContext::floatingPosition const):
+        (WebCore::Layout::FloatingPair::FloatingPair):
+        (WebCore::Layout::Iterator::Iterator):
+
 2018-08-02  Ryosuke Niwa  <rniwa@webkit.org>
 
         Move queue processing logic from CustomElementReactionStack to CustomElementReactionQueue
index 604bb27..6f78dfc 100644 (file)
@@ -72,9 +72,8 @@ public:
 
 private:
     friend class Iterator;
-    FloatingPair(const LayoutContext&, const FloatingState::FloatList&);
+    FloatingPair(const FloatingState::FloatList&);
 
-    const LayoutContext& m_layoutContext;
     const FloatingState::FloatList& m_floats;
 
     std::optional<unsigned> m_leftIndex;
@@ -84,7 +83,7 @@ private:
 
 class Iterator {
 public:
-    Iterator(const LayoutContext&, const FloatingState::FloatList&, std::optional<LayoutUnit> verticalPosition);
+    Iterator(const FloatingState::FloatList&, std::optional<LayoutUnit> verticalPosition);
 
     const FloatingPair& operator*() const { return m_current; }
     Iterator& operator++();
@@ -94,20 +93,19 @@ public:
 private:
     void set(LayoutUnit verticalPosition);
 
-    const LayoutContext& m_layoutContext;
     const FloatingState::FloatList& m_floats;
     FloatingPair m_current;
 };
 
-static Iterator begin(const LayoutContext& layoutContext, const FloatingState& floatingState, LayoutUnit initialVerticalPosition)
+static Iterator begin(const FloatingState& floatingState, LayoutUnit initialVerticalPosition)
 {
     // Start with the inner-most floating pair for the initial vertical position.
-    return Iterator(layoutContext, floatingState.floats(), initialVerticalPosition);
+    return Iterator(floatingState.floats(), initialVerticalPosition);
 }
 
-static Iterator end(const LayoutContext& layoutContext, const FloatingState& floatingState)
+static Iterator end(const FloatingState& floatingState)
 {
-    return Iterator(layoutContext, floatingState.floats(), std::nullopt);
+    return Iterator(floatingState.floats(), std::nullopt);
 }
 
 FloatingContext::FloatingContext(FloatingState& floatingState)
@@ -139,10 +137,10 @@ Position FloatingContext::floatingPosition(const FloatingState::FloatItem& float
     auto& displayBox = floatItem.displayBox();
     auto marginBoxSize = displayBox.marginBox().size();
 
-    auto end = Layout::end(layoutContext(), m_floatingState);
+    auto end = Layout::end(m_floatingState);
     auto top = initialVerticalPosition;
     auto bottomMost = top;
-    for (auto iterator = begin(layoutContext(), m_floatingState, initialVerticalPosition); iterator != end; ++iterator) {
+    for (auto iterator = begin(m_floatingState, initialVerticalPosition); iterator != end; ++iterator) {
         ASSERT(!(*iterator).isEmpty());
 
         auto floats = *iterator;
@@ -233,9 +231,8 @@ Position FloatingContext::toContainingBlock(const FloatingState::FloatItem& floa
     return { position.x - containgBlockDisplayBox.left(), position.y - containgBlockDisplayBox.top() };
 }
 
-FloatingPair::FloatingPair(const LayoutContext& layoutContext, const FloatingState::FloatList& floats)
-    : m_layoutContext(layoutContext)
-    , m_floats(floats)
+FloatingPair::FloatingPair(const FloatingState::FloatList& floats)
+    : m_floats(floats)
 {
 }
 
@@ -309,10 +306,9 @@ LayoutUnit FloatingPair::bottom() const
     return *rightBottom;
 }
 
-Iterator::Iterator(const LayoutContext& layoutContext, const FloatingState::FloatList& floats, std::optional<LayoutUnit> verticalPosition)
-    : m_layoutContext(layoutContext)
-    , m_floats(floats)
-    , m_current(layoutContext, floats)
+Iterator::Iterator(const FloatingState::FloatList& floats, std::optional<LayoutUnit> verticalPosition)
+    : m_floats(floats)
+    , m_current(floats)
 {
     if (verticalPosition)
         set(*verticalPosition);