Title: [268082] trunk/Source/WebCore
- Revision
- 268082
- Author
- za...@apple.com
- Date
- 2020-10-06 15:59:56 -0700 (Tue, 06 Oct 2020)
Log Message
[LFC][BFC] Move document box special height computation out of contentHeightForFormattingContextRoot
https://bugs.webkit.org/show_bug.cgi?id=217402
Reviewed by Simon Fraser.
Document box (<html>) is not a formatting context root and while its content height computation is very similar to
BFC root height computation, it should not pollute the generic contentHeightForFormattingContextRoot code.
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
(WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (268081 => 268082)
--- trunk/Source/WebCore/ChangeLog 2020-10-06 22:54:32 UTC (rev 268081)
+++ trunk/Source/WebCore/ChangeLog 2020-10-06 22:59:56 UTC (rev 268082)
@@ -1,3 +1,17 @@
+2020-10-06 Zalan Bujtas <za...@apple.com>
+
+ [LFC][BFC] Move document box special height computation out of contentHeightForFormattingContextRoot
+ https://bugs.webkit.org/show_bug.cgi?id=217402
+
+ Reviewed by Simon Fraser.
+
+ Document box (<html>) is not a formatting context root and while its content height computation is very similar to
+ BFC root height computation, it should not pollute the generic contentHeightForFormattingContextRoot code.
+
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
+
2020-10-06 Chris Dumez <cdu...@apple.com>
Add implementation for AudioWorkletGlobalScope's currentFrame / currentTime / sampleRate attributes
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (268081 => 268082)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2020-10-06 22:54:32 UTC (rev 268081)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2020-10-06 22:59:56 UTC (rev 268082)
@@ -170,7 +170,8 @@
LayoutUnit FormattingContext::Geometry::contentHeightForFormattingContextRoot(const Box& layoutBox) const
{
- ASSERT((isHeightAuto(layoutBox) || layoutBox.establishesTableFormattingContext() || layoutBox.isTableCell()) && (layoutBox.establishesFormattingContext() || layoutBox.isDocumentBox()));
+ ASSERT(layoutBox.establishesFormattingContext());
+ ASSERT(isHeightAuto(layoutBox) || layoutBox.establishesTableFormattingContext() || layoutBox.isTableCell());
// 10.6.7 'Auto' heights for block formatting context roots
@@ -203,7 +204,7 @@
// FIXME: Move flex over to layout geometry.
top = lines.first().top();
bottom = lines.last().bottom();
- } else if (formattingRootContainer.establishesBlockFormattingContext() || formattingRootContainer.establishesTableFormattingContext() || formattingRootContainer.isDocumentBox()) {
+ } else if (formattingRootContainer.establishesBlockFormattingContext() || formattingRootContainer.establishesTableFormattingContext()) {
if (formattingRootContainer.hasInFlowChild()) {
auto& firstBoxGeometry = formattingContext.geometryForBox(*formattingRootContainer.firstInFlowChild(), EscapeReason::NeedsGeometryFromEstablishedFormattingContext);
auto& lastBoxGeometry = formattingContext.geometryForBox(*formattingRootContainer.lastInFlowChild(), EscapeReason::NeedsGeometryFromEstablishedFormattingContext);
@@ -213,18 +214,11 @@
} else
ASSERT_NOT_REACHED();
- auto* formattingContextRoot = &formattingRootContainer;
- // TODO: The document renderer is not a formatting context root by default at all. Need to find out what it is.
- if (!layoutBox.establishesFormattingContext()) {
- ASSERT(layoutBox.isDocumentBox());
- formattingContextRoot = &layoutBox.formattingContextRoot();
- }
-
- auto& floatingState = layoutState.establishedFormattingState(*formattingContextRoot).floatingState();
- auto floatBottom = floatingState.bottom(*formattingContextRoot);
+ auto& floatingState = layoutState.establishedFormattingState(formattingRootContainer).floatingState();
+ auto floatBottom = floatingState.bottom(formattingRootContainer);
if (floatBottom) {
bottom = std::max<LayoutUnit>(*floatBottom, bottom);
- auto floatTop = floatingState.top(*formattingContextRoot);
+ auto floatTop = floatingState.top(formattingRootContainer);
ASSERT(floatTop);
top = std::min<LayoutUnit>(*floatTop, top);
}
@@ -827,7 +821,27 @@
// #2
if (!height) {
ASSERT(isHeightAuto(layoutBox));
- height = contentHeightForFormattingContextRoot(layoutBox);
+ if (!is<ContainerBox>(layoutBox) || !downcast<ContainerBox>(layoutBox).hasInFlowOrFloatingChild())
+ height = 0_lu;
+ else if (layoutBox.isDocumentBox() && !layoutBox.establishesFormattingContext()) {
+ auto& documentBox = downcast<ContainerBox>(layoutBox);
+ auto top = formattingContext().geometryForBox(*documentBox.firstInFlowChild()).logicalRectWithMargin().top();
+ auto bottom = formattingContext().geometryForBox(*documentBox.lastInFlowChild()).logicalRectWithMargin().bottom();
+ // This is a special (quirk?) behavior since the document box is not a formatting context root and
+ // all the float boxes end up at the ICB level.
+ auto& initialContainingBlock = documentBox.formattingContextRoot();
+ auto& floatingState = layoutState().establishedFormattingState(initialContainingBlock).floatingState();
+ if (auto floatBottom = floatingState.bottom(initialContainingBlock)) {
+ bottom = std::max<LayoutUnit>(*floatBottom, bottom);
+ auto floatTop = floatingState.top(initialContainingBlock);
+ ASSERT(floatTop);
+ top = std::min<LayoutUnit>(*floatTop, top);
+ }
+ height = bottom - top;
+ } else {
+ ASSERT(layoutBox.establishesFormattingContext());
+ height = contentHeightForFormattingContextRoot(layoutBox);
+ }
}
ASSERT(height);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes