WebKit Bugzilla
Attachment 342809 Details for
Bug 186637
: [LFC] Add LayoutFormattingContext logging channel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186637-20180615065329.patch (text/plain), 31.54 KB, created by
zalan
on 2018-06-15 06:53:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-15 06:53:30 PDT
Size:
31.54 KB
patch
obsolete
>Subversion Revision: 232868 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index aa2644c06c2750a3f3efad613d868f3198f54e6e..2974d7c2d9218cf174b0b3b87448a12013423dfc 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,52 @@ >+2018-06-15 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add FormattingContextLayout logging channel >+ https://bugs.webkit.org/show_bug.cgi?id=186637 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add some basic layout logging (-WebCoreLogging "LayoutFormattingContext"). >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const): >+ (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::contentHeightForFormattingContextRoot): >+ (WebCore::Layout::shrinkToFitWidth): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::computedBorder): >+ (WebCore::Layout::FormattingContext::Geometry::computedPadding): >+ (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): >+ (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): >+ * layout/Verification.cpp: >+ (WebCore::Layout::outputMismatchingBoxInformationIfNeeded): >+ (WebCore::Layout::verifyAndOutputSubtree): >+ (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::layout const): >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition): >+ * layout/layouttree/LayoutTreeBuilder.cpp: >+ (WebCore::Layout::outputLayoutBox): >+ (WebCore::Layout::outputLayoutTree): >+ (WebCore::Layout::TreeBuilder::showLayoutTree): >+ (WebCore::Layout::printLayoutTreeForLiveDocuments): >+ * layout/layouttree/LayoutTreeBuilder.h: >+ * platform/Logging.h: >+ > 2018-06-15 Antoine Quint <graouts@apple.com> > > [Web Animations] CSS Animations should take precedence over CSS Transitions >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 0d9ea3af88620b03979e3ca0e3bf2da5c3ebb353..2f95bab85bb03f14d606010b29c0cbdd2c9d3702 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -33,7 +33,9 @@ > #include "LayoutContainer.h" > #include "LayoutContext.h" > #include "LayoutDescendantIterator.h" >+#include "Logging.h" > #include <wtf/IsoMallocInlines.h> >+#include <wtf/text/TextStream.h> > > namespace WebCore { > namespace Layout { >@@ -96,17 +98,22 @@ void FormattingContext::placeInFlowPositionedChildren(LayoutContext& layoutConte > if (container.establishesFormattingContext() && &container != &root()) > return; > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: move in-flow positioned children -> context: " << &layoutContext << " parent: " << &container); > for (auto& layoutBox : childrenOfType<Box>(container)) { > if (!layoutBox.isInFlowPositioned()) > continue; > computeInFlowPositionedPosition(layoutContext, layoutBox, *layoutContext.displayBoxForLayoutBox(layoutBox)); > } >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> context: " << &layoutContext << " parent: " << &container); > } > > void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext) const > { > if (!is<Container>(m_root.get())) > return; >+ >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root()); >+ > for (auto& outOfFlowBox : downcast<Container>(*m_root).outOfFlowDescendants()) { > auto& layoutBox = *outOfFlowBox; > auto& displayBox = layoutContext.createDisplayBox(layoutBox); >@@ -124,6 +131,7 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext) > > computeOutOfFlowVerticalGeometry(layoutContext, layoutBox, displayBox); > } >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "End: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root()); > } > > #ifndef NDEBUG >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 55d5ced7429ff2d24cd1b72d81a3c3e28014a0b7..d347d40739333501090e15701c9eb9b673d71dda 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -56,11 +56,14 @@ static LayoutUnit contentHeightForFormattingContextRoot(LayoutContext& layoutCon > auto top = firstDisplayBox->marginBox().top(); > auto bottom = lastDisplayBox->marginBox().bottom(); > // FIXME: add floating support. >- return bottom - top; >+ auto computedHeight = bottom - top; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height] -> content height for formatting context root -> height(" << computedHeight << "px) layoutBox("<< &layoutBox << ")"); >+ return computedHeight; > } > >-static LayoutUnit shrinkToFitWidth(LayoutContext&, const Box&) >+static LayoutUnit shrinkToFitWidth(LayoutContext&, const Box& layoutBox) > { >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width] -> shrink to fit -> unsupported -> width(" << LayoutUnit { } << "px) layoutBox: " << &layoutBox << ")"); > return { }; > } > >@@ -183,6 +186,7 @@ FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOf > ASSERT(marginTop); > ASSERT(marginBottom); > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow non-replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << *height << "px) margin(" << *marginTop << "px, " << *marginBottom << "px) layoutBox(" << &layoutBox << ")"); > return { *top, *bottom, { *height, { *marginTop, *marginBottom} } }; > } > >@@ -324,6 +328,7 @@ FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::out > ASSERT(marginLeft); > ASSERT(marginRight); > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow non-replaced -> left(" << *left << "px) right(" << *right << "px) width(" << *width << "px) margin(" << *marginLeft << "px, " << *marginRight << "px) layoutBox(" << &layoutBox << ")"); > return { *left, *right, { *width, { *marginLeft, *marginRight } } }; > } > >@@ -391,6 +396,7 @@ FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOf > if (boxHeight > containingBlockHeight) > bottom = containingBlockHeight - (*top + *marginTop + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginBottom); > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << height << "px) margin(" << *marginTop << "px, " << *marginBottom << "px) layoutBox(" << &layoutBox << ")"); > return { *top, *bottom, { height, { *marginTop, *marginBottom } } }; > } > >@@ -484,6 +490,7 @@ FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::out > ASSERT(marginLeft); > ASSERT(marginRight); > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow replaced -> left(" << *left << "px) right(" << *right << "px) width(" << width << "px) margin(" << *marginLeft << "px, " << *marginRight << "px) layoutBox(" << &layoutBox << ")"); > return { *left, *right, { width, { *marginLeft, *marginRight } } }; > } > >@@ -514,6 +521,8 @@ FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::floati > // #2 > if (!height) > height = contentHeightForFormattingContextRoot(layoutContext, layoutBox); >+ >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating non-replaced -> height(" << *height << "px) margin(" << *marginTop << "px, " << *marginBottom << "px) -> layoutBox(" << &layoutBox << ")"); > return FormattingContext::Geometry::HeightAndMargin { *height, { *marginTop, *marginBottom } }; > } > >@@ -532,6 +541,7 @@ FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatin > auto computedNonCollapsedHorizontalMarginValues = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox); > // #2 > auto computedWidthValue = width.isAuto() ? shrinkToFitWidth(layoutContext, layoutBox) : LayoutUnit(width.value()); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> floating non-replaced -> width(" << computedWidthValue << "px) margin(" << computedNonCollapsedHorizontalMarginValues.left << "px, " << computedNonCollapsedHorizontalMarginValues.right << "px) -> layoutBox(" << &layoutBox << ")"); > return FormattingContext::Geometry::WidthAndMargin { computedWidthValue, computedNonCollapsedHorizontalMarginValues }; > } > >@@ -540,6 +550,7 @@ FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::floati > ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced()); > // 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' > // replaced elements in normal flow and floating replaced elements >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced"); > return inlineReplacedHeightAndMargin(layoutContext, layoutBox); > } > >@@ -551,6 +562,7 @@ FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatin > // 1. If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'. > // 2. The used value of 'width' is determined as for inline replaced elements. > auto computedNonCollapsedHorizontalMarginValues = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced"); > return inlineReplacedWidthAndMargin(layoutContext, layoutBox, computedNonCollapsedHorizontalMarginValues.left, computedNonCollapsedHorizontalMarginValues.right); > } > >@@ -629,6 +641,7 @@ FormattingContext::Geometry::HeightAndMargin FormattingContext::Geometry::inline > } else > computedHeightValue = height.value(); > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow replaced -> height(" << computedHeightValue << "px) margin(" << computedNonCollapsedVerticalMarginValues.top << "px, " << computedNonCollapsedVerticalMarginValues.bottom << "px) -> layoutBox(" << &layoutBox << ")"); > return { computedHeightValue, computedNonCollapsedVerticalMarginValues }; > } > >@@ -699,12 +712,14 @@ FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::inlineR > computedWidthValue = 300; > } > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << computedWidthValue << "px) margin(" << computedMarginLeftValue << "px, " << computedMarginRightValue << "px) -> layoutBox(" << &layoutBox << ")"); > return { computedWidthValue, { computedMarginLeftValue, computedMarginRightValue } }; > } > > Display::Box::Edges FormattingContext::Geometry::computedBorder(LayoutContext&, const Box& layoutBox) > { > auto& style = layoutBox.style(); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Border] -> layoutBox: " << &layoutBox); > return { > { style.borderLeft().boxModelWidth(), style.borderRight().boxModelWidth() }, > { style.borderTop().boxModelWidth(), style.borderBottom().boxModelWidth() } >@@ -718,6 +733,7 @@ std::optional<Display::Box::Edges> FormattingContext::Geometry::computedPadding( > > auto& style = layoutBox.style(); > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width(); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox); > return Display::Box::Edges { > { valueForLength(style.paddingLeft(), containingBlockWidth), valueForLength(style.paddingRight(), containingBlockWidth) }, > { valueForLength(style.paddingTop(), containingBlockWidth), valueForLength(style.paddingBottom(), containingBlockWidth) } >@@ -731,6 +747,7 @@ Display::Box::HorizontalEdges FormattingContext::Geometry::computedNonCollapsedH > auto marginRight = style.marginRight(); > > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width(); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Margin] -> non collapsed horizontal -> layoutBox: " << &layoutBox); > return { > marginLeft.isAuto() ? LayoutUnit { 0 } : valueForLength(marginLeft, containingBlockWidth), > marginRight.isAuto() ? LayoutUnit { 0 } : valueForLength(marginRight, containingBlockWidth) >@@ -744,6 +761,7 @@ Display::Box::VerticalEdges FormattingContext::Geometry::computedNonCollapsedVer > auto marginBottom = style.marginBottom(); > > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width(); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Margin] -> non collapsed vertical -> layoutBox: " << &layoutBox); > return { > marginTop.isAuto() ? LayoutUnit { 0 } : valueForLength(marginTop, containingBlockWidth), > marginBottom.isAuto() ? LayoutUnit { 0 } : valueForLength(marginBottom, containingBlockWidth) >diff --git a/Source/WebCore/layout/Verification.cpp b/Source/WebCore/layout/Verification.cpp >index 9ab808f1b8de556a0fce0fff55fe16493ab2ee0b..357d41bb918713749b9f534cae7759a7cb52c4d5 100644 >--- a/Source/WebCore/layout/Verification.cpp >+++ b/Source/WebCore/layout/Verification.cpp >@@ -31,6 +31,7 @@ > #include "DisplayBox.h" > #include "LayoutBox.h" > #include "LayoutContainer.h" >+#include "LayoutTreeBuilder.h" > #include "RenderBox.h" > #include "RenderView.h" > #include <wtf/text/TextStream.h> >@@ -38,7 +39,7 @@ > namespace WebCore { > namespace Layout { > >-static void outputMismatchingBoxInformationIfNeeded(TextStream& stream, const LayoutContext& context, const RenderBox& renderer, const Box& layoutBox) >+static bool outputMismatchingBoxInformationIfNeeded(TextStream& stream, const LayoutContext& context, const RenderBox& renderer, const Box& layoutBox) > { > bool firstMismatchingRect = true; > auto outputRect = [&] (const String& prefix, const LayoutRect& rendererRect, const LayoutRect& layoutRect) { >@@ -56,30 +57,40 @@ static void outputMismatchingBoxInformationIfNeeded(TextStream& stream, const La > auto* displayBox = context.displayBoxForLayoutBox(layoutBox); > ASSERT(displayBox); > >- if (renderer.frameRect() != displayBox->rect()) >+ if (renderer.frameRect() != displayBox->rect()) { > outputRect("frameBox", renderer.frameRect(), displayBox->rect()); >+ return true; >+ } > >- if (renderer.marginBoxRect() != displayBox->marginBox()) >+ if (renderer.marginBoxRect() != displayBox->marginBox()) { > outputRect("marginBox", renderer.marginBoxRect(), displayBox->marginBox()); >+ return true; >+ } > >- if (renderer.borderBoxRect() != displayBox->borderBox()) >+ if (renderer.borderBoxRect() != displayBox->borderBox()) { > outputRect("borderBox", renderer.borderBoxRect(), displayBox->borderBox()); >+ return true; >+ } > >- if (renderer.paddingBoxRect() != displayBox->paddingBox()) >+ if (renderer.paddingBoxRect() != displayBox->paddingBox()) { > outputRect("paddingBox", renderer.paddingBoxRect(), displayBox->paddingBox()); >+ return true; >+ } > >- if (renderer.contentBoxRect() != displayBox->contentBox()) >+ if (renderer.contentBoxRect() != displayBox->contentBox()) { > outputRect("contentBox", renderer.contentBoxRect(), displayBox->contentBox()); >+ return true; >+ } > >- stream.nextLine(); >+ return false; > } > >-static void verifyAndOutputSubtree(TextStream& stream, const LayoutContext& context, const RenderBox& renderer, const Box& layoutBox) >+static bool verifyAndOutputSubtree(TextStream& stream, const LayoutContext& context, const RenderBox& renderer, const Box& layoutBox) > { >- outputMismatchingBoxInformationIfNeeded(stream, context, renderer, layoutBox); >+ auto mismtachingGeometry = outputMismatchingBoxInformationIfNeeded(stream, context, renderer, layoutBox); > > if (!is<Container>(layoutBox)) >- return; >+ return mismtachingGeometry; > > auto& container = downcast<Container>(layoutBox); > auto* childBox = container.firstChild(); >@@ -91,19 +102,25 @@ static void verifyAndOutputSubtree(TextStream& stream, const LayoutContext& cont > continue; > } > >- verifyAndOutputSubtree(stream, context, downcast<RenderBox>(*childRenderer), *childBox); >+ auto mismatchingSubtreeGeometry = verifyAndOutputSubtree(stream, context, downcast<RenderBox>(*childRenderer), *childBox); >+ mismtachingGeometry |= mismatchingSubtreeGeometry; >+ > childBox = childBox->nextSibling(); > childRenderer = childRenderer->nextSibling(); > } >+ return mismtachingGeometry; > } > > void LayoutContext::verifyAndOutputMismatchingLayoutTree(const RenderView& renderView) const > { > TextStream stream; >+ auto mismatchingGeometry = verifyAndOutputSubtree(stream, *this, renderView, *m_root.get()); > #if ENABLE(TREE_DEBUGGING) >- showRenderTree(&renderView); >+ if (mismatchingGeometry) { >+ showRenderTree(&renderView); >+ TreeBuilder::showLayoutTree(*this, *m_root.get()); >+ } > #endif >- verifyAndOutputSubtree(stream, *this, renderView, *m_root.get()); > WTFLogAlways("%s", stream.release().utf8().data()); > } > >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 7e03cd672abd10e4ed52fb744b05973536cb812d..a0cba501b9265f9d9daff1cff0e38f99cc822041 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -35,7 +35,9 @@ > #include "LayoutBox.h" > #include "LayoutContainer.h" > #include "LayoutContext.h" >+#include "Logging.h" > #include <wtf/IsoMallocInlines.h> >+#include <wtf/text/TextStream.h> > > namespace WebCore { > namespace Layout { >@@ -55,6 +57,9 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > // Vertical margins between adjacent block-level boxes in a block formatting context collapse. > if (!is<Container>(root())) > return; >+ >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> block formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")"); >+ > auto& formattingRoot = downcast<Container>(root()); > LayoutQueue layoutQueue; > FloatingContext floatingContext(formattingState.floatingState()); >@@ -73,6 +78,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > auto& layoutBox = layoutPair.layoutBox; > auto& displayBox = layoutPair.displayBox; > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")"); > computeStaticPosition(layoutContext, layoutBox, displayBox); > computeBorderAndPadding(layoutContext, layoutBox, displayBox); > computeWidthAndMargin(layoutContext, layoutBox, displayBox); >@@ -93,6 +99,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > auto layoutPair = layoutQueue.takeLast(); > auto& layoutBox = layoutPair->layoutBox; > auto& displayBox = layoutPair->displayBox; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")"); > > computeHeightAndMargin(layoutContext, layoutBox, displayBox); > // Adjust position now that we have all the previous floats placed in this context -if needed. >@@ -115,6 +122,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > #ifndef NDEBUG > validateGeometryConstraintsAfterLayout(layoutContext); > #endif >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> block formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")"); > } > > std::unique_ptr<FormattingState> BlockFormattingContext::createFormattingState(Ref<FloatingState>&& floatingState) const >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 38445eac355482b5b8eaec204ff294837a57fb8d..8efa333deca1efa560eb6d410ec5198fa81615f9 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -29,6 +29,8 @@ > #if ENABLE(LAYOUT_FORMATTING_CONTEXT) > > #include "FormattingContext.h" >+#include "Logging.h" >+#include <wtf/text/TextStream.h> > > namespace WebCore { > namespace Layout { >@@ -112,14 +114,17 @@ FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::i > auto marginTop = MarginCollapse::marginTop(layoutContext, layoutBox); > auto marginBottom = MarginCollapse::marginBottom(layoutContext, layoutBox); > >- if (!isStretchedToViewport(layoutContext, layoutBox)) >+ if (!isStretchedToViewport(layoutContext, layoutBox)) { >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> height(" << height << "px) margin(" << marginTop << "px, " << marginBottom << "px) -> layoutBox(" << &layoutBox << ")"); > return { height, { marginTop, marginBottom } }; >+ } > > auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBox().height(); > // Stretch but never overstretch with the margins. > if (height + marginTop + marginBottom < initialContainingBlockHeight) > height = initialContainingBlockHeight - marginTop - marginBottom; > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> streched to viewport -> height(" << height << "px) margin(" << marginTop << "px, " << marginBottom << "px) -> layoutBox(" << &layoutBox << ")"); > return { height, { marginTop, marginBottom } }; > } > >@@ -223,8 +228,10 @@ FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::in > }; > > auto computedWidthAndMarginValue = compute(); >- if (!isStretchedToViewport(layoutContext, layoutBox)) >+ if (!isStretchedToViewport(layoutContext, layoutBox)) { >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << computedWidthAndMarginValue.width << "px) margin(" << computedWidthAndMarginValue.margin.left << "px, " << computedWidthAndMarginValue.margin.right << "px) -> layoutBox(" << &layoutBox << ")"); > return computedWidthAndMarginValue; >+ } > > auto initialContainingBlockWidth = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBox().width(); > auto horizontalMargins = computedWidthAndMarginValue.margin.left + computedWidthAndMarginValue.margin.right; >@@ -232,6 +239,7 @@ FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::in > if (computedWidthAndMarginValue.width + horizontalMargins < initialContainingBlockWidth) > computedWidthAndMarginValue.width = initialContainingBlockWidth - horizontalMargins; > >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> streched to viewport-> width(" << computedWidthAndMarginValue.width << "px) margin(" << computedWidthAndMarginValue.margin.left << "px, " << computedWidthAndMarginValue.margin.right << "px) -> layoutBox(" << &layoutBox << ")"); > return { computedWidthAndMarginValue.width, computedWidthAndMarginValue.margin }; > } > >@@ -249,6 +257,7 @@ FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::in > // #2 > auto inlineReplacedWidthAndBlockNonReplacedMargin = inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, inlineReplacedWidthAndMargin.width); > ASSERT(inlineReplacedWidthAndMargin.width == inlineReplacedWidthAndBlockNonReplacedMargin.width); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << inlineReplacedWidthAndBlockNonReplacedMargin.width << "px) margin(" << inlineReplacedWidthAndBlockNonReplacedMargin.margin.left << "px, " << inlineReplacedWidthAndBlockNonReplacedMargin.margin.left << "px) -> layoutBox(" << &layoutBox << ")"); > return inlineReplacedWidthAndBlockNonReplacedMargin; > } > >@@ -267,6 +276,7 @@ LayoutPoint BlockFormattingContext::Geometry::staticPosition(LayoutContext& layo > auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); > top = previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.marginBottom(); > } >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> static -> top(" << top << "px) left(" << left << "px) layoutBox(" << &layoutBox << ")"); > return { top, left }; > } > >@@ -329,7 +339,10 @@ LayoutPoint BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutCon > leftDelta = left.value(); > } > >- return { displayBox.left() + leftDelta, displayBox.top() + topDelta }; >+ auto computedLeft = displayBox.left() + leftDelta; >+ auto computedTop = displayBox.top() + topDelta; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> positioned inflow -> top(" << top << "px) left(" << left << "px) layoutBox(" << &layoutBox << ")"); >+ return { computedLeft, computedTop }; > } > > FormattingContext::Geometry::HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox) >diff --git a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >index ae34a30215d675a45477b9ec2f59ddf6f4004881..b874b57a7510a55c286586152e916d969225dd0d 100644 >--- a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp >@@ -28,10 +28,12 @@ > > #if ENABLE(LAYOUT_FORMATTING_CONTEXT) > >+#include "DisplayBox.h" > #include "LayoutBlockContainer.h" > #include "LayoutBox.h" > #include "LayoutChildIterator.h" > #include "LayoutContainer.h" >+#include "LayoutContext.h" > #include "LayoutInlineBox.h" > #include "LayoutInlineContainer.h" > #include "RenderBlock.h" >@@ -106,7 +108,7 @@ void TreeBuilder::createSubTree(const RenderElement& rootRenderer, Container& ro > } > > #if ENABLE(TREE_DEBUGGING) >-static void outputLayoutBox(TextStream& stream, const Box& layoutBox, unsigned depth) >+static void outputLayoutBox(TextStream& stream, const Box& layoutBox, const Display::Box& displayBox, unsigned depth) > { > unsigned printedCharacters = 0; > while (++printedCharacters <= depth * 2) >@@ -122,26 +124,26 @@ static void outputLayoutBox(TextStream& stream, const Box& layoutBox, unsigned d > stream << "block container"; > } else > stream << "box"; >- stream << " at [0 0] size [0 0]"; >+ stream << " at [" << displayBox.left() << " " << displayBox.top() << "] size [" << displayBox.width() << " " << displayBox.height() << "]"; > stream << " object [" << &layoutBox << "]"; > > stream.nextLine(); > } > >-static void outputLayoutTree(TextStream& stream, const Container& rootContainer, unsigned depth) >+static void outputLayoutTree(const LayoutContext& layoutContext, TextStream& stream, const Container& rootContainer, unsigned depth) > { > for (auto& child : childrenOfType<Box>(rootContainer)) { >- outputLayoutBox(stream, child, depth); >+ outputLayoutBox(stream, child, *layoutContext.displayBoxForLayoutBox(child), depth); > if (is<Container>(child)) >- outputLayoutTree(stream, downcast<Container>(child), depth + 1); >+ outputLayoutTree(layoutContext, stream, downcast<Container>(child), depth + 1); > } > } > >-void TreeBuilder::showLayoutTree(const Container& layoutBox) >+void TreeBuilder::showLayoutTree(const LayoutContext& layoutContext, const Container& layoutBox) > { > TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect); >- outputLayoutBox(stream, layoutBox, 0); >- outputLayoutTree(stream, layoutBox, 1); >+ outputLayoutBox(stream, layoutBox, *layoutContext.displayBoxForLayoutBox(layoutBox), 0); >+ outputLayoutTree(layoutContext, stream, layoutBox, 1); > WTFLogAlways("%s", stream.release().utf8().data()); > } > >@@ -153,7 +155,8 @@ void printLayoutTreeForLiveDocuments() > if (document->frame() && document->frame()->isMainFrame()) > fprintf(stderr, "----------------------main frame--------------------------\n"); > fprintf(stderr, "%s\n", document->url().string().utf8().data()); >- Layout::TreeBuilder::showLayoutTree(*TreeBuilder::createLayoutTree(*document->renderView())); >+ // FIXME: Need to find a way to output geometry without layout context. >+ // Layout::TreeBuilder::showLayoutTree(*TreeBuilder::createLayoutTree(*document->renderView())); > } > } > #endif >diff --git a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h >index c3b87b9b2c7bae223c26ead0c8264f88af9a64c6..a8b1cfd49a3498fc6fe74178fbb8699e569449c0 100644 >--- a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h >+++ b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h >@@ -35,11 +35,12 @@ class RenderView; > namespace Layout { > > class Container; >+class LayoutContext; > > class TreeBuilder { > public: > static std::unique_ptr<Container> createLayoutTree(const RenderView&); >- static void showLayoutTree(const Container&); >+ static void showLayoutTree(const LayoutContext&, const Container&); > > private: > static void createSubTree(const RenderElement& rootRenderer, Container& rootContainer); >diff --git a/Source/WebCore/platform/Logging.h b/Source/WebCore/platform/Logging.h >index e0f441d6e28949e353abc17463e4616714cd2fe2..b47cbf993991a2acad935c37fd2c55369ed656e4 100644 >--- a/Source/WebCore/platform/Logging.h >+++ b/Source/WebCore/platform/Logging.h >@@ -61,6 +61,7 @@ namespace WebCore { > M(IndexedDBOperations) \ > M(Layers) \ > M(Layout) \ >+ M(FormattingContextLayout) \ > M(Loading) \ > M(Media) \ > M(MediaCaptureSamples) \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186637
:
342778
|
342809
|
342810