[LFC][BFC][Quirk] Ignore collapsed(through) margin after when stretching body height.
https://bugs.webkit.org/show_bug.cgi?id=193894

Reviewed by Antti Koivisto.

* layout/blockformatting/BlockFormattingContextQuirks.cpp:
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@240580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 424128a..d1b7bc6 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2019-01-28  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][BFC][Quirk] Ignore collapsed(through) margin after when stretching body height.
+        https://bugs.webkit.org/show_bug.cgi?id=193894
+
+        Reviewed by Antti Koivisto.
+
+        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
+        (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
+
 2019-01-28  Antoine Quint  <graouts@apple.com>
 
         Limit user-agent interactions based on the touch-action property on iOS
diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
index cffe722..a125b64 100644
--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
@@ -93,7 +93,8 @@
 
         auto nonCollapsedMargin = heightAndMargin.nonCollapsedMargin;
         auto collapsedMargin = MarginCollapse::collapsedVerticalValues(layoutState, layoutBox, nonCollapsedMargin);
-        totalVerticalMargin = collapsedMargin.before.valueOr(nonCollapsedMargin.before) + collapsedMargin.after.valueOr(nonCollapsedMargin.after);
+        totalVerticalMargin = collapsedMargin.before.valueOr(nonCollapsedMargin.before);
+        totalVerticalMargin += collapsedMargin.isCollapsedThrough ? nonCollapsedMargin.after : collapsedMargin.after.valueOr(nonCollapsedMargin.after);
     }
 
     // Stretch but never overstretch with the margins.