[Chromium][Mac] Move Mac-specific theme functions out of PlatformSupport
authorpilgrim@chromium.org <pilgrim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 21:25:48 +0000 (21:25 +0000)
committerpilgrim@chromium.org <pilgrim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Sep 2012 21:25:48 +0000 (21:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97817

Reviewed by Adam Barth.

Part of a refactoring series. See tracking bug 82948. We're calling WebThemeEngine directly now instead of proxying through PlatformSupport.

Source/WebCore:

* platform/chromium/PlatformSupport.h:
(PlatformSupport):
* platform/chromium/ScrollbarThemeChromiumMac.mm:
(WebCore::scrollbarStateToThemeState):
(WebCore):
(WebCore::ScrollbarThemeChromiumMac::paint):

Source/WebKit/chromium:

* src/AssertMatchingEnums.cpp:
* src/PlatformSupport.cpp:
(WebCore):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/chromium/PlatformSupport.h
Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/AssertMatchingEnums.cpp
Source/WebKit/chromium/src/PlatformSupport.cpp

index 3cb7f97..b355fbe 100644 (file)
@@ -1,3 +1,19 @@
+2012-09-27  Mark Pilgrim  <pilgrim@chromium.org>
+
+        [Chromium][Mac] Move Mac-specific theme functions out of PlatformSupport
+        https://bugs.webkit.org/show_bug.cgi?id=97817
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948. We're calling WebThemeEngine directly now instead of proxying through PlatformSupport.
+
+        * platform/chromium/PlatformSupport.h:
+        (PlatformSupport):
+        * platform/chromium/ScrollbarThemeChromiumMac.mm:
+        (WebCore::scrollbarStateToThemeState):
+        (WebCore):
+        (WebCore::ScrollbarThemeChromiumMac::paint):
+
 2012-09-27  Erik Arvidsson  <arv@chromium.org>
 
         Fix issue with ClassList which was hitting an assert in debug mode
index 813ad2b..4fc3d63 100644 (file)
@@ -127,39 +127,6 @@ public:
         GraphicsContext*, int part, int state, int classicState, const IntRect&);
     static void paintProgressBar(
         GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds);
-#elif OS(DARWIN)
-    enum ThemePaintState {
-        StateDisabled,
-        StateInactive,
-        StateActive,
-        StatePressed,
-    };
-
-    enum ThemePaintSize {
-        SizeRegular,
-        SizeSmall,
-    };
-
-    enum ThemePaintScrollbarOrientation {
-        ScrollbarOrientationHorizontal,
-        ScrollbarOrientationVertical,
-    };
-
-    enum ThemePaintScrollbarParent {
-        ScrollbarParentScrollView,
-        ScrollbarParentRenderLayer,
-    };
-
-    struct ThemePaintScrollbarInfo {
-        ThemePaintScrollbarOrientation orientation;
-        ThemePaintScrollbarParent parent;
-        int maxValue;
-        int currentValue;
-        int visibleSize;
-        int totalSize;
-    };
-
-    static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&);
 #endif
 };
 
index 9fe8a90..44ee673 100644 (file)
 #include "LocalCurrentGraphicsContext.h"
 #include "NSScrollerImpDetails.h"
 #include "PlatformContextSkia.h"
-#include "PlatformSupport.h"
 #include "ScrollAnimatorMac.h"
 #include "ScrollView.h"
 #include "skia/ext/skia_utils_mac.h"
 #include <Carbon/Carbon.h>
+#include <public/Platform.h>
+#include <public/WebRect.h>
+#include <public/mac/WebThemeEngine.h>
 
 namespace WebCore {
 
@@ -58,16 +60,16 @@ ScrollbarThemeChromiumMac::~ScrollbarThemeChromiumMac()
 {
 }
 
-static PlatformSupport::ThemePaintState scrollbarStateToThemeState(ScrollbarThemeClient* scrollbar)
+static WebKit::WebThemeEngine::State scrollbarStateToThemeState(ScrollbarThemeClient* scrollbar)
 {
     if (!scrollbar->enabled())
-        return PlatformSupport::StateDisabled;
+        return WebKit::WebThemeEngine::StateDisabled;
     if (!scrollbar->isScrollableAreaActive())
-        return PlatformSupport::StateInactive;
+        return WebKit::WebThemeEngine::StateInactive;
     if (scrollbar->pressedPart() == ThumbPart)
-        return PlatformSupport::StatePressed;
+        return WebKit::WebThemeEngine::StatePressed;
 
-    return PlatformSupport::StateActive;
+    return WebKit::WebThemeEngine::StateActive;
 }
 
 static void scrollbarPainterPaintTrack(ScrollbarPainter scrollbarPainter, bool enabled, double value, CGFloat proportion, CGRect frameRect)
@@ -88,7 +90,7 @@ static void scrollbarPainterPaintTrack(ScrollbarPainter scrollbarPainter, bool e
 }
 
 // Override ScrollbarThemeMac::paint() to add support for the following:
-//     - drawing using PlatformSupport functions
+//     - drawing using WebThemeEngine functions
 //     - drawing tickmarks
 //     - Skia specific changes
 bool ScrollbarThemeChromiumMac::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* context, const IntRect& damageRect)
