[LFC][BFC][MarginCollapsing] Add support for peculiar cases.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Jan 2019 16:08:05 +0000 (16:08 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Jan 2019 16:08:05 +0000 (16:08 +0000)
commit13be84e98c53cd2fa162cce2b77b1babf71e47e1
tree1decdbf45c5cf7df2e81c2f1b8014489ead647dc
parent3349290720271849a1fdf65d28849387c8998b6a
[LFC][BFC][MarginCollapsing] Add support for peculiar cases.
https://bugs.webkit.org/show_bug.cgi?id=192625

Reviewed by Antti Koivisto.

Source/WebCore:

Implement some of the more peculiar cases like margin collpasing through multiple boxes etc.
Add ~100 new passing cases.

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
* layout/LayoutState.h:
(WebCore::Layout::LayoutState::hasFormattingState const):
* layout/MarginTypes.h:
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
(WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
(WebCore::Layout::hasPrecomputedMarginBefore):
(WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
(WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
(WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
* layout/blockformatting/BlockFormattingContext.h:
(WebCore::Layout::BlockFormattingContext::blockFormattingState const):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginBefore): Deleted.
(WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginAfter): Deleted.
* layout/blockformatting/BlockFormattingContextQuirks.cpp:
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
(WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginAfter):
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight): Deleted.
* layout/blockformatting/BlockFormattingState.h:
(WebCore::Layout::BlockFormattingState::setPositiveAndNegativeVerticalMargin):
(WebCore::Layout::BlockFormattingState::hasPositiveAndNegativeVerticalMargin const):
(WebCore::Layout::BlockFormattingState::positiveAndNegativeVerticalMargin const):
(WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore):
(WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore):
(WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const):
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::hasClearance):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
(WebCore::Layout::computedPositiveAndNegativeMargin):
(WebCore::Layout::marginValue):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::updateCollapsedMarginAfter):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore): Deleted.
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter): Deleted.
* layout/displaytree/DisplayBox.cpp:
(WebCore::Display::Box::Box):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::hasClearance const):
(WebCore::Display::Box::setEstimatedMarginBefore):
(WebCore::Display::Box::estimatedMarginBefore const):
(WebCore::Display::Box::setHasClearance):
(WebCore::Display::Box::invalidateEstimatedMarginBefore):
(WebCore::Display::Box::setVerticalMargin):
(WebCore::Display::Box::rectWithMargin const):
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239773 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/layout/LayoutState.h
Source/WebCore/layout/MarginTypes.h
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h
Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
Source/WebCore/layout/blockformatting/BlockFormattingState.h
Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
Source/WebCore/layout/displaytree/DisplayBox.cpp
Source/WebCore/layout/displaytree/DisplayBox.h
Source/WebCore/layout/floats/FloatingContext.cpp
Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
Tools/ChangeLog
Tools/LayoutReloaded/misc/LFC-passing-tests.txt