Changeset 294193 in webkit
- Timestamp:
- May 14, 2022 6:59:52 AM (2 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r294192 r294193 1 2022-05-14 Alan Bujtas <zalan@apple.com> 2 3 [FFC][Integration] Add updateFormattingRootGeometryAndInvalidate/updateRenderers 4 https://bugs.webkit.org/show_bug.cgi?id=240413 5 6 Reviewed by Antti Koivisto. 7 8 Make sure that the layout box/renderer geometries are all up-to-date. 9 10 * layout/integration/flex/LayoutIntegrationFlexLayout.cpp: 11 (WebCore::LayoutIntegration::logicalBorder): 12 (WebCore::LayoutIntegration::logicalPadding): 13 (WebCore::LayoutIntegration::FlexLayout::updateFormattingRootGeometryAndInvalidate): 14 (WebCore::LayoutIntegration::FlexLayout::layout): 15 (WebCore::LayoutIntegration::FlexLayout::updateRenderers const): 16 * layout/integration/flex/LayoutIntegrationFlexLayout.h: 17 (WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer const): 18 (WebCore::LayoutIntegration::FlexLayout::flexBoxRenderer): 19 * rendering/RenderFlexibleBox.cpp: 20 (WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext): 21 1 22 2022-05-14 Alan Bujtas <zalan@apple.com> 2 23 -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
r294191 r294193 46 46 } 47 47 48 // FIXME: Merge these with the other integration layout functions. 49 static inline Layout::Edges logicalBorder(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode) 50 { 51 UNUSED_PARAM(isLeftToRightInlineDirection); 52 UNUSED_PARAM(writingMode); 53 54 auto borderLeft = renderer.borderLeft(); 55 auto borderRight = renderer.borderRight(); 56 auto borderTop = renderer.borderTop(); 57 auto borderBottom = renderer.borderBottom(); 58 59 return { { borderLeft, borderRight }, { borderTop, borderBottom } }; 60 } 61 62 static inline Layout::Edges logicalPadding(const RenderBoxModelObject& renderer, bool isLeftToRightInlineDirection, WritingMode writingMode) 63 { 64 UNUSED_PARAM(isLeftToRightInlineDirection); 65 UNUSED_PARAM(writingMode); 66 67 auto paddingLeft = renderer.paddingLeft(); 68 auto paddingRight = renderer.paddingRight(); 69 auto paddingTop = renderer.paddingTop(); 70 auto paddingBottom = renderer.paddingBottom(); 71 72 return { { paddingLeft, paddingRight }, { paddingTop, paddingBottom } }; 73 } 74 48 75 void FlexLayout::updateFormattingRootGeometryAndInvalidate() 49 76 { 77 auto& flexBoxRenderer = this->flexBoxRenderer(); 78 79 auto updateGeometry = [&](auto& root) { 80 auto isLeftToRightInlineDirection = flexBoxRenderer.style().isLeftToRightDirection(); 81 auto writingMode = flexBoxRenderer.style().writingMode(); 82 83 root.setContentBoxWidth(writingMode == WritingMode::TopToBottom ? flexBoxRenderer.contentWidth() : flexBoxRenderer.contentHeight()); 84 root.setPadding(logicalPadding(flexBoxRenderer, isLeftToRightInlineDirection, writingMode)); 85 root.setBorder(logicalBorder(flexBoxRenderer, isLeftToRightInlineDirection, writingMode)); 86 root.setHorizontalMargin({ }); 87 root.setVerticalMargin({ }); 88 }; 89 return updateGeometry(m_layoutState.ensureGeometryForBox(rootLayoutBox())); 50 90 } 51 91 … … 81 121 82 122 flexFormattingContext.layoutInFlowContentForIntegration({ horizontalConstraints, rootGeometry.contentBoxTop() }); 123 124 updateRenderers(); 125 } 126 127 void FlexLayout::updateRenderers() const 128 { 129 auto& boxAndRendererList = m_boxTree.boxAndRendererList(); 130 for (auto& boxAndRenderer : boxAndRendererList) { 131 auto& layoutBox = boxAndRenderer.box.get(); 132 133 auto& renderer = downcast<RenderBox>(*boxAndRenderer.renderer); 134 renderer.setLocation(Layout::BoxGeometry::borderBoxTopLeft(m_flexFormattingState.boxGeometry(layoutBox))); 135 } 83 136 } 84 137 -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
r293297 r294193 65 65 66 66 private: 67 void updateRenderers() const; 68 67 69 const Layout::ContainerBox& rootLayoutBox() const { return m_boxTree.rootLayoutBox(); } 68 70 Layout::ContainerBox& rootLayoutBox() { return m_boxTree.rootLayoutBox(); } 71 72 const RenderFlexibleBox& flexBoxRenderer() const { return downcast<RenderFlexibleBox>(m_boxTree.rootRenderer()); } 73 RenderFlexibleBox& flexBoxRenderer() { return downcast<RenderFlexibleBox>(m_boxTree.rootRenderer()); } 69 74 70 75 BoxTree m_boxTree; -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r293943 r294193 2348 2348 m_flexLayout = makeUnique<LayoutIntegration::FlexLayout>(*this); 2349 2349 2350 m_flexLayout->updateFormattingRootGeometryAndInvalidate(); 2351 2350 2352 for (auto& flexItem : childrenOfType<RenderBlock>(*this)) { 2351 2353 flexItem.layoutIfNeeded();
Note: See TracChangeset
for help on using the changeset viewer.