Title: [91574] trunk
Revision
91574
Author
[email protected]
Date
2011-07-22 10:54:32 -0700 (Fri, 22 Jul 2011)

Log Message

REGRESSION(r88757): The thumb of a vertical range slider is offset to the right on non-Mac.
https://bugs.webkit.org/show_bug.cgi?id=65011

Patch by Kent Tamura <[email protected]> on 2011-07-22
Reviewed by Dimitri Glazkov.

Source/WebCore:

We need to update the apeearance of thumbs before the layout of RenderSlider.

* html/shadow/SliderThumbElement.cpp:
(WebCore::RenderSliderThumb::updateAppearance):
Added. This function adjsuts the apparance of a thumb for the appearance of an <input>.
(WebCore::RenderSliderThumb::isSliderThumb):
Added.  Returns true.
(WebCore::RenderSliderThumb::layout):
Remove the appearance adjustment code. It is unnecessary because it is
done in RenderSlider::layout().
(WebCore::trackLimiterElementOf): Added.
* html/shadow/SliderThumbElement.h: Move RenderSliderThumb from SliderThumbElement.cpp.
* rendering/RenderObject.h:
(WebCore::RenderObject::isSliderThumb): Added. Returns false.
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::layout):
If the renderers for the thumb element and the limiter element is
RenderSliderThumb, updates its appearance.

LayoutTests:

* platform/chromium-linux/fast/forms/input-appearance-range-expected.png:
* platform/chromium-linux/fast/forms/input-appearance-range-expected.txt:
* platform/chromium/test_expectations.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91573 => 91574)


--- trunk/LayoutTests/ChangeLog	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/LayoutTests/ChangeLog	2011-07-22 17:54:32 UTC (rev 91574)
@@ -1,3 +1,14 @@
+2011-07-22  Kent Tamura  <[email protected]>
+
+        REGRESSION(r88757): The thumb of a vertical range slider is offset to the right on non-Mac.
+        https://bugs.webkit.org/show_bug.cgi?id=65011
+
+        Reviewed by Dimitri Glazkov.
+
+        * platform/chromium-linux/fast/forms/input-appearance-range-expected.png:
+        * platform/chromium-linux/fast/forms/input-appearance-range-expected.txt:
+        * platform/chromium/test_expectations.txt:
+
 2011-07-22  Kent Tamura  <[email protected]>
 
         Validation message bubble is incorrectly positioned in a relative body.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (91573 => 91574)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-07-22 17:54:32 UTC (rev 91574)
@@ -3771,7 +3771,9 @@
 // The test is flaky, due to the WebSocket issue.
 BUGWK64788 : http/tests/websocket/tests/hybi/reserved-opcodes.html = PASS TIMEOUT
 
-BUGWK64904 : fast/forms/input-appearance-range-rtl.html = IMAGE
+BUGWK65011 WIN : fast/forms/input-appearance-range-rtl.html = FAIL
+BUGWK65011 WIN : fast/forms/input-appearance-range.html = FAIL
+BUGWK65011 WIN LINUX : media/video-volume-slider.html = FAIL
 
 BUGRNIWA LEOPARD DEBUG : animations/dynamic-stylesheet-loading.html = PASS TEXT
 BUGRNIWA DEBUG : jquery/css.html = PASS TIMEOUT

Modified: trunk/LayoutTests/platform/chromium-linux/fast/forms/input-appearance-range-expected.png


(Binary files differ)

Added: trunk/LayoutTests/platform/chromium-linux/fast/forms/input-appearance-range-expected.txt (0 => 91574)


