WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-206581-20200122092130.patch (text/plain), 5.34 KB, created by
alan
on 2020-01-22 09:21:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
alan
Created:
2020-01-22 09:21:31 PST
Size:
5.34 KB
patch
obsolete
>Subversion Revision: 254927 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 449d71d93539c3fee64f75a2ec618d76bbd4fed1..e1c6970351a39c1f35ab20b365dc054a51eaea81 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2020-01-22 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Do not create a FormattingContext to compute intrinsic width unless there's some content. >+ https://bugs.webkit.org/show_bug.cgi?id=206581 >+ <rdar://problem/58798593> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We should only construct a formatting context when it has some content. >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::FormattingContext): >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): >+ * layout/inlineformatting/InlineFormattingContext.cpp: >+ (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot): >+ > 2020-01-22 Zalan Bujtas <zalan@apple.com> > > [LFC] Do not create a FormattingContext unless there's content to layout. >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 2f3854c35d21d216509658252533681f7ab0766a..29e710abb4ff4e2fb1a546d29f52526f903fc17d 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -49,6 +49,7 @@ FormattingContext::FormattingContext(const Container& formattingContextRoot, For > : m_root(makeWeakPtr(formattingContextRoot)) > , m_formattingState(formattingState) > { >+ ASSERT(formattingContextRoot.hasChild()); > #ifndef NDEBUG > layoutState().registerFormattingContext(*this); > #endif >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index fe36ed3f939fd7a1ef8dfd34fe67ed47a7405e55..f6a597beb03043c16ee74c42c2538c756c4c536f 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -285,7 +285,7 @@ LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(const Box& formattingRo > > // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width). > auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; >- if (is<Container>(formattingRoot)) { >+ if (is<Container>(formattingRoot) && downcast<Container>(formattingRoot).hasInFlowOrFloatingChild()) { > auto& root = downcast<Container>(formattingRoot); > auto& formattingStateForRoot = layoutState().ensureFormattingState(root); > auto precomputedIntrinsicWidthConstraints = formattingStateForRoot.intrinsicWidthConstraints(); >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 876f3b4e1f1162a52bf26c05479a9437628d8a6c..0cad8b1807115570c5aaba775d61fa30e7a239b6 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -318,12 +318,12 @@ FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::i > return { }; > } > >- if (layoutBox.establishesFormattingContext() && is<Container>(layoutBox)) >- return LayoutContext::createFormattingContext(downcast<Container>(layoutBox), layoutState())->computedIntrinsicWidthConstraints(); >- > if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) > return { }; > >+ if (layoutBox.establishesFormattingContext()) >+ return LayoutContext::createFormattingContext(downcast<Container>(layoutBox), layoutState())->computedIntrinsicWidthConstraints(); >+ > auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; > auto& formattingState = layoutState().formattingStateForBox(layoutBox); > for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) { >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index 372cf4a9f6fe2070cd77724560dbdcd7d4cc45e3..836fbf9a8cdee5499c8b129096da73fd01ec5664 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -264,7 +264,7 @@ void InlineFormattingContext::computeIntrinsicWidthForFormattingRoot(const Box& > auto constraints = IntrinsicWidthConstraints { }; > if (auto fixedWidth = geometry().fixedValue(formattingRoot.style().logicalWidth())) > constraints = { *fixedWidth, *fixedWidth }; >- else if (is<Container>(formattingRoot)) >+ else if (is<Container>(formattingRoot) && downcast<Container>(formattingRoot).hasInFlowOrFloatingChild()) > constraints = LayoutContext::createFormattingContext(downcast<Container>(formattingRoot), layoutState())->computedIntrinsicWidthConstraints(); > constraints = geometry().constrainByMinMaxWidth(formattingRoot, constraints); > constraints.expand(geometryForBox(formattingRoot).horizontalMarginBorderAndPadding());
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 206581
:
388429
|
388437