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

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

Issue 1217833007: Cannot rely on auto-positioned absolutely positioned descendants being marked for layout. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « LayoutTests/fast/block/positioning/abspos-auto-left-fixed-top-change-parent-margin-left-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutBlock.cpp
diff --git a/Source/core/layout/LayoutBlock.cpp b/Source/core/layout/LayoutBlock.cpp
index 5cee8786dba8a9c20f46c54ec7b6042949bd0eff..c1af440fd2abc4c4a1a092d3d14551061e0ca1a6 100644
--- a/Source/core/layout/LayoutBlock.cpp
+++ b/Source/core/layout/LayoutBlock.cpp
@@ -1202,20 +1202,29 @@ LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild(LayoutBox& child) co
return margin;
}
-static bool needsLayoutDueToStaticPosition(LayoutObject* child)
-{
- // When a non-positioned block element moves, it may have positioned children that are implicitly positioned relative to the
- // non-positioned block. In block flow we can detect these when we layout the non-positioned block (by noticing the change
- // in the immediate parent's logical top in |adjustPositionedBlock|). In line layout we always need to mark the positioned
- // child for layout if its statically positioned in the direction in which the object lays out.
- // crbug.com/490322(rhogan): We probably need to move the block layout case in here too, as marking a positioned object for
- // layout while laying out an object's children invalidly assumes that our positionedObjects list is in DOM order and that
- // we could never mark a positioned object for layout *after* we've laid it out in layoutPositionedObjects.
- if (!child->parent()->childrenInline())
- return false;
+static bool needsLayoutDueToStaticPosition(LayoutBox* child)
+{
+ // 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();
- return style->hasStaticBlockPosition(isHorizontal) || (style->isOriginalDisplayInlineType() && style->hasStaticInlinePosition(isHorizontal));
+ if (style->hasStaticBlockPosition(isHorizontal)) {
+ LayoutBox::LogicalExtentComputedValues computedValues;
+ LayoutUnit currentLogicalTop = child->logicalTop();
+ LayoutUnit currentLogicalHeight = child->logicalHeight();
+ child->computeLogicalHeight(currentLogicalHeight, currentLogicalTop, computedValues);
+ if (computedValues.m_position != currentLogicalTop || computedValues.m_extent != currentLogicalHeight)
+ return true;
+ }
+ if (style->hasStaticInlinePosition(isHorizontal)) {
+ LayoutBox::LogicalExtentComputedValues computedValues;
+ LayoutUnit currentLogicalLeft = child->logicalLeft();
+ LayoutUnit currentLogicalWidth = child->logicalWidth();
+ child->computeLogicalWidth(computedValues);
+ if (computedValues.m_position != currentLogicalLeft || computedValues.m_extent != currentLogicalWidth)
+ return true;
+ }
+ return false;
}
void LayoutBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayoutBehavior info)
@@ -1237,7 +1246,7 @@ void LayoutBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayou
continue;
}
- if (relayoutChildren || needsLayoutDueToStaticPosition(positionedObject))
+ if (!positionedObject->normalChildNeedsLayout() && (relayoutChildren || needsLayoutDueToStaticPosition(positionedObject)))
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.
« no previous file with comments | « LayoutTests/fast/block/positioning/abspos-auto-left-fixed-top-change-parent-margin-left-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698