Commit 2ccb17c0 authored by mihnea@adobe.com's avatar mihnea@adobe.com

[CSS Regions] Auto width is not working for Regions

https://bugs.webkit.org/show_bug.cgi?id=74135

Reviewed by Julien Chaffraix.

Source/WebCore:

It was not possible to flow content into a region having { width: auto; } since in such case, the region width was computed to 0.
Now, a region having auto width, will have its width computed following the rules for calculation of widths and margins
(http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins).
For those cases in which resolving the width requires measuring of content's min/max-content values, we use the associated named flow min/max-content
values (the same for all regions with width auto in a region chain).
When a region has width:auto, the computation of width should be done using normal block/box sizing code, instead of replaced element code.
Contains code contributed by Alexandru Chiculita(achicu@adobe.com).

Tests: fast/regions/autowidth-abspos-regionchain.html
       fast/regions/autowidth-abspos.html
       fast/regions/autowidth-float.html
       fast/regions/autowidth-inlineblock.html
       fast/regions/autowidth-nonreplaced-abspos.html
       fast/regions/autowidth-nonreplacedblock-normalflow.html
       fast/regions/autowidth-normalflow-maxwidth.html
       fast/regions/autowidth-normalflow-minmaxwidth.html
       fast/regions/autowidth-normalflow-minwidth.html
       fast/regions/autowidth-normalflow-vertrl.html
       fast/regions/autowidth-normalflow.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePositionedLogicalWidth): For positioned auto-width regions, skip the code path for replaced elements.
* rendering/RenderRegion.cpp:
(WebCore): Override min/maxPreferredLogicalWidth as they are used in the process of computing width for regions with auto width.
As this moment, a region is still a RenderReplaced element, so this code needs to be revisited when the region will become a RenderBlock.
Also, for min/max-width, we support only <length> values. We will extend support for other values in a following patch.
(WebCore::RenderRegion::minPreferredLogicalWidth):
(WebCore::RenderRegion::maxPreferredLogicalWidth):
* rendering/RenderRegion.h:
(RenderRegion):
Override isInlineBlockOrInlineTable() and shouldComputeSizeAsReplaced() to ensure that computation for width auto follows the normal
block/box sizing code.

LayoutTests:

It was not possible to flow content into a region having { width: auto; } since in such case, the region width was computed to 0.
Now, a region having auto width, will have its width computed following the rules for calculation of widths and margins
(http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins).
For those cases in which resolving the width requires measuring of content's min/max-content values, we use the associated named flow min/max-content
values (the same for all regions with width auto in a region chain).

Besides adding new tests, i have modified existing tests that were having regions with width:auto as they were failing after this patch.

