Title: [215566] trunk/Source/WebCore
Revision
215566
Author
[email protected]
Date
2017-04-20 11:23:29 -0700 (Thu, 20 Apr 2017)

Log Message

Make it possible to request the non-expanded scrollbar width from ScrollbarTheme
https://bugs.webkit.org/show_bug.cgi?id=171047

Reviewed by Sam Weinig.

No new tests, new behavior is not exposed in any way.

* platform/ScrollTypes.h:
* platform/ScrollbarTheme.h:
(WebCore::ScrollbarTheme::scrollbarThickness):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::scrollbarThickness):
* platform/gtk/ScrollbarThemeGtk.h:
* platform/ios/ScrollbarThemeIOS.h:
* platform/ios/ScrollbarThemeIOS.mm:
(WebCore::ScrollbarThemeIOS::scrollbarThickness):
* platform/mac/ScrollbarThemeMac.h:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::scrollbarThickness):
* platform/mock/ScrollbarThemeMock.cpp:
(WebCore::ScrollbarThemeMock::scrollbarThickness):
* platform/mock/ScrollbarThemeMock.h:
* platform/win/ScrollbarThemeWin.cpp:
(WebCore::ScrollbarThemeWin::scrollbarThickness):
* platform/win/ScrollbarThemeWin.h:
* rendering/RenderScrollbarTheme.h:
On Mac, when the scrollbar is hovered, it gets bigger.
Currently, scrollbarThickness always returns the big size.
It should be possible to request the smaller, "regular" scrollbar size as well.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215565 => 215566)


--- trunk/Source/WebCore/ChangeLog	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/ChangeLog	2017-04-20 18:23:29 UTC (rev 215566)
@@ -1,3 +1,35 @@
+2017-04-20  Tim Horton  <[email protected]>
+
+        Make it possible to request the non-expanded scrollbar width from ScrollbarTheme
+        https://bugs.webkit.org/show_bug.cgi?id=171047
+
+        Reviewed by Sam Weinig.
+
+        No new tests, new behavior is not exposed in any way.
+
+        * platform/ScrollTypes.h:
+        * platform/ScrollbarTheme.h:
+        (WebCore::ScrollbarTheme::scrollbarThickness):
+        * platform/gtk/ScrollbarThemeGtk.cpp:
+        (WebCore::ScrollbarThemeGtk::scrollbarThickness):
+        * platform/gtk/ScrollbarThemeGtk.h:
+        * platform/ios/ScrollbarThemeIOS.h:
+        * platform/ios/ScrollbarThemeIOS.mm:
+        (WebCore::ScrollbarThemeIOS::scrollbarThickness):
+        * platform/mac/ScrollbarThemeMac.h:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::ScrollbarThemeMac::scrollbarThickness):
+        * platform/mock/ScrollbarThemeMock.cpp:
+        (WebCore::ScrollbarThemeMock::scrollbarThickness):
+        * platform/mock/ScrollbarThemeMock.h:
+        * platform/win/ScrollbarThemeWin.cpp:
+        (WebCore::ScrollbarThemeWin::scrollbarThickness):
+        * platform/win/ScrollbarThemeWin.h:
+        * rendering/RenderScrollbarTheme.h:
+        On Mac, when the scrollbar is hovered, it gets bigger.
+        Currently, scrollbarThickness always returns the big size.
+        It should be possible to request the smaller, "regular" scrollbar size as well.
+
 2017-04-20  Jon Lee  <[email protected]>
 
         Update pip placard to "picture in picture"

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (215565 => 215566)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -124,6 +124,8 @@
 
 enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar };
 
+enum class ScrollbarExpansionState { Regular, Expanded };
+
 enum class ScrollEventAxis { Horizontal, Vertical };
 
 typedef unsigned ScrollbarControlState;

Modified: trunk/Source/WebCore/platform/ScrollbarTheme.h (215565 => 215566)


--- trunk/Source/WebCore/platform/ScrollbarTheme.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/ScrollbarTheme.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -51,7 +51,7 @@
     virtual bool paint(Scrollbar&, GraphicsContext&, const IntRect& /*damageRect*/) { return false; }
     virtual ScrollbarPart hitTest(Scrollbar&, const IntPoint&) { return NoPart; }
     
-    virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { return 0; }
+    virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) { return 0; }
 
     virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarButtonsSingle; }
 

Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (215565 => 215566)


--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp	2017-04-20 18:23:29 UTC (rev 215566)
@@ -844,7 +844,7 @@
 }
 
 #if GTK_CHECK_VERSION(3, 20, 0)
-int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize)
+int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState)
 {
     RenderThemeGadget::Info info = { RenderThemeGadget::Type::Scrollbar, "scrollbar", GTK_STATE_FLAG_PRELIGHT, { "vertical", "right", "hovering" } };
     if (m_usesOverlayScrollbars)
@@ -876,7 +876,7 @@
     return preferredSize.width();
 }
 #else
