2011-06-10  Kent Tamura  <tkent@chromium.org>

        Reviewed by Dimitri Glazkov.

        Use CSS machinery to position slider thumb.
        https://bugs.webkit.org/show_bug.cgi?id=52920

        Add two new tests, and update tests with sliders.

        * fast/dom/HTMLInputElement/input-slider-update-styled-expected.txt:
        * fast/forms/input-appearance-range.html: Added.
        * fast/forms/slider-thumb-stylability.html: Remove text.
        * fast/forms/validation-message-on-range-expected.txt: Added.
        * fast/forms/validation-message-on-range.html: Added.
        * fast/multicol/client-rects-expected.txt:
        * fast/repaint/slider-thumb-float-expected.txt:
        * media/audio-repaint-expected.txt:
        * media/controls-without-preload-expected.txt:
        * media/media-document-audio-repaint-expected.txt:
        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped: Skip validaiton-message-on-range.html because
          this platform doesn't support the interactive validation.
        * platform/mac-wk2/Skipped: Skip validaiton-message-on-range.html.
        * platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.png:
        * platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.txt:
        * platform/mac/fast/forms/box-shadow-override-expected.png:
        * platform/mac/fast/forms/box-shadow-override-expected.txt:
        * platform/mac/fast/forms/input-appearance-height-expected.png:
        * platform/mac/fast/forms/input-appearance-height-expected.txt:
        * platform/mac/fast/forms/input-appearance-range-expected.png: Added.
        * platform/mac/fast/forms/input-appearance-range-expected.txt: Added.
        * platform/mac/fast/forms/range-thumb-height-percentage-expected.txt:
        * platform/mac/fast/forms/slider-padding-expected.png:
        * platform/mac/fast/forms/slider-padding-expected.txt:
        * platform/mac/fast/forms/slider-thumb-shared-style-expected.png:
        * platform/mac/fast/forms/slider-thumb-shared-style-expected.txt:
        * platform/mac/fast/forms/slider-thumb-stylability-expected.png:
        * platform/mac/fast/forms/slider-thumb-stylability-expected.txt:
        * platform/mac/fast/forms/thumbslider-no-parent-slider-expected.png:
        * platform/mac/fast/forms/thumbslider-no-parent-slider-expected.txt:
        * platform/mac/fast/repaint/slider-thumb-drag-release-expected.png:
        * platform/mac/fast/repaint/slider-thumb-drag-release-expected.txt:
        * platform/mac/media/audio-controls-rendering-expected.png:
        * platform/mac/media/audio-controls-rendering-expected.txt:
        * platform/mac/media/controls-after-reload-expected.png:
        * platform/mac/media/controls-after-reload-expected.txt:
        * platform/mac/media/controls-styling-expected.png:
        * platform/mac/media/controls-styling-expected.txt:
        * platform/qt/Skipped: Skip validaiton-message-on-range.html.
        * platform/win/Skipped: Skip validaiton-message-on-range.html.
2011-06-10  Kent Tamura  <tkent@chromium.org>

        Reviewed by Dimitri Glazkov.

        Use CSS machinery to position slider thumb.
        https://bugs.webkit.org/show_bug.cgi?id=52920

        Remove RenderSlider::layout().
        In order to remove it, we introduce new three shadow nodes:
         - A flex box container occupying the whole box
         - A flex box item representing a movable area of the thumb
         - A flex box item limiting the movable area of the thumb
        The thumb position is specified by percentage position in the second element.

        This change also fixes Bug 60353.

        Tests: fast/forms/input-appearance-range.html
               fast/forms/validation-message-on-range.html

        * accessibility/AccessibilitySlider.cpp:
        (WebCore::AccessibilitySliderThumb::elementRect):
          Use Node::getRect() for the thumb element.
        * css/html.css: Add new style definitions for the new node layout.
        (input[type="range"]::-webkit-slider-container):
        (input[type="range"]::-webkit-slider-runnable-track):
        (input[type="range"]::-webkit-slider-thumb):
        * html/RangeInputType.cpp:
        (WebCore::RangeInputType::handleMouseDownEvent):
          Accepts events on shadow nodes, use sliderThumbElementOf().
        (WebCore::RangeInputType::createShadowSubtree):
          Creates new nodes layout.
        (WebCore::RangeInputType::valueChanged): Use sliderThumbElementOf().
        * html/RangeInputType.h: Remove shadowSliderThumb().
        * html/shadow/SliderThumbElement.cpp:
        (WebCore::sliderPosition): Moved from RenderSlider.cpp.
        (WebCore::hasVerticalAppearance): New utility function.
        (WebCore::sliderThumbElementOf): New utility function.
        (WebCore::RenderSliderThumb::layout):
          Sets CSS top/left values.
        (WebCore::RenderSliderContainer::RenderSliderContainer):
        (WebCore::RenderSliderContainer::layout):
          Add some adjustment code.
          - Setting box-orient
          - Adjust heights of some nodes. It is required to pass existing tests.
        (WebCore::SliderThumbElement::setPositionFromValue):
          Update comments.
        (WebCore::SliderThumbElement::setPositionFromPoint):
          Calculate the current position from absolute positions.
        (WebCore::SliderThumbElement::hostInput):
          Removed unnecessary variable.
        (WebCore::TrackLimiterElement::TrackLimiterElement):
        (WebCore::TrackLimiterElement::create): Adjust style.
        (WebCore::TrackLimiterElement::createRenderer):
          This node uses RenderSliderThumb.
        (WebCore::TrackLimiterElement::shadowPseudoId):
          This node also uses -webkit-slider-thumb.
        (WebCore::SliderContainerElement::SliderContainerElement):
        (WebCore::SliderContainerElement::create):
        (WebCore::SliderContainerElement::createRenderer):
          Uses RenderSliderContainer.
        (WebCore::SliderContainerElement::shadowPseudoId):
        * html/shadow/SliderThumbElement.h:
          Make hostInput() public, add declarations of TrackLimiterElement
          and SliderContainerElement.
        * rendering/RenderSlider.cpp:
        (WebCore::RenderSlider::RenderSlider): Added an assertion.
        (WebCore::RenderSlider::inDragMode): Uses sliderThumbElementOf().
        * rendering/RenderSlider.h: Remove declarations of removed functions.
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::adjustSliderThumbStyle):
          Calls adjustSliderThumbSize().

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88757 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3e1bf69..0d4823d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,54 @@
+2011-06-10  Kent Tamura  <tkent@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Use CSS machinery to position slider thumb.
+        https://bugs.webkit.org/show_bug.cgi?id=52920
+
+        Add two new tests, and update tests with sliders.
+
+        * fast/dom/HTMLInputElement/input-slider-update-styled-expected.txt:
+        * fast/forms/input-appearance-range.html: Added.
+        * fast/forms/slider-thumb-stylability.html: Remove text.
+        * fast/forms/validation-message-on-range-expected.txt: Added.
+        * fast/forms/validation-message-on-range.html: Added.
+        * fast/multicol/client-rects-expected.txt:
+        * fast/repaint/slider-thumb-float-expected.txt:
+        * media/audio-repaint-expected.txt:
+        * media/controls-without-preload-expected.txt:
+        * media/media-document-audio-repaint-expected.txt:
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped: Skip validaiton-message-on-range.html because
+          this platform doesn't support the interactive validation.
+        * platform/mac-wk2/Skipped: Skip validaiton-message-on-range.html.
+        * platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.png:
+        * platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.txt:
+        * platform/mac/fast/forms/box-shadow-override-expected.png:
+        * platform/mac/fast/forms/box-shadow-override-expected.txt:
+        * platform/mac/fast/forms/input-appearance-height-expected.png:
+        * platform/mac/fast/forms/input-appearance-height-expected.txt:
+        * platform/mac/fast/forms/input-appearance-range-expected.png: Added.
+        * platform/mac/fast/forms/input-appearance-range-expected.txt: Added.
+        * platform/mac/fast/forms/range-thumb-height-percentage-expected.txt:
+        * platform/mac/fast/forms/slider-padding-expected.png:
+        * platform/mac/fast/forms/slider-padding-expected.txt:
+        * platform/mac/fast/forms/slider-thumb-shared-style-expected.png:
+        * platform/mac/fast/forms/slider-thumb-shared-style-expected.txt:
+        * platform/mac/fast/forms/slider-thumb-stylability-expected.png:
+        * platform/mac/fast/forms/slider-thumb-stylability-expected.txt:
+        * platform/mac/fast/forms/thumbslider-no-parent-slider-expected.png:
+        * platform/mac/fast/forms/thumbslider-no-parent-slider-expected.txt:
+        * platform/mac/fast/repaint/slider-thumb-drag-release-expected.png:
+        * platform/mac/fast/repaint/slider-thumb-drag-release-expected.txt:
+        * platform/mac/media/audio-controls-rendering-expected.png:
+        * platform/mac/media/audio-controls-rendering-expected.txt:
+        * platform/mac/media/controls-after-reload-expected.png:
+        * platform/mac/media/controls-after-reload-expected.txt:
+        * platform/mac/media/controls-styling-expected.png:
+        * platform/mac/media/controls-styling-expected.txt:
+        * platform/qt/Skipped: Skip validaiton-message-on-range.html.
+        * platform/win/Skipped: Skip validaiton-message-on-range.html.
+
 2011-06-13  Ryosuke Niwa  <rniwa@webkit.org>
 
         Another GTK rebaseline after r88717 because non-breaking spaces were somehow converted to
