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

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

Issue 1674323002: Detect a change in border that affects a positioned object's height or position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 884d88c7c867f4c4d64bfbc974ddf4acb98d2b54..e3a14b1d0b82ba26b60094f44dde8da97da36ce2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1170,13 +1170,15 @@ LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild(LayoutBox& child) co
return margin;
}
-static bool needsLayoutDueToStaticPosition(LayoutBox* child)
+static bool needsLayoutDueToMovement(LayoutBox* child, LayoutBox* containingBlock)
{
// When a non-positioned block element moves, it may have positioned children that are
// implicitly positioned relative to the non-positioned block.
const ComputedStyle* style = child->style();
bool isHorizontal = style->isHorizontalWritingMode();
- if (style->hasStaticBlockPosition(isHorizontal)) {
+ // A change in the containing block's block-direction borders will affect the child's height and position.
+ bool checkForChangeInAvailableHeight = containingBlock->needsLayout() && containingBlock->style()->logicalHeight().isAuto() && (containingBlock->borderBefore() || containingBlock->borderAfter());
+ if (style->hasStaticBlockPosition(isHorizontal) || checkForChangeInAvailableHeight) {
mstensho (USE GERRIT) 2016/02/09 09:08:51 I was wondering why we don't need to do the same f
rhogan 2016/02/09 18:38:30 If we can come up with additional use cases, defin
mstensho (USE GERRIT) 2016/02/10 10:39:10 <!DOCTYPE html> <p>There should be a blue <em>squa
LayoutBox::LogicalExtentComputedValues computedValues;
LayoutUnit currentLogicalTop = child->logicalTop();
LayoutUnit currentLogicalHeight = child->logicalHeight();
@@ -1216,7 +1218,7 @@ void LayoutBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayou
continue;
}
- if (!positionedObject->normalChildNeedsLayout() && (relayoutChildren || needsLayoutDueToStaticPosition(positionedObject)))
+ if (!positionedObject->normalChildNeedsLayout() && (relayoutChildren || needsLayoutDueToMovement(positionedObject, this)))
layoutScope.setChildNeedsLayout(positionedObject);
// If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.

Powered by Google App Engine
This is Rietveld 408576698