-int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize)
+int ScrollbarThemeGtk::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState)
 {
     int thumbFat, troughBorderWidth;
     gtk_style_context_get_style(createStyleContext().get(), "slider-width", &thumbFat, "trough-border", &troughBorderWidth, nullptr);

Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h (215565 => 215566)


--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -48,7 +48,7 @@
 
     bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
     ScrollbarButtonPressAction handleMousePressEvent(Scrollbar&, const PlatformMouseEvent&, ScrollbarPart) override;
-    int scrollbarThickness(ScrollbarControlSize) override;
+    int scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
     int minimumThumbLength(Scrollbar&) override;
 
     // TODO: These are the default GTK+ values. At some point we should pull these from the theme itself.

Modified: trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.h (215565 => 215566)


--- trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -37,7 +37,7 @@
 
     bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
 
-    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) override;
+    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
     
     bool supportsControlTints() const override { return true; }
 

Modified: trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.mm (215565 => 215566)


--- trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.mm	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/ios/ScrollbarThemeIOS.mm	2017-04-20 18:23:29 UTC (rev 215566)
@@ -61,7 +61,7 @@
 {
 }
 
-int ScrollbarThemeIOS::scrollbarThickness(ScrollbarControlSize)
+int ScrollbarThemeIOS::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState)
 {
     return 0;
 }

Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h (215565 => 215566)


--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -41,7 +41,7 @@
 
     bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
 
-    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) override;
+    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
     
     bool supportsControlTints() const override { return true; }
     bool usesOverlayScrollbars() const  override;

Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (215565 => 215566)


--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm	2017-04-20 18:23:29 UTC (rev 215566)
@@ -240,11 +240,11 @@
     usesOverlayScrollbarsChanged();
 }
 
-int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
+int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize, ScrollbarExpansionState expansionState)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     NSScrollerImp *scrollerImp = [NSScrollerImp scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(controlSize) horizontal:NO replacingScrollerImp:nil];
-    [scrollerImp setExpanded:YES];
+    [scrollerImp setExpanded:(expansionState == ScrollbarExpansionState::Expanded)];
     return [scrollerImp trackBoxWidth];
     END_BLOCK_OBJC_EXCEPTIONS;
 }

Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp (215565 => 215566)


--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp	2017-04-20 18:23:29 UTC (rev 215566)
@@ -39,7 +39,7 @@
     return scrollbar.frameRect();
 }
 
-int ScrollbarThemeMock::scrollbarThickness(ScrollbarControlSize controlSize)
+int ScrollbarThemeMock::scrollbarThickness(ScrollbarControlSize controlSize, ScrollbarExpansionState)
 {
     return cScrollbarThickness[controlSize];
 }

Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h (215565 => 215566)


--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -33,7 +33,7 @@
 // Scrollbar theme used in image snapshots, to eliminate appearance differences between platforms.
 class ScrollbarThemeMock : public ScrollbarThemeComposite {
 public:
-    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) override;
+    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
 
 protected:
     bool hasButtons(Scrollbar&) override { return false; }

Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp (215565 => 215566)


--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.cpp	2017-04-20 18:23:29 UTC (rev 215566)
@@ -115,7 +115,7 @@
     return thickness;
 }
 
-int ScrollbarThemeWin::scrollbarThickness(ScrollbarControlSize)
+int ScrollbarThemeWin::scrollbarThickness(ScrollbarControlSize, ScrollbarExpansionState)
 {
     float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(0);
     return clampTo<int>(inverseScaleFactor * scrollbarThicknessInPixels());

Modified: trunk/Source/WebCore/platform/win/ScrollbarThemeWin.h (215565 => 215566)


--- trunk/Source/WebCore/platform/win/ScrollbarThemeWin.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/platform/win/ScrollbarThemeWin.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -35,7 +35,7 @@
     ScrollbarThemeWin();
     virtual ~ScrollbarThemeWin();
 
-    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) override;
+    int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
 
     void themeChanged() override;
     

Modified: trunk/Source/WebCore/rendering/RenderScrollbarTheme.h (215565 => 215566)


--- trunk/Source/WebCore/rendering/RenderScrollbarTheme.h	2017-04-20 17:55:44 UTC (rev 215565)
+++ trunk/Source/WebCore/rendering/RenderScrollbarTheme.h	2017-04-20 18:23:29 UTC (rev 215566)
@@ -37,7 +37,7 @@
 public:
     virtual ~RenderScrollbarTheme() { }
     
-    int scrollbarThickness(ScrollbarControlSize controlSize) override { return ScrollbarTheme::theme().scrollbarThickness(controlSize); }
+    int scrollbarThickness(ScrollbarControlSize controlSize, ScrollbarExpansionState expansionState = ScrollbarExpansionState::Expanded) override { return ScrollbarTheme::theme().scrollbarThickness(controlSize, expansionState); }
 
     ScrollbarButtonsPlacement buttonsPlacement() const override { return ScrollbarTheme::theme().buttonsPlacement(); }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to