Title: [250088] trunk/Source/WebCore
Revision
250088
Author
[email protected]
Date
2019-09-19 06:25:46 -0700 (Thu, 19 Sep 2019)

Log Message

[LFC] FloatingContext should take the root container.
https://bugs.webkit.org/show_bug.cgi?id=201968
<rdar://problem/55505090>

Reviewed by Antti Koivisto.

Now FormattingContext::root() does not need to be public anymore.

* layout/FormattingContext.h:
(WebCore::Layout::FormattingContext::root const):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::FloatingContext):
(WebCore::Layout::FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot const):
* layout/floats/FloatingContext.h:
(WebCore::Layout::FloatingContext::root const):
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
(WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250087 => 250088)


--- trunk/Source/WebCore/ChangeLog	2019-09-19 05:58:27 UTC (rev 250087)
+++ trunk/Source/WebCore/ChangeLog	2019-09-19 13:25:46 UTC (rev 250088)
@@ -1,3 +1,26 @@
+2019-09-19  Zalan Bujtas  <[email protected]>
+
+        [LFC] FloatingContext should take the root container.
+        https://bugs.webkit.org/show_bug.cgi?id=201968
+        <rdar://problem/55505090>
+
+        Reviewed by Antti Koivisto.
+
+        Now FormattingContext::root() does not need to be public anymore.
+
+        * layout/FormattingContext.h:
+        (WebCore::Layout::FormattingContext::root const):
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
+        * layout/floats/FloatingContext.cpp:
+        (WebCore::Layout::FloatingContext::FloatingContext):
+        (WebCore::Layout::FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot const):
+        * layout/floats/FloatingContext.h:
+        (WebCore::Layout::FloatingContext::root const):
+        * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
+        (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
+        (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
+
 2019-09-18  Brent Fulgham  <[email protected]>
 
         [FTW] Correct ImageBufferData and clear operations

Modified: trunk/Source/WebCore/layout/FormattingContext.h (250087 => 250088)


--- trunk/Source/WebCore/layout/FormattingContext.h	2019-09-19 05:58:27 UTC (rev 250087)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2019-09-19 13:25:46 UTC (rev 250088)
@@ -76,11 +76,10 @@
     };
     const Display::Box& geometryForBox(const Box&, Optional<EscapeType> = WTF::nullopt) const;
 
-    const Container& root() const { return *m_root; }
-
 protected:
     using LayoutQueue = Vector<const Box*>;
 
+    const Container& root() const { return *m_root; }
     LayoutState& layoutState() const;
     const FormattingState& formattingState() const { return m_formattingState; }
     FormattingState& formattingState() { return m_formattingState; }

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (250087 => 250088)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2019-09-19 05:58:27 UTC (rev 250087)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2019-09-19 13:25:46 UTC (rev 250088)
@@ -60,7 +60,7 @@
 
     auto& formattingRoot = root();
     LayoutQueue layoutQueue;
-    auto floatingContext = FloatingContext { *this, formattingState().floatingState() };
+    auto floatingContext = FloatingContext { formattingRoot, *this, formattingState().floatingState() };
     // This is a post-order tree traversal layout.
     // The root container layout is done in the formatting context it lives in, not that one it creates, so let's start with the first child.
     if (auto* firstChild = formattingRoot.firstInFlowOrFloatingChild())

Modified: trunk/Source/WebCore/layout/floats/FloatingContext.cpp (250087 => 250088)


--- trunk/Source/WebCore/layout/floats/FloatingContext.cpp	2019-09-19 05:58:27 UTC (rev 250087)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.cpp	2019-09-19 13:25:46 UTC (rev 250088)
@@ -156,8 +156,9 @@
     HorizontalEdges containingBlockContentBox;
 };
 
-FloatingContext::FloatingContext(const FormattingContext& formattingContext, FloatingState& floatingState)
-    : m_formattingContext(formattingContext)
+FloatingContext::FloatingContext(const Container& floatingContextRoot, const FormattingContext& formattingContext, FloatingState& floatingState)
+    : m_root(makeWeakPtr(floatingContextRoot))
+    , m_formattingContext(formattingContext)
     , m_floatingState(floatingState)
 {
 }
@@ -457,7 +458,7 @@
 
 Point FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot(Point position) const
 {
-    auto& from = formattingContext().root();
+    auto& from = root();
     auto& to = floatingState().root();
     if (&from == &to)
         return position;

Modified: trunk/Source/WebCore/layout/floats/FloatingContext.h (250087 => 250088)


--- trunk/Source/WebCore/layout/floats/FloatingContext.h	2019-09-19 05:58:27 UTC (rev 250087)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.h	2019-09-19 13:25:46 UTC (rev 250088)
@@ -46,7 +46,7 @@
 class FloatingContext {
     WTF_MAKE_ISO_ALLOCATED(FloatingContext);
 public:
-    FloatingContext(const FormattingContext&, FloatingState&);
+    FloatingContext(const Container& floatingContextRoot, const FormattingContext&, FloatingState&);
 
     FloatingState& floatingState() const { return m_floatingState; }
 
@@ -72,7 +72,7 @@
 private:
     LayoutState& layoutState() const { return m_floatingState.layoutState(); }
     const FormattingContext& formattingContext() const { return m_formattingContext; }
-    const Container& root() const { return formattingContext().root(); }
+    const Container& root() const { return *m_root; }
 
     void findPositionForFloatBox(FloatBox&) const;
     void findPositionForFormattingContextRoot(FloatAvoider&) const;
@@ -83,6 +83,7 @@
     LayoutUnit mapTopToFloatingStateRoot(const Box&) const;
     Point mapPointFromFormattingContextRootToFloatingStateRoot(Point) const;
 
+    WeakPtr<const Container> m_root;
     const FormattingContext& m_formattingContext;
     FloatingState& m_floatingState;
 };

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp (250087 => 250088)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp	2019-09-19 05:58:27 UTC (rev 250087)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp	2019-09-19 13:25:46 UTC (rev 250088)
@@ -280,7 +280,7 @@
     auto& formattingContext = this->formattingContext();
     auto& formattingRoot = this->formattingRoot();
     auto& formattingRootGeometry = formattingContext.geometryForBox(formattingRoot);
-    auto floatingContext = FloatingContext { formattingContext, layoutState.establishedFormattingState(formattingRoot).floatingState() };
+    auto floatingContext = FloatingContext { formattingRoot, formattingContext, layoutState.establishedFormattingState(formattingRoot).floatingState() };
 
     auto lineLogicalTop = formattingRootGeometry.contentBoxTop();
     auto lineLogicalLeft = formattingRootGeometry.contentBoxLeft();
@@ -362,7 +362,7 @@
     auto& layoutState = this->layoutState();
     auto& formattingContext = this->formattingContext();
     auto& formattingState = downcast<InlineFormattingState>(layoutState.establishedFormattingState(formattingRoot()));
-    auto floatingContext = FloatingContext { formattingContext, formattingState.floatingState() };
+    auto floatingContext = FloatingContext { formattingRoot(), formattingContext, formattingState.floatingState() };
 
     // Move floats to their final position.
     for (auto floatItem : floats) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to