WebKit Bugzilla
Attachment 373569 Details for
Bug 199551
: [LFC] Fix formatting context root for inflow positioned inline containers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199551-20190706122025.patch (text/plain), 6.21 KB, created by
zalan
on 2019-07-06 12:20:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-07-06 12:20:31 PDT
Size:
6.21 KB
patch
obsolete
>Subversion Revision: 247168 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index aeefe810691745fcb22580bbafc53d1866c78810..497e1747ddce598d263292b4e14382e3ddd0f7b0 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-07-06 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Fix formatting context root for inflow positioned inline containers >+ https://bugs.webkit.org/show_bug.cgi?id=199551 >+ <rdar://problem/52728868> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Relatively positioned (inflow) inline container lives in the formatting context where its parent lives unless >+ the parent establishes a formatting context. This is slightly different from the usual behavior which is containing block driven. >+ >+ div id=outer style="position: absolute">><div id=inner><span style="position: relative">content</span></div></div> >+ >+ While the relatively positioned inline container (span) is placed relative to its containing block "outer", it lives in the inline formatting context established by "inner". >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): >+ * layout/layouttree/LayoutBox.cpp: >+ (WebCore::Layout::Box::formattingContextRoot const): >+ * layout/layouttree/LayoutBox.h: >+ * layout/layouttree/LayoutInlineContainer.cpp: >+ (WebCore::Layout::InlineContainer::formattingContextRoot const): >+ * layout/layouttree/LayoutInlineContainer.h: >+ > 2019-07-05 Youenn Fablet <youenn@apple.com> > > [iOS] Local capture MediaStreamTrack does not render in portrait mode >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index ff653743f0d16c01f160286df7977bfa55ff4b77..49186f6457345d64a242f9a82c29d59338424b04 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -135,10 +135,6 @@ void FormattingContext::computeBorderAndPadding(const Box& layoutBox, Optional<U > > void FormattingContext::layoutOutOfFlowDescendants(const Box& layoutBox) const > { >- // Initial containing block by definition is a containing block. >- if (!layoutBox.isPositioned() && !layoutBox.isInitialContainingBlock()) >- return; >- > if (!is<Container>(layoutBox)) > return; > >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.cpp b/Source/WebCore/layout/layouttree/LayoutBox.cpp >index 7ea4c6ceb172aff50dbaabff7a7f020ad7db2c0f..55e2bf0316452638e4a087cb2bdb32eeaa772de7 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBox.cpp >@@ -174,16 +174,13 @@ const Container* Box::containingBlock() const > > const Container& Box::formattingContextRoot() const > { >- for (auto* ancestor = containingBlock(); ancestor; ancestor = ancestor->containingBlock()) { >- if (ancestor->establishesFormattingContext()) >- return *ancestor; >- } >- >- // Initial containing block always establishes a formatting context. >- if (isInitialContainingBlock()) >- return downcast<Container>(*this); >- >- RELEASE_ASSERT_NOT_REACHED(); >+ // We should never need to ask this question on the ICB. >+ ASSERT(!isInitialContainingBlock()); >+ // A box lives in the same formatting context as its containing block unless the containing block establishes a formatting context. >+ auto& containingBlock = *this->containingBlock(); >+ if (containingBlock.establishesFormattingContext()) >+ return containingBlock; >+ return containingBlock.formattingContextRoot(); > } > > const Container& Box::initialContainingBlock() const >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.h b/Source/WebCore/layout/layouttree/LayoutBox.h >index 7aea082e64e3e31a6aee5ffe35a3cf904c243ef9..2bb17afc46b9502f44b697d15576062735257118 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutBox.h >@@ -97,7 +97,7 @@ public: > bool isFloatingOrOutOfFlowPositioned() const { return isFloatingPositioned() || isOutOfFlowPositioned(); } > > const Container* containingBlock() const; >- const Container& formattingContextRoot() const; >+ virtual const Container& formattingContextRoot() const; > const Container& initialContainingBlock() const; > > bool isDescendantOf(const Container&) const; >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp b/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >index bc985bba0931c6723d9daef34a243d42fe07074c..401899045b4443b72991dfce5ff5638f8cb04810 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >@@ -54,6 +54,20 @@ bool InlineContainer::establishesInlineFormattingContext() const > return false; > } > >+const Container& InlineContainer::formattingContextRoot() const >+{ >+ // Relatively positioned (inflow) inline container lives in the formatting context where its parent lives unless >+ // the parent establishes a formatting context. This is slightly different from the usual behavior which is containing block driven. >+ // >+ // <div id=outer style="position: absolute">><div id=inner><span style="position: relative">content</span></div></div> >+ // While the relatively positioned inline container (span) is placed relative to its containing block "outer", it lives in the inline >+ // formatting context established by "inner". >+ auto& ancestor = isInFlowPositioned() ? *parent() : *containingBlock(); >+ if (ancestor.establishesFormattingContext()) >+ return ancestor; >+ return ancestor.formattingContextRoot(); >+} >+ > } > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineContainer.h b/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >index 5bde45d7bf79c81d70d25c1a89d4c321c6f05193..ef69695e6489dfc1e9382ce7a57a903413c99d89 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >@@ -42,6 +42,7 @@ public: > InlineContainer(Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = InlineContainerFlag); > > bool establishesInlineFormattingContext() const final; >+ const Container& formattingContextRoot() const final; > }; > > }
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 199551
: 373569