Title: [293297] trunk/Source/WebCore
Revision
293297
Author
za...@apple.com
Date
2022-04-23 16:03:32 -0700 (Sat, 23 Apr 2022)

Log Message

[FFC][Integration] Add integration API to FlexFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=239692

Reviewed by Antti Koivisto.

The integration codepath needs dedicated (and temporary)APIs on the formatting contexts.
(This is exactly how inline layout has been integrated.)

* layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntergration):
(WebCore::Layout::FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration):
* layout/formattingContexts/flex/FlexFormattingContext.h:
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntergration):
(WebCore::Layout::InlineFormattingContext::lineLayoutForIntergration): Deleted.
* layout/formattingContexts/inline/InlineFormattingContext.h:
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::FlexLayout::FlexLayout):
(WebCore::LayoutIntegration::FlexLayout::computeIntrinsicWidthConstraints):
(WebCore::LayoutIntegration::FlexLayout::layout):
* layout/integration/flex/LayoutIntegrationFlexLayout.h:
(WebCore::LayoutIntegration::FlexLayout::rootLayoutBox const):
(WebCore::LayoutIntegration::FlexLayout::rootLayoutBox):
* layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layout):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293296 => 293297)


--- trunk/Source/WebCore/ChangeLog	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/ChangeLog	2022-04-23 23:03:32 UTC (rev 293297)
@@ -1,3 +1,31 @@
+2022-04-23  Alan Bujtas  <za...@apple.com>
+
+        [FFC][Integration] Add integration API to FlexFormattingContext
+        https://bugs.webkit.org/show_bug.cgi?id=239692
+
+        Reviewed by Antti Koivisto.
+
+        The integration codepath needs dedicated (and temporary)APIs on the formatting contexts.
+        (This is exactly how inline layout has been integrated.)
+
+        * layout/formattingContexts/flex/FlexFormattingContext.cpp:
+        (WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntergration):
+        (WebCore::Layout::FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration):
+        * layout/formattingContexts/flex/FlexFormattingContext.h:
+        * layout/formattingContexts/inline/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::layoutInFlowContentForIntergration):
+        (WebCore::Layout::InlineFormattingContext::lineLayoutForIntergration): Deleted.
+        * layout/formattingContexts/inline/InlineFormattingContext.h:
+        * layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+        (WebCore::LayoutIntegration::FlexLayout::FlexLayout):
+        (WebCore::LayoutIntegration::FlexLayout::computeIntrinsicWidthConstraints):
+        (WebCore::LayoutIntegration::FlexLayout::layout):
+        * layout/integration/flex/LayoutIntegrationFlexLayout.h:
+        (WebCore::LayoutIntegration::FlexLayout::rootLayoutBox const):
+        (WebCore::LayoutIntegration::FlexLayout::rootLayoutBox):
+        * layout/integration/inline/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::layout):
+
 2022-04-23  Brady Eidson  <beid...@apple.com>
 
         Add WKNotification and WKWebsiteDataStore SPI for handling click/close of persistent notifications

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp (293296 => 293297)


--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp	2022-04-23 23:03:32 UTC (rev 293297)
@@ -118,7 +118,16 @@
     }
 }
 
+void FlexFormattingContext::layoutInFlowContentForIntergration(const ConstraintsForInFlowContent&)
+{
 }
+
+IntrinsicWidthConstraints FlexFormattingContext::computedIntrinsicWidthConstraintsForIntegration()
+{
+    return { };
 }
 
+}
+}
+
 #endif

Modified: trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h (293296 => 293297)


--- trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h	2022-04-23 23:03:32 UTC (rev 293297)
@@ -42,13 +42,15 @@
 public:
     FlexFormattingContext(const ContainerBox& formattingContextRoot, FlexFormattingState&);
     void layoutInFlowContent(const ConstraintsForInFlowContent&) override;
+    IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
     LayoutUnit usedContentHeight() const override;
 
-    IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
-
     const FlexFormattingGeometry& formattingGeometry() const final { return m_flexFormattingGeometry; }
     const FormattingQuirks& formattingQuirks() const final { return m_flexFormattingQuirks; }
 
+    void layoutInFlowContentForIntergration(const ConstraintsForInFlowContent&);
+    IntrinsicWidthConstraints computedIntrinsicWidthConstraintsForIntegration();
+
 private:
     void sizeAndPlaceFlexItems(const ConstraintsForInFlowContent&);
     void computeIntrinsicWidthConstraintsForFlexItems();

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (293296 => 293297)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2022-04-23 23:03:32 UTC (rev 293297)
@@ -150,7 +150,7 @@
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> formatting root(" << &root() << ")");
 }
 
-void InlineFormattingContext::lineLayoutForIntergration(const ConstraintsForInFlowContent& constraints)
+void InlineFormattingContext::layoutInFlowContentForIntergration(const ConstraintsForInFlowContent& constraints)
 {
     invalidateFormattingState();
     collectContentIfNeeded();

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h (293296 => 293297)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h	2022-04-23 23:03:32 UTC (rev 293297)
@@ -47,19 +47,18 @@
     WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext);
 public:
     InlineFormattingContext(const ContainerBox& formattingContextRoot, InlineFormattingState&, const InlineDamage* = nullptr);
+
     void layoutInFlowContent(const ConstraintsForInFlowContent&) override;
+    IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
     LayoutUnit usedContentHeight() const override;
 
     const InlineFormattingState& formattingState() const { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }
     InlineFormattingState& formattingState() { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }
-
-    void lineLayoutForIntergration(const ConstraintsForInFlowContent&);
-    IntrinsicWidthConstraints computedIntrinsicWidthConstraintsForIntegration();
-
     const InlineFormattingGeometry& formattingGeometry() const final { return m_inlineFormattingGeometry; }
     const InlineFormattingQuirks& formattingQuirks() const final { return m_inlineFormattingQuirks; }
 
-    IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
+    void layoutInFlowContentForIntergration(const ConstraintsForInFlowContent&);
+    IntrinsicWidthConstraints computedIntrinsicWidthConstraintsForIntegration();
 
 private:
     void lineLayout(InlineItems&, LineBuilder::InlineItemRange, const ConstraintsForInFlowContent&);

Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (293296 => 293297)


--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp	2022-04-23 23:03:32 UTC (rev 293297)
@@ -28,6 +28,7 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
+#include "FlexFormattingContext.h"
 #include "HitTestLocation.h"
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
@@ -39,7 +40,8 @@
 
 FlexLayout::FlexLayout(RenderFlexibleBox& flexBoxRenderer)
     : m_boxTree(flexBoxRenderer)
-    , m_layoutState(flexBoxRenderer.document(), m_boxTree.rootLayoutBox())
+    , m_layoutState(flexBoxRenderer.document(), rootLayoutBox())
+    , m_flexFormattingState(m_layoutState.ensureFlexFormattingState(rootLayoutBox()))
 {
 }
 
@@ -65,11 +67,19 @@
 
 std::pair<LayoutUnit, LayoutUnit> FlexLayout::computeIntrinsicWidthConstraints()
 {
-    return { };
+    auto flexFormattingContext = Layout::FlexFormattingContext { rootLayoutBox(), m_flexFormattingState };
+    auto constraints = flexFormattingContext.computedIntrinsicWidthConstraintsForIntegration();
+
+    return { constraints.minimum, constraints.maximum };
 }
 
 void FlexLayout::layout()
 {
+    auto& rootGeometry = m_layoutState.geometryForBox(rootLayoutBox());
+    auto flexFormattingContext = Layout::FlexFormattingContext { rootLayoutBox(), m_flexFormattingState };
+    auto horizontalConstraints = Layout::HorizontalConstraints { rootGeometry.contentBoxLeft(), rootGeometry.contentBoxWidth() };
+
+    flexFormattingContext.layoutInFlowContentForIntergration({ horizontalConstraints, rootGeometry.contentBoxTop() });
 }
 
 void FlexLayout::paint(PaintInfo&, const LayoutPoint&)

Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h (293296 => 293297)


--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h	2022-04-23 23:03:32 UTC (rev 293297)
@@ -27,6 +27,7 @@
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
+#include "FlexFormattingState.h"
 #include "LayoutIntegrationBoxTree.h"
 #include "LayoutState.h"
 #include "RenderObjectEnums.h"
@@ -63,8 +64,12 @@
     LayoutUnit contentLogicalHeight() const;
 
 private:
+    const Layout::ContainerBox& rootLayoutBox() const { return m_boxTree.rootLayoutBox(); }
+    Layout::ContainerBox& rootLayoutBox() { return m_boxTree.rootLayoutBox(); }
+
     BoxTree m_boxTree;
     Layout::LayoutState m_layoutState;
+    Layout::FlexFormattingState& m_flexFormattingState;
 };
 
 }

Modified: trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp (293296 => 293297)


--- trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp	2022-04-23 22:26:57 UTC (rev 293296)
+++ trunk/Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp	2022-04-23 23:03:32 UTC (rev 293297)
@@ -380,7 +380,7 @@
 
     auto horizontalConstraints = Layout::HorizontalConstraints { rootGeometry.contentBoxLeft(), rootGeometry.contentBoxWidth() };
 
-    inlineFormattingContext.lineLayoutForIntergration({ horizontalConstraints, rootGeometry.contentBoxTop() });
+    inlineFormattingContext.layoutInFlowContentForIntergration({ horizontalConstraints, rootGeometry.contentBoxTop() });
 
     constructContent();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to