Title: [128238] trunk/Source/WebCore
Revision
128238
Author
t...@chromium.org
Date
2012-09-11 16:20:44 -0700 (Tue, 11 Sep 2012)

Log Message

Pass the logical height and logical top into RenderBox::computeLogicalHeight
https://bugs.webkit.org/show_bug.cgi?id=96432

Reviewed by Ojan Vafai.

This allows us to call RenderBox::computeLogicalHeight without first having to call
setLogicalHeight() and setLogicalTop().  Previously, computeLogicalHeight would depend
on these values.

No new tests, this is just a refactor.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateLogicalHeight): Pass logicalHeight and logicalTop as params.
(WebCore::RenderBox::computeLogicalHeight): Use passed in values instead of calling logicalHeight/logicalTop.
(WebCore::RenderBox::computePositionedLogicalHeight): Pass the logicalHeight into computePositionedLogicalHeightUsing.
(WebCore::RenderBox::computePositionedLogicalHeightUsing): Pass in the logicalHeight as a parameter.
* rendering/RenderBox.h:
(RenderBox): Update computePositionedLogicalHeightUsing and computeLogicalHeight.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128237 => 128238)


--- trunk/Source/WebCore/ChangeLog	2012-09-11 23:18:40 UTC (rev 128237)
+++ trunk/Source/WebCore/ChangeLog	2012-09-11 23:20:44 UTC (rev 128238)
@@ -1,3 +1,24 @@
+2012-09-11  Tony Chang  <t...@chromium.org>
+
+        Pass the logical height and logical top into RenderBox::computeLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=96432
+
+        Reviewed by Ojan Vafai.
+
+        This allows us to call RenderBox::computeLogicalHeight without first having to call
+        setLogicalHeight() and setLogicalTop().  Previously, computeLogicalHeight would depend
+        on these values.
+
+        No new tests, this is just a refactor.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::updateLogicalHeight): Pass logicalHeight and logicalTop as params.
+        (WebCore::RenderBox::computeLogicalHeight): Use passed in values instead of calling logicalHeight/logicalTop.
+        (WebCore::RenderBox::computePositionedLogicalHeight): Pass the logicalHeight into computePositionedLogicalHeightUsing.
+        (WebCore::RenderBox::computePositionedLogicalHeightUsing): Pass in the logicalHeight as a parameter.
+        * rendering/RenderBox.h:
+        (RenderBox): Update computePositionedLogicalHeightUsing and computeLogicalHeight.
+
 2012-09-11  Joshua Bell  <jsb...@chromium.org>
 
         IndexedDB: Optimize key decode and comparison operations

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (128237 => 128238)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-09-11 23:18:40 UTC (rev 128237)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-09-11 23:20:44 UTC (rev 128238)
@@ -1964,7 +1964,7 @@
 void RenderBox::updateLogicalHeight()
 {
     LogicalExtentComputedValues computedValues;
-    computeLogicalHeight(computedValues);
+    computeLogicalHeight(logicalHeight(), logicalTop(), computedValues);
 
     setLogicalHeight(computedValues.m_extent);
     setLogicalTop(computedValues.m_position);
@@ -1972,10 +1972,10 @@
     setMarginAfter(computedValues.m_margins.m_after);
 }
 
-void RenderBox::computeLogicalHeight(LogicalExtentComputedValues& computedValues) const
+void RenderBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
 {
-    computedValues.m_extent = logicalHeight();
-    computedValues.m_position = logicalTop();
+    computedValues.m_extent = logicalHeight;
+    computedValues.m_position = logicalTop;
 
     // Cell height is managed by the table and inline non-replaced elements do not support a height property.
     if (isTableCell() || (isInline() && !isReplaced()))
@@ -1999,7 +1999,7 @@
         if (isTable()) {
             if (hasPerpendicularContainingBlock) {
                 bool shouldFlipBeforeAfter = shouldFlipBeforeAfterMargins(cb->style(), style());
-                computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), logicalHeight(),
+                computeInlineDirectionMargins(cb, containingBlockLogicalWidthForContent(), computedValues.m_extent,
                     shouldFlipBeforeAfter ? computedValues.m_margins.m_after : computedValues.m_margins.m_before,
                     shouldFlipBeforeAfter ? computedValues.m_margins.m_before : computedValues.m_margins.m_after);
             }
@@ -2039,7 +2039,7 @@
         if (checkMinMaxHeight) {
             heightResult = computeLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight());
             if (heightResult == -1)
-                heightResult = logicalHeight();
+                heightResult = computedValues.m_extent;
             heightResult = constrainLogicalHeightByMinMax(heightResult);
         } else {
             // The only times we don't check min/max height are when a fixed length has
@@ -2930,7 +2930,8 @@
     computeBlockStaticDistance(logicalTopLength, logicalBottomLength, this, containerBlock);
 
     // Calculate constraint equation values for 'height' case.
-    computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
+    LayoutUnit logicalHeight = computedValues.m_extent;
+    computePositionedLogicalHeightUsing(MainOrPreferredSize, styleToUse->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
                                         logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
                                         computedValues);
 
@@ -2941,7 +2942,7 @@
     if (!styleToUse->logicalMaxHeight().isUndefined()) {
         LogicalExtentComputedValues maxValues;
 
-        computePositionedLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
+        computePositionedLogicalHeightUsing(MaxSize, styleToUse->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
                                             logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
                                             maxValues);
 
@@ -2957,7 +2958,7 @@
     if (!styleToUse->logicalMinHeight().isZero()) {
         LogicalExtentComputedValues minValues;
 
-        computePositionedLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding,
+        computePositionedLogicalHeightUsing(MinSize, styleToUse->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, logicalHeight,
                                             logicalTopLength, logicalBottomLength, marginBefore, marginAfter,
                                             minValues);
 
@@ -3012,7 +3013,7 @@
 }
 
 void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
-                                                    LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding,
+                                                    LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight,
                                                     Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter,
                                                     LogicalExtentComputedValues& computedValues) const
 {
@@ -3024,7 +3025,7 @@
     ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto()));
 
     LayoutUnit logicalHeightValue;
-    LayoutUnit contentLogicalHeight = logicalHeight() - bordersPlusPadding;
+    LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding;
 
     LayoutUnit logicalTopValue = 0;
 

Modified: trunk/Source/WebCore/rendering/RenderBox.h (128237 => 128238)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-09-11 23:18:40 UTC (rev 128237)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-09-11 23:20:44 UTC (rev 128238)
@@ -366,7 +366,7 @@
 
     virtual void updateLogicalWidth();
     virtual void updateLogicalHeight();
-    void computeLogicalHeight(LogicalExtentComputedValues&) const;
+    void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const;
 
     RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;
     void computeLogicalWidthInRegion(LogicalExtentComputedValues&, RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = ZERO_LAYOUT_UNIT) const;
@@ -592,8 +592,8 @@
                                             LayoutUnit containerLogicalWidth, LayoutUnit bordersPlusPadding,
                                             Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight,
                                             LogicalExtentComputedValues&) const;
-    void computePositionedLogicalHeightUsing(SizeType, Length logicalHeight, const RenderBoxModelObject* containerBlock,
-                                             LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding,
+    void computePositionedLogicalHeightUsing(SizeType, Length logicalHeightLength, const RenderBoxModelObject* containerBlock,
+                                             LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight,
                                              Length logicalTop, Length logicalBottom, Length marginLogicalTop, Length marginLogicalBottom,
                                              LogicalExtentComputedValues&) const;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to