Replace RenderMeter::updateLogicalHeight to RenderMeter::computeLogicalHeight
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 21:11:48 +0000 (21:11 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Sep 2012 21:11:48 +0000 (21:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97475

Reviewed by Ojan Vafai.

Using RenderMeter::computeLogicalHeight is part of bug 96804.
Also fix some code to be vertical writing mode aware. This doesn't actually cause
a behavioral difference because we use percentage heights/widths which don't depend on
updateLogicalWidth or computeLogicalHeight.  You can still see bugs if you try to set
the min-width on a <meter> node in a vertical writing mode.

No new tests, no behavioral changes.

* rendering/RenderMeter.cpp:
(WebCore::RenderMeter::updateLogicalWidth): Make vertical writing mode aware.
(WebCore::RenderMeter::computeLogicalHeight): Switch from updateLogicalHeight and make vertical writing mode aware.
* rendering/RenderMeter.h:
(RenderMeter):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderMeter.cpp
Source/WebCore/rendering/RenderMeter.h

index fa9ff41..c97bd77 100644 (file)
@@ -1,3 +1,24 @@
+2012-09-24  Tony Chang  <tony@chromium.org>
+
+        Replace RenderMeter::updateLogicalHeight to RenderMeter::computeLogicalHeight
+        https://bugs.webkit.org/show_bug.cgi?id=97475
+
+        Reviewed by Ojan Vafai.
+
+        Using RenderMeter::computeLogicalHeight is part of bug 96804.
+        Also fix some code to be vertical writing mode aware. This doesn't actually cause
+        a behavioral difference because we use percentage heights/widths which don't depend on
+        updateLogicalWidth or computeLogicalHeight.  You can still see bugs if you try to set
+        the min-width on a <meter> node in a vertical writing mode.
+
+        No new tests, no behavioral changes.
+
+        * rendering/RenderMeter.cpp:
+        (WebCore::RenderMeter::updateLogicalWidth): Make vertical writing mode aware.
+        (WebCore::RenderMeter::computeLogicalHeight): Switch from updateLogicalHeight and make vertical writing mode aware.
+        * rendering/RenderMeter.h:
+        (RenderMeter):
+
 2012-09-24  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Remove unbaked support for :scope pseudo-class.
index b539c0a..a4b3eca 100644 (file)
@@ -55,13 +55,22 @@ HTMLMeterElement* RenderMeter::meterElement() const
 void RenderMeter::updateLogicalWidth()
 {
     RenderBox::updateLogicalWidth();
-    setWidth(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).width());
+
+    IntSize frameSize = theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect()));
+    setLogicalWidth(isHorizontalWritingMode() ? frameSize.width() : frameSize.height());
 }
 
-void RenderMeter::updateLogicalHeight()
+void RenderMeter::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
 {
-    RenderBox::updateLogicalHeight();
-    setHeight(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).height());
+    RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
+
+    LayoutRect frame = frameRect();
+    if (isHorizontalWritingMode())
+        frame.setHeight(computedValues.m_extent);
+    else
+        frame.setWidth(computedValues.m_extent);
+    IntSize frameSize = theme()->meterSizeForBounds(this, pixelSnappedIntRect(frame));
+    computedValues.m_extent = isHorizontalWritingMode() ? frameSize.height() : frameSize.width();
 }
 
 double RenderMeter::valueRatio() const
index 9051951..b7c3ece 100644 (file)
@@ -40,7 +40,7 @@ public:
 
 private:    
     virtual void updateLogicalWidth() OVERRIDE;
-    virtual void updateLogicalHeight() OVERRIDE;
+    virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
 
     virtual const char* renderName() const { return "RenderMeter"; }
     virtual bool isMeter() const { return true; }