@@ -235,19 +237,20 @@ bool ScrollbarThemeChromiumMac::paint(ScrollbarThemeClient* scrollbar, GraphicsC
     paintGivenTickmarks(drawingContext, scrollbar, tickmarkTrackRect, tickmarks);
 
     if (hasThumb(scrollbar)) {
-        PlatformSupport::ThemePaintScrollbarInfo scrollbarInfo;
-        scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? PlatformSupport::ScrollbarOrientationHorizontal : PlatformSupport::ScrollbarOrientationVertical;
-        scrollbarInfo.parent = scrollbar->isScrollViewScrollbar() ? PlatformSupport::ScrollbarParentScrollView : PlatformSupport::ScrollbarParentRenderLayer;
+        WebKit::WebThemeEngine::ScrollbarInfo scrollbarInfo;
+        scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::ScrollbarOrientationHorizontal : WebKit::WebThemeEngine::ScrollbarOrientationVertical;
+        scrollbarInfo.parent = scrollbar->isScrollViewScrollbar() ? WebKit::WebThemeEngine::ScrollbarParentScrollView : WebKit::WebThemeEngine::ScrollbarParentRenderLayer;
         scrollbarInfo.maxValue = scrollbar->maximum();
         scrollbarInfo.currentValue = scrollbar->currentPos();
         scrollbarInfo.visibleSize = scrollbar->visibleSize();
         scrollbarInfo.totalSize = scrollbar->totalSize();
 
-        PlatformSupport::paintScrollbarThumb(
-            drawingContext,
+        WebKit::WebCanvas* webCanvas = drawingContext->platformContext()->canvas();
+        WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(
+            webCanvas,
             scrollbarStateToThemeState(scrollbar),
-            scrollbar->controlSize() == RegularScrollbar ? PlatformSupport::SizeRegular : PlatformSupport::SizeSmall,
-            scrollbar->frameRect(),
+            scrollbar->controlSize() == RegularScrollbar ? WebKit::WebThemeEngine::SizeRegular : WebKit::WebThemeEngine::SizeSmall,
+            WebKit::WebRect(scrollbar->frameRect()),
             scrollbarInfo);
     }
 
index f2231cc..734e989 100644 (file)
@@ -1,5 +1,18 @@
 2012-09-27  Mark Pilgrim  <pilgrim@chromium.org>
 
+        [Chromium][Mac] Move Mac-specific theme functions out of PlatformSupport
+        https://bugs.webkit.org/show_bug.cgi?id=97817
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948. We're calling WebThemeEngine directly now instead of proxying through PlatformSupport.
+
+        * src/AssertMatchingEnums.cpp:
+        * src/PlatformSupport.cpp:
+        (WebCore):
+
+2012-09-27  Mark Pilgrim  <pilgrim@chromium.org>
+
         [Chromium] Move UNIX-specific theme functions out of PlatformSupport
         https://bugs.webkit.org/show_bug.cgi?id=96516
 
index c6bf971..d2461a9 100644 (file)
 #include <wtf/Assertions.h>
 #include <wtf/text/StringImpl.h>
 
-#if OS(DARWIN)
-#include "PlatformSupport.h"
-#include <public/mac/WebThemeEngine.h>
-#endif
-
 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
     COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums)
 
@@ -548,22 +543,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorNotSupported, NOT_SUPPORTED_ERR
 COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorAbort, ABORT_ERR);
 #endif
 
-#if OS(DARWIN)
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateDisabled, PlatformSupport::StateDisabled);
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateInactive, PlatformSupport::StateInactive);
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateActive, PlatformSupport::StateActive);
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StatePressed, PlatformSupport::StatePressed);
-
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeRegular, PlatformSupport::SizeRegular);
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeSmall, PlatformSupport::SizeSmall);
-
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationHorizontal, PlatformSupport::ScrollbarOrientationHorizontal);
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationVertical, PlatformSupport::ScrollbarOrientationVertical);
-
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, PlatformSupport::ScrollbarParentScrollView);
-COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, PlatformSupport::ScrollbarParentRenderLayer);
-#endif
-
 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateVisible, PageVisibilityStateVisible);
 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateHidden, PageVisibilityStateHidden);
 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePrerender, PageVisibilityStatePrerender);
index 9efc337..37f3db0 100644 (file)
@@ -324,29 +324,6 @@ void PlatformSupport::paintProgressBar(
         gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds);
 }
 
-#elif OS(DARWIN)
-
-void PlatformSupport::paintScrollbarThumb(
-    GraphicsContext* gc, ThemePaintState state, ThemePaintSize size, const IntRect& rect, const ThemePaintScrollbarInfo& scrollbarInfo)
-{
-    WebThemeEngine::ScrollbarInfo webThemeScrollbarInfo;
-
-    webThemeScrollbarInfo.orientation = static_cast<WebThemeEngine::ScrollbarOrientation>(scrollbarInfo.orientation);
-    webThemeScrollbarInfo.parent = static_cast<WebThemeEngine::ScrollbarParent>(scrollbarInfo.parent);
-    webThemeScrollbarInfo.maxValue = scrollbarInfo.maxValue;
-    webThemeScrollbarInfo.currentValue = scrollbarInfo.currentValue;
-    webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize;
-    webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize;
-
-    WebKit::WebCanvas* webCanvas = gc->platformContext()->canvas();
-    WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(
-        webCanvas,
-        static_cast<WebThemeEngine::State>(state),
-        static_cast<WebThemeEngine::Size>(size),
-        rect,
-        webThemeScrollbarInfo);
-}
-
 #endif
 
 // These are temporary methods that the WebKit layer can use to call to the