Title: [131971] trunk/Source/WebCore
Revision
131971
Author
[email protected]
Date
2012-10-19 18:43:00 -0700 (Fri, 19 Oct 2012)

Log Message

Replace calls to updateLogicalHeight with calls to computeLogicalHeight
https://bugs.webkit.org/show_bug.cgi?id=99883

Reviewed by Ojan Vafai.

In RenderBox and RenderBlock, switch to using computeLogicalHeight instead of
saving the old height, calling update logical height, then restoring the old height.

No new tests, this is just a refactoring.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeBlockPreferredLogicalWidths): Simple replace.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight): Adjust for content height.
(WebCore::RenderBox::computeReplacedLogicalHeightUsing): Adjust for content height.
(WebCore::RenderBox::availableLogicalHeightUsing): Adjust for content height.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131970 => 131971)


--- trunk/Source/WebCore/ChangeLog	2012-10-20 01:16:25 UTC (rev 131970)
+++ trunk/Source/WebCore/ChangeLog	2012-10-20 01:43:00 UTC (rev 131971)
@@ -1,3 +1,22 @@
+2012-10-19  Tony Chang  <[email protected]>
+
+        Replace calls to updateLogicalHeight with calls to computeLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=99883
+
+        Reviewed by Ojan Vafai.
+
+        In RenderBox and RenderBlock, switch to using computeLogicalHeight instead of
+        saving the old height, calling update logical height, then restoring the old height.
+
+        No new tests, this is just a refactoring.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeBlockPreferredLogicalWidths): Simple replace.
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computePercentageLogicalHeight): Adjust for content height.
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing): Adjust for content height.
+        (WebCore::RenderBox::availableLogicalHeightUsing): Adjust for content height.
+
 2012-10-19  Pablo Flouret  <[email protected]>
 
         Implement setRangeText() on text controls

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (131970 => 131971)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-10-20 01:16:25 UTC (rev 131970)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-10-20 01:43:00 UTC (rev 131971)
@@ -6094,11 +6094,9 @@
         LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth;
         if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWritingMode()) {
             RenderBox* childBox = toRenderBox(child);
-            LayoutUnit oldHeight = childBox->logicalHeight();
-            childBox->setLogicalHeight(childBox->borderAndPaddingLogicalHeight());
-            childBox->updateLogicalHeight();
-            childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = childBox->logicalHeight();
-            childBox->setLogicalHeight(oldHeight);
+            LogicalExtentComputedValues computedValues;
+            childBox->computeLogicalHeight(childBox->borderAndPaddingLogicalHeight(), 0, computedValues);
+            childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = computedValues.m_extent;
         } else {
             childMinPreferredLogicalWidth = child->minPreferredLogicalWidth();
             childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth();

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (131970 => 131971)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-10-20 01:16:25 UTC (rev 131970)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-10-20 01:43:00 UTC (rev 131971)
@@ -2213,10 +2213,9 @@
     } else if (cb->isRenderView() || 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();
-        availableHeight = cb->contentLogicalHeight();
-        cb->setLogicalHeight(oldHeight);
+        LogicalExtentComputedValues computedValues;
+        cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues);
+        availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalHeight() - cb->scrollbarLogicalHeight();
     }
 
     if (availableHeight == -1)
@@ -2312,10 +2311,10 @@
             if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
                 ASSERT(cb->isRenderBlock());
                 RenderBlock* block = toRenderBlock(cb);
-                LayoutUnit oldHeight = block->height();
-                block->updateLogicalHeight();
-                LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBoxSizing(block->contentHeight());
-                block->setHeight(oldHeight);
+                LogicalExtentComputedValues computedValues;
+                block->computeLogicalHeight(block->logicalHeight(), 0, computedValues);
+                LayoutUnit newContentHeight = computedValues.m_extent - block->borderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight();
+                LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBoxSizing(newContentHeight);
                 return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, newHeight));
             }
             
@@ -2387,11 +2386,10 @@
     // https://bugs.webkit.org/show_bug.cgi?id=46500
     if (isRenderBlock() && isOutOfFlowPositioned() && style()->height().isAuto() && !(style()->top().isAuto() || style()->bottom().isAuto())) {
         RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this));
-        LayoutUnit oldHeight = block->logicalHeight();
-        block->updateLogicalHeight();
-        LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBoxSizing(block->contentLogicalHeight());
-        block->setLogicalHeight(oldHeight);
-        return adjustContentBoxLogicalHeightForBoxSizing(newHeight);
+        LogicalExtentComputedValues computedValues;
+        block->computeLogicalHeight(block->logicalHeight(), 0, computedValues);
+        LayoutUnit newContentHeight = computedValues.m_extent - block->borderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight();
+        return adjustContentBoxLogicalHeightForBoxSizing(newContentHeight);
     }
 
     // FIXME: This is wrong if the containingBlock has a perpendicular writing mode.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to