Title: [128215] trunk/Source/WebCore
- Revision
- 128215
- Author
- [email protected]
- Date
- 2012-09-11 12:05:35 -0700 (Tue, 11 Sep 2012)
Log Message
Refactor computePercentageLogicalHeight to simplify the logic a bit
https://bugs.webkit.org/show_bug.cgi?id=96329
Reviewed by Tony Chang.
This makes it clear that the value we're computing as we go is the availableHeight.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (128214 => 128215)
--- trunk/Source/WebCore/ChangeLog 2012-09-11 19:04:35 UTC (rev 128214)
+++ trunk/Source/WebCore/ChangeLog 2012-09-11 19:05:35 UTC (rev 128215)
@@ -1,3 +1,15 @@
+2012-09-11 Ojan Vafai <[email protected]>
+
+ Refactor computePercentageLogicalHeight to simplify the logic a bit
+ https://bugs.webkit.org/show_bug.cgi?id=96329
+
+ Reviewed by Tony Chang.
+
+ This makes it clear that the value we're computing as we go is the availableHeight.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computePercentageLogicalHeight):
+
2012-09-11 Joshua Bell <[email protected]>
IndexedDB: Optimize key decode and comparison operations
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (128214 => 128215)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2012-09-11 19:04:35 UTC (rev 128214)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2012-09-11 19:05:35 UTC (rev 128215)
@@ -2118,7 +2118,7 @@
LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) const
{
- LayoutUnit result = -1;
+ LayoutUnit availableHeight = -1;
// 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
@@ -2163,38 +2163,40 @@
return 0;
return -1;
}
- result = cb->overrideLogicalContentHeight();
+ availableHeight = cb->overrideLogicalContentHeight();
includeBorderPadding = true;
}
} else if (cbstyle->logicalHeight().isFixed()) {
// Otherwise we only use our percentage height if our containing block had a specified height.
LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle->logicalHeight().value());
- result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
+ availableHeight = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
} else if (cbstyle->logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) {
// We need to recur and compute the percentage height for our containing block.
LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle->logicalHeight());
if (heightWithScrollbar != -1) {
LayoutUnit contentBoxHeightWithScrollbar = cb->adjustContentBoxLogicalHeightForBoxSizing(heightWithScrollbar);
- result = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
+ availableHeight = max<LayoutUnit>(0, contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight());
}
} else if (cb->isRenderView() || (cb->isBody() && document()->inQuirksMode()) || 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.
LayoutUnit oldHeight = cb->logicalHeight();
cb->updateLogicalHeight();
- result = cb->contentLogicalHeight();
+ availableHeight = cb->contentLogicalHeight();
cb->setLogicalHeight(oldHeight);
}
- if (result != -1) {
- result = valueForLength(height, result);
- if (includeBorderPadding) {
- // It is necessary to use the border-box to match WinIE's broken
- // box model. This is essential for sizing inside
- // table cells using percentage heights.
- result -= borderAndPaddingLogicalHeight();
- result = max<LayoutUnit>(0, result);
- }
+ if (availableHeight == -1)
+ return availableHeight;
+
+ LayoutUnit result = valueForLength(height, availableHeight);
+ if (includeBorderPadding) {
+ // FIXME: Table cells should default to box-sizing: border-box so we can avoid this hack.
+ // It is necessary to use the border-box to match WinIE's broken
+ // box model. This is essential for sizing inside
+ // table cells using percentage heights.
+ result -= borderAndPaddingLogicalHeight();
+ return max<LayoutUnit>(0, result);
}
return result;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes