Added: trunk/LayoutTests/fast/multicol/overflow-across-columns-percent-height.html (0 => 94253)
--- trunk/LayoutTests/fast/multicol/overflow-across-columns-percent-height.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/overflow-across-columns-percent-height.html 2011-09-01 00:14:17 UTC (rev 94253)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<div style="text-align: justify; text-decoration: underline; border: solid; width: 500px; -webkit-columns: 3; -moz-column-count: 3; font-size: 12px; line-height: 2; height: 499px;">
+<div>
+<div style="overflow:auto; max-height: 100%;">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ornare, nunc eget condimentum tempor,
+augue ligula accumsan eros, sed consequat sapien orci id libero. Curabitur tristique, augue in aliquet
+accumsan, nibh nisi lobortis odio, et suscipit est ligula eu nisi. Nunc aliquet lobortis porta. Donec
+venenatis consectetur eleifend. Etiam sed tempor quam. Pellentesque gravida gravida eros venenatis
+suscipit. Aenean diam enim, suscipit id pellentesque vel, hendrerit et metus. Suspendisse felis erat,
+hendrerit a congue in, euismod ac erat. Donec pulvinar venenatis tortor, a lobortis erat scelerisque
+et. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
+Aliquam in orci id felis mollis porta ac et orci. Donec viverra, eros ac mattis dapibus, quam ante
+porta lectus, accumsan pellentesque nibh metus non felis. Vivamus sed eros quis magna scelerisque
+ultrices ac eget velit.
+
+Nunc et odio ut velit posuere viverra. Integer eu mi quis velit dapibus tempus at ut purus. Quisque
+congue mollis mauris a hendrerit. Nam viverra est at orci interdum a ullamcorper mi dictum. In id
+sapien augue. Suspendisse potenti. Vestibulum turpis purus, convallis ut sagittis quis, semper vel
+mauris. Curabitur vitae felis turpis. Fusce augue nibh, consectetur non vestibulum et, bibendum sit
+amet lectus. Nulla at imperdiet metus. Donec non est velit, non fringilla ipsum. Fusce elementum neque
+a nibh egestas sodales. Mauris ut lorem hendrerit metus interdum malesuada. Nam tempus sodales neque
+vitae bibendum. Vestibulum ac est sit amet dolor vehicula semper at sed ante. Nunc at neque urna, in
+volutpat orci. Praesent eu velit neque, quis rutrum metus. Nunc eu ipsum sit amet ligula mattis
+porttitor sit amet id felis. Integer volutpat aliquam odio et feugiat.
+
+</div>
+</div>
+</div>
Added: trunk/LayoutTests/platform/mac/fast/multicol/overflow-across-columns-percent-height-expected.txt (0 => 94253)
--- trunk/LayoutTests/platform/mac/fast/multicol/overflow-across-columns-percent-height-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/multicol/overflow-across-columns-percent-height-expected.txt 2011-09-01 00:14:17 UTC (rev 94253)
@@ -0,0 +1,71 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x521
+ RenderBlock {HTML} at (0,0) size 800x521
+ RenderBody {BODY} at (8,8) size 784x505
+layer at (8,8) size 506x505
+ RenderBlock {DIV} at (0,0) size 506x505 [border: (3px solid #000000)]
+ RenderBlock {DIV} at (3,3) size 158x1454
+layer at (11,11) size 158x1454 backgroundClip at (11,11) size 158x589 clip at (11,11) size 158x589 outlineClip at (0,0) size 800x600
+ RenderBlock {DIV} at (0,0) size 158x1454
+ RenderText {#text} at (0,5) size 158x1444
+ text run at (0,5) width 158: "Lorem ipsum dolor sit amet,"
+ text run at (0,29) width 158: "consectetur adipiscing elit."
+ text run at (0,53) width 158: "Nullam ornare, nunc eget"
+ text run at (0,77) width 158: "condimentum tempor, augue"
+ text run at (0,101) width 158: "ligula accumsan eros, sed"
+ text run at (0,125) width 158: "consequat sapien orci id libero."
+ text run at (0,149) width 158: "Curabitur tristique, augue in"
+ text run at (0,173) width 158: "aliquet accumsan, nibh nisi"
+ text run at (0,197) width 158: "lobortis odio, et suscipit est ligula"
+ text run at (0,221) width 158: "eu nisi. Nunc aliquet lobortis"
+ text run at (0,245) width 158: "porta. Donec venenatis"
+ text run at (0,269) width 158: "consectetur eleifend. Etiam sed"
+ text run at (0,293) width 158: "tempor quam. Pellentesque"
+ text run at (0,317) width 158: "gravida gravida eros venenatis"
+ text run at (0,341) width 158: "suscipit. Aenean diam enim,"
+ text run at (0,365) width 158: "suscipit id pellentesque vel,"
+ text run at (0,389) width 158: "hendrerit et metus. Suspendisse"
+ text run at (0,413) width 158: "felis erat, hendrerit a congue in,"
+ text run at (0,437) width 158: "euismod ac erat. Donec pulvinar"
+ text run at (0,461) width 158: "venenatis tortor, a lobortis erat"
+ text run at (0,504) width 158: "scelerisque et. Class aptent taciti"
+ text run at (0,528) width 158: "sociosqu ad litora torquent per"
+ text run at (0,552) width 158: "conubia nostra, per inceptos"
+ text run at (0,576) width 158: "himenaeos. Aliquam in orci id"
+ text run at (0,600) width 158: "felis mollis porta ac et orci."
+ text run at (0,624) width 158: "Donec viverra, eros ac mattis"
+ text run at (0,648) width 158: "dapibus, quam ante porta lectus,"
+ text run at (0,672) width 158: "accumsan pellentesque nibh"
+ text run at (0,696) width 158: "metus non felis. Vivamus sed"
+ text run at (0,720) width 158: "eros quis magna scelerisque"
+ text run at (0,744) width 116: "ultrices ac eget velit. "
+ text run at (116,744) width 42: "Nunc et"
+ text run at (0,768) width 158: "odio ut velit posuere viverra."
+ text run at (0,792) width 158: "Integer eu mi quis velit dapibus"
+ text run at (0,816) width 158: "tempus at ut purus. Quisque"
+ text run at (0,840) width 158: "congue mollis mauris a hendrerit."
+ text run at (0,864) width 158: "Nam viverra est at orci interdum"
+ text run at (0,888) width 158: "a ullamcorper mi dictum. In id"
+ text run at (0,912) width 158: "sapien augue. Suspendisse"
+ text run at (0,936) width 158: "potenti. Vestibulum turpis purus,"
+ text run at (0,960) width 158: "convallis ut sagittis quis, semper"
+ text run at (0,1003) width 158: "vel mauris. Curabitur vitae felis"
+ text run at (0,1027) width 158: "turpis. Fusce augue nibh,"
+ text run at (0,1051) width 158: "consectetur non vestibulum et,"
+ text run at (0,1075) width 158: "bibendum sit amet lectus. Nulla"
+ text run at (0,1099) width 158: "at imperdiet metus. Donec non"
+ text run at (0,1123) width 158: "est velit, non fringilla ipsum."
+ text run at (0,1147) width 158: "Fusce elementum neque a nibh"
+ text run at (0,1171) width 158: "egestas sodales. Mauris ut lorem"
+ text run at (0,1195) width 158: "hendrerit metus interdum"
+ text run at (0,1219) width 158: "malesuada. Nam tempus sodales"
+ text run at (0,1243) width 158: "neque vitae bibendum."
+ text run at (0,1267) width 158: "Vestibulum ac est sit amet dolor"
+ text run at (0,1291) width 158: "vehicula semper at sed ante."
+ text run at (0,1315) width 158: "Nunc at neque urna, in volutpat"
+ text run at (0,1339) width 158: "orci. Praesent eu velit neque, quis"
+ text run at (0,1363) width 158: "rutrum metus. Nunc eu ipsum sit"
+ text run at (0,1387) width 158: "amet ligula mattis porttitor sit"
+ text run at (0,1411) width 158: "amet id felis. Integer volutpat"
+ text run at (0,1435) width 110: "aliquam odio et feugiat."
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (94252 => 94253)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2011-09-01 00:00:12 UTC (rev 94252)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2011-09-01 00:14:17 UTC (rev 94253)
@@ -3340,6 +3340,49 @@
m_overflow->resetLayoutOverflow(borderBoxRect());
}
+static bool percentageLogicalHeightIsResolvable(const RenderBox* box)
+{
+ // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
+ // block that may have a specified height and then use it. In strict mode, this violates the
+ // specification, which states that percentage heights just revert to auto if the containing
+ // block has an auto height. We still skip anonymous containing blocks in both modes, though, and look
+ // only at explicit containers.
+ const RenderBlock* cb = box->containingBlock();
+ while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->logicalHeight().isAuto()) {
+ if (!box->document()->inQuirksMode() && !cb->isAnonymousBlock())
+ break;
+ cb = cb->containingBlock();
+ }
+
+ // A positioned element that specified both top/bottom or that specifies height should be treated as though it has a height
+ // explicitly specified that can be used for any percentage computations.
+ // FIXME: We can't just check top/bottom here.
+ // https://bugs.webkit.org/show_bug.cgi?id=46500
+ bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto()));
+
+ // Table cells violate what the CSS spec says to do with heights. Basically we
+ // don't care if the cell specified a height or not. We just always make ourselves
+ // be a percentage of the cell's current content height.
+ if (cb->isTableCell())
+ return true;
+
+ // Otherwise we only use our percentage height if our containing block had a specified
+ // height.
+ if (cb->style()->logicalHeight().isFixed())
+ return true;
+ if (cb->style()->logicalHeight().isPercent() && !isPositionedWithSpecifiedHeight)
+ return percentageLogicalHeightIsResolvable(cb);
+ if (cb->isRenderView() || (cb->isBody() && box->document()->inQuirksMode()) || isPositionedWithSpecifiedHeight)
+ return true;
+ if (cb->isRoot() && box->isPositioned()) {
+ // Match the positioned objects behavior, which is that positioned objects will fill their viewport
+ // always. Note we could only hit this case by recurring into computePercentageLogicalHeight on a positioned containing block.
+ return true;
+ }
+
+ return false;
+}
+
bool RenderBox::hasUnsplittableScrollingOverflow() const
{
// We will paginate as long as we don't scroll overflow in the pagination direction.
@@ -3353,8 +3396,8 @@
// conditions, but it should work out to be good enough for common cases. Paginating overflow
// with scrollbars present is not the end of the world and is what we used to do in the old model anyway.
return !style()->logicalHeight().isIntrinsicOrAuto()
- || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logicalMaxHeight().isUndefined())
- || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logicalMinHeight().isPositive());
+ || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logicalMaxHeight().isUndefined() && (!style()->logicalMaxHeight().isPercent() || percentageLogicalHeightIsResolvable(this)))
+ || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logicalMinHeight().isPositive() && (!style()->logicalMinHeight().isPercent() || percentageLogicalHeightIsResolvable(this)));
}
LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const