Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1530303003: Implement Layout Containment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch to Ahem. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 3b7b86b541dba44270a3bf1b18f7e362fdae1114..c95a4239f796a8013be69f965680b4fa407d4319 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1034,7 +1034,7 @@ bool LayoutBlock::createsNewFormattingContext() const
{
return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated()
|| style()->specifiesColumns() || isLayoutFlowThread() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot()
- || isDocumentElement() || isColumnSpanAll() || isGridItem() || style()->containsPaint();
+ || isDocumentElement() || isColumnSpanAll() || isGridItem() || style()->containsPaint() || style()->containsLayout();
}
void LayoutBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, LayoutBox& child)
@@ -1948,6 +1948,10 @@ int LayoutBlock::columnGap() const
void LayoutBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
+ // Layout-contained elements don't consider their contents for preferred sizing.
+ if (style()->containsLayout())
+ return;
+
if (childrenInline()) {
// FIXME: Remove this const_cast.
toLayoutBlockFlow(const_cast<LayoutBlock*>(this))->computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth);
@@ -2235,8 +2239,11 @@ int LayoutBlock::inlineBlockBaseline(LineDirectionMode lineDirection) const
// either no in-flow line boxes or if its 'overflow' property has a computed
// value other than 'visible', in which case the baseline is the bottom
// margin edge.
+ // We likewise avoid using the last line box in the case of layout containment,
+ // where the block's contents shouldn't be considered when laying out its
+ // ancestors or siblings.
- if (!style()->isOverflowVisible() && !shouldIgnoreOverflowPropertyForInlineBlockBaseline()) {
+ if ((!style()->isOverflowVisible() && !shouldIgnoreOverflowPropertyForInlineBlockBaseline()) || style()->containsLayout()) {
// We are not calling LayoutBox::baselinePosition here because the caller should add the margin-top/margin-right, not us.
return lineDirection == HorizontalLine ? size().height() + marginBottom() : size().width() + marginLeft();
}

Powered by Google App Engine
This is Rietveld 408576698