Changeset 293293 in webkit
- Timestamp:
- Apr 23, 2022 1:25:12 PM (2 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r293291 r293293 1 2022-04-23 Alan Bujtas <zalan@apple.com> 2 3 [FFC][Integration] Construct and update the layout tree for the flex items 4 https://bugs.webkit.org/show_bug.cgi?id=239684 5 6 Reviewed by Antti Koivisto. 7 8 This patch implements the usual flow of preparing a subtree for integration layout. 9 10 1. Take the direct children of a RenderFlexibleBox (flex items) and construct Layout::ContainerBox objects. 11 2. Run layout on the direct children (RenderBlocks) first and update the associated Layout::ContainerBoxes' geometries. 12 3. Call LayoutIntegration::FlexLayout::layout (not yet implemented) to run flex layout on the flex items. 13 14 * layout/integration/LayoutIntegrationBoxTree.cpp: 15 (WebCore::LayoutIntegration::BoxTree::buildTreeForFlexContent): 16 * layout/integration/LayoutIntegrationBoxTree.h: 17 * layout/integration/flex/LayoutIntegrationFlexLayout.cpp: 18 (WebCore::LayoutIntegration::FlexLayout::FlexLayout): 19 (WebCore::LayoutIntegration::FlexLayout::updateFlexItemDimensions): 20 * layout/integration/flex/LayoutIntegrationFlexLayout.h: 21 * rendering/RenderFlexibleBox.cpp: 22 (WebCore::RenderFlexibleBox::layoutUsingFlexFormattingContext): 23 * rendering/RenderFlexibleBox.h: 24 1 25 2022-04-23 Andres Gonzalez <andresg_22@apple.com> 2 26 -
trunk/Source/WebCore/Headers.cmake
r293285 r293293 971 971 inspector/agents/InspectorPageAgent.h 972 972 973 layout/LayoutState.h 973 974 layout/LayoutUnits.h 974 975 layout/MarginTypes.h … … 976 977 layout/formattingContexts/inline/display/InlineDisplayBox.h 977 978 layout/formattingContexts/inline/InlineRect.h 979 980 layout/integration/LayoutIntegrationBoxTree.h 978 981 979 982 layout/integration/flex/LayoutIntegrationFlexLayout.h … … 992 995 layout/layouttree/LayoutContainerBox.h 993 996 layout/layouttree/LayoutBox.h 997 layout/layouttree/LayoutInitialContainingBlock.h 994 998 995 999 loader/CanvasActivityRecord.h -
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp
r293222 r293293 38 38 #include "RenderChildIterator.h" 39 39 #include "RenderDetailsMarker.h" 40 #include "RenderFlexibleBox.h" 40 41 #include "RenderImage.h" 41 42 #include "RenderLineBreak.h" … … 88 89 if (is<RenderBlockFlow>(rootRenderer)) 89 90 buildTreeForInlineContent(); 91 else if (is<RenderFlexibleBox>(rootRenderer)) 92 buildTreeForFlexContent(); 90 93 else 91 94 ASSERT_NOT_IMPLEMENTED_YET(); … … 171 174 auto childBox = createChildBox(childRenderer); 172 175 appendChild(makeUniqueRefFromNonNullUniquePtr(WTFMove(childBox)), childRenderer); 176 } 177 } 178 179 void BoxTree::buildTreeForFlexContent() 180 { 181 for (auto& flexItemRenderer : childrenOfType<RenderObject>(m_rootRenderer)) { 182 auto style = RenderStyle::clone(flexItemRenderer.style()); 183 auto flexItem = makeUnique<Layout::ContainerBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::IntegrationBlockContainer }, WTFMove(style)); 184 appendChild(makeUniqueRefFromNonNullUniquePtr(WTFMove(flexItem)), flexItemRenderer); 173 185 } 174 186 } -
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h
r293222 r293293 72 72 private: 73 73 void buildTreeForInlineContent(); 74 void buildTreeForFlexContent(); 74 75 void appendChild(UniqueRef<Layout::Box>, RenderObject&); 75 76 -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
r293251 r293293 32 32 #include "HitTestRequest.h" 33 33 #include "HitTestResult.h" 34 #include "LayoutBoxGeometry.h" 34 35 #include "RenderFlexibleBox.h" 35 36 … … 39 40 FlexLayout::FlexLayout(RenderFlexibleBox& flexBoxRenderer) 40 41 : m_boxTree(flexBoxRenderer) 42 , m_layoutState(flexBoxRenderer.document(), m_boxTree.rootLayoutBox()) 41 43 { 42 44 } … … 46 48 } 47 49 48 void FlexLayout::updateFlexItemDimensions(const RenderBlock& )50 void FlexLayout::updateFlexItemDimensions(const RenderBlock& flexItem) 49 51 { 52 auto& boxGeometry = m_layoutState.ensureGeometryForBox(m_boxTree.layoutBoxForRenderer(flexItem)); 53 54 boxGeometry.setContentBoxWidth(flexItem.contentWidth()); 55 boxGeometry.setContentBoxHeight(flexItem.contentHeight()); 56 boxGeometry.setVerticalMargin({ flexItem.marginTop(), flexItem.marginBottom() }); 57 boxGeometry.setHorizontalMargin({ flexItem.marginLeft(), flexItem.marginRight() }); 58 boxGeometry.setBorder({ { flexItem.borderLeft(), flexItem.borderRight() }, { flexItem.borderTop(), flexItem.borderBottom() } }); 59 boxGeometry.setPadding(Layout::Edges { { flexItem.paddingLeft(), flexItem.paddingRight() }, { flexItem.paddingTop(), flexItem.paddingBottom() } }); 50 60 } 51 61 -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.h
r293251 r293293 29 29 30 30 #include "LayoutIntegrationBoxTree.h" 31 #include "LayoutState.h" 31 32 #include "RenderObjectEnums.h" 32 33 #include <wtf/CheckedPtr.h> … … 64 65 private: 65 66 BoxTree m_boxTree; 67 Layout::LayoutState m_layoutState; 66 68 }; 67 69 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r293233 r293293 2345 2345 void RenderFlexibleBox::layoutUsingFlexFormattingContext() 2346 2346 { 2347 if (!m_flexLayout) 2348 m_flexLayout = makeUnique<LayoutIntegration::FlexLayout>(*this); 2349 2350 for (auto& flexItem : childrenOfType<RenderBlock>(*this)) { 2351 flexItem.layoutIfNeeded(); 2352 m_flexLayout->updateFlexItemDimensions(flexItem); 2353 } 2354 m_flexLayout->layout(); 2347 2355 } 2348 2356 #endif -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r293233 r293293 31 31 #pragma once 32 32 33 #include "LayoutIntegrationFlexLayout.h" 33 34 #include "OrderIterator.h" 34 35 #include "RenderBlock.h" … … 235 236 bool m_inLayout { false }; 236 237 bool m_shouldResetChildLogicalHeightBeforeLayout { false }; 238 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 239 std::unique_ptr<LayoutIntegration::FlexLayout> m_flexLayout; 240 #endif 237 241 }; 238 242
Note: See TracChangeset
for help on using the changeset viewer.