* fast/regions/autowidth-abspos-expected.html: Added.
* fast/regions/autowidth-abspos-regionchain-expected.html: Added.
* fast/regions/autowidth-abspos-regionchain.html: Added.
* fast/regions/autowidth-abspos.html: Added.
* fast/regions/autowidth-float-expected.html: Added.
* fast/regions/autowidth-float.html: Added.
* fast/regions/autowidth-inlineblock-expected.html: Added.
* fast/regions/autowidth-inlineblock.html: Added.
* fast/regions/autowidth-nonreplaced-abspos-expected.html: Added.
* fast/regions/autowidth-nonreplaced-abspos.html: Added.
* fast/regions/autowidth-nonreplacedblock-normalflow-expected.html: Added.
* fast/regions/autowidth-nonreplacedblock-normalflow.html: Added.
* fast/regions/autowidth-normalflow-expected.html: Added.
* fast/regions/autowidth-normalflow-maxwidth-expected.html: Added.
* fast/regions/autowidth-normalflow-maxwidth.html: Added.
* fast/regions/autowidth-normalflow-minmaxwidth-expected.html: Added.
* fast/regions/autowidth-normalflow-minmaxwidth.html: Added.
* fast/regions/autowidth-normalflow-minwidth-expected.html: Added.
* fast/regions/autowidth-normalflow-minwidth.html: Added.
* fast/regions/autowidth-normalflow-vertrl-expected.html: Added.
* fast/regions/autowidth-normalflow-vertrl.html: Added.
* fast/regions/autowidth-normalflow.html: Added.
* fast/regions/bottom-overflow-out-of-first-region.html:
* fast/regions/flows-dependency-dynamic-remove.html:
* fast/regions/flows-dependency-same-flow.html:
* fast/regions/render-region-renderer-expected.html:
* fast/regions/top-overflow-out-of-second-region.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127596 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 65e67acb
2012-09-05 Mihnea Ovidenie <mihnea@adobe.com>
[CSS Regions] Auto width is not working for Regions
https://bugs.webkit.org/show_bug.cgi?id=74135
Reviewed by Julien Chaffraix.
It was not possible to flow content into a region having { width: auto; } since in such case, the region width was computed to 0.
Now, a region having auto width, will have its width computed following the rules for calculation of widths and margins
(http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins).
For those cases in which resolving the width requires measuring of content's min/max-content values, we use the associated named flow min/max-content
values (the same for all regions with width auto in a region chain).
Besides adding new tests, i have modified existing tests that were having regions with width:auto as they were failing after this patch.
* fast/regions/autowidth-abspos-expected.html: Added.
* fast/regions/autowidth-abspos-regionchain-expected.html: Added.
* fast/regions/autowidth-abspos-regionchain.html: Added.
* fast/regions/autowidth-abspos.html: Added.
* fast/regions/autowidth-float-expected.html: Added.
* fast/regions/autowidth-float.html: Added.
* fast/regions/autowidth-inlineblock-expected.html: Added.
* fast/regions/autowidth-inlineblock.html: Added.
* fast/regions/autowidth-nonreplaced-abspos-expected.html: Added.
* fast/regions/autowidth-nonreplaced-abspos.html: Added.
* fast/regions/autowidth-nonreplacedblock-normalflow-expected.html: Added.
* fast/regions/autowidth-nonreplacedblock-normalflow.html: Added.
* fast/regions/autowidth-normalflow-expected.html: Added.
* fast/regions/autowidth-normalflow-maxwidth-expected.html: Added.
* fast/regions/autowidth-normalflow-maxwidth.html: Added.
* fast/regions/autowidth-normalflow-minmaxwidth-expected.html: Added.
* fast/regions/autowidth-normalflow-minmaxwidth.html: Added.
* fast/regions/autowidth-normalflow-minwidth-expected.html: Added.
* fast/regions/autowidth-normalflow-minwidth.html: Added.
* fast/regions/autowidth-normalflow-vertrl-expected.html: Added.
* fast/regions/autowidth-normalflow-vertrl.html: Added.
* fast/regions/autowidth-normalflow.html: Added.
* fast/regions/bottom-overflow-out-of-first-region.html:
* fast/regions/flows-dependency-dynamic-remove.html:
* fast/regions/flows-dependency-same-flow.html:
* fast/regions/render-region-renderer-expected.html:
* fast/regions/top-overflow-out-of-second-region.html:
2012-09-05 Brady Eidson <beidson@apple.com>
Frequent crashes in PluginView::scriptObject under runtimeObjectCustomGetOwnPropertySlot
<!doctype html>
<html>
<head>
<style>
#green { position: absolute; width: 50px; height: 50px; top: 150px; background-color: green; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is an absolutely positioned, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#green1 { position: absolute; background-color: green; width: 100px; height: 50px; top: 150px; }
#green2 { position: absolute; background-color: green; width: 100px; height: 50px; top: 250px; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The regions are absolutely positioned, non replaced element.</p>
<p>In this case, the regions have the same width, based on the same flow thread min/max content.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green1"></div>
<div id="green2"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; }
#box1 { width: 50px; height: 50px; background-color: green; }
#box2 { width: 100px; height: 50px; background-color: green; }
#container { width: 200px; height: 200px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; position: absolute; background-color: green; }
#region2 { -webkit-flow-from: flow; height: 50px; position: absolute; top: 100px; background-color: green; }
#red1 { position: absolute; background-color: red; width: 100px; height: 50px; top: 150px; }
#red2 { position: absolute; background-color: red; width: 100px; height: 50px; top: 250px; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The regions are absolutely positioned, non replaced element.</p>
<p>In this case, the regions have the same width, based on the same flow thread min/max content.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="article">
<div id="box1"></div>
<div id="box2"></div>
</div>
<div id="red1"></div>
<div id="red2"></div>
<div id="container">
<div id="region"></div>
<div id="region2"></div>
<div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; width: 40px; height: 50px; background-color: green; }
#container { width: 200px; height: 200px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; padding-left: 5px; padding-right: 5px; position: absolute; background-color: green; box-sizing: border-box; }
#red { position: absolute; width: 50px; height: 50px; top: 150px; background-color: red; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is an absolutely positioned, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="red"></div>
<div id="article"></div>
<div id="container">
<div id="region"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#green { position: absolute; width: 50px; height: 50px; top: 150px; background-color: green; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a floating, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; width: 40px; height: 50px; background-color: green; }
#container { width: 200px; height: 200px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; padding-left: 5px; padding-right: 5px; float: left; background-color: green; }
#red { position: absolute; width: 50px; height: 50px; top: 150px; background-color: red; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a floating, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="red"></div>
<div id="article"></div>
<div id="container">
<div id="region"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#green { position: absolute; width: 50px; height: 50px; top: 150px; background-color: green; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is an inline-block, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; width: 30px; height: 50px; background-color: green; }
#container { width: 200px; height: 200px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; padding-left: 5px; padding-right: 5px;
border-left: 5px solid green; border-right: 5px solid green;
display: inline-block; background-color: green; box-sizing: border-box; }
#red { position: absolute; width: 50px; height: 50px; top: 150px; background-color: red; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is an inline-block, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="red"></div>
<div id="article"></div>
<div id="container">
<div id="region"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#green { position: absolute; width: 50px; height: 50px; top: 150px; background-color: green; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is an absolutely positioned, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; width: 40px; height: 50px; background-color: green; }
#container { width: 200px; height: 200px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; padding-left: 5px; padding-right: 5px; position: absolute; background-color: green; box-sizing: border-box; }
#red { position: absolute; width: 50px; height: 50px; top: 150px; background-color: red; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is an absolutely positioned, non replaced element.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="red"></div>
<div id="article"></div>
<div id="container">
<div id="region"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body { margin: 0px; }
#green { position: absolute; top: 150px; width: 50px; height: 50px; background-color: green; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body { margin: 0px; }
#article { -webkit-flow-into: flow; width: 50px; height: 50px; background-color: green; }
#container { width: 50px; height: 100px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; }
#red { position: absolute; top: 150px; width: 50px; height: 50px; background-color: red; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="red"></div>
<div id="article"></div>
<div id="container">
<div id="region"></div>
<div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body { margin: 0px; }
#green { position: absolute; top: 150px; width: 50px; height: 50px; background-color: green; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="green"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body { font-family: monospace; }
#gray { width: 200px; height: 400px; font-size: 25px; line-height: 2; text-align: justify; color: #a0a0a0; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, having max-width specified.</p>
<p>On success, you should see more than one gray line below.</p>
<div id="gray">
<span style="background-color:#a0a0a0">
This is some content This is some content
This is some content This is some content
This is some content
</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body { font-family: monospace; }
#article { -webkit-flow-into: flow; font-size: 25px; line-height: 2; text-align: justify; color:#a0a0a0; }
#region { -webkit-flow-from: flow; height: 400px; max-width: 200px; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, having max-width specified.</p>
<p>On success, you should see more than one gray line below.</p>
<div id="article">
<span style="background-color:#a0a0a0">
This is some content This is some content
This is some content This is some content
This is some content
</span>
</div>
<div id="region"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#gray { width: 200px; height: 400px; font-size: 25px; line-height: 2;
text-align: justify; color: #a0a0a0; font-family: Ahem;
padding-left: 25px; padding-right: 25px; box-sizing: border-box; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, having min-width and max-width specified.</p>
<p>On success, you should see 2 gray lines below.</p>
<div id="gray">
<span style="background-color:#a0a0a0">
aaa aaa
</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; font-size: 25px; line-height: 2; text-align: justify; color: #a0a0a0; font-family: Ahem; }
#region { -webkit-flow-from: flow; height: 400px; min-width: 200px; max-width: 300px; padding-left: 25px; padding-right: 25px; box-sizing: border-box; }
#container { width: 100px; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, having min-width and max-width specified.</p>
<p>On success, you should see 2 gray lines below.</p>
<div id="article">
<span style="background-color: #a0a0a0">
aaa aaa
</span>
</div>
<div id="container">
<div id="region"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#gray { width: 200px; height: 400px; font-size: 25px; line-height: 2; text-align: justify; color: #a0a0a0; font-family: Ahem; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, having min-width specified.</p>
<p>On success, you should see a single gray line below.</p>
<div id="gray">
<span style="background-color:#a0a0a0">
aa aa aa
</span>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#article { -webkit-flow-into: flow; font-size: 25px; line-height: 2; text-align: justify; color:#a0a0a0; font-family: Ahem; }
#region { -webkit-flow-from: flow; height: 400px; min-width: 200px; }
#container { width: 100px; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, having min-width specified.</p>
<p>On success, you should see a single gray line below.</p>
<div id="article">
<span style="background-color:#a0a0a0">
aa aa aa
</span>
</div>
<div id="container">
<div id="region"></div>
</div>
</body>
</html>
<!doctype html>
<html style="-webkit-writing-mode: vertical-rl;">
<head>
<style>
body { font-family: monospace; }
#gray { height: 200px; font-size: 25px; line-height: 2; text-align: justify; font-family: Ahem; color: #a0a0a0; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, vertical rl writing mode.</p>
<p>On success, you should see more than one gray line below.</p>
<div id="gray">
<span style="background-color:#a0a0a0">
aaaa aaaa aaaa
</span>
</div>
</body>
</html>
<!doctype html>
<html style="-webkit-writing-mode: vertical-rl;">
<head>
<style>
body { font-family: monospace; }
#article { -webkit-flow-into: flow; font-size: 25px; line-height: 2;
text-align: justify; font-family: Ahem; color: #a0a0a0; }
#region { -webkit-flow-from: flow; width: 400px; max-height: 200px; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow, vertical rl writing mode.</p>
<p>On success, you should see more than one gray line below.</p>
<div id="article">
<span style="background-color:#a0a0a0">
aaaa aaaa aaaa
</span>
</div>
<div id="region"></div>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
body { margin: 0px; }
#article { -webkit-flow-into: flow; width: 50px; height: 50px; background-color: green; }
#container { width: 50px; height: 100px; position: absolute; top: 150px; }
#region { -webkit-flow-from: flow; height: 50px; }
#red { position: absolute; top: 150px; width: 50px; height: 50px; background-color: red; }
</style>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=74135"> Auto width is not working for regions</a>.</p>
<p>The region is a block level, non replaced element in normal flow.</p>
<p>On success, you should not see a red rectangle below.</p>
<div id="red"></div>
<div id="article"></div>
<div id="container">
<div id="region"></div>
<div>
</body>
</html>
......@@ -33,6 +33,10 @@
height: 100px;
}
#region3 {
width: 0px;
height: 0px;
}
</style>
<body>
......
......@@ -8,6 +8,8 @@
.regionFlowA { -webkit-flow-from: flowA; }
.regionFlowB { -webkit-flow-from: flowB; }
.regionFlowC { -webkit-flow-from: flowC; }
.regionFlowA, .regionFlowB, .regionFlowC { width: 0px; height: 0px; }
</style>
<div class="flowA">
......
......@@ -8,6 +8,8 @@
.regionFlowA { -webkit-flow-from: flowA; }
.regionFlowB { -webkit-flow-from: flowB; }
.regionFlowC { -webkit-flow-from: flowC; }
.regionFlowA, .regionFlowB, .regionFlowC { width: 0px; height: 0px; }
</style>
<div class="flowA">
......
......@@ -14,7 +14,6 @@
}
.size1
{
width:0.5px;
height:0.5px;
}
......
......@@ -33,6 +33,10 @@
height: 200px;
}
#region3 {
width: 0px;
height: 0px;
}
</style>
<body>
......
2012-09-05 Mihnea Ovidenie <mihnea@adobe.com>
[CSS Regions] Auto width is not working for Regions
https://bugs.webkit.org/show_bug.cgi?id=74135
Reviewed by Julien Chaffraix.
It was not possible to flow content into a region having { width: auto; } since in such case, the region width was computed to 0.
Now, a region having auto width, will have its width computed following the rules for calculation of widths and margins
(http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins).
For those cases in which resolving the width requires measuring of content's min/max-content values, we use the associated named flow min/max-content
values (the same for all regions with width auto in a region chain).
When a region has width:auto, the computation of width should be done using normal block/box sizing code, instead of replaced element code.
Contains code contributed by Alexandru Chiculita(achicu@adobe.com).
Tests: fast/regions/autowidth-abspos-regionchain.html
fast/regions/autowidth-abspos.html
fast/regions/autowidth-float.html
fast/regions/autowidth-inlineblock.html
fast/regions/autowidth-nonreplaced-abspos.html
fast/regions/autowidth-nonreplacedblock-normalflow.html
fast/regions/autowidth-normalflow-maxwidth.html
fast/regions/autowidth-normalflow-minmaxwidth.html
fast/regions/autowidth-normalflow-minwidth.html
fast/regions/autowidth-normalflow-vertrl.html
fast/regions/autowidth-normalflow.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePositionedLogicalWidth): For positioned auto-width regions, skip the code path for replaced elements.
* rendering/RenderRegion.cpp:
(WebCore): Override min/maxPreferredLogicalWidth as they are used in the process of computing width for regions with auto width.
As this moment, a region is still a RenderReplaced element, so this code needs to be revisited when the region will become a RenderBlock.
Also, for min/max-width, we support only <length> values. We will extend support for other values in a following patch.
(WebCore::RenderRegion::minPreferredLogicalWidth):
(WebCore::RenderRegion::maxPreferredLogicalWidth):
* rendering/RenderRegion.h:
(RenderRegion):
Override isInlineBlockOrInlineTable() and shouldComputeSizeAsReplaced() to ensure that computation for width auto follows the normal
block/box sizing code.
2012-09-05 Ilya Tikhonovsky <loislo@chromium.org>
Web Inspector: NMI: extract MemoryObjectType constants from MemoryInstrumentation.
......@@ -2546,8 +2546,14 @@ static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
void RenderBox::computePositionedLogicalWidth(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage)
{
if (isReplaced()) {
computePositionedLogicalWidthReplaced(); // FIXME: Patch for regions when we add replaced element support.
return;
// FIXME: For regions with width auto, we want to compute width using the normal block sizing code.
// For now, regions are replaced elements and this code can be removed once the RenderRegion
// will inherit from RenderBlock instead of RenderReplaced.
// (see https://bugs.webkit.org/show_bug.cgi?id=74132 )
if (!isRenderRegion() || (isRenderRegion() && shouldComputeSizeAsReplaced())) {
computePositionedLogicalWidthReplaced(); // FIXME: Patch for regions when we add replaced element support.
return;
}
}
// QUESTIONS
......
......@@ -496,4 +496,44 @@ void RenderRegion::clearObjectStyleInRegion(const RenderObject* object)
clearObjectStyleInRegion(child);
}
// FIXME: when RenderRegion will inherit from RenderBlock instead of RenderReplaced,
// we should overwrite computePreferredLogicalWidths ( see https://bugs.webkit.org/show_bug.cgi?id=74132 )
LayoutUnit RenderRegion::minPreferredLogicalWidth() const
{
if (!m_flowThread)
return RenderReplaced::minPreferredLogicalWidth();
// FIXME: Currently, the code handles only the <length> case for min-width. It should also support other values, like percentage, calc
// or viewport relative.
RenderStyle* styleToUse = style();
LayoutUnit minPreferredLogicalWidth = m_flowThread->minPreferredLogicalWidth();
if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().