Commit 92be5598 authored by mstensho@opera.com's avatar mstensho@opera.com

Don't change the height of a layout object while not laying it out.

The old flexbox implementation did that. This still used to work halfheartedly
by accident until the fix for bug 498770, though, because we used to mark
out-of-flow positioned children in updateBlockChildDirtyBitsBeforeLayout(). But
it never worked for anything other than direct children. Added one test for the
recent regression (out-of-flow child) and one test that has probably never
passed, until now (out-of-flow grandchild).

We need to be inside layout() when setting the height of an object, or we won't
be able to detect any changes and thus fail to relayout positioned descendants
that may be affected.

BUG=504239
R=leviw@chromium.org

Review URL: https://codereview.chromium.org/1213843002

git-svn-id: svn://svn.chromium.org/blink/trunk@198017 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 37b5b98a
<!DOCTYPE html>
<script src="../../resources/check-layout.js"></script>
<p>There should be no red this page.</p>
<div style="display:-webkit-box; width:200px; background:red;">
<div style="position:relative;">
<div id="abspos" data-expected-height="200" style="position:absolute; left:0; top:0; width:200px; height:100%; background:lime;"></div>
</div>
<div style="height:200px;"></div>
</div>
<p id="result"></p>
<script>
checkLayout('#abspos', document.getElementById("result"));
</script>
<!DOCTYPE html>
<script src="../../resources/check-layout.js"></script>
<p>There should be no red this page.</p>
<div style="display:-webkit-box; width:200px; background:red;">
<div style="position:relative;">
<div>
<div id="abspos" data-expected-height="200" style="position:absolute; left:0; top:0; width:200px; height:100%; background:lime;"></div>
</div>
</div>
<div style="height:200px;"></div>
</div>
<p id="result"></p>
<script>
checkLayout('#abspos', document.getElementById("result"));
</script>
......@@ -400,12 +400,15 @@ void LayoutDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
SubtreeLayoutScope layoutScope(*child);
// We need to see if this child's height has changed, since we make block elements
// fill the height of a containing box by default.
// Now do a layout.
LayoutUnit oldChildHeight = child->size().height();
child->updateLogicalHeight();
if (oldChildHeight != child->size().height())
// We need to see if this child's height will change, since we make block elements fill
// the height of a containing box by default. We cannot actually *set* the new height
// here, though. Need to do that from within layout, or we won't be able to detect the
// change and duly notify any positioned descendants that are affected by it.
LayoutUnit oldChildHeight = child->logicalHeight();
LogicalExtentComputedValues computedValues;
child->computeLogicalHeight(child->logicalHeight(), child->logicalTop(), computedValues);
LayoutUnit newChildHeight = computedValues.m_extent;
if (oldChildHeight != newChildHeight)
layoutScope.setChildNeedsLayout(child);
if (!child->needsLayout())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment