diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2015-12-03 19:53:06 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2015-12-04 10:00:29 +0000 |
commit | c255643360af6b7067ab97687f3724418eee2dd6 (patch) | |
tree | e25596f9fb17a7a91ed16aa8eea0241531152e3a | |
parent | 1d849b5b575987cd08e134e1bc339ac8746c01b2 (diff) | |
download | qtwebkit-c255643360af6b7067ab97687f3724418eee2dd6.tar.gz |
% 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.
* 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.
Change-Id: Id0158323c6d1b5a43b267133bfe0c7ce5fe4b472
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
-rw-r--r-- | Source/WebCore/rendering/RenderBox.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 03b81ac9a..355a4f958 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -2680,6 +2680,17 @@ LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); availableHeight = max<LayoutUnit>(0, contentBoxHeight); } + } else if (cbstyle->logicalHeight().isViewportPercentage()) { + LayoutUnit heightWithScrollbar = valueForLength(cbstyle->logicalHeight(), 0, view()); + if (heightWithScrollbar != -1) { + LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar); + // We need to adjust for min/max height because this method does + // not handle the min/max of the current block, its caller does. + // So the return value from the recursive call will not have been + // adjusted yet. + LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight()); + availableHeight = std::max<LayoutUnit>(0, contentBoxHeight); + } } else if (isOutOfFlowPositionedWithSpecifiedHeight) { // Don't allow this to affect the block' height() member variable, since this // can get called while the block is still laying out its kids. |