Changeset 240474 in webkit
- Timestamp:
- Jan 25, 2019 8:46:47 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r240472 r240474 1 2019-01-25 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][BFC][MarginCollapsing] Move positive/negative margin value updating to a dedicated function 4 https://bugs.webkit.org/show_bug.cgi?id=193812 5 6 Reviewed by Antti Koivisto. 7 8 Move update logic to BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues(). 9 10 * layout/blockformatting/BlockFormattingContext.cpp: 11 (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const): 12 * layout/blockformatting/BlockFormattingContext.h: 13 * layout/blockformatting/BlockMarginCollapse.cpp: 14 (WebCore::Layout::BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues): 15 (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues): 16 * page/FrameViewLayoutContext.cpp: 17 (WebCore::layoutUsingFormattingContext): 18 1 19 2019-01-25 Antoine Quint <graouts@apple.com> 2 20 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r240467 r240474 432 432 displayBox.setContentBoxHeight(heightAndMargin.height); 433 433 displayBox.setVerticalMargin(verticalMargin); 434 435 MarginCollapse::updatePositiveNegativeMarginValues(layoutState, layoutBox); 434 436 // Adjust the previous sibling's margin bottom now that this box's vertical margin is computed. 435 437 MarginCollapse::updateMarginAfterForPreviousSibling(layoutState, layoutBox); -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r240467 r240474 98 98 static LayoutUnit marginBeforeIgnoringCollapsingThrough(const LayoutState&, const Box&, const UsedVerticalMargin::NonCollapsedValues&); 99 99 static void updateMarginAfterForPreviousSibling(const LayoutState&, const Box&); 100 static void updatePositiveNegativeMarginValues(const LayoutState&, const Box&); 100 101 101 102 static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&); -
trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
r240467 r240474 607 607 } 608 608 609 void BlockFormattingContext::MarginCollapse::updatePositiveNegativeMarginValues(const LayoutState& layoutState, const Box& layoutBox) 610 { 611 ASSERT(layoutBox.isBlockLevelBox()); 612 auto nonCollapsedValues = layoutState.displayBoxForLayoutBox(layoutBox).verticalMargin().nonCollapsedValues(); 613 614 auto positiveNegativeMarginBefore = MarginCollapse::positiveNegativeMarginBefore(layoutState, layoutBox, nonCollapsedValues); 615 auto positiveNegativeMarginAfter = MarginCollapse::positiveNegativeMarginAfter(layoutState, layoutBox, nonCollapsedValues); 616 617 if (MarginCollapse::marginsCollapseThrough(layoutState, layoutBox)) { 618 positiveNegativeMarginBefore = computedPositiveAndNegativeMargin(positiveNegativeMarginBefore, positiveNegativeMarginAfter); 619 positiveNegativeMarginAfter = positiveNegativeMarginBefore; 620 } 621 auto& blockFormattingState = downcast<BlockFormattingState>(layoutState.formattingStateForBox(layoutBox)); 622 blockFormattingState.setPositiveAndNegativeVerticalMargin(layoutBox, { positiveNegativeMarginBefore, positiveNegativeMarginAfter }); 623 } 624 609 625 UsedVerticalMargin::CollapsedValues BlockFormattingContext::MarginCollapse::collapsedVerticalValues(const LayoutState& layoutState, const Box& layoutBox, const UsedVerticalMargin::NonCollapsedValues& nonCollapsedValues) 610 626 { … … 626 642 } 627 643 628 // FIXME: Move state saving out of this function.629 auto& blockFormattingState = downcast<BlockFormattingState>(layoutState.formattingStateForBox(layoutBox));630 blockFormattingState.setPositiveAndNegativeVerticalMargin(layoutBox, { positiveNegativeMarginBefore, positiveNegativeMarginAfter });631 632 644 auto beforeMarginIsCollapsedValue = marginBeforeCollapsesWithFirstInFlowChildMarginBefore(layoutState, layoutBox) || marginBeforeCollapsesWithPreviousSiblingMarginAfter(layoutState, layoutBox); 633 645 auto afterMarginIsCollapsedValue = marginAfterCollapsesWithLastInFlowChildMarginAfter(layoutState, layoutBox);
Note: See TracChangeset
for help on using the changeset viewer.