⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 160159 in webkit


Ignore:
Timestamp:
Dec 4, 2013, 9:11:06 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

% unit heights don't work if parent block height is set in vh
https://bugs.webkit.org/show_bug.cgi?id=118516

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2013-12-04
Reviewed by Simon Fraser.

From Blink r156449 by <srinivasa.ragavan.venkateswaran@intel.com>

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.

Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r160150 r160159  
     12013-12-04  Gurpreet Kaur  <k.gurpreet@samsung.com>
     2
     3        % unit heights don't work if parent block height is set in vh
     4        https://bugs.webkit.org/show_bug.cgi?id=118516
     5
     6        Reviewed by Simon Fraser.
     7
     8        From Blink r156449 by <srinivasa.ragavan.venkateswaran@intel.com>
     9
     10        * fast/css/viewport-percentage-compute-box-height-expected.html: Added.
     11        * fast/css/viewport-percentage-compute-box-height.html: Added.
     12        * fast/css/viewport-percentage-compute-box-width-expected.html: Added.
     13        * fast/css/viewport-percentage-compute-box-width.html: Added.
     14        Added new tests for verifying that percentage unit height/width works
     15        if parent block height/width is set in vh/vw units.
     16
    1172013-12-04  Filip Pizlo  <fpizlo@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r160158 r160159  
     12013-12-04  Gurpreet Kaur  <k.gurpreet@samsung.com>
     2
     3        % unit heights don't work if parent block height is set in vh
     4        https://bugs.webkit.org/show_bug.cgi?id=118516
     5
     6        Reviewed by Simon Fraser.
     7
     8        From Blink r156449 by <srinivasa.ragavan.venkateswaran@intel.com>
     9
     10        An element having height as percentage needs to have the
     11        containingblock's height or availableheight to calculate its
     12        own height. The containing block having a height set in vh
     13        unit was not being considered for calculating the child's
     14        height.
     15
     16        Tests: fast/css/viewport-percentage-compute-box-height.html
     17               fast/css/viewport-percentage-compute-box-width.html
     18
     19        * rendering/RenderBox.cpp:
     20        (WebCore::RenderBox::computePercentageLogicalHeight):
     21        Correct child's height(in pecentage) was not being calculated
     22        incase of parent having height set in vh unit. Added condition
     23        to calculate the containing block height in terms of viewport size.
     24
    1252013-12-04  Roger Fong  <roger_fong@apple.com>
    226
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r159779 r160159  
    27272727            // return value from the recursive call will not have been adjusted
    27282728            // yet.
     2729            LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
     2730            availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
     2731        }
     2732    } else if (cbstyle.logicalHeight().isViewportPercentage()) {
     2733        LayoutUnit heightWithScrollbar = valueForLength(cbstyle.logicalHeight(), 0, &view());
     2734        if (heightWithScrollbar != -1) {
     2735            LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar);
     2736            // We need to adjust for min/max height because this method does
     2737            // not handle the min/max of the current block, its caller does.
     2738            // So the return value from the recursive call will not have been
     2739            // adjusted yet.
    27292740            LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
    27302741            availableHeight = std::max<LayoutUnit>(0, contentBoxHeight);
Note: See TracChangeset for help on using the changeset viewer.