No subject


Fri Nov 22 17:22:33 PST 2013


6449">r156449</a> by &lt;srinivasa.ragavan.venkateswaran at intel.com&gt;

Source/WebCore:

An element having height as percentage needs to have the
containingblock's height or availableheight to calculate its
own height. The containing block having a height set in vh
unit was not being considered for calculating the child's
height.

Tests: fast/css/viewport-percentage-compute-box-height.html
       fast/css/viewport-percentage-compute-box-width.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):
Correct child's height(in pecentage) was not being calculated
incase of parent having height set in vh unit. Added condition
to calculate the containing block height in terms of viewport size.

LayoutTests:

* fast/css/viewport-percentage-compute-box-height-expected.html: Added.
* fast/css/viewport-percentage-compute-box-height.html: Added.
* fast/css/viewport-percentage-compute-box-width-expected.html: Added.
* fast/css/viewport-percentage-compute-box-width.html: Added.
Added new tests for verifying that percentage unit height/width works
if parent block height/width is set in vh/vw units.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a=
></li>
<li><a href=3D"#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeL=
og</a></li>
<li><a href=3D"#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/Web=
Core/rendering/RenderBox.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsfastcssviewportpercentagecomputeboxheight=
expectedhtml">trunk/LayoutTests/fast/css/viewport-percentage-compute-box-=
height-expected.html</a></li>
<li><a href=3D"#trunkLayoutTestsfastcssviewportpercentagecomputeboxheight=
html">trunk/LayoutTests/fast/css/viewport-percentage-compute-box-height.h=
tml</a></li>
<li><a href=3D"#trunkLayoutTestsfastcssviewportpercentagecomputeboxwidthe=
xpectedhtml">trunk/LayoutTests/fast/css/viewport-percentage-compute-box-w=
idth-expected.html</a></li>
<li><a href=3D"#trunkLayoutTestsfastcssviewportpercentagecomputeboxwidthh=
tml">trunk/LayoutTests/fast/css/viewport-percentage-compute-box-width.htm=
l</a></li>
</ul>

</div>
<div id=3D"patch">
<h3>Diff</h3>
<a id=3D"trunkLayoutTestsChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (160158 =
=3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/ChangeLog	2013-12-05 04:35:49 =
UTC (rev 160158)
+++ trunk/LayoutTests/ChangeLog	2013-12-05 05:11:06 UTC (rev 160159)
</span><span class=3D"lines">@@ -1,3 +1,19 @@
</span><ins>+2013-12-04  Gurpreet Kaur  &lt;k.gurpreet at samsung.com&gt;
+
+        % unit heights don't work if parent block height is set in vh
+        https://bugs.webkit.org/show_bug.cgi?id=3D118516
+
+        Reviewed by Simon Fraser.
+
+        From Blink r156449 by &lt;srinivasa.ragavan.venkateswaran at intel.=
com&gt;
+
+        * fast/css/viewport-percentage-compute-box-height-expected.html:=
 Added.
