<meter> doesn't update rendering when its value is changed.
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 05:41:27 +0000 (05:41 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 05:41:27 +0000 (05:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67614

Reviewed by Dimitri Glazkov.

Source/WebCore:

It lacks repaint() when the value is changed.

For non-native appearance it works because the indicator is
implemented in shadow DOM, for native appearance, repainting should be
handled explicitly.

Test: fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html

* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::didElementStateChange):
* rendering/RenderMeter.cpp:
(WebCore::RenderMeter::updateFromElement):
* rendering/RenderMeter.h:
* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::updateAnimationState):

LayoutTests:

* fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.png: Added.
* platform/chromium/test_expectations.txt:
* platform/mac/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt: Added.
* platform/mac/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html [new file with mode: 0644]
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMeterElement.cpp
Source/WebCore/rendering/RenderMeter.cpp
Source/WebCore/rendering/RenderMeter.h
Source/WebCore/rendering/RenderProgress.cpp

index b2b84a0..0c2be7a 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-20  MORITA Hajime  <morrita@google.com>
+
+        <meter> doesn't update rendering when its value is changed.
+        https://bugs.webkit.org/show_bug.cgi?id=67614
+
+        Reviewed by Dimitri Glazkov.
+
+        * fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.png: Added.
+        * platform/chromium/test_expectations.txt:
+        * platform/mac/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt: Added.
+        * platform/mac/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html: Added.
+
 2011-09-20  Keishi Hattori  <keishi@webkit.org>
 
         [chromium] changed test expectations for zoom-svg-through-object-with-auto-size.html:wq
diff --git a/LayoutTests/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html b/LayoutTests/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html
new file mode 100644 (file)
index 0000000..18cbb62
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<head>
+<body>
+<meter id="native" value="0" min="0" max="100"></meter>
+<meter id="shadow" value="0" min="0" max="100" style="-webkit-appearance: none;"></meter>
+<script>
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+document.body.onload = function() {
+    window.setTimeout(function() {
+        document.getElementById("native").value = 50;
+        document.getElementById("shadow").value = 50;
+        window.setTimeout(function() {
+             if (window.layoutTestController)
+                 layoutTestController.notifyDone();
+        }, 0);
+    }, 50);
+}
+</script>
+</body>
+</html>
index 987f7ab..43b1da0 100644 (file)
@@ -3712,6 +3712,8 @@ BUG_ABARTH WIN : svg/as-background-image/svg-as-background-3.html = PASS IMAGE
 
 BUGCR95972 WIN DEBUG : webaudio/sample-accurate-scheduling.html = CRASH
 
+// Needs expectation.
+BUGWK67614 : fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html = MISSING 
 
 // Failing after r94912.
 BUGWK67913 WIN LINUX SNOWLEOPARD : media/video-zoom-controls.html = TEXT
diff --git a/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.png b/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.png
new file mode 100644 (file)
index 0000000..ee45d62
Binary files /dev/null and b/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt b/LayoutTests/platform/mac/fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value-expected.txt
new file mode 100644 (file)
index 0000000..a004c20
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderMeter {METER} at (0,1) size 80x16
+      RenderText {#text} at (80,0) size 4x18
+        text run at (80,0) width 4: " "
+      RenderMeter {METER} at (84,1) size 80x16
+        RenderBlock {DIV} at (0,0) size 80x16
+          RenderBlock {DIV} at (0,0) size 40x16
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
index 97f0f21..30b3d2f 100644 (file)
@@ -1,3 +1,26 @@
+2011-09-20  MORITA Hajime  <morrita@google.com>
+
+        <meter> doesn't update rendering when its value is changed.
+        https://bugs.webkit.org/show_bug.cgi?id=67614
+
+        Reviewed by Dimitri Glazkov.
+
+        It lacks repaint() when the value is changed. 
+        
+        For non-native appearance it works because the indicator is
+        implemented in shadow DOM, for native appearance, repainting should be
+        handled explicitly.
+        
+        Test: fast/dom/HTMLMeterElement/meter-element-repaint-on-update-value.html
+
+        * html/HTMLMeterElement.cpp:
+        (WebCore::HTMLMeterElement::didElementStateChange):
+        * rendering/RenderMeter.cpp:
+        (WebCore::RenderMeter::updateFromElement):
+        * rendering/RenderMeter.h:
+        * rendering/RenderProgress.cpp:
+        (WebCore::RenderProgress::updateAnimationState):
+
 2011-09-20  Kent Tamura  <tkent@chromium.org>
 
         Move RenderObject::markContainingBlocksForLayout() to RenderObject.cpp.
index 13e02ed..011a669 100644 (file)
@@ -228,6 +228,8 @@ double HTMLMeterElement::valueRatio() const
 void HTMLMeterElement::didElementStateChange()
 {
     m_value->setWidthPercentage(valueRatio()*100);
+    if (RenderObject* render = renderer())
+        render->updateFromElement();
 }
 
 void HTMLMeterElement::createShadowSubtree()
index a4a19c9..78ed8cd 100644 (file)
@@ -60,6 +60,11 @@ double RenderMeter::valueRatio() const
     return static_cast<HTMLMeterElement*>(node())->valueRatio();
 }
 
+void RenderMeter::updateFromElement()
+{
+    repaint();
+}
+
 } // namespace WebCore
 
 #endif
index 12ab6ba..6eb1717 100644 (file)
@@ -43,6 +43,7 @@ private:
     virtual bool isMeter() const { return true; }
     virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
     virtual bool canHaveChildren() const { return false; }
+    virtual void updateFromElement();
 
     double valueRatio() const;
 };
index d5aa5da..498141a 100644 (file)
@@ -88,6 +88,7 @@ void RenderProgress::updateAnimationState()
     if (animating == m_animating)
         return;
 
+    repaint();
     m_animating = animating;
     if (m_animating) {
         m_animationStartTime = currentTime();