Changeset 233260 in webkit
- Timestamp:
- Jun 27, 2018 9:18:00 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r233259 r233260 1 2018-06-27 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Move formatting context root layout logic to a dedicated function. 4 https://bugs.webkit.org/show_bug.cgi?id=187097 5 6 Reviewed by Antti Koivisto. 7 8 * layout/blockformatting/BlockFormattingContext.cpp: 9 (WebCore::Layout::BlockFormattingContext::layout const): 10 (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const): 11 * layout/blockformatting/BlockFormattingContext.h: 12 1 13 2018-06-27 Zalan Bujtas <zalan@apple.com> 2 14 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r232914 r233260 78 78 auto& layoutBox = layoutPair.layoutBox; 79 79 auto& displayBox = layoutPair.displayBox; 80 81 if (layoutBox.establishesFormattingContext()) { 82 layoutFormattingContextRoot(layoutContext, formattingState, layoutBox, displayBox); 83 layoutQueue.removeLast(); 84 // Since this box is a formatting context root, it takes care of its entire subtree. 85 break; 86 } 80 87 81 88 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")"); … … 83 90 computeBorderAndPadding(layoutContext, layoutBox, displayBox); 84 91 computeWidthAndMargin(layoutContext, layoutBox, displayBox); 85 if (layoutBox.establishesFormattingContext()) {86 auto formattingContext = layoutContext.formattingContext(layoutBox);87 formattingContext->layout(layoutContext, layoutContext.establishedFormattingState(layoutBox, *formattingContext));88 break;89 }90 92 if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) 91 93 break; … … 100 102 auto& layoutBox = layoutPair->layoutBox; 101 103 auto& displayBox = layoutPair->displayBox; 104 102 105 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")"); 106 // Formatting root boxes are special-cased and they don't come here. 107 ASSERT(!layoutBox.establishesFormattingContext()); 103 108 104 109 computeHeightAndMargin(layoutContext, layoutBox, displayBox); … … 126 131 } 127 132 133 void BlockFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutContext, FormattingState& formattingState, const Box& layoutBox, Display::Box& displayBox) const 134 { 135 // Start laying out this formatting root in the formatting contenxt it lives in. 136 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")"); 137 computeStaticPosition(layoutContext, layoutBox, displayBox); 138 computeBorderAndPadding(layoutContext, layoutBox, displayBox); 139 computeWidthAndMargin(layoutContext, layoutBox, displayBox); 140 141 // Swich over to the new formatting context (the one that the root creates). 142 auto formattingContext = layoutContext.formattingContext(layoutBox); 143 auto& establishedFormattingState = layoutContext.establishedFormattingState(layoutBox, *formattingContext); 144 formattingContext->layout(layoutContext, establishedFormattingState); 145 146 // Come back and finalize the root's geometry. 147 FloatingContext(formattingState.floatingState()).computePosition(layoutBox, displayBox); 148 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")"); 149 computeHeightAndMargin(layoutContext, layoutBox, displayBox); 150 } 151 128 152 std::unique_ptr<FormattingState> BlockFormattingContext::createFormattingState(Ref<FloatingState>&& floatingState) const 129 153 { -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r233188 r233260 52 52 53 53 private: 54 void layoutFormattingContextRoot(LayoutContext&, FormattingState&, const Box&, Display::Box&) const; 55 54 56 void computeWidthAndMargin(LayoutContext&, const Box&, Display::Box&) const; 55 57 void computeHeightAndMargin(LayoutContext&, const Box&, Display::Box&) const;
Note: See TracChangeset
for help on using the changeset viewer.