[GTK] Add support for rendering slider ticks
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Feb 2020 10:03:02 +0000 (10:03 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Feb 2020 10:03:02 +0000 (10:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=208132

Reviewed by Adrian Perez de Castro.

.:

Add a test case for sliders with ticks.

* ManualTests/gtk/theme.html:

Source/WebCore:

* rendering/RenderThemeAdwaita.cpp:
(WebCore::RenderThemeAdwaita::paintSliderTrack):
(WebCore::RenderThemeAdwaita::sliderTickSize const):
(WebCore::RenderThemeAdwaita::sliderTickOffsetFromTrackCenter const):

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

ChangeLog
ManualTests/gtk/theme.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderThemeAdwaita.cpp

index b26565c..8ca7aad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2020-02-25  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        [GTK] Add support for rendering slider ticks
+        https://bugs.webkit.org/show_bug.cgi?id=208132
+
+        Reviewed by Adrian Perez de Castro.
+
+        Add a test case for sliders with ticks.
+
+        * ManualTests/gtk/theme.html:
+
+2020-02-25  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         [GTK] Stop using gtk foreign drawing API to style form controls
         https://bugs.webkit.org/show_bug.cgi?id=208129
 
index c141239..6fd214a 100644 (file)
       <td><input type="range" value="50" max="100" disabled></input></td>
       <td><input type="range" value="50" max="100" style="-webkit-appearance: slider-vertical" disabled></input></td>
     </tr>
+    <tr>
+      <td><input type="range" min="0" max="100" step="25" list="steplist"></input></td>
+      <td><input type="range" min="0" max="100" step="25" list="steplist" style="-webkit-appearance: slider-vertical"></input></td>
+    </tr>
   </table>
+  <datalist id="steplist">
+    <option>0</option>
+    <option>25</option>
+    <option>50</option>
+    <option>75</option>
+    <option>100</option>
+  </datalist>
 
   <h1>Iframe scrollbars</h1>
   <iframe width="200" height="100" scrolling="yes" src="data:text/html,
index d9da8af..3e493bc 100644 (file)
@@ -1,5 +1,17 @@
 2020-02-25  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        [GTK] Add support for rendering slider ticks
+        https://bugs.webkit.org/show_bug.cgi?id=208132
+
+        Reviewed by Adrian Perez de Castro.
+
+        * rendering/RenderThemeAdwaita.cpp:
+        (WebCore::RenderThemeAdwaita::paintSliderTrack):
+        (WebCore::RenderThemeAdwaita::sliderTickSize const):
+        (WebCore::RenderThemeAdwaita::sliderTickOffsetFromTrackCenter const):
+
+2020-02-25  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         [GTK] Stop using gtk foreign drawing API to style form controls
         https://bugs.webkit.org/show_bug.cgi?id=208129
 
index c08a437..7282efe 100644 (file)
@@ -433,6 +433,10 @@ bool RenderThemeAdwaita::paintSliderTrack(const RenderObject& renderObject, cons
     graphicsContext.setFillColor(activeSelectionBackgroundColor({ }));
     graphicsContext.fillPath(path);
 
+#if ENABLE(DATALIST_ELEMENT)
+    paintSliderTicks(renderObject, paintInfo, rect);
+#endif
+
     if (isFocused(renderObject))
         ThemeAdwaita::paintFocus(graphicsContext, fieldRect, sliderTrackFocusOffset);
 
@@ -565,14 +569,12 @@ bool RenderThemeAdwaita::paintMediaVolumeSliderTrack(const RenderObject& renderO
 #if ENABLE(DATALIST_ELEMENT)
 IntSize RenderThemeAdwaita::sliderTickSize() const
 {
-    // FIXME: We need to set this to the size of one tick mark.
-    return IntSize(0, 0);
+    return { 1, 7 };
 }
 
 int RenderThemeAdwaita::sliderTickOffsetFromTrackCenter() const
 {
-    // FIXME: We need to set this to the position of the tick marks.
-    return 0;
+    return -16;
 }
 
 void RenderThemeAdwaita::adjustListButtonStyle(RenderStyle& style, const Element*) const