diff --git a/LayoutTests/fast/dom/HTMLInputElement/input-slider-update-styled-expected.txt b/LayoutTests/fast/dom/HTMLInputElement/input-slider-update-styled-expected.txt
index 54911b0..c638816 100644
--- a/LayoutTests/fast/dom/HTMLInputElement/input-slider-update-styled-expected.txt
+++ b/LayoutTests/fast/dom/HTMLInputElement/input-slider-update-styled-expected.txt
@@ -4,5 +4,9 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderSlider {INPUT} at (2,2) size 100x10 [bgcolor=#FF0000]
-        RenderBlock {DIV} at (90,0) size 10x10 [bgcolor=#008000]
+        RenderFlexibleBox {DIV} at (0,0) size 100x10
+          RenderBlock {DIV} at (0,0) size 90x10
+          RenderBlock {DIV} at (90,0) size 10x10 [bgcolor=#008000]
       RenderText {#text} at (0,0) size 0x0
+layer at (100,10) size 10x10
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x10 [bgcolor=#008000]
diff --git a/LayoutTests/fast/forms/input-appearance-range.html b/LayoutTests/fast/forms/input-appearance-range.html
new file mode 100644
index 0000000..9da47a2a
--- /dev/null
+++ b/LayoutTests/fast/forms/input-appearance-range.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<body>
+<!--
+  You'll see
+   - three horizontal sliders with various thumb positions.
+   - a vertical slider
+   - a slant slider
+-->
+
+<div><input type=range style="height: 30px;"></div>
+<div><input type=range value=0 min=0 max=100></div>
+<div><input type=range value=110 min=0 max=100></div>
+
+<div><input type=range style="-webkit-appearance:slider-vertical; height:140px; margin-left:64px"></div>
+
+<div><input type=range value=75 style="-webkit-transform: rotate(30deg)"></div>
+</body>
diff --git a/LayoutTests/fast/forms/slider-thumb-stylability.html b/LayoutTests/fast/forms/slider-thumb-stylability.html
index 47a9dfd..dc47e277 100644
--- a/LayoutTests/fast/forms/slider-thumb-stylability.html
+++ b/LayoutTests/fast/forms/slider-thumb-stylability.html
@@ -10,12 +10,10 @@
     </style>
 </head>
 <body>
-    <p>
-        This tests styling of the slider thumb.
-    </p>
-    <p>
-        You should see a green 20&times;20px square.
-    </p>
-    <input type="range" value="0" style="-webkit-appearance: none;">
+<!--
+  This tests styling of the slider thumb.
+  You should see a green 20x20px square.
+-->
+<input type="range" value="0" style="-webkit-appearance: none;">
 </body>
 </html>
diff --git a/LayoutTests/fast/forms/validation-message-on-range-expected.txt b/LayoutTests/fast/forms/validation-message-on-range-expected.txt
new file mode 100644
index 0000000..3b922b8
--- /dev/null
+++ b/LayoutTests/fast/forms/validation-message-on-range-expected.txt
@@ -0,0 +1,10 @@
+Check if the position of a validation message for a range control is good.
+
+ 
+The top of the bubble should be on the bottom of the host node:
+PASS bubbleRect.top is hostRect.bottom
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/validation-message-on-range.html b/LayoutTests/fast/forms/validation-message-on-range.html
new file mode 100644
index 0000000..76c1ed6
--- /dev/null
+++ b/LayoutTests/fast/forms/validation-message-on-range.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+<script src="resources/common.js"></script>
+</head>
+<body>
+<p>Check if the position of a validation message for a range control is good.</p>
+
+<form action="validation-message-on-range.html">
+<input type=range id=host required>
+<input type=submit id=submit>
+</form>
+
+<div id="console"></div>
+<script>
+function check() {
+    hostRect = getAbsoluteRect(host);
+    bubbleRect = getAbsoluteRect(getValidationMessageBubbleNode(host));
+    debug('The top of the bubble should be on the bottom of the host node:');
+    shouldBe('bubbleRect.top', 'hostRect.bottom');
+    debug('');
+
+    finishJSTest();
+}
+
+var host = $('host');
+var hostRect;
+var bubbleRect;
+host.setCustomValidity('Invalid Value');
+$('submit').click();
+if (window.layoutTestController) {
+    setTimeout(check, 0);
+} else {
+    debug('The test requires layoutTestController.');
+}
+
+var jsTestIsAsync = true;
+var successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+
diff --git a/LayoutTests/fast/multicol/client-rects-expected.txt b/LayoutTests/fast/multicol/client-rects-expected.txt
index 1633754..d0568cd 100644
--- a/LayoutTests/fast/multicol/client-rects-expected.txt
+++ b/LayoutTests/fast/multicol/client-rects-expected.txt
@@ -61,7 +61,9 @@
     RenderBlock {DIV} at (13,38) size 50x54
       RenderBR {BR} at (0,0) size 0x25
       RenderSlider {INPUT} at (2,27) size 25x25 [color=#000000] [bgcolor=#ADD8E6]
-        RenderBlock {DIV} at (12,12) size 0x0
+        RenderFlexibleBox {DIV} at (0,0) size 25x25
+          RenderBlock {DIV} at (0,12) size 25x0
+          RenderBlock {DIV} at (25,12) size 0x0
 layer at (8,483) size 136x76
   RenderBlock {DIV} at (0,475) size 136x76 [color=#ADD8E6] [border: (3px solid #000000)]
     RenderBlock (anonymous) at (13,13) size 50x25
diff --git a/LayoutTests/fast/repaint/slider-thumb-float-expected.txt b/LayoutTests/fast/repaint/slider-thumb-float-expected.txt
index f728d46..273e09b 100644
--- a/LayoutTests/fast/repaint/slider-thumb-float-expected.txt
+++ b/LayoutTests/fast/repaint/slider-thumb-float-expected.txt
@@ -4,4 +4,8 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderSlider {INPUT} at (2,2) size 100x10 [bgcolor=#FF0000]
-        RenderBlock {DIV} at (90,0) size 10x10 [bgcolor=#008000]
+        RenderFlexibleBox {DIV} at (0,0) size 100x10
+          RenderBlock {DIV} at (0,0) size 90x10
+          RenderBlock {DIV} at (90,0) size 10x10 [bgcolor=#008000]
+layer at (100,10) size 10x10
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x10 [bgcolor=#008000]
diff --git a/LayoutTests/media/audio-repaint-expected.txt b/LayoutTests/media/audio-repaint-expected.txt
index f3eec60..9ea5c92 100644
--- a/LayoutTests/media/audio-repaint-expected.txt
+++ b/LayoutTests/media/audio-repaint-expected.txt
@@ -22,8 +22,12 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 126x15
       RenderSlider {INPUT} at (0,2) size 126x13
-        RenderBlock {DIV} at (58,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (177,6) size 14x12
+layer at (115,76) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
 layer at (8,42) size 200x25
   RenderBlock (relative positioned) {DIV} at (0,0) size 200x25
 layer at (8,42) size 200x25
@@ -32,8 +36,12 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 126x15
       RenderSlider {INPUT} at (0,2) size 126x13
-        RenderBlock {DIV} at (58,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (177,6) size 14x12
+layer at (115,51) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
 layer at (8,144) size 200x25
   RenderMedia {AUDIO} at (0,102) size 200x25
 layer at (8,144) size 200x25
@@ -44,5 +52,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 126x15
       RenderSlider {INPUT} at (0,2) size 126x13
-        RenderBlock {DIV} at (58,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (177,6) size 14x12
+layer at (115,153) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
diff --git a/LayoutTests/media/controls-without-preload-expected.txt b/LayoutTests/media/controls-without-preload-expected.txt
index bb7b20f..5f4644b 100644
--- a/LayoutTests/media/controls-without-preload-expected.txt
+++ b/LayoutTests/media/controls-without-preload-expected.txt
@@ -18,7 +18,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 216x15
       RenderSlider {INPUT} at (45,2) size 126x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (297,4) size 16x16
     RenderButton {INPUT} at (267,6) size 14x12
 layer at (57,264) size 45x11
@@ -31,3 +33,5 @@
     RenderBlock (anonymous) at (7,0) size 31x11
       RenderText {#text} at (0,0) size 31x11
         text run at (0,0) width 31: "-00:06"
+layer at (102,266) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
diff --git a/LayoutTests/media/media-document-audio-repaint-expected.txt b/LayoutTests/media/media-document-audio-repaint-expected.txt
index f28f331..04b1711 100644
--- a/LayoutTests/media/media-document-audio-repaint-expected.txt
+++ b/LayoutTests/media/media-document-audio-repaint-expected.txt
@@ -27,7 +27,9 @@
         RenderButton {INPUT} at (32,4) size 16x16
         RenderFlexibleBox {DIV} at (49,5) size 226x15
           RenderSlider {INPUT} at (45,2) size 136x13
-            RenderBlock {DIV} at (63,2) size 10x8
+            RenderFlexibleBox {DIV} at (0,0) size 136x13
+              RenderBlock {DIV} at (0,2) size 126x8
+              RenderBlock {DIV} at (126,2) size 10x8
         RenderButton {INPUT} at (277,6) size 14x12
     layer at (89,147) size 45x11
       RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
@@ -39,3 +41,5 @@
         RenderBlock (anonymous) at (7,0) size 31x11
           RenderText {#text} at (0,0) size 31x11
             text run at (0,0) width 31: "-00:00"
+    layer at (197,149) size 10x8
+      RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 5e06afc..1f9a8a2 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -3949,6 +3949,34 @@
 BUGWK61936 : fast/filesystem/filesystem-no-callback-null-ptr-crash.html = CRASH PASS
 BUGABARTH LINUX : svg/text/scaling-font-with-geometric-precision.html = IMAGE PASS
 
+// Need rebaseline for all of rendering tests with <input type=range> including media controls.
+BUGWK52920 : fast/dom/HTMLInputElement/input-slider-update.html = FAIL
+BUGWK52920 LINUX WIN : fast/forms/box-shadow-override.html = FAIL
+BUGWK52920 LINUX WIN : fast/forms/input-appearance-height.html = FAIL
+BUGWK52920 : fast/forms/input-appearance-range.html = FAIL
+BUGWK52920 : fast/forms/range-thumb-height-percentage.html = FAIL
+BUGWK52920 : fast/forms/slider-delete-while-dragging-thumb.html = FAIL
+BUGWK52920 : fast/forms/slider-mouse-events.html = FAIL
+BUGWK52920 : fast/forms/slider-onchange-event.html = FAIL
+BUGWK52920 : fast/forms/slider-padding.html = FAIL
+BUGWK52920 : fast/forms/slider-thumb-shared-style.html = FAIL
+BUGWK52920 : fast/forms/slider-thumb-stylability.html = FAIL
+BUGWK52920 : fast/forms/thumbslider-no-parent-slider.html = FAIL
+BUGWK52920 : fast/layers/video-layer.html = FAIL
+BUGWK52920 : fast/multicol/client-rects.html = FAIL
+BUGWK52920 : fast/repaint/slider-thumb-drag-release.html = FAIL
+BUGWK52920 : media/audio-controls-rendering.html = FAIL
+BUGWK52920 : media/audio-repaint.html = FAIL
+BUGWK52920 : media/controls-after-reload.html = FAIL
+BUGWK52920 : media/controls-strict.html = FAIL
+BUGWK52920 : media/controls-styling.html = FAIL
+BUGWK52920 : media/controls-without-preload.html = FAIL
+BUGWK52920 : media/video-controls-rendering.html = FAIL
+BUGWK52920 : media/video-display-toggle.html = FAIL
+BUGWK52920 : media/video-empty-source.html = FAIL
+BUGWK52920 : media/video-no-audio.html = FAIL
+BUGWK52920 : media/video-volume-slider.html = FAIL
+BUGWK52920 : media/video-zoom-controls.html = FAIL
 
 BUGCR84157 GPU : plugins/embed-attributes-style.html = IMAGE+TEXT
 BUGCR84157 GPU : svg/as-image/svg-as-background-with-relative-size.html = IMAGE+TEXT
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 49c1a87..5ecd28d 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1240,6 +1240,7 @@
 fast/forms/validation-message-on-listbox.html
 fast/forms/validation-message-on-menulist.html
 fast/forms/validation-message-on-radio.html
+fast/forms/validation-message-on-range.html
 fast/forms/validation-message-on-textarea.html
 
 # Tests that seem to be Mac only, assume that smart drag-and-drop
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index b75d56e..00adc5e 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -1518,6 +1518,7 @@
 fast/forms/validation-message-on-listbox.html
 fast/forms/validation-message-on-menulist.html
 fast/forms/validation-message-on-radio.html
+fast/forms/validation-message-on-range.html
 fast/forms/validation-message-on-textarea.html
 
 # Misbehaving computedStyleIncludingVisitedInfo or keepWebHistory API in WebKitTestRunner
diff --git a/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.png b/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.png
index 07d86cd..13d8b72 100644
--- a/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.png
+++ b/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.txt b/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.txt
index 9853bd0..1587ce0 100644
--- a/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.txt
+++ b/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-slider-update-expected.txt
@@ -4,5 +4,9 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderSlider {INPUT} at (2,2) size 129x15 [bgcolor=#FFFFFF]
-        RenderBlock {DIV} at (114,0) size 15x15
+        RenderFlexibleBox {DIV} at (0,0) size 129x15
+          RenderBlock {DIV} at (0,0) size 114x15
+          RenderBlock {DIV} at (114,0) size 15x15
       RenderText {#text} at (0,0) size 0x0
+layer at (124,10) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.png b/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.png
index ed265ae..756e05a 100644
--- a/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.png
+++ b/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.txt b/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.txt
index 0c360ca..27a57ab 100644
--- a/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.txt
@@ -35,7 +35,9 @@
         RenderText {#text} at (36,9) size 4x18
           text run at (36,9) width 4: " "
         RenderSlider {INPUT} at (42,8) size 129x15 [bgcolor=#FFFFFF]
-          RenderBlock {DIV} at (57,0) size 15x15
+          RenderFlexibleBox {DIV} at (0,0) size 129x15
+            RenderBlock {DIV} at (0,0) size 114x15
+            RenderBlock {DIV} at (114,0) size 15x15
         RenderText {#text} at (173,9) size 4x18
           text run at (173,9) width 4: " "
         RenderFileUploadControl {INPUT} at (179,10) size 237x18 "no file selected"
@@ -76,3 +78,5 @@
   RenderBlock {DIV} at (17,0) size 89x13
 layer at (35,127) size 84x13
   RenderBlock {DIV} at (22,0) size 84x13
+layer at (107,153) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png b/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png
index 57b4e9c..b3677c4 100644
--- a/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png
+++ b/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt b/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
index 9cb6024..af5734c 100644
--- a/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
@@ -50,7 +50,9 @@
         RenderText {#text} at (0,127) size 39x18
           text run at (0,127) width 39: "range "
         RenderSlider {INPUT} at (41,126) size 129x15 [bgcolor=#FFFFFF]
-          RenderBlock {DIV} at (57,0) size 15x15
+          RenderFlexibleBox {DIV} at (0,0) size 129x15
+            RenderBlock {DIV} at (0,0) size 114x15
+            RenderBlock {DIV} at (114,0) size 15x15
         RenderText {#text} at (172,127) size 4x18
           text run at (172,127) width 4: " "
         RenderBR {BR} at (176,141) size 0x0
@@ -101,3 +103,5 @@
   RenderBlock {DIV} at (3,3) size 119x13
 layer at (65,266) size 98x13
   RenderBlock {DIV} at (8,0) size 98x13
+layer at (106,152) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-range-expected.png b/LayoutTests/platform/mac/fast/forms/input-appearance-range-expected.png
new file mode 100644
index 0000000..0630067
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/forms/input-appearance-range-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-range-expected.txt b/LayoutTests/platform/mac/fast/forms/input-appearance-range-expected.txt
new file mode 100644
index 0000000..0089c1b
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/forms/input-appearance-range-expected.txt
@@ -0,0 +1,41 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x261
+  RenderBlock {HTML} at (0,0) size 800x261
+    RenderBody {BODY} at (8,8) size 784x245
+      RenderBlock {DIV} at (0,0) size 784x36
+        RenderSlider {INPUT} at (2,2) size 129x30 [bgcolor=#FFFFFF]
+          RenderFlexibleBox {DIV} at (0,0) size 129x30
+            RenderBlock {DIV} at (0,7) size 114x15
+            RenderBlock {DIV} at (114,7) size 15x15
+      RenderBlock {DIV} at (0,36) size 784x21
+        RenderSlider {INPUT} at (2,2) size 129x15 [bgcolor=#FFFFFF]
+          RenderFlexibleBox {DIV} at (0,0) size 129x15
+            RenderBlock {DIV} at (0,0) size 114x15
+            RenderBlock {DIV} at (114,0) size 15x15
+      RenderBlock {DIV} at (0,57) size 784x21
+        RenderSlider {INPUT} at (2,2) size 129x15 [bgcolor=#FFFFFF]
+          RenderFlexibleBox {DIV} at (0,0) size 129x15
+            RenderBlock {DIV} at (0,0) size 114x15
+            RenderBlock {DIV} at (114,0) size 15x15
+      RenderBlock {DIV} at (0,78) size 784x146
+        RenderSlider {INPUT} at (64,2) size 129x140 [bgcolor=#FFFFFF]
+          RenderFlexibleBox {DIV} at (0,0) size 129x140
+            RenderBlock {DIV} at (57,0) size 15x125
+            RenderBlock {DIV} at (57,125) size 15x15
+      RenderBlock {DIV} at (0,224) size 784x21
+layer at (67,17) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
+layer at (10,46) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
+layer at (124,67) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
+layer at (129,150) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
+layer at (10,234) size 129x15
+  RenderSlider {INPUT} at (2,2) size 129x15 [bgcolor=#FFFFFF]
+    RenderFlexibleBox {DIV} at (0,0) size 129x15
+      RenderBlock {DIV} at (0,0) size 114x15
+      RenderBlock {DIV} at (114,0) size 15x15
+layer at (95,234) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/fast/forms/range-thumb-height-percentage-expected.txt b/LayoutTests/platform/mac/fast/forms/range-thumb-height-percentage-expected.txt
index c198ec6..ad2e962 100644
--- a/LayoutTests/platform/mac/fast/forms/range-thumb-height-percentage-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/range-thumb-height-percentage-expected.txt
@@ -8,5 +8,9 @@
           text run at (0,0) width 536: "The slider thumb below has a height specified as 50%. It should be a 10 pixel square."
       RenderBlock (anonymous) at (0,34) size 784x24
         RenderSlider {INPUT} at (2,2) size 200x20 [bgcolor=#C0C0C0]
-          RenderBlock {DIV} at (95,5) size 10x10 [bgcolor=#008000]
+          RenderFlexibleBox {DIV} at (0,0) size 200x20
+            RenderBlock {DIV} at (0,5) size 190x10
+            RenderBlock {DIV} at (190,5) size 10x10 [bgcolor=#008000]
         RenderText {#text} at (0,0) size 0x0
+layer at (105,49) size 10x10
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x10 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/forms/slider-padding-expected.png b/LayoutTests/platform/mac/fast/forms/slider-padding-expected.png
index 0a0ae59..d7224c4 100644
--- a/LayoutTests/platform/mac/fast/forms/slider-padding-expected.png
+++ b/LayoutTests/platform/mac/fast/forms/slider-padding-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/slider-padding-expected.txt b/LayoutTests/platform/mac/fast/forms/slider-padding-expected.txt
index cf5ac6f..43d971c 100644
--- a/LayoutTests/platform/mac/fast/forms/slider-padding-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/slider-padding-expected.txt
@@ -9,6 +9,10 @@
         RenderBR {BR} at (0,0) size 0x0
       RenderBlock {DIV} at (0,18) size 784x39 [bgcolor=#ADD8E6]
         RenderSlider {INPUT} at (2,2) size 100x35 [bgcolor=#FFFFFF]
-          RenderBlock {DIV} at (10,10) size 15x15
+          RenderFlexibleBox {DIV} at (10,10) size 80x15
+            RenderBlock {DIV} at (0,0) size 65x15
+            RenderBlock {DIV} at (65,0) size 15x15
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {PRE} at (0,70) size 784x0
+layer at (20,38) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.png b/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.png
index 606aeec..2da7c54 100644
--- a/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.png
+++ b/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.txt b/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.txt
index 1beae67..8929339 100644
--- a/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/slider-thumb-shared-style-expected.txt
@@ -20,8 +20,16 @@
           text run at (0,0) width 282: "The first slider\x{2019}s thumb should be on the left."
       RenderBlock {DIV} at (0,68) size 784x38
         RenderSlider {INPUT} at (2,2) size 129x15 [bgcolor=#FFFFFF]
-          RenderBlock {DIV} at (0,0) size 15x15
+          RenderFlexibleBox {DIV} at (0,0) size 129x15
+            RenderBlock {DIV} at (0,0) size 114x15
+            RenderBlock {DIV} at (114,0) size 15x15
         RenderBR {BR} at (133,17) size 0x0
         RenderSlider {INPUT} at (2,21) size 129x15 [bgcolor=#FFFFFF]
-          RenderBlock {DIV} at (114,0) size 15x15
+          RenderFlexibleBox {DIV} at (0,0) size 129x15
+            RenderBlock {DIV} at (0,0) size 114x15
+            RenderBlock {DIV} at (114,0) size 15x15
         RenderText {#text} at (0,0) size 0x0
+layer at (10,78) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
+layer at (124,97) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.png b/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.png
index aeb35cf..1a8745a 100644
--- a/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.png
+++ b/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.txt b/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.txt
index 4c0aaa1..550c688 100644
--- a/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/slider-thumb-stylability-expected.txt
@@ -3,13 +3,10 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderBlock {P} at (0,0) size 784x18
-        RenderText {#text} at (0,0) size 231x18
-          text run at (0,0) width 231: "This tests styling of the slider thumb."
-      RenderBlock {P} at (0,34) size 784x18
-        RenderText {#text} at (0,0) size 258x18
-          text run at (0,0) width 258: "You should see a green 20\x{D7}20px square."
-      RenderBlock (anonymous) at (0,68) size 784x24
-        RenderSlider {INPUT} at (2,2) size 129x20 [bgcolor=#FFFFFF]
-          RenderBlock {DIV} at (0,0) size 20x20 [bgcolor=#008000]
-        RenderText {#text} at (0,0) size 0x0
+      RenderSlider {INPUT} at (2,2) size 129x20 [bgcolor=#FFFFFF]
+        RenderFlexibleBox {DIV} at (0,0) size 129x20
+          RenderBlock {DIV} at (0,0) size 109x20
+          RenderBlock {DIV} at (109,0) size 20x20 [bgcolor=#008000]
+      RenderText {#text} at (0,0) size 0x0
+layer at (10,10) size 20x20
+  RenderBlock (relative positioned) {DIV} at (0,0) size 20x20 [bgcolor=#008000]
diff --git a/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.png b/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.png
index 685eaed..d749666 100644
--- a/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.png
+++ b/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.txt b/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.txt
index f1d641f..b4b5699 100644
--- a/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/thumbslider-no-parent-slider-expected.txt
@@ -3,7 +3,7 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderBlock {SPAN} at (0,0) size 20x20
-      RenderBR {BR} at (20,20) size 0x0
-      RenderBlock {SPAN} at (0,20) size 20x20
+      RenderBlock {SPAN} at (0,0) size 15x15
+      RenderBR {BR} at (15,15) size 0x0
+      RenderBlock {SPAN} at (0,15) size 15x15
       RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.png b/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.png
index 07d86cd..13d8b72 100644
--- a/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.png
+++ b/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.txt b/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.txt
index 9853bd0..1587ce0 100644
--- a/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.txt
+++ b/LayoutTests/platform/mac/fast/repaint/slider-thumb-drag-release-expected.txt
@@ -4,5 +4,9 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderSlider {INPUT} at (2,2) size 129x15 [bgcolor=#FFFFFF]
-        RenderBlock {DIV} at (114,0) size 15x15
+        RenderFlexibleBox {DIV} at (0,0) size 129x15
+          RenderBlock {DIV} at (0,0) size 114x15
+          RenderBlock {DIV} at (114,0) size 15x15
       RenderText {#text} at (0,0) size 0x0
+layer at (124,10) size 15x15
+  RenderBlock (relative positioned) {DIV} at (0,0) size 15x15
diff --git a/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png b/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png
index 585821d..c41a5e8 100644
--- a/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png
+++ b/LayoutTests/platform/mac/media/audio-controls-rendering-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt b/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt
index 6ddb911..9d352bd 100644
--- a/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt
+++ b/LayoutTests/platform/mac/media/audio-controls-rendering-expected.txt
@@ -22,8 +22,12 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 126x15
       RenderSlider {INPUT} at (0,2) size 126x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (177,6) size 14x12
+layer at (57,51) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
 layer at (8,85) size 320x25
   RenderBlock (relative positioned) {DIV} at (0,0) size 320x25
 layer at (8,85) size 320x25
@@ -32,7 +36,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 246x15
       RenderSlider {INPUT} at (45,2) size 156x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 156x13
+          RenderBlock {DIV} at (0,2) size 146x8
+          RenderBlock {DIV} at (146,2) size 10x8
     RenderButton {INPUT} at (297,6) size 14x12
 layer at (57,92) size 45x11
   RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
@@ -44,6 +50,8 @@
     RenderBlock (anonymous) at (7,0) size 31x11
       RenderText {#text} at (0,0) size 31x11
         text run at (0,0) width 31: "-00:07"
+layer at (102,94) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
 layer at (8,128) size 320x100
   RenderMedia {AUDIO} at (8,128) size 320x100 [bgcolor=#0000FF]
 layer at (8,128) size 320x100
@@ -54,7 +62,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 246x15
       RenderSlider {INPUT} at (45,2) size 156x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 156x13
+          RenderBlock {DIV} at (0,2) size 146x8
+          RenderBlock {DIV} at (146,2) size 10x8
     RenderButton {INPUT} at (297,6) size 14x12
 layer at (57,210) size 45x11
   RenderFlexibleBox {DIV} at (0,2) size 45x11 [color=#FFFFFF]
@@ -66,3 +76,5 @@
     RenderBlock (anonymous) at (7,0) size 31x11
       RenderText {#text} at (0,0) size 31x11
         text run at (0,0) width 31: "-00:07"
+layer at (102,212) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
diff --git a/LayoutTests/platform/mac/media/controls-after-reload-expected.png b/LayoutTests/platform/mac/media/controls-after-reload-expected.png
index c95ac8c..a74876f 100644
--- a/LayoutTests/platform/mac/media/controls-after-reload-expected.png
+++ b/LayoutTests/platform/mac/media/controls-after-reload-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/media/controls-after-reload-expected.txt b/LayoutTests/platform/mac/media/controls-after-reload-expected.txt
index 7fe399c..78097b6 100644
--- a/LayoutTests/platform/mac/media/controls-after-reload-expected.txt
+++ b/LayoutTests/platform/mac/media/controls-after-reload-expected.txt
@@ -18,7 +18,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 216x15
       RenderSlider {INPUT} at (45,2) size 126x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (297,4) size 16x16
     RenderButton {INPUT} at (267,6) size 14x12
 layer at (57,264) size 45x11
@@ -31,3 +33,5 @@
     RenderBlock (anonymous) at (7,0) size 31x11
       RenderText {#text} at (0,0) size 31x11
         text run at (0,0) width 31: "-00:06"
+layer at (102,266) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
diff --git a/LayoutTests/platform/mac/media/controls-styling-expected.png b/LayoutTests/platform/mac/media/controls-styling-expected.png
index 030bd55..afcfd72 100644
--- a/LayoutTests/platform/mac/media/controls-styling-expected.png
+++ b/LayoutTests/platform/mac/media/controls-styling-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/media/controls-styling-expected.txt b/LayoutTests/platform/mac/media/controls-styling-expected.txt
index bed87d4..1ec62e5 100644
--- a/LayoutTests/platform/mac/media/controls-styling-expected.txt
+++ b/LayoutTests/platform/mac/media/controls-styling-expected.txt
@@ -22,7 +22,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 216x15
       RenderSlider {INPUT} at (45,2) size 126x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (297,4) size 16x16
     RenderButton {INPUT} at (267,6) size 14x12
 layer at (67,264) size 45x11
@@ -35,6 +37,8 @@
     RenderBlock (anonymous) at (7,0) size 31x11
       RenderText {#text} at (0,0) size 31x11
         text run at (0,0) width 31: "-00:06"
+layer at (112,266) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
 layer at (8,282) size 320x240
   RenderBlock (relative positioned) {DIV} at (0,0) size 320x240
 layer at (8,497) size 320x25
@@ -43,7 +47,9 @@
     RenderButton {INPUT} at (32,4) size 16x16
     RenderFlexibleBox {DIV} at (49,5) size 216x15
       RenderSlider {INPUT} at (45,2) size 126x13
-        RenderBlock {DIV} at (0,2) size 10x8
+        RenderFlexibleBox {DIV} at (0,0) size 126x13
+          RenderBlock {DIV} at (0,2) size 116x8
+          RenderBlock {DIV} at (116,2) size 10x8
     RenderButton {INPUT} at (297,4) size 16x16
     RenderButton {INPUT} at (267,6) size 14x12
 layer at (57,504) size 45x11
@@ -56,3 +62,5 @@
     RenderBlock (anonymous) at (7,0) size 31x11
       RenderText {#text} at (0,0) size 31x11
         text run at (0,0) width 31: "-00:06"
+layer at (102,506) size 10x8
+  RenderBlock (relative positioned) {DIV} at (0,0) size 10x8
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index bab5c1c..532417c 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -2010,6 +2010,7 @@
 fast/forms/validation-message-on-listbox.html
 fast/forms/validation-message-on-menulist.html
 fast/forms/validation-message-on-radio.html
+fast/forms/validation-message-on-range.html
 fast/forms/validation-message-on-textarea.html
 
 # [Qt] REGRESSION(63862): animations/play-state.html fails intermittently
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 8b7a5c5..25f9757 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -1108,6 +1108,7 @@
 fast/forms/validation-message-on-listbox.html
 fast/forms/validation-message-on-menulist.html
 fast/forms/validation-message-on-radio.html
+fast/forms/validation-message-on-range.html
 fast/forms/validation-message-on-textarea.html
 
 # Web Timing is not enabled.
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index f9d7d0c..a2aa532 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,75 @@
+2011-06-10  Kent Tamura  <tkent@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Use CSS machinery to position slider thumb.
+        https://bugs.webkit.org/show_bug.cgi?id=52920
+
+        Remove RenderSlider::layout().
+        In order to remove it, we introduce new three shadow nodes:
+         - A flex box container occupying the whole box
+         - A flex box item representing a movable area of the thumb
+         - A flex box item limiting the movable area of the thumb
+        The thumb position is specified by percentage position in the second element.
+
+        This change also fixes Bug 60353.
+
+        Tests: fast/forms/input-appearance-range.html
+               fast/forms/validation-message-on-range.html
+
+        * accessibility/AccessibilitySlider.cpp:
+        (WebCore::AccessibilitySliderThumb::elementRect):
+          Use Node::getRect() for the thumb element.
+        * css/html.css: Add new style definitions for the new node layout.
+        (input[type="range"]::-webkit-slider-container):
+        (input[type="range"]::-webkit-slider-runnable-track):
+        (input[type="range"]::-webkit-slider-thumb):
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::handleMouseDownEvent):
+          Accepts events on shadow nodes, use sliderThumbElementOf().
+        (WebCore::RangeInputType::createShadowSubtree):
+          Creates new nodes layout.
+        (WebCore::RangeInputType::valueChanged): Use sliderThumbElementOf().
+        * html/RangeInputType.h: Remove shadowSliderThumb().
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::sliderPosition): Moved from RenderSlider.cpp.
+        (WebCore::hasVerticalAppearance): New utility function.
+        (WebCore::sliderThumbElementOf): New utility function.
+        (WebCore::RenderSliderThumb::layout):
+          Sets CSS top/left values.
+        (WebCore::RenderSliderContainer::RenderSliderContainer):
+        (WebCore::RenderSliderContainer::layout):
+          Add some adjustment code.
+          - Setting box-orient
+          - Adjust heights of some nodes. It is required to pass existing tests.
+        (WebCore::SliderThumbElement::setPositionFromValue):
+          Update comments.
+        (WebCore::SliderThumbElement::setPositionFromPoint):
+          Calculate the current position from absolute positions.
+        (WebCore::SliderThumbElement::hostInput):
+          Removed unnecessary variable.
+        (WebCore::TrackLimiterElement::TrackLimiterElement):
+        (WebCore::TrackLimiterElement::create): Adjust style.
+        (WebCore::TrackLimiterElement::createRenderer):
+          This node uses RenderSliderThumb.
+        (WebCore::TrackLimiterElement::shadowPseudoId):
+          This node also uses -webkit-slider-thumb.
+        (WebCore::SliderContainerElement::SliderContainerElement):
+        (WebCore::SliderContainerElement::create):
+        (WebCore::SliderContainerElement::createRenderer):
+          Uses RenderSliderContainer.
+        (WebCore::SliderContainerElement::shadowPseudoId):
+        * html/shadow/SliderThumbElement.h:
+          Make hostInput() public, add declarations of TrackLimiterElement
+          and SliderContainerElement.
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::RenderSlider): Added an assertion.
+        (WebCore::RenderSlider::inDragMode): Uses sliderThumbElementOf().
+        * rendering/RenderSlider.h: Remove declarations of removed functions.
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::adjustSliderThumbStyle):
+          Calls adjustSliderThumbSize().
+
 2011-06-13  Joone Hur  <joone.hur@collabora.co.uk>
 
         Reviewed by Martin Robinson.
diff --git a/Source/WebCore/accessibility/AccessibilitySlider.cpp b/Source/WebCore/accessibility/AccessibilitySlider.cpp
index 01d185d..fa0c27f 100644
--- a/Source/WebCore/accessibility/AccessibilitySlider.cpp
+++ b/Source/WebCore/accessibility/AccessibilitySlider.cpp
@@ -34,6 +34,7 @@
 #include "HTMLNames.h"
 #include "RenderObject.h"
 #include "RenderSlider.h"
+#include "SliderThumbElement.h"
 
 namespace WebCore {
     
@@ -175,13 +176,10 @@
     
 IntRect AccessibilitySliderThumb::elementRect() const
 {
-    if (!m_parentSlider->renderer())
+    RenderObject* sliderRenderer = m_parentSlider->renderer();
+    if (!sliderRenderer || !sliderRenderer->isSlider())
         return IntRect();
-
-    IntRect intRect = toRenderSlider(m_parentSlider->renderer())->thumbRect();
-    FloatQuad floatQuad = m_parentSlider->renderer()->localToAbsoluteQuad(FloatRect(intRect));
-
-    return floatQuad.enclosingBoundingBox();
+    return sliderThumbElementOf(sliderRenderer->node())->getRect();
 }
 
 IntSize AccessibilitySliderThumb::size() const
diff --git a/Source/WebCore/css/html.css b/Source/WebCore/css/html.css
index f9aafea..d687065 100644
--- a/Source/WebCore/css/html.css
+++ b/Source/WebCore/css/html.css
@@ -546,9 +546,26 @@
     margin: 2px;
 }
 
+input[type="range"]::-webkit-slider-container {
+    -webkit-box-align: center;
+    -webkit-box-orient: horizontal; /* This property is updated by C++ code. */
+    -webkit-box-sizing: border-box;
+    display: -webkit-box;
+    height: 100%;
+    width: 100%;
+}
+
+input[type="range"]::-webkit-slider-runnable-track {
+    -webkit-box-flex: 1;
+    -webkit-box-sizing: border-box;
+    display: block;
+}
+
 input[type="range"]::-webkit-slider-thumb {
     -webkit-appearance: sliderthumb-horizontal;
+    -webkit-box-sizing: border-box;
     display: block;
+    position: relative;
 }
 
 input[type="button"]:disabled, input[type="submit"]:disabled, input[type="reset"]:disabled,
diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp
index 31b0a86..2a2eb09 100644
--- a/Source/WebCore/html/RangeInputType.cpp
+++ b/Source/WebCore/html/RangeInputType.cpp
@@ -32,6 +32,7 @@
 #include "config.h"
 #include "RangeInputType.h"
 
+#include "ElementWithPseudoId.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
@@ -151,11 +152,12 @@
 
 void RangeInputType::handleMouseDownEvent(MouseEvent* event)
 {
-    if (event->button() != LeftButton || event->target() != element())
+    Node* targetNode = event->target()->toNode();
+    if (event->button() != LeftButton || !targetNode || (targetNode != element() && !targetNode->isDescendantOf(element()->shadowRoot())))
         return;
 
-    if (SliderThumbElement* thumb = shadowSliderThumb())
-        thumb->dragFrom(event->absoluteLocation());
+    SliderThumbElement* thumb = sliderThumbElementOf(element());
+    thumb->dragFrom(event->absoluteLocation());
 }
 
 void RangeInputType::handleKeydownEvent(KeyboardEvent* event)
@@ -203,7 +205,13 @@
 void RangeInputType::createShadowSubtree()
 {
     ExceptionCode ec = 0;
-    element()->ensureShadowRoot()->appendChild(SliderThumbElement::create(element()->document()), ec);
+    Document* document = element()->document();
+    RefPtr<HTMLElement> track = ElementWithPseudoId::create(document, "-webkit-slider-runnable-track");
+    track->appendChild(SliderThumbElement::create(document), ec);
+    RefPtr<HTMLElement> container = SliderContainerElement::create(document);
+    container->appendChild(track.release(), ec);
+    container->appendChild(TrackLimiterElement::create(document), ec);
+    element()->ensureShadowRoot()->appendChild(container.release(), ec);
 }
 
 RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) const
@@ -248,7 +256,7 @@
 
 void RangeInputType::valueChanged()
 {
-    shadowSliderThumb()->setPositionFromValue();
+    sliderThumbElementOf(element())->setPositionFromValue();
 }
 
 String RangeInputType::fallbackValue()
@@ -272,10 +280,4 @@
     return true;
 }
 
-SliderThumbElement* RangeInputType::shadowSliderThumb() const
-{
-    Node* shadow = element()->shadowRoot();
-    return shadow ? toSliderThumbElement(shadow->firstChild()) : 0;
-}
-
 } // namespace WebCore
diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h
index 4708383..702776a 100644
--- a/Source/WebCore/html/RangeInputType.h
+++ b/Source/WebCore/html/RangeInputType.h
@@ -70,8 +70,6 @@
     virtual String fallbackValue();
     virtual String sanitizeValue(const String& proposedValue);
     virtual bool shouldRespectListAttribute();
-
-    SliderThumbElement* shadowSliderThumb() const;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp
index 591f738..c67d10c 100644
--- a/Source/WebCore/html/shadow/SliderThumbElement.cpp
+++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp
@@ -33,13 +33,16 @@
 #include "config.h"
 #include "SliderThumbElement.h"
 
+#include "CSSValueKeywords.h"
 #include "Event.h"
 #include "Frame.h"
 #include "HTMLInputElement.h"
 #include "HTMLParserIdioms.h"
 #include "MouseEvent.h"
+#include "RenderFlexibleBox.h"
 #include "RenderSlider.h"
 #include "RenderTheme.h"
+#include "ShadowRoot.h"
 #include "StepRange.h"
 #include <wtf/MathExtras.h>
 
@@ -47,7 +50,33 @@
 
 namespace WebCore {
 
+inline static double sliderPosition(HTMLInputElement* element)
+{
+    StepRange range(element);
+    return range.proportionFromValue(range.valueFromElement(element));
+}
+
+inline static bool hasVerticalAppearance(HTMLInputElement* input)
+{
+    ASSERT(input->renderer());
+    RenderStyle* sliderStyle = input->renderer()->style();
+    return sliderStyle->appearance() == SliderVerticalPart || sliderStyle->appearance() == MediaVolumeSliderPart;
+}
+
+SliderThumbElement* sliderThumbElementOf(Node* node)
+{
+    ASSERT(node);
+    Node* shadow = node->toInputElement()->shadowRoot();
+    ASSERT(shadow);
+    Node* thumb = shadow->firstChild()->firstChild()->firstChild();
+    ASSERT(thumb);
+    return toSliderThumbElement(thumb);
+}
+
+// --------------------------------
+
 // 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*);
@@ -63,29 +92,90 @@
 
 void RenderSliderThumb::layout()
 {
+    // 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 = parent()->style();
-    if (parentStyle->appearance() == SliderVerticalPart)
+    RenderStyle* parentStyle = input->renderer()->style();
+    bool isVertical = false;
+    if (parentStyle->appearance() == SliderVerticalPart) {
         style()->setAppearance(SliderThumbVerticalPart);
-    else if (parentStyle->appearance() == SliderHorizontalPart)
+        isVertical = true;
+    } 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());
+
+    double fraction = sliderPosition(input) * 100;
+    if (isVertical)
+        style()->setTop(Length(100 - fraction, Percent));
+    else
+        style()->setLeft(Length(fraction, Percent));
+
     RenderBlock::layout();
 }
 
+// --------------------------------
+
+// FIXME: Find a way to cascade appearance and adjust heights, and get rid of this class.
+// http://webkit.org/b/62535
+class RenderSliderContainer : public RenderFlexibleBox {
+public:
+    RenderSliderContainer(Node* node)
+        : RenderFlexibleBox(node) { }
+
+private:
+    virtual void layout();
+};
+
+void RenderSliderContainer::layout()
+{
+    HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement();
+    bool isVertical = hasVerticalAppearance(input);
+    style()->setBoxOrient(isVertical ? VERTICAL : HORIZONTAL);
+    // Sets the concrete height if the height of the <input> is not fixed or a
+    // percentage value because a percentage height value of this box won't be
+    // based on the <input> height in such case.
+    Length inputHeight = input->renderer()->style()->height();
+    RenderObject* trackRenderer = node()->firstChild()->renderer();
+    if (!isVertical && input->renderer()->isSlider() && !inputHeight.isFixed() && !inputHeight.isPercent()) {
+        RenderObject* thumbRenderer = input->shadowRoot()->firstChild()->firstChild()->firstChild()->renderer();
+        if (thumbRenderer) {
+            style()->setHeight(thumbRenderer->style()->height());
+            if (trackRenderer)
+                trackRenderer->style()->setHeight(thumbRenderer->style()->height());
+        }
+    } else {
+        style()->setHeight(Length(100, Percent));
+        if (trackRenderer)
+            trackRenderer->style()->setHeight(Length());
+    }
+
+    RenderFlexibleBox::layout();
+
+    // Percentage 'top' for the thumb doesn't work if the parent style has no
+    // concrete height.
+    Node* track = node()->firstChild();
+    if (track && track->renderer()->isBox()) {
+        RenderBox* trackBox = track->renderBox();
+        trackBox->style()->setHeight(Length(trackBox->height() - trackBox->borderAndPaddingHeight(), Fixed));
+    }
+}
+
+// --------------------------------
+
 void SliderThumbElement::setPositionFromValue()
 {
-    // Since today the code to calculate position is in the RenderSlider layout
+    // Since the code to calculate position is in the RenderSliderThumb layout
     // path, we don't actually update the value here. Instead, we poke at the
     // renderer directly to trigger layout.
-    // FIXME: Move the logic of positioning the thumb here.
     if (renderer())
         renderer()->setNeedsLayout(true);
 }
@@ -119,26 +209,36 @@
 void SliderThumbElement::setPositionFromPoint(const IntPoint& point)
 {
     HTMLInputElement* input = hostInput();
-    ASSERT(input);
 
     if (!input->renderer() || !renderer())
         return;
 
     IntPoint offset = roundedIntPoint(input->renderer()->absoluteToLocal(point, false, true));
-    RenderStyle* sliderStyle = input->renderer()->style();
-    bool isVertical = sliderStyle->appearance() == SliderVerticalPart || sliderStyle->appearance() == MediaVolumeSliderPart;
-
+    bool isVertical = hasVerticalAppearance(input);
     int trackSize;
     int position;
     int currentPosition;
+    // We need to calculate currentPosition from absolute points becaue the
+    // renderer for this node is usually on a layer and renderBox()->x() and
+    // y() are unusable.
+    IntPoint absoluteThumbOrigin = renderBox()->absoluteBoundingBoxRect().location();
+    IntPoint absoluteSliderContentOrigin = roundedIntPoint(input->renderer()->localToAbsolute());
     if (isVertical) {
         trackSize = input->renderBox()->contentHeight() - renderBox()->height();
+        // FIXME: The following expression assumes the pointer position is
+        // always the center of the thumb. If a user presses the mouse button at
+        // non-center of the thumb and start moving the pointer, the thumb is
+        // forcely adjusted so that the pointer is at the center of the thumb.
         position = offset.y() - renderBox()->height() / 2;
-        currentPosition = renderBox()->y() - input->renderBox()->contentBoxRect().y();
+        currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.y();
     } else {
         trackSize = input->renderBox()->contentWidth() - renderBox()->width();
+        // FIXME: The following expression assumes the pointer position is
+        // always the center of the thumb. If a user presses the mouse button at
+        // non-center of the thumb and start moving the pointer, the thumb is
+        // forcely adjusted so that the pointer is at the center of the thumb.
         position = offset.x() - renderBox()->width() / 2;
-        currentPosition = renderBox()->x() - input->renderBox()->contentBoxRect().x();
+        currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x();
     }
     position = max(0, min(position, trackSize));
     if (position == currentPosition)
@@ -215,8 +315,7 @@
 {
     // Only HTMLInputElement creates SliderThumbElement instances as its shadow nodes.
     // So, shadowAncestorNode() must be an HTMLInputElement.
-    HTMLInputElement* input = shadowAncestorNode()->toInputElement();
-    return input;
+    return shadowAncestorNode()->toInputElement();
 }
 
 const AtomicString& SliderThumbElement::shadowPseudoId() const
@@ -225,5 +324,54 @@
     return sliderThumb;
 }
 
+// --------------------------------
+
+inline TrackLimiterElement::TrackLimiterElement(Document* document)
+    : HTMLDivElement(HTMLNames::divTag, document)
+{
+}
+
+PassRefPtr<TrackLimiterElement> TrackLimiterElement::create(Document* document)
+{
+    RefPtr<TrackLimiterElement> element = adoptRef(new TrackLimiterElement(document));
+    element->getInlineStyleDecl()->setProperty(CSSPropertyVisibility, CSSValueHidden);
+    element->getInlineStyleDecl()->setProperty(CSSPropertyPosition, CSSValueStatic);
+    return element.release();
+}
+
+RenderObject* TrackLimiterElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderSliderThumb(this);
+}
+
+const AtomicString& TrackLimiterElement::shadowPseudoId() const
+{
+    DEFINE_STATIC_LOCAL(AtomicString, sliderThumb, ("-webkit-slider-thumb"));
+    return sliderThumb;
+}
+
+// --------------------------------
+
+inline SliderContainerElement::SliderContainerElement(Document* document)
+    : HTMLDivElement(HTMLNames::divTag, document)
+{
+}
+
+PassRefPtr<SliderContainerElement> SliderContainerElement::create(Document* document)
+{
+    return adoptRef(new SliderContainerElement(document));
+}
+
+RenderObject* SliderContainerElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderSliderContainer(this);
+}
+
+const AtomicString& SliderContainerElement::shadowPseudoId() const
+{
+    DEFINE_STATIC_LOCAL(AtomicString, sliderThumb, ("-webkit-slider-container"));
+    return sliderThumb;
+}
+
 }
 
diff --git a/Source/WebCore/html/shadow/SliderThumbElement.h b/Source/WebCore/html/shadow/SliderThumbElement.h
index 52cae8c..ad03547 100644
--- a/Source/WebCore/html/shadow/SliderThumbElement.h
+++ b/Source/WebCore/html/shadow/SliderThumbElement.h
@@ -55,6 +55,7 @@
     virtual void defaultEventHandler(Event*);
     virtual void detach();
     virtual const AtomicString& shadowPseudoId() const;
+    HTMLInputElement* hostInput() const;
 
 private:
     SliderThumbElement(Document*);
@@ -66,7 +67,6 @@
     void startDragging();
     void stopDragging();
     void setPositionFromPoint(const IntPoint&);
-    HTMLInputElement* hostInput() const;
 
     bool m_inDragMode;
 };
@@ -93,6 +93,34 @@
     return static_cast<SliderThumbElement*>(node);
 }
 
+// This always return a valid pointer.
+// An assertion fails if the specified node is not a range input.
+SliderThumbElement* sliderThumbElementOf(Node*);
+
+// --------------------------------
+
+class TrackLimiterElement : public HTMLDivElement {
+public:
+    static PassRefPtr<TrackLimiterElement> create(Document*);
+
+private:
+    TrackLimiterElement(Document*);
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+    virtual const AtomicString& shadowPseudoId() const;
+};
+
+// --------------------------------
+
+class SliderContainerElement : public HTMLDivElement {
+public:
+    static PassRefPtr<SliderContainerElement> create(Document*);
+
+private:
+    SliderContainerElement(Document*);
+    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+    virtual const AtomicString& shadowPseudoId() const;
+};
+
 }
 
 #endif
diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp
index a4e4a3b..b355abc 100644
--- a/Source/WebCore/rendering/RenderSlider.cpp
+++ b/Source/WebCore/rendering/RenderSlider.cpp
@@ -48,16 +48,11 @@
 
 static const int defaultTrackLength = 129;
 
-// Returns a value between 0 and 1.
-static double sliderPosition(HTMLInputElement* element)
-{
-    StepRange range(element);
-    return range.proportionFromValue(range.valueFromElement(element));
-}
-
 RenderSlider::RenderSlider(HTMLInputElement* element)
     : RenderBlock(element)
 {
+    // We assume RenderSlider works only with <input type=range>.
+    ASSERT(element->isRangeControl());
 }
 
 RenderSlider::~RenderSlider()
@@ -100,93 +95,9 @@
     setPreferredLogicalWidthsDirty(false); 
 }
 
-IntRect RenderSlider::thumbRect()
-{
-    SliderThumbElement* thumbElement = shadowSliderThumb();
-    if (!thumbElement)
-        return IntRect();
-
-    IntRect thumbRect;
-    RenderBox* thumb = toRenderBox(thumbElement->renderer());
-
-    thumbRect.setWidth(thumb->style()->width().calcMinValue(contentWidth()));
-    thumbRect.setHeight(thumb->style()->height().calcMinValue(contentHeight()));
-
-    double fraction = sliderPosition(static_cast<HTMLInputElement*>(node()));
-    IntRect contentRect = contentBoxRect();
-    if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) {
-        thumbRect.setX(contentRect.x() + (contentRect.width() - thumbRect.width()) / 2);
-        thumbRect.setY(contentRect.y() + static_cast<int>(nextafter((contentRect.height() - thumbRect.height()) + 1, 0) * (1 - fraction)));
-    } else {
-        thumbRect.setX(contentRect.x() + static_cast<int>(nextafter((contentRect.width() - thumbRect.width()) + 1, 0) * fraction));
-        thumbRect.setY(contentRect.y() + (contentRect.height() - thumbRect.height()) / 2);
-    }
-
-    return thumbRect;
-}
-
-void RenderSlider::layout()
-{
-    ASSERT(needsLayout());
-
-    SliderThumbElement* thumbElement = shadowSliderThumb();
-    RenderBox* thumb = thumbElement ? toRenderBox(thumbElement->renderer()) : 0;
-
-    IntSize baseSize(borderAndPaddingWidth(), borderAndPaddingHeight());
-
-    if (thumb) {
-        // Allow the theme to set the size of the thumb.
-        if (thumb->style()->hasAppearance())
-            theme()->adjustSliderThumbSize(thumb->style());
-
-        baseSize.expand(thumb->style()->width().calcMinValue(0), thumb->style()->height().calcMinValue(0));
-    }
-
-    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
-
-    IntSize oldSize = size();
-
-    setSize(baseSize);
-    computeLogicalWidth();
-    computeLogicalHeight();
-    updateLayerTransform();
-
-    m_overflow.clear();
-
-    if (thumb) {
-        if (oldSize != size())
-            thumb->setChildNeedsLayout(true, false);
-
-        LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), style()->isFlippedBlocksWritingMode());
-
-        IntRect oldThumbRect = thumb->frameRect();
-
-        thumb->layoutIfNeeded();
-
-        IntRect rect = thumbRect();
-        thumb->setFrameRect(rect);
-        if (thumb->checkForRepaintDuringLayout())
-            thumb->repaintDuringLayoutIfMoved(oldThumbRect);
-
-        statePusher.pop();
-        addOverflowFromChild(thumb);
-    }
-
-    repainter.repaintAfterLayout();    
-
-    setNeedsLayout(false);
-}
-
-SliderThumbElement* RenderSlider::shadowSliderThumb() const
-{
-    Node* shadow = static_cast<Element*>(node())->shadowRoot();
-    return shadow ? toSliderThumbElement(shadow->firstChild()) : 0;
-}
-
 bool RenderSlider::inDragMode() const
 {
-    SliderThumbElement* thumbElement = shadowSliderThumb();
-    return thumbElement && thumbElement->active();
+    return sliderThumbElementOf(node())->active();
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/rendering/RenderSlider.h b/Source/WebCore/rendering/RenderSlider.h
index 4e17f30..8b7d552 100644
--- a/Source/WebCore/rendering/RenderSlider.h
+++ b/Source/WebCore/rendering/RenderSlider.h
@@ -35,7 +35,6 @@
         virtual ~RenderSlider();
 
         bool inDragMode() const;
-        IntRect thumbRect();
 
     private:
         virtual const char* renderName() const { return "RenderSlider"; }
@@ -43,12 +42,6 @@
 
         virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
         virtual void computePreferredLogicalWidths();
-        virtual void layout();
-
-        // FIXME: Eventually, the logic of manipulating slider thumb should move to
-        // SliderThumbElement and accessing shadowSliderThumb should not be necessary in this class.
-        SliderThumbElement* shadowSliderThumb() const;
-
         virtual bool requiresForcedStyleRecalcPropagation() const { return true; }
     };
 
diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp
index 1095382..559f80f 100644
--- a/Source/WebCore/rendering/RenderTheme.cpp
+++ b/Source/WebCore/rendering/RenderTheme.cpp
@@ -962,9 +962,9 @@
 {
 }
 
-void RenderTheme::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const
+void RenderTheme::adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
 {
-    // FIXME: Should call adjustSliderThumbSize().
+    adjustSliderThumbSize(style);
 }
 
 void RenderTheme::adjustSliderThumbSize(RenderStyle*) const