+        * fast/css/viewport-percentage-compute-box-height.html: Added.
+        * fast/css/viewport-percentage-compute-box-width-expected.html: =
Added.
+        * fast/css/viewport-percentage-compute-box-width.html: Added.
+        Added new tests for verifying that percentage unit height/width =
works
+        if parent block height/width is set in vh/vw units.
+
</ins><span class=3D"cx"> 2013-12-04  Filip Pizlo  &lt;fpizlo at apple.com&g=
t;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         Fold constant typed arrays
</span></span></pre></div>
<a id=3D"trunkLayoutTestsfastcssviewportpercentagecomputeboxheightexpecte=
dhtml"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/viewport-per=
centage-compute-box-height-expected.html (0 =3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/viewport-percentage-c=
ompute-box-height-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-percentage-compute-box-height-exp=
ected.html	2013-12-05 05:11:06 UTC (rev 160159)
</span><span class=3D"lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;body&gt;
+        &lt;p&gt;The height of innerdiv should be 50% of the height of t=
he outerdiv.&lt;/p&gt;
+        &lt;div id=3D&quot;outer&quot; style=3D&quot;height: 300px; widt=
h: 400px; background-color: lightcyan;&quot;&gt;
+            &lt;div id=3D&quot;inner&quot; style=3D&quot;width: 50%; hei=
ght: 50%; background-color: lightseagreen;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;   =20
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class=3D"cx">\ No newline at end of file
</span><span class=3D"cx">Property changes on: trunk/LayoutTests/fast/css=
/viewport-percentage-compute-box-height-expected.html
</span><span class=3D"cx">_______________________________________________=
____________________
</span></span></pre></div>
<a id=3D"svnexecutable"></a>
<div class=3D"addfile"><h4>Added: svn:executable</h4></div>
<a id=3D"trunkLayoutTestsfastcssviewportpercentagecomputeboxheighthtml"><=
/a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/viewport-per=
centage-compute-box-height.html (0 =3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/viewport-percentage-c=
ompute-box-height.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-percentage-compute-box-height.htm=
l	2013-12-05 05:11:06 UTC (rev 160159)
</span><span class=3D"lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;body&gt;
+        &lt;p&gt;The height of innerdiv should be 50% of the height of t=
he outerdiv.&lt;/p&gt;
+        &lt;div id=3D&quot;outer&quot; style=3D&quot;height: 50vh; width=
: 400px; background-color: lightcyan;&quot;&gt;
+            &lt;div id=3D&quot;inner&quot; style=3D&quot;width: 50%; hei=
ght: 50%; background-color: lightseagreen;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;   =20
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class=3D"cx">\ No newline at end of file
</span><span class=3D"cx">Property changes on: trunk/LayoutTests/fast/css=
/viewport-percentage-compute-box-height.html
</span><span class=3D"cx">_______________________________________________=
____________________
</span></span></pre></div>
<a id=3D"svnexecutable"></a>
<div class=3D"addfile"><h4>Added: svn:executable</h4></div>
<a id=3D"trunkLayoutTestsfastcssviewportpercentagecomputeboxwidthexpected=
html"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/viewport-per=
centage-compute-box-width-expected.html (0 =3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/viewport-percentage-c=
ompute-box-width-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-percentage-compute-box-width-expe=
cted.html	2013-12-05 05:11:06 UTC (rev 160159)
</span><span class=3D"lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;body&gt;
+        &lt;p&gt;The width of innerdiv should be 50% of the width of the=
 outerdiv.&lt;/p&gt;
+        &lt;div id=3D&quot;outer&quot; style=3D&quot;height: 300px; widt=
h: 400px; background-color: lightcyan;&quot;&gt;
+            &lt;div id=3D&quot;inner&quot; style=3D&quot;width: 50%; hei=
ght: 50%; background-color: lightseagreen;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;   =20
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class=3D"cx">\ No newline at end of file
</span><span class=3D"cx">Property changes on: trunk/LayoutTests/fast/css=
/viewport-percentage-compute-box-width-expected.html
</span><span class=3D"cx">_______________________________________________=
____________________
</span></span></pre></div>
<a id=3D"svnexecutable"></a>
<div class=3D"addfile"><h4>Added: svn:executable</h4></div>
<a id=3D"trunkLayoutTestsfastcssviewportpercentagecomputeboxwidthhtml"></=
a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/viewport-per=
centage-compute-box-width.html (0 =3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/viewport-percentage-c=
ompute-box-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/viewport-percentage-compute-box-width.html=
	2013-12-05 05:11:06 UTC (rev 160159)
</span><span class=3D"lines">@@ -0,0 +1,9 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;body&gt;
+        &lt;p&gt;The width of innerdiv should be 50% of the width of the=
 outerdiv.&lt;/p&gt;
+        &lt;div id=3D&quot;outer&quot; style=3D&quot;height: 300px; widt=
h: 50vw; background-color: lightcyan;&quot;&gt;
+            &lt;div id=3D&quot;inner&quot; style=3D&quot;width: 50%; hei=
ght: 50%; background-color: lightseagreen;&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;   =20
+    &lt;/body&gt;
+&lt;/html&gt;
</ins><span class=3D"cx">\ No newline at end of file
</span><span class=3D"cx">Property changes on: trunk/LayoutTests/fast/css=
/viewport-percentage-compute-box-width.html
</span><span class=3D"cx">_______________________________________________=
____________________
</span></span></pre></div>
<a id=3D"svnexecutable"></a>
<div class=3D"addfile"><h4>Added: svn:executable</h4></div>
<a id=3D"trunkSourceWebCoreChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (1601=
58 =3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/ChangeLog	2013-12-05 04:35:=
49 UTC (rev 160158)
+++ trunk/Source/WebCore/ChangeLog	2013-12-05 05:11:06 UTC (rev 160159)
</span><span class=3D"lines">@@ -1,3 +1,27 @@
</span><ins>+2013-12-04  Gurpreet Kaur  &lt;k.gurpreet at samsung.com&gt;
+
+        % unit heights don't work if parent block height is set in vh
+        https://bugs.webkit.org/show_bug.cgi?id=3D118516
+
+        Reviewed by Simon Fraser.
+
+        From Blink r156449 by &lt;srinivasa.ragavan.venkateswaran at intel.=
com&gt;
+
+        An element having height as percentage needs to have the
+        containingblock's height or availableheight to calculate its
+        own height. The containing block having a height set in vh
+        unit was not being considered for calculating the child's
+        height.
+
+        Tests: fast/css/viewport-percentage-compute-box-height.html
+               fast/css/viewport-percentage-compute-box-width.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computePercentageLogicalHeight):
+        Correct child's height(in pecentage) was not being calculated
+        incase of parent having height set in vh unit. Added condition
+        to calculate the containing block height in terms of viewport si=
ze.
+
</ins><span class=3D"cx"> 2013-12-04  Roger Fong  &lt;roger_fong at apple.co=
m&gt;
</span><span class=3D"cx">=20
</span><span class=3D"cx">         [Windows] Unreviewed build fix. Copy h=
eaders from rendering/line to build directory.
</span></span></pre></div>
<a id=3D"trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/rendering/Rende=
rBox.cpp (160158 =3D> 160159)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/rendering/RenderBox.cpp	201=
3-12-05 04:35:49 UTC (rev 160158)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-12-05 05:11:06 UTC =
(rev 160159)
</span><span class=3D"lines">@@ -2729,6 +2729,17 @@
</span><span class=3D"cx">             LayoutUnit contentBoxHeight =3D cb=
-&gt;constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollb=
ar - cb-&gt;scrollbarLogicalHeight());
</span><span class=3D"cx">             availableHeight =3D std::max&lt;La=
youtUnit&gt;(0, contentBoxHeight);
</span><span class=3D"cx">         }
</span><ins>+    } else if (cbstyle.logicalHeight().isViewportPercentage(=
)) {
+        LayoutUnit heightWithScrollbar =3D valueForLength(cbstyle.logica=
lHeight(), 0, &amp;view());
+        if (heightWithScrollbar !=3D -1) {
+            LayoutUnit contentBoxHeightWithScrollbar =3D cb-&gt;adjustCo=
ntentBoxLogicalHeightForBoxSizing(heightWithScrollbar);
+            // We need to adjust for min/max height because this method =
does=20
+            // not handle the min/max of the current block, its caller d=
oes.
+            // So the return value from the recursive call will not have=
 been
+            // adjusted yet.
+            LayoutUnit contentBoxHeight =3D cb-&gt;constrainContentBoxLo=
gicalHeightByMinMax(contentBoxHeightWithScrollbar - cb-&gt;scrollbarLogic=
alHeight());
+            availableHeight =3D std::max&lt;LayoutUnit&gt;(0, contentBox=
Height);
+        }
</ins><span class=3D"cx">     } else if (isOutOfFlowPositionedWithSpecifi=
edHeight) {
</span><span class=3D"cx">         // Don't allow this to affect the bloc=
k' height() member variable, since this
</span><span class=3D"cx">         // can get called while the block is s=
till laying out its kids.
</span></span></pre>
</div>
</div>

</body>
</html>


More information about the webkit-changes mailing list