WebKit Bugzilla
Attachment 346446 Details for
Bug 188296
: [LFC][BFC] Apply the "10.6.6 Complicated cases" when computing height and margin for the document renderer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188296-20180802203350.patch (text/plain), 8.55 KB, created by
zalan
on 2018-08-02 20:33:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-08-02 20:33:51 PDT
Size:
8.55 KB
patch
obsolete
>Subversion Revision: 234536 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b6cf83317fe59e470b523e397e8b8e0207f5c1bd..d1925f8a55cb3235704feb703ef5efaa68baff15 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-08-02 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC] Apply the "10.6.6 Complicated cases" when computing height and margin for the document renderer >+ https://bugs.webkit.org/show_bug.cgi?id=188296 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The spec is not clear about what to do with the document renderer. It behaves as if it was a formatting context root when >+ it comes to computing its height. Let's apply "10.6.6 Complicated cases" for now. >+ >+ * layout/FormattingContext.h: >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases): >+ (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): Deleted. >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): >+ * layout/layouttree/LayoutBox.cpp: >+ (WebCore::Layout::Box::establishesBlockFormattingContext const): >+ * layout/layouttree/LayoutBox.h: >+ > 2018-08-02 Zalan Bujtas <zalan@apple.com> > > [LFC][Floating] Add FloatingState::bottom() to enable content height computation for formatting roots. >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index ce201cff64d443684cb33c12ee8551d2152dc33a..57139a5e6847d81a0755319ec4461d38ae4ff026 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -97,6 +97,8 @@ protected: > static WidthAndMargin inlineReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedMarginLeft = { }, > std::optional<LayoutUnit> precomputedMarginRight = { }); > >+ static HeightAndMargin complicatedCases(LayoutContext&, const Box&); >+ > static Edges computedBorder(LayoutContext&, const Box&); > static std::optional<Edges> computedPadding(LayoutContext&, const Box&); > >@@ -116,7 +118,6 @@ protected: > static HeightAndMargin floatingReplacedHeightAndMargin(LayoutContext&, const Box&); > static WidthAndMargin floatingReplacedWidthAndMargin(LayoutContext&, const Box&); > >- static HeightAndMargin floatingNonReplacedHeightAndMargin(LayoutContext&, const Box&); > static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&); > > static LayoutUnit shrinkToFitWidth(LayoutContext&, const FormattingContext&, const Box&); >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 7313388f2291e7e713efccd96922fa5bf40b7d77..a7a8c274cf89af061747c1851505b2849a928f7d 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -574,9 +574,11 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > return { *left, *right, { width, { *marginLeft, *marginRight } } }; > } > >-HeightAndMargin FormattingContext::Geometry::floatingNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox) >+HeightAndMargin FormattingContext::Geometry::complicatedCases(LayoutContext& layoutContext, const Box& layoutBox) > { >- ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced()); >+ ASSERT(!layoutBox.replaced()); >+ // TODO: Use complicated-case for document renderer for now (see BlockFormattingContext::Geometry::inFlowHeightAndMargin). >+ ASSERT((layoutBox.isBlockLevelBox() && layoutBox.isInFlow() && !layoutBox.isOverflowVisible()) || layoutBox.isInlineBlockBox() || layoutBox.isFloatingPositioned() || layoutBox.isDocumentBox()); > > // 10.6.6 Complicated cases > // >@@ -685,7 +687,7 @@ HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(LayoutConte > ASSERT(layoutBox.isFloatingPositioned()); > > if (!layoutBox.replaced()) >- return floatingNonReplacedHeightAndMargin(layoutContext, layoutBox); >+ return complicatedCases(layoutContext, layoutBox); > return floatingReplacedHeightAndMargin(layoutContext, layoutBox); > } > >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 8b5265a1979826dc4d268cb1f332981a5a95304f..a6d7f09f4568c489af4a700e4baebac0e206e009 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -60,6 +60,7 @@ static const Container& initialContainingBlock(const Box& layoutBox) > HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox) > { > ASSERT(layoutBox.isInFlow() && !layoutBox.replaced()); >+ ASSERT(layoutBox.isOverflowVisible()); > > auto compute = [&]() -> HeightAndMargin { > >@@ -364,11 +365,18 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(LayoutCo > { > ASSERT(layoutBox.isInFlow()); > >- if (!layoutBox.replaced()) >- return inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox); > // 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' > // replaced elements in normal flow and floating replaced elements >- return FormattingContext::Geometry::inlineReplacedHeightAndMargin(layoutContext, layoutBox); >+ if (layoutBox.replaced()) >+ return FormattingContext::Geometry::inlineReplacedHeightAndMargin(layoutContext, layoutBox); >+ >+ // TODO: Figure out the case for the document element. Let's just complicated-case it for now. >+ if (layoutBox.isOverflowVisible() && !layoutBox.isDocumentBox()) >+ return inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox); >+ >+ // 10.6.6 Complicated cases >+ // Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport). >+ return FormattingContext::Geometry::complicatedCases(layoutContext, layoutBox); > } > > WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.cpp b/Source/WebCore/layout/layouttree/LayoutBox.cpp >index 13a89d442e0666929bcf93a7f235142767569e89..b6025696d6ab471729ea84487daf121543ef5d39 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBox.cpp >@@ -57,16 +57,20 @@ bool Box::establishesBlockFormattingContext() const > // Initial Containing Block always creates a new (inital) block formatting context. > if (!parent()) > return true; >+ > // 9.4.1 Block formatting contexts > // Floats, absolutely positioned elements, block containers (such as inline-blocks, table-cells, and table-captions) > // that are not block boxes, and block boxes with 'overflow' other than 'visible' (except when that value has been propagated to the viewport) > // establish new block formatting contexts for their contents. > if (isFloatingPositioned() || isAbsolutelyPositioned()) > return true; >+ > if (isBlockContainerBox() && !isBlockLevelBox()) > return true; >+ > if (isBlockLevelBox() && !isOverflowVisible()) > return true; >+ > return false; > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.h b/Source/WebCore/layout/layouttree/LayoutBox.h >index f83a73a9bebf2d951496c1d7a42d76c06c4e606e..f544515b36a1ac6ee314b7b66a273c5e1711b67e 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutBox.h >@@ -95,6 +95,7 @@ public: > bool isInlineContainer() const { return m_baseTypeFlags & InlineContainerFlag; } > > bool isPaddingApplicable() const; >+ bool isOverflowVisible() const; > > const RenderStyle& style() const { return m_style; } > >@@ -125,8 +126,6 @@ protected: > }; > Box(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags); > >- bool isOverflowVisible() const; >- > private: > void setParent(Container& parent) { m_parent = &parent; } > void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; }
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 188296
:
346446
|
346451