Replace 2 uses of updateLogicalHeight with computeLogicalHeight
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Oct 2012 21:16:27 +0000 (21:16 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Oct 2012 21:16:27 +0000 (21:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98677

Reviewed by Ojan Vafai.

This is part of bug 96804.  Convert RenderTextControl and RenderSVGForeignObject to
override the const computeLogicalHeight method rather than the updateLogicalHeight
setter method.

No new tests, there should be no behavior change as this is just a refactor.

* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::computeLogicalHeight): Pass logicalHeight through rather than setting height.
This is a slight correctness fix, although we don't support vertical inputs yet.
* rendering/RenderTextControl.h:
(RenderTextControl):
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::computeLogicalHeight):
* rendering/svg/RenderSVGForeignObject.h:
(RenderSVGForeignObject):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130686 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
Source/WebCore/rendering/svg/RenderSVGForeignObject.h

index 9b3dca4..c4cf762 100644 (file)
@@ -1,3 +1,26 @@
+2012-10-08  Tony Chang  <tony@chromium.org>
+
+        Replace 2 uses of updateLogicalHeight with computeLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=98677
+
+        Reviewed by Ojan Vafai.
+
+        This is part of bug 96804.  Convert RenderTextControl and RenderSVGForeignObject to
+        override the const computeLogicalHeight method rather than the updateLogicalHeight
+        setter method.
+
+        No new tests, there should be no behavior change as this is just a refactor.
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::computeLogicalHeight): Pass logicalHeight through rather than setting height.
+        This is a slight correctness fix, although we don't support vertical inputs yet.
+        * rendering/RenderTextControl.h:
+        (RenderTextControl):
+        * rendering/svg/RenderSVGForeignObject.cpp:
+        (WebCore::RenderSVGForeignObject::computeLogicalHeight):
+        * rendering/svg/RenderSVGForeignObject.h:
+        (RenderSVGForeignObject):
+
 2012-10-08  Min Qin  <qinmin@chromium.org>
 
         Upstream some tweaks for overlay play button on Android
index c0d72cd..35da704 100644 (file)
@@ -144,20 +144,20 @@ int RenderTextControl::scrollbarThickness() const
     return ScrollbarTheme::theme()->scrollbarThickness();
 }
 
-void RenderTextControl::updateLogicalHeight()
+void RenderTextControl::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
 {
     HTMLElement* innerText = innerTextElement();
     ASSERT(innerText);
     if (RenderBox* innerTextBox = innerText->renderBox()) {
         LayoutUnit nonContentHeight = innerTextBox->borderAndPaddingHeight() + innerTextBox->marginHeight();
-        setHeight(computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight());
+        logicalHeight = computeControlHeight(innerTextBox->lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes), nonContentHeight) + borderAndPaddingHeight();
 
         // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
         if (style()->overflowX() == OSCROLL ||  (style()->overflowX() == OAUTO && innerText->renderer()->style()->overflowWrap() == NormalOverflowWrap))
-            setHeight(height() + scrollbarThickness());
+            logicalHeight += scrollbarThickness();
     }
 
-    RenderBlock::updateLogicalHeight();
+    RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
 }
 
 void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset)
index 4fe4da5..62cf5af 100644 (file)
@@ -62,7 +62,7 @@ protected:
     virtual RenderStyle* textBaseStyle() const = 0;
 
     virtual void updateFromElement();
-    virtual void updateLogicalHeight() OVERRIDE;
+    virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
     virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren);
 
 private:
index 3430b55..2efddd2 100644 (file)
@@ -112,11 +112,13 @@ void RenderSVGForeignObject::updateLogicalWidth()
     setWidth(static_cast<int>(roundf(m_viewport.width())));
 }
 
-void RenderSVGForeignObject::updateLogicalHeight()
+void RenderSVGForeignObject::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
 {
     // FIXME: Investigate in size rounding issues
     // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
-    setHeight(static_cast<int>(roundf(m_viewport.height())));
+    // FIXME: Is this correct for vertical writing mode?
+    computedValues.m_extent = static_cast<int>(roundf(m_viewport.height()));
+    computedValues.m_position = logicalTop;
 }
 
 void RenderSVGForeignObject::layout()
index 2bbb15e..c8836ae 100644 (file)
@@ -60,7 +60,7 @@ public:
 
 private:
     virtual void updateLogicalWidth() OVERRIDE;
-    virtual void updateLogicalHeight() OVERRIDE;
+    virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
 
     virtual const AffineTransform& localToParentTransform() const;
     virtual AffineTransform localTransform() const { return m_localTransform; }