Title: [267059] trunk/Source/WebCore
- Revision
- 267059
- Author
- [email protected]
- Date
- 2020-09-14 17:40:18 -0700 (Mon, 14 Sep 2020)
Log Message
[LFC][FFC] Block box flex items establish block formatting contexts
https://bugs.webkit.org/show_bug.cgi?id=216502
Reviewed by Simon Fraser.
1. The display value of a flex item is blockified: if the specified display of an in-flow child of an element
generating a flex container is an inline-level value, it computes to its block-level equivalent.
2. A block box that establishes an independent formatting context establishes a new block formatting context for its contents.
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::establishesBlockFormattingContext const):
(WebCore::Layout::Box::isBlockBox const):
* layout/layouttree/LayoutBox.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (267058 => 267059)
--- trunk/Source/WebCore/ChangeLog 2020-09-14 23:20:35 UTC (rev 267058)
+++ trunk/Source/WebCore/ChangeLog 2020-09-15 00:40:18 UTC (rev 267059)
@@ -1,3 +1,19 @@
+2020-09-14 Zalan Bujtas <[email protected]>
+
+ [LFC][FFC] Block box flex items establish block formatting contexts
+ https://bugs.webkit.org/show_bug.cgi?id=216502
+
+ Reviewed by Simon Fraser.
+
+ 1. The display value of a flex item is blockified: if the specified display of an in-flow child of an element
+ generating a flex container is an inline-level value, it computes to its block-level equivalent.
+ 2. A block box that establishes an independent formatting context establishes a new block formatting context for its contents.
+
+ * layout/layouttree/LayoutBox.cpp:
+ (WebCore::Layout::Box::establishesBlockFormattingContext const):
+ (WebCore::Layout::Box::isBlockBox const):
+ * layout/layouttree/LayoutBox.h:
+
2020-09-14 Jer Noble <[email protected]>
[Cocoa,HDR] HLS streams with HDR variants will not select HDR.
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (267058 => 267059)
--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp 2020-09-14 23:20:35 UTC (rev 267058)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp 2020-09-15 00:40:18 UTC (rev 267059)
@@ -81,17 +81,21 @@
if (isTableWrapperBox())
return true;
+ // A block box that establishes an independent formatting context establishes a new block formatting context for its contents.
+ if (isBlockBox() && establishesIndependentFormattingContext())
+ 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()) {
+ if (isFloatingPositioned()) {
// Not all floating or out-of-positioned block level boxes establish BFC.
// See [9.7 Relationships between 'display', 'position', and 'float'] for details.
return style().display() == DisplayType::Block;
}
- if (isBlockContainerBox() && !isBlockLevelBox())
+ if (isBlockContainer() && !isBlockLevelBox())
return true;
if (isBlockLevelBox() && !isOverflowVisible())
@@ -104,7 +108,7 @@
{
// 9.4.2 Inline formatting contexts
// An inline formatting context is established by a block container box that contains no block-level boxes.
- if (!isBlockContainerBox())
+ if (!isBlockContainer())
return false;
if (!isContainerBox())
@@ -204,7 +208,7 @@
if (!isPositioned() || isInFlowPositioned()) {
auto* ancestor = &parent();
for (; !is<InitialContainingBlock>(*ancestor); ancestor = &ancestor->parent()) {
- if (ancestor->isBlockContainerBox() || ancestor->establishesFormattingContext())
+ if (ancestor->isBlockContainer() || ancestor->establishesFormattingContext())
return *ancestor;
}
return *ancestor;
@@ -294,6 +298,12 @@
return display == DisplayType::Block || display == DisplayType::ListItem || display == DisplayType::Table;
}
+bool Box::isBlockBox() const
+{
+ // A block-level box that is also a block container.
+ return isBlockLevelBox() && isBlockContainer();
+}
+
bool Box::isInlineLevelBox() const
{
// Inline level elements generate inline level boxes.
@@ -321,7 +331,7 @@
return isInFlow() && parent().isFlexBox();
}
-bool Box::isBlockContainerBox() const
+bool Box::isBlockContainer() const
{
auto display = m_style.display();
return display == DisplayType::Block || display == DisplayType::ListItem || isInlineBlockBox() || isTableCell() || isTableCaption(); // TODO && !replaced element
Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.h (267058 => 267059)
--- trunk/Source/WebCore/layout/layouttree/LayoutBox.h 2020-09-14 23:20:35 UTC (rev 267058)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.h 2020-09-15 00:40:18 UTC (rev 267059)
@@ -101,13 +101,17 @@
bool isAnonymous() const { return m_isAnonymous; }
+ // Block level elements generate block level boxes.
bool isBlockLevelBox() const;
+ // A block-level box that is also a block container.
+ bool isBlockBox() const;
+ // A block-level box is also a block container box unless it is a table box or the principal box of a replaced element.
+ bool isBlockContainer() const;
bool isInlineLevelBox() const;
bool isInlineBox() const;
bool isAtomicInlineLevelBox() const;
bool isInlineBlockBox() const;
bool isInlineTableBox() const;
- bool isBlockContainerBox() const;
bool isInitialContainingBlock() const { return baseTypeFlags().contains(InitialContainingBlockFlag); }
bool isDocumentBox() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Document; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes