Title: [233307] trunk/Source/WebCore
- Revision
- 233307
- Author
- [email protected]
- Date
- 2018-06-28 08:42:42 -0700 (Thu, 28 Jun 2018)
Log Message
[LFC] Add Display::Box::nonCollapsedMarginBox for verification purposes.
https://bugs.webkit.org/show_bug.cgi?id=187140
Reviewed by Antti Koivisto.
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
* layout/displaytree/DisplayBox.cpp:
(WebCore::Display::Box::nonCollapsedMarginBox const):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::setVerticalNonCollapsedMargin):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (233306 => 233307)
--- trunk/Source/WebCore/ChangeLog 2018-06-28 15:37:04 UTC (rev 233306)
+++ trunk/Source/WebCore/ChangeLog 2018-06-28 15:42:42 UTC (rev 233307)
@@ -1,5 +1,24 @@
2018-06-28 Zalan Bujtas <[email protected]>
+ [LFC] Add Display::Box::nonCollapsedMarginBox for verification purposes.
+ https://bugs.webkit.org/show_bug.cgi?id=187140
+
+ Reviewed by Antti Koivisto.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
+ (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
+ * layout/Verification.cpp:
+ (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
+ * layout/displaytree/DisplayBox.cpp:
+ (WebCore::Display::Box::nonCollapsedMarginBox const):
+ * layout/displaytree/DisplayBox.h:
+ (WebCore::Display::Box::setVerticalNonCollapsedMargin):
+
+2018-06-28 Zalan Bujtas <[email protected]>
+
[LFC] The margin bottom of the document element does not collapse with its last inflow child's bottom margin.
https://bugs.webkit.org/show_bug.cgi?id=187135
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (233306 => 233307)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2018-06-28 15:37:04 UTC (rev 233306)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2018-06-28 15:42:42 UTC (rev 233307)
@@ -55,7 +55,8 @@
{
auto heightAndMargin = Geometry::floatingHeightAndMargin(layoutContext, layoutBox);
displayBox.setContentBoxHeight(heightAndMargin.height);
- displayBox.moveVertically(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin).top);
+ displayBox.moveVertically(heightAndMargin.margin.top);
+ ASSERT(!heightAndMargin.collapsedMargin);
displayBox.setVerticalMargin(heightAndMargin.margin);
}
Modified: trunk/Source/WebCore/layout/Verification.cpp (233306 => 233307)
--- trunk/Source/WebCore/layout/Verification.cpp 2018-06-28 15:37:04 UTC (rev 233306)
+++ trunk/Source/WebCore/layout/Verification.cpp 2018-06-28 15:42:42 UTC (rev 233307)
@@ -67,10 +67,19 @@
return true;
}
- if (renderer.marginBoxRect() != displayBox->marginBox()) {
+#ifndef NDEBUG
+ if (renderer.marginBoxRect() != displayBox->nonCollapsedMarginBox()) {
+ outputRect("marginBox", renderer.marginBoxRect(), displayBox->nonCollapsedMarginBox());
+ return true;
+ }
+#else
+ // For now in non-debug builds, verify the horizontal margin only
+ if (renderer.marginBoxRect().left() != displayBox->marginBox().left()
+ || renderer.marginBoxRect().right() != displayBox->marginBox().right() ) {
outputRect("marginBox", renderer.marginBoxRect(), displayBox->marginBox());
return true;
}
+#endif
if (renderer.borderBoxRect() != displayBox->borderBox()) {
outputRect("borderBox", renderer.borderBoxRect(), displayBox->borderBox());
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (233306 => 233307)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-06-28 15:37:04 UTC (rev 233306)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-06-28 15:42:42 UTC (rev 233307)
@@ -193,7 +193,10 @@
auto heightAndMargin = Geometry::inFlowHeightAndMargin(layoutContext, layoutBox);
displayBox.setContentBoxHeight(heightAndMargin.height);
displayBox.moveVertically(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin).top);
- displayBox.setVerticalMargin(heightAndMargin.margin);
+ displayBox.setVerticalMargin(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin));
+#ifndef NDEBUG
+ displayBox.setVerticalNonCollapsedMargin(heightAndMargin.margin);
+#endif
}
void BlockFormattingContext::computeInFlowWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const
Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.cpp (233306 => 233307)
--- trunk/Source/WebCore/layout/displaytree/DisplayBox.cpp 2018-06-28 15:37:04 UTC (rev 233306)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.cpp 2018-06-28 15:42:42 UTC (rev 233307)
@@ -62,6 +62,20 @@
return marginBox;
}
+#ifndef NDEBUG
+Box::Rect Box::nonCollapsedMarginBox() const
+{
+ auto borderBox = this->borderBox();
+
+ Rect marginBox;
+ marginBox.setTop(borderBox.top() - m_nonCollapsedVertivalMargin.top);
+ marginBox.setLeft(borderBox.left() - marginLeft());
+ marginBox.setHeight(borderBox.height() + m_nonCollapsedVertivalMargin.top + m_nonCollapsedVertivalMargin.bottom);
+ marginBox.setWidth(borderBox.width() + marginLeft() + marginRight());
+ return marginBox;
+}
+#endif
+
Box::Rect Box::borderBox() const
{
Rect borderBox;
Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (233306 => 233307)
--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h 2018-06-28 15:37:04 UTC (rev 233306)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h 2018-06-28 15:42:42 UTC (rev 233307)
@@ -147,6 +147,9 @@
LayoutUnit contentBoxWidth() const;
Rect marginBox() const;
+#ifndef NDEBUG
+ Rect nonCollapsedMarginBox() const;
+#endif
Rect borderBox() const;
Rect paddingBox() const;
Rect contentBox() const;
@@ -186,6 +189,9 @@
void setHorizontalMargin(HorizontalEdges);
void setVerticalMargin(VerticalEdges);
+#ifndef NDEBUG
+ void setVerticalNonCollapsedMargin(VerticalEdges margin) { m_nonCollapsedVertivalMargin = margin; }
+#endif
void setBorder(Edges);
void setPadding(Edges);
@@ -211,6 +217,9 @@
LayoutUnit m_contentHeight;
Edges m_margin;
+#ifndef NDEBUG
+ VerticalEdges m_nonCollapsedVertivalMargin;
+#endif
Edges m_border;
Edges m_padding;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes