Title: [136735] trunk/Source
Revision
136735
Author
pilg...@chromium.org
Date
2012-12-05 12:30:16 -0800 (Wed, 05 Dec 2012)

Log Message

[Chromium][Win] Remove theme-related functions from PlatformSupport
https://bugs.webkit.org/show_bug.cgi?id=102699

Reviewed by Adam Barth.

Call theme engine directly instead of going through
PlatformSupport. Part of a refactoring series. See tracking bug 82948.

Source/WebCore:

* platform/chromium/PlatformSupport.h:
(PlatformSupport):
* platform/chromium/ScrollbarThemeChromiumWin.cpp:
(WebCore::ScrollbarThemeChromiumWin::paintTrackPiece):
(WebCore::ScrollbarThemeChromiumWin::paintButton):
* rendering/RenderThemeChromiumWin.cpp:
(WebCore):
(WebCore::RenderThemeChromiumWin::paintButton):
(WebCore::RenderThemeChromiumWin::paintSliderTrack):
(WebCore::RenderThemeChromiumWin::paintSliderThumb):
(WebCore::RenderThemeChromiumWin::paintMenuList):
(WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
(WebCore::RenderThemeChromiumWin::paintInnerSpinButton):
(WebCore::RenderThemeChromiumWin::paintProgressBar):

Source/WebKit/chromium:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136734 => 136735)


--- trunk/Source/WebCore/ChangeLog	2012-12-05 20:28:07 UTC (rev 136734)
+++ trunk/Source/WebCore/ChangeLog	2012-12-05 20:30:16 UTC (rev 136735)
@@ -1,3 +1,28 @@
+2012-12-05  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium][Win] Remove theme-related functions from PlatformSupport
+        https://bugs.webkit.org/show_bug.cgi?id=102699
+
+        Reviewed by Adam Barth.
+
+        Call theme engine directly instead of going through
+        PlatformSupport. Part of a refactoring series. See tracking bug 82948.
+
+        * platform/chromium/PlatformSupport.h:
+        (PlatformSupport):
+        * platform/chromium/ScrollbarThemeChromiumWin.cpp:
+        (WebCore::ScrollbarThemeChromiumWin::paintTrackPiece):
+        (WebCore::ScrollbarThemeChromiumWin::paintButton):
+        * rendering/RenderThemeChromiumWin.cpp:
+        (WebCore):
+        (WebCore::RenderThemeChromiumWin::paintButton):
+        (WebCore::RenderThemeChromiumWin::paintSliderTrack):
+        (WebCore::RenderThemeChromiumWin::paintSliderThumb):
+        (WebCore::RenderThemeChromiumWin::paintMenuList):
+        (WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
+        (WebCore::RenderThemeChromiumWin::paintInnerSpinButton):
+        (WebCore::RenderThemeChromiumWin::paintProgressBar):
+
 2012-12-05  Stephen White  <senorbla...@chromium.org>
 
         Unreviewed, rolling out r136609.

Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (136734 => 136735)


--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-12-05 20:28:07 UTC (rev 136734)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h	2012-12-05 20:30:16 UTC (rev 136735)
@@ -78,28 +78,6 @@
 
     // Plugin -------------------------------------------------------------
     static bool plugins(bool refresh, Vector<PluginInfo>*);
-
-    // Theming ------------------------------------------------------------
-#if OS(WINDOWS) && !ENABLE(DEFAULT_RENDER_THEME)
-    static void paintButton(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&);
-    static void paintMenuList(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&);
-    static void paintScrollbarArrow(
-        GraphicsContext*, int state, int classicState, const IntRect&);
-    static void paintScrollbarThumb(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&);
-    static void paintScrollbarTrack(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&, const IntRect& alignRect);
-    static void paintSpinButton(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&);
-    static void paintTextField(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges);
-    static void paintTrackbar(
-        GraphicsContext*, int part, int state, int classicState, const IntRect&);
-    static void paintProgressBar(
-        GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds);
-#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp (136734 => 136735)


--- trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp	2012-12-05 20:28:07 UTC (rev 136734)
+++ trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp	2012-12-05 20:30:16 UTC (rev 136735)
@@ -34,9 +34,11 @@
 #include "LayoutTestSupport.h"
 #include "PlatformContextSkia.h"
 #include "PlatformMouseEvent.h"
-#include "PlatformSupport.h"
 #include "Scrollbar.h"
 #include "SystemInfo.h"
+#include <public/Platform.h>
+#include <public/WebRect.h>
+#include <public/win/WebThemeEngine.h>
 
 namespace WebCore {
 
@@ -104,14 +106,10 @@
 
     IntRect alignRect = trackRect(scrollbar, false);
 
+    WebKit::WebCanvas* canvas = gc->platformContext()->canvas();
     // Draw the track area before/after the thumb on the scroll bar.
-    PlatformSupport::paintScrollbarTrack(
-        gc,
-        partId,
-        getThemeState(scrollbar, partType),
-        getClassicThemeState(scrollbar, partType),
-        rect,
-        alignRect);
+    WebKit::Platform::current()->themeEngine()->paintScrollbarTrack(canvas, partId, getThemeState(scrollbar, partType), getClassicThemeState(scrollbar, partType), WebKit::WebRect(rect), WebKit::WebRect(alignRect));
+
 }
 
 void ScrollbarThemeChromiumWin::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part)
@@ -124,33 +122,21 @@
     else
         partId = horz ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN;
 
+    WebKit::WebCanvas* canvas = gc->platformContext()->canvas();
     // Draw the thumb (the box you drag in the scroll bar to scroll).
-    PlatformSupport::paintScrollbarArrow(
-        gc,
-        getThemeArrowState(scrollbar, part),
-        partId | getClassicThemeState(scrollbar, part),
-        rect);
+    WebKit::Platform::current()->themeEngine()->paintScrollbarArrow(canvas, getThemeArrowState(scrollbar, part), partId | getClassicThemeState(scrollbar, part), WebKit::WebRect(rect);
 }
 
 void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect)
 {
     bool horz = scrollbar->orientation() == HorizontalScrollbar;
 
+    WebKit::WebCanvas* canvas = gc->platformContext()->canvas();
     // Draw the thumb (the box you drag in the scroll bar to scroll).
-    PlatformSupport::paintScrollbarThumb(
-        gc,
-        horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT,
-        getThemeState(scrollbar, ThumbPart),
-        getClassicThemeState(scrollbar, ThumbPart),
-        rect);
+    WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(canvas, horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), WebKit::WebRect(rect));
 
     // Draw the gripper (the three little lines on the thumb).
-    PlatformSupport::paintScrollbarThumb(
-        gc,
-        horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT,
-        getThemeState(scrollbar, ThumbPart),
-        getClassicThemeState(scrollbar, ThumbPart),
-        rect);
+    WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(canvas, horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), WebKit::WebRect(rect));
 }
 
 int ScrollbarThemeChromiumWin::getThemeState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const

Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp (136734 => 136735)


--- trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp	2012-12-05 20:28:07 UTC (rev 136734)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp	2012-12-05 20:30:16 UTC (rev 136735)
@@ -38,7 +38,7 @@
 #include "LayoutTestSupport.h"
 #include "MediaControlElements.h"
 #include "PaintInfo.h"
-#include "PlatformSupport.h"
+#include "PlatformContextSkia.h"
 #include "RenderBox.h"
 #include "RenderProgress.h"
 #include "RenderSlider.h"
@@ -46,6 +46,9 @@
 #include "ScrollbarTheme.h"
 #include "SystemInfo.h"
 #include "TransparencyWin.h"
+#include <public/Platform.h>
+#include <public/WebRect.h>
+#include <public/win/WebThemeEngine.h>
 #include <wtf/CurrentTime.h>
 
 
@@ -304,11 +307,8 @@
     const ThemeData& themeData = getThemeData(o);
 
     ThemePainter painter(i.context, r);
-    PlatformSupport::paintButton(painter.context(),
-                                themeData.m_part,
-                                themeData.m_state,
-                                themeData.m_classicState,
-                                painter.drawRect());
+    WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+    WebKit::Platform::current()->themeEngine()->paintButton(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()));
     return false;
 }
 
@@ -322,11 +322,8 @@
     const ThemeData& themeData = getThemeData(o);
 
     ThemePainter painter(i.context, r);
-    PlatformSupport::paintTrackbar(painter.context(),
-                                  themeData.m_part,
-                                  themeData.m_state,
-                                  themeData.m_classicState,
-                                  painter.drawRect());
+    WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+    WebKit::Platform::current()->themeEngine()->paintTrackbar(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()));
 
 #if ENABLE(DATALIST_ELEMENT)
     paintSliderTicks(o, i, r);
@@ -340,11 +337,8 @@
     const ThemeData& themeData = getThemeData(o);
 
     ThemePainter painter(i.context, r);
-    PlatformSupport::paintTrackbar(painter.context(),
-                                   themeData.m_part,
-                                   themeData.m_state,
-                                   themeData.m_classicState,
-                                   painter.drawRect());
+    WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+    WebKit::Platform::current()->themeEngine()->paintTrackbar(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()));
 
     return false;
 }
@@ -399,11 +393,8 @@
 
     // Get the correct theme data for a textfield and paint the menu.
     ThemePainter painter(i.context, rect);
-    PlatformSupport::paintMenuList(painter.context(),
-                                   CP_DROPDOWNBUTTON,
-                                   determineState(o),
-                                   determineClassicState(o),
-                                   painter.drawRect());
+    WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+    WebKit::Platform::current()->themeEngine()->paintMenuList(canvas, CP_DROPDOWNBUTTON, determineState(o), determineClassicState(o), WebKit::WebRect(painter.drawRect()));
     return false;
 }
 
@@ -556,7 +547,6 @@
                                                     bool drawEdges)
 {
     // Fallback to white if the specified color object is invalid.
-    // (Note PlatformSupport::paintTextField duplicates this check).
     Color backgroundColor(Color::white);
     if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
         backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
@@ -580,14 +570,8 @@
     {
         const ThemeData& themeData = getThemeData(o);
         ThemePainter painter(i.context, r);
-        PlatformSupport::paintTextField(painter.context(),
-                                        themeData.m_part,
-                                        themeData.m_state,
-                                        themeData.m_classicState,
-                                        painter.drawRect(),
-                                        backgroundColor,
-                                        fillContentArea,
-                                        drawEdges);
+        WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+        WebKit::Platform::current()->themeEngine()->paintTextField(canvas, themeData.m_part, themeData.m_state, themeData.m_classicState, WebKit::WebRect(painter.drawRect()), backgroundColor, fillContentArea, drawEdges);
         // End of block commits the painter before restoring context.
     }
     if (o->style()->hasBorderRadius())
@@ -611,22 +595,16 @@
         half.setHeight(rect.height() / 2);
         const ThemeData& upThemeData = getThemeData(object, SpinButtonUp);
         ThemePainter upPainter(info.context, half);
-        PlatformSupport::paintSpinButton(upPainter.context(),
-                                         upThemeData.m_part,
-                                         upThemeData.m_state,
-                                         upThemeData.m_classicState,
-                                         upPainter.drawRect());
+        WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+        WebKit::Platform::current()->themeEngine()->paintSpinButton(canvas, upThemeData.m_part, upThemeData.m_state, upThemeData.m_classicState, WebKit::WebRect(upPainter.drawRect()));
     }
 
     {
         half.setY(rect.y() + rect.height() / 2);
         const ThemeData& downThemeData = getThemeData(object, SpinButtonDown);
         ThemePainter downPainter(info.context, half);
-        PlatformSupport::paintSpinButton(downPainter.context(),
-                                         downThemeData.m_part,
-                                         downThemeData.m_state,
-                                         downThemeData.m_classicState,
-                                         downPainter.drawRect());
+        WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+        WebKit::Platform::current()->themeEngine()->paintSpinButton(canvas, downThemeData.m_part, downThemeData.m_state, downThemeData.m_classicState, WebKit::WebRect(downPainter.drawRect()));
     }
     return false;
 }
@@ -665,7 +643,8 @@
     double animatedSeconds = renderProgress->animationStartTime() ?  WTF::currentTime() - renderProgress->animationStartTime() : 0;
     ThemePainter painter(i.context, r);
     DirectionFlippingScope scope(o, i, r);
-    PlatformSupport::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds);
+    WebKit::WebCanvas* canvas = painter.context()->platformContext()->canvas();
+    WebKit::Platform::current()->themeEngine()->paintProgressBar(canvas, WebKit::WebRect(r), WebKit::WebRect(valueRect), renderProgress->isDeterminate(), animatedSeconds);
     return false;
 }
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (136734 => 136735)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-12-05 20:28:07 UTC (rev 136734)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-12-05 20:30:16 UTC (rev 136735)
@@ -1,3 +1,16 @@
+2012-12-05  Mark Pilgrim  <pilg...@chromium.org>
+
+        [Chromium][Win] Remove theme-related functions from PlatformSupport
+        https://bugs.webkit.org/show_bug.cgi?id=102699
+
+        Reviewed by Adam Barth.
+
+        Call theme engine directly instead of going through
+        PlatformSupport. Part of a refactoring series. See tracking bug 82948.
+
+        * src/PlatformSupport.cpp:
+        (WebCore::PlatformSupport::pluginScriptableObject):
+
 2012-12-05  Stephen White  <senorbla...@chromium.org>
 
         Unreviewed, rolling out r136609.

Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (136734 => 136735)


--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-12-05 20:28:07 UTC (rev 136734)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp	2012-12-05 20:30:16 UTC (rev 136735)
@@ -56,40 +56,10 @@
 #include "platform/WebString.h"
 #include "platform/WebURL.h"
 
-#if OS(WINDOWS)
-#include "platform/WebRect.h"
-#if !ENABLE(DEFAULT_RENDER_THEME)
-#include <public/win/WebThemeEngine.h>
-#endif // !ENABLE(DEFAULT_RENDER_THEME)
-#endif
-
-#if ENABLE(DEFAULT_RENDER_THEME)
-#include <public/default/WebThemeEngine.h>
-#endif
-
-#if OS(DARWIN)
-#include <public/mac/WebThemeEngine.h>
-#elif OS(UNIX)
-#include "WebFontRenderStyle.h"
-#if OS(ANDROID)
-#include <public/android/WebThemeEngine.h>
-#else
-#include "WebFontInfo.h"
-#if !ENABLE(DEFAULT_RENDER_THEME)
-#include <public/linux/WebThemeEngine.h>
-#endif // !ENABLE(DEFAULT_RENDER_THEME)
-#endif // OS(ANDROID)
-#endif // elif OS(UNIX)
-
-#include "NativeImageSkia.h"
-
-#include "BitmapImage.h"
 #include "FrameView.h"
-#include "GraphicsContext.h"
 #include "IDBFactoryBackendProxy.h"
 #include "KURL.h"
 #include "NotImplemented.h"
-#include "PlatformContextSkia.h"
 #include "PluginData.h"
 #include "SharedBuffer.h"
 
@@ -122,89 +92,6 @@
     return true;  // FIXME: There is no need for this function to return a value.
 }
 
-// Theming --------------------------------------------------------------------
-
-#if OS(WINDOWS) && !ENABLE(DEFAULT_RENDER_THEME)
-
-void PlatformSupport::paintButton(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect)
-{
-    WebKit::Platform::current()->themeEngine()->paintButton(
-        gc->platformContext()->canvas(), part, state, classicState, rect);
-}
-
-void PlatformSupport::paintMenuList(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect)
-{
-    WebKit::Platform::current()->themeEngine()->paintMenuList(
-        gc->platformContext()->canvas(), part, state, classicState, rect);
-}
-
-void PlatformSupport::paintScrollbarArrow(
-    GraphicsContext* gc, int state, int classicState,
-    const IntRect& rect)
-{
-    WebKit::Platform::current()->themeEngine()->paintScrollbarArrow(
-        gc->platformContext()->canvas(), state, classicState, rect);
-}
-
-void PlatformSupport::paintScrollbarThumb(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect)
-{
-    WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(
-        gc->platformContext()->canvas(), part, state, classicState, rect);
-}
-
-void PlatformSupport::paintScrollbarTrack(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect, const IntRect& alignRect)
-{
-    WebKit::Platform::current()->themeEngine()->paintScrollbarTrack(
-        gc->platformContext()->canvas(), part, state, classicState, rect,
-        alignRect);
-}
-
-void PlatformSupport::paintSpinButton(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect)
-{
-    WebKit::Platform::current()->themeEngine()->paintSpinButton(
-        gc->platformContext()->canvas(), part, state, classicState, rect);
-}
-
-void PlatformSupport::paintTextField(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect, const Color& color, bool fillContentArea,
-    bool drawEdges)
-{
-    // Fallback to white when |color| is invalid.
-    RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white;
-
-    WebKit::Platform::current()->themeEngine()->paintTextField(
-        gc->platformContext()->canvas(), part, state, classicState, rect,
-        backgroundColor, fillContentArea, drawEdges);
-}
-
-void PlatformSupport::paintTrackbar(
-    GraphicsContext* gc, int part, int state, int classicState,
-    const IntRect& rect)
-{
-    WebKit::Platform::current()->themeEngine()->paintTrackbar(
-        gc->platformContext()->canvas(), part, state, classicState, rect);
-}
-
-void PlatformSupport::paintProgressBar(
-    GraphicsContext* gc, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds)
-{
-    WebKit::Platform::current()->themeEngine()->paintProgressBar(
-        gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds);
-}
-
-#endif
-
 // These are temporary methods that the WebKit layer can use to call to the
 // Glue layer. Once the Glue layer moves entirely into the WebKit layer, these
 // methods will be deleted.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to