--- trunk/LayoutTests/platform/chromium-linux/fast/forms/input-appearance-range-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/fast/forms/input-appearance-range-expected.txt	2011-07-22 17:54:32 UTC (rev 91574)
@@ -0,0 +1,41 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x284
+  RenderBlock {HTML} at (0,0) size 800x284
+    RenderBody {BODY} at (8,8) size 784x268
+      RenderBlock {DIV} at (0,0) size 784x37
+        RenderSlider {INPUT} at (2,2) size 129x30 [bgcolor=#FFFFFF]
+          RenderDeprecatedFlexibleBox {DIV} at (0,0) size 129x30
+            RenderBlock {DIV} at (0,4) size 118x21
+            RenderBlock {DIV} at (118,4) size 11x21
+      RenderBlock {DIV} at (0,37) size 784x28
+        RenderSlider {INPUT} at (2,2) size 129x21 [bgcolor=#FFFFFF]
+          RenderDeprecatedFlexibleBox {DIV} at (0,0) size 129x21
+            RenderBlock {DIV} at (0,0) size 118x21
+            RenderBlock {DIV} at (118,0) size 11x21
+      RenderBlock {DIV} at (0,65) size 784x28
+        RenderSlider {INPUT} at (2,2) size 129x21 [bgcolor=#FFFFFF]
+          RenderDeprecatedFlexibleBox {DIV} at (0,0) size 129x21
+            RenderBlock {DIV} at (0,0) size 118x21
+            RenderBlock {DIV} at (118,0) size 11x21
+      RenderBlock {DIV} at (0,93) size 784x147
+        RenderSlider {INPUT} at (64,2) size 129x140 [bgcolor=#FFFFFF]
+          RenderDeprecatedFlexibleBox {DIV} at (0,0) size 129x140
+            RenderBlock {DIV} at (54,0) size 21x129
+            RenderBlock {DIV} at (54,129) size 21x11
+      RenderBlock {DIV} at (0,240) size 784x28
+layer at (69,14) size 11x21
+  RenderBlock (relative positioned) {DIV} at (0,0) size 11x21
+layer at (10,47) size 11x21
+  RenderBlock (relative positioned) {DIV} at (0,0) size 11x21
+layer at (128,75) size 11x21
+  RenderBlock (relative positioned) {DIV} at (0,0) size 11x21
+layer at (126,167) size 21x11
+  RenderBlock (relative positioned) {DIV} at (0,0) size 21x11
+layer at (10,250) size 129x21
+  RenderSlider {INPUT} at (2,2) size 129x21 [bgcolor=#FFFFFF]
+    RenderDeprecatedFlexibleBox {DIV} at (0,0) size 129x21
+      RenderBlock {DIV} at (0,0) size 118x21
+      RenderBlock {DIV} at (118,0) size 11x21
+layer at (98,250) size 11x21
+  RenderBlock (relative positioned) {DIV} at (0,0) size 11x21

Modified: trunk/Source/WebCore/ChangeLog (91573 => 91574)


--- trunk/Source/WebCore/ChangeLog	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/Source/WebCore/ChangeLog	2011-07-22 17:54:32 UTC (rev 91574)
@@ -1,3 +1,29 @@
+2011-07-22  Kent Tamura  <[email protected]>
+
+        REGRESSION(r88757): The thumb of a vertical range slider is offset to the right on non-Mac.
+        https://bugs.webkit.org/show_bug.cgi?id=65011
+
+        Reviewed by Dimitri Glazkov.
+
+        We need to update the apeearance of thumbs before the layout of RenderSlider.
+
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::RenderSliderThumb::updateAppearance):
+        Added. This function adjsuts the apparance of a thumb for the appearance of an <input>.
+        (WebCore::RenderSliderThumb::isSliderThumb):
+        Added.  Returns true.
+        (WebCore::RenderSliderThumb::layout):
+        Remove the appearance adjustment code. It is unnecessary because it is
+        done in RenderSlider::layout().
+        (WebCore::trackLimiterElementOf): Added.
+        * html/shadow/SliderThumbElement.h: Move RenderSliderThumb from SliderThumbElement.cpp.
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isSliderThumb): Added. Returns false.
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::layout):
+        If the renderers for the thumb element and the limiter element is
+        RenderSliderThumb, updates its appearance.
+
 2011-07-22  Kent Tamura  <[email protected]>
 
         Validation message bubble is incorrectly positioned in a relative body.

Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (91573 => 91574)


--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp	2011-07-22 17:54:32 UTC (rev 91574)
@@ -75,44 +75,37 @@
 
 // --------------------------------
 
-// FIXME: Find a way to cascade appearance (see the layout method) and get rid of this class.
-// http://webkit.org/b/62535
-class RenderSliderThumb : public RenderBlock {
-public:
-    RenderSliderThumb(Node*);
-
-private:
-    virtual void layout();
-};
-
 RenderSliderThumb::RenderSliderThumb(Node* node)
     : RenderBlock(node)
 {
 }
 
-void RenderSliderThumb::layout()
+void RenderSliderThumb::updateAppearance(RenderStyle* parentStyle)
 {
-    // Do not cast node() to SliderThumbElement. This renderer is used for
-    // TrackLimitElement too.
-    HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
-    // FIXME: Hard-coding this cascade of appearance is bad, because it's something
-    // that CSS usually does. We need to find a way to express this in CSS.
-    RenderStyle* parentStyle = input->renderer()->style();
-    bool isVertical = false;
-    if (parentStyle->appearance() == SliderVerticalPart) {
+    if (parentStyle->appearance() == SliderVerticalPart)
         style()->setAppearance(SliderThumbVerticalPart);
-        isVertical = true;
-    } else if (parentStyle->appearance() == SliderHorizontalPart)
+    else if (parentStyle->appearance() == SliderHorizontalPart)
         style()->setAppearance(SliderThumbHorizontalPart);
     else if (parentStyle->appearance() == MediaSliderPart)
         style()->setAppearance(MediaSliderThumbPart);
-    else if (parentStyle->appearance() == MediaVolumeSliderPart) {
+    else if (parentStyle->appearance() == MediaVolumeSliderPart)
         style()->setAppearance(MediaVolumeSliderThumbPart);
-        isVertical = true;
-    }
     if (style()->hasAppearance())
         theme()->adjustSliderThumbSize(style());
+}
 
+bool RenderSliderThumb::isSliderThumb() const
+{
+    return true;
+}
+
+void RenderSliderThumb::layout()
+{
+    // Do not cast node() to SliderThumbElement. This renderer is used for
+    // TrackLimitElement too.
+    HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
+    bool isVertical = style()->appearance() == SliderThumbVerticalPart || style()->appearance() == MediaVolumeSliderThumbPart;
+
     double fraction = sliderPosition(input) * 100;
     if (isVertical)
         style()->setTop(Length(100 - fraction, Percent));
@@ -347,6 +340,16 @@
     return sliderThumb;
 }
 
+TrackLimiterElement* trackLimiterElementOf(Node* node)
+{
+    ASSERT(node);
+    ShadowRoot* shadow = node->toInputElement()->shadowRoot();
+    ASSERT(shadow);
+    Node* limiter = shadow->firstChild()->lastChild();
+    ASSERT(limiter);
+    return static_cast<TrackLimiterElement*>(limiter);
+}
+
 // --------------------------------
 
 inline SliderContainerElement::SliderContainerElement(Document* document)

Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.h (91573 => 91574)


--- trunk/Source/WebCore/html/shadow/SliderThumbElement.h	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.h	2011-07-22 17:54:32 UTC (rev 91574)
@@ -35,6 +35,7 @@
 #include "FloatPoint.h"
 #include "HTMLDivElement.h"
 #include "HTMLNames.h"
+#include "RenderBlock.h"
 #include "RenderStyleConstants.h"
 #include <wtf/Forward.h>
 
@@ -99,6 +100,18 @@
 
 // --------------------------------
 
+class RenderSliderThumb : public RenderBlock {
+public:
+    RenderSliderThumb(Node*);
+    void updateAppearance(RenderStyle* parentStyle);
+
+private:
+    virtual bool isSliderThumb() const;
+    virtual void layout();
+};
+
+// --------------------------------
+
 class TrackLimiterElement : public HTMLDivElement {
 public:
     static PassRefPtr<TrackLimiterElement> create(Document*);
@@ -109,6 +122,10 @@
     virtual const AtomicString& shadowPseudoId() const;
 };
 
+// This always return a valid pointer.
+// An assertion fails if the specified node is not a range input.
+TrackLimiterElement* trackLimiterElementOf(Node*);
+
 // --------------------------------
 
 class SliderContainerElement : public HTMLDivElement {

Modified: trunk/Source/WebCore/rendering/RenderObject.h (91573 => 91574)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-07-22 17:54:32 UTC (rev 91574)
@@ -296,6 +296,7 @@
     virtual bool isRubyText() const { return false; }
 
     virtual bool isSlider() const { return false; }
+    virtual bool isSliderThumb() const { return false; }
 #if ENABLE(DETAILS)
     virtual bool isSummary() const { return false; }
 #endif

Modified: trunk/Source/WebCore/rendering/RenderSlider.cpp (91573 => 91574)


--- trunk/Source/WebCore/rendering/RenderSlider.cpp	2011-07-22 17:46:12 UTC (rev 91573)
+++ trunk/Source/WebCore/rendering/RenderSlider.cpp	2011-07-22 17:54:32 UTC (rev 91574)
@@ -97,8 +97,18 @@
 
 void RenderSlider::layout()
 {
+    // FIXME: Find a way to cascade appearance.
+    // http://webkit.org/b/62535
+    RenderBox* thumbBox = sliderThumbElementOf(node())->renderBox();
+    if (thumbBox && thumbBox->isSliderThumb())
+        static_cast<RenderSliderThumb*>(thumbBox)->updateAppearance(style());
+    if (RenderObject* limiterRenderer = trackLimiterElementOf(node())->renderer()) {
+        if (limiterRenderer->isSliderThumb())
+          static_cast<RenderSliderThumb*>(limiterRenderer)->updateAppearance(style());
+    }
+
     RenderBlock::layout();
-    RenderBox* thumbBox = sliderThumbElementOf(node())->renderBox();
+
     if (!thumbBox)
         return;
     LayoutUnit heightDiff = thumbBox->height() - contentHeight();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to