Title: [294193] trunk/Source/WebCore
- Revision
- 294193
- Author
- za...@apple.com
- Date
- 2022-05-14 06:59:52 -0700 (Sat, 14 May 2022)
Log Message
[FFC][Integration] Add updateFormattingRootGeometryAndInvalidate/updateRenderers
https://bugs.webkit.org/show_bug.cgi?id=240413
Reviewed by Antti Koivisto.
Make sure that the layout box/renderer geometries are all up-to-date.
* layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
(WebCore::LayoutIntegration::logicalBorder):
(WebCore::LayoutIntegration::logicalPadding):
(WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
(WebCore::LayoutIntegration::FlexLayout::layout):
(WebCore::LayoutIntegration::FlexLayout::updateRenderers const):
* layout/integration/flex/LayoutIntegrationFlexLayout.h:
(WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer const):
(WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (294192 => 294193)
--- trunk/Source/WebCore/ChangeLog 2022-05-14 13:30:56 UTC (rev 294192)
+++ trunk/Source/WebCore/ChangeLog 2022-05-14 13:59:52 UTC (rev 294193)
@@ -1,5 +1,26 @@
2022-05-14 Alan Bujtas <za...@apple.com>
+ [FFC][Integration] Add updateFormattingRootGeometryAndInvalidate/updateRenderers
+ https://bugs.webkit.org/show_bug.cgi?id=240413
+
+ Reviewed by Antti Koivisto.
+
+ Make sure that the layout box/renderer geometries are all up-to-date.
+
+ * layout/integration/flex/LayoutIntegrationFlexLayout.cpp:
+ (WebCore::LayoutIntegration::logicalBorder):
+ (WebCore::LayoutIntegration::logicalPadding):
+ (WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate):
+ (WebCore::LayoutIntegration::FlexLayout::layout):
+ (WebCore::LayoutIntegration::FlexLayout::updateRenderers const):
+ * layout/integration/flex/LayoutIntegrationFlexLayout.h:
+ (WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer const):
+ (WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext):
+
+2022-05-14 Alan Bujtas <za...@apple.com>
+
[FFC][Integration] Do not reset the effective display value for flex root
https://bugs.webkit.org/show_bug.cgi?id=240412
Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp (294192 => 294193)
--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp 2022-05-14 13:30:56 UTC (rev 294192)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp 2022-05-14 13:59:52 UTC (rev 294193)
@@ -45,8 +45,48 @@
{
}
+// FIXME: Merge these with the other integration layout functions.
+static inline Layout::Edges logicalBorder(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
+{
+ UNUSED_PARAM(isLeftToRightInlineDirection);
+ UNUSED_PARAM(writingMode);
+
+ auto borderLeft = renderer.borderLeft();
+ auto borderRight = renderer.borderRight();
+ auto borderTop = renderer.borderTop();
+ auto borderBottom = renderer.borderBottom();
+
+ return { { borderLeft, borderRight }, { borderTop, borderBottom } };
+}
+
+static inline Layout::Edges logicalPadding(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode)
+{
+ UNUSED_PARAM(isLeftToRightInlineDirection);
+ UNUSED_PARAM(writingMode);
+
+ auto paddingLeft = renderer.paddingLeft();
+ auto paddingRight = renderer.paddingRight();
+ auto paddingTop = renderer.paddingTop();
+ auto paddingBottom = renderer.paddingBottom();
+
+ return { { paddingLeft, paddingRight }, { paddingTop, paddingBottom } };
+}
+
void FlexLayout::updateFormattingRootGeometryAndInvalidate()
{
+ auto& flexBoxRenderer = this->flexBoxRenderer();
+
+ auto updateGeometry = [&](auto& root) {
+ auto isLeftToRightInlineDirection = flexBoxRenderer.style().isLeftToRightDirection();
+ auto writingMode = flexBoxRenderer.style().writingMode();
+
+ root.setContentBoxWidth(writingMode == WritingMode::TopToBottom ? flexBoxRenderer.contentWidth() : flexBoxRenderer.contentHeight());
+ root.setPadding(logicalPadding(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
+ root.setBorder(logicalBorder(flexBoxRenderer, isLeftToRightInlineDirection, writingMode));
+ root.setHorizontalMargin({ });
+ root.setVerticalMargin({ });
+ };
+ return updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox()));
}
void FlexLayout::updateFlexItemDimensions(const RenderBlock& flexItem)
@@ -80,8 +120,21 @@
auto horizontalConstraints = Layout::HorizontalConstraints { rootGeometry.contentBoxLeft(), rootGeometry.contentBoxWidth() };
flexFormattingContext.layoutInFlowContentForIntegration({ horizontalConstraints, rootGeometry.contentBoxTop() });
+
+ updateRenderers();
}
+void FlexLayout::updateRenderers() const
+{
+ auto& boxAndRendererList = m_boxTree.boxAndRendererList();
+ for (auto& boxAndRenderer : boxAndRendererList) {
+ auto& layoutBox = boxAndRenderer.box.get();
+
+ auto& renderer = downcast<RenderBox>(*boxAndRenderer.renderer);
+ renderer.setLocation(Layout::BoxGeometry::borderBoxTopLeft(m_flexFormattingState.boxGeometry(layoutBox)));
+ }
+}
+
void FlexLayout::paint(PaintInfo&, const LayoutPoint&)
{
}
Modified: trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h (294192 => 294193)
--- trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h 2022-05-14 13:30:56 UTC (rev 294192)
+++ trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h 2022-05-14 13:59:52 UTC (rev 294193)
@@ -64,9 +64,14 @@
LayoutUnit contentLogicalHeight() const;
private:
+ void updateRenderers() const;
+
const Layout::ContainerBox& rootLayoutBox() const { return m_boxTree.rootLayoutBox(); }
Layout::ContainerBox& rootLayoutBox() { return m_boxTree.rootLayoutBox(); }
+ const RenderFlexibleBox& flexBoxRenderer() const { return downcast<RenderFlexibleBox>(m_boxTree.rootRenderer()); }
+ RenderFlexibleBox& flexBoxRenderer() { return downcast<RenderFlexibleBox>(m_boxTree.rootRenderer()); }
+
BoxTree m_boxTree;
Layout::LayoutState m_layoutState;
Layout::FlexFormattingState& m_flexFormattingState;
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (294192 => 294193)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2022-05-14 13:30:56 UTC (rev 294192)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2022-05-14 13:59:52 UTC (rev 294193)
@@ -2347,6 +2347,8 @@
if (!m_flexLayout)
m_flexLayout = makeUnique<LayoutIntegration::FlexLayout>(*this);
+ m_flexLayout->updateFormattingRootGeometryAndInvalidate();
+
for (auto& flexItem : childrenOfType<RenderBlock>(*this)) {
flexItem.layoutIfNeeded();
m_flexLayout->updateFlexItemDimensions(flexItem);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes