[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c

mihaip at chromium.org mihaip at chromium.org
Mon Dec 27 16:27:38 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6221be84d17534c6b6fac03330382bf1e349743d
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 21 20:15:53 2010 +0000

    2010-12-21  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [Chromium] Rename WebThemeEngine/ControlDRT to WebThemeEngine/ControlDRTWin
            https://bugs.webkit.org/show_bug.cgi?id=51406
    
            Rename WebThemeControlDRT to WebThemeControlDRTWin and WebThemeEngineDRT
            to WebThemeEngineDRTWin and update references everywhere.
    
            * DumpRenderTree/DumpRenderTree.gypi:
            * DumpRenderTree/chromium/TestShellWin.cpp:
            * DumpRenderTree/chromium/WebThemeControlDRTWin.cpp: Renamed from Tools/DumpRenderTree/chromium/WebThemeControlDRT.cpp.
            * DumpRenderTree/chromium/WebThemeControlDRTWin.h: Renamed from Tools/DumpRenderTree/chromium/WebThemeControlDRT.h.
            * DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp: Renamed from Tools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp.
            * DumpRenderTree/chromium/WebThemeEngineDRTWin.h: Renamed from Tools/DumpRenderTree/chromium/WebThemeEngineDRT.h.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 9d97b9b..7802f91 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-21  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [Chromium] Rename WebThemeEngine/ControlDRT to WebThemeEngine/ControlDRTWin
+        https://bugs.webkit.org/show_bug.cgi?id=51406 
+        
+        Rename WebThemeControlDRT to WebThemeControlDRTWin and WebThemeEngineDRT
+        to WebThemeEngineDRTWin and update references everywhere.
+
+        * DumpRenderTree/DumpRenderTree.gypi:
+        * DumpRenderTree/chromium/TestShellWin.cpp:
+        * DumpRenderTree/chromium/WebThemeControlDRTWin.cpp: Renamed from Tools/DumpRenderTree/chromium/WebThemeControlDRT.cpp.
+        * DumpRenderTree/chromium/WebThemeControlDRTWin.h: Renamed from Tools/DumpRenderTree/chromium/WebThemeControlDRT.h.
+        * DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp: Renamed from Tools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp.
+        * DumpRenderTree/chromium/WebThemeEngineDRTWin.h: Renamed from Tools/DumpRenderTree/chromium/WebThemeEngineDRT.h.
+
 2010-12-21  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by John Sullivan.
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi
index b437eaf..04caee7 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.gypi
+++ b/Tools/DumpRenderTree/DumpRenderTree.gypi
@@ -61,10 +61,10 @@
         'conditions': [
             ['OS=="win"', {
                 'drt_files': [
-                    'chromium/WebThemeControlDRT.cpp',
-                    'chromium/WebThemeControlDRT.h',
-                    'chromium/WebThemeEngineDRT.cpp',
-                    'chromium/WebThemeEngineDRT.h',
+                    'chromium/WebThemeControlDRTWin.cpp',
+                    'chromium/WebThemeControlDRTWin.h',
+                    'chromium/WebThemeEngineDRTWin.cpp',
+                    'chromium/WebThemeEngineDRTWin.h',
                 ],
             }],
         ],
diff --git a/Tools/DumpRenderTree/chromium/TestShellWin.cpp b/Tools/DumpRenderTree/chromium/TestShellWin.cpp
index 9efcf5a..3b3ddd9 100644
--- a/Tools/DumpRenderTree/chromium/TestShellWin.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShellWin.cpp
@@ -31,7 +31,7 @@
 #include "config.h"
 #include "TestShell.h"
 
-#include "WebThemeEngineDRT.h"
+#include "WebThemeEngineDRTWin.h"
 #include "webkit/support/webkit_support.h"
 #include <fcntl.h>
 #include <io.h>
@@ -49,7 +49,7 @@
     SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
 
 // Theme engine
-static WebThemeEngineDRT themeEngine;
+static WebThemeEngineDRTWin themeEngine;
 
 // Thread main to run for the thread which just tests for timeout.
 unsigned int __stdcall watchDogThread(void* arg)
diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRT.cpp b/Tools/DumpRenderTree/chromium/WebThemeControlDRT.cpp
deleted file mode 100755
index 202248a..0000000
--- a/Tools/DumpRenderTree/chromium/WebThemeControlDRT.cpp
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This file implements a simple generic version of the WebThemeEngine,
-// which is used to draw all the native controls on a web page. We use this
-// file when running in layout test mode in order to remove any
-// platform-specific rendering differences due to themes, colors, etc.
-//
-
-#include "config.h"
-#include "WebThemeControlDRT.h"
-
-#include "skia/ext/platform_canvas.h"
-#include "skia/ext/skia_utils_win.h"
-#include "third_party/skia/include/core/SkPaint.h"
-#include "third_party/skia/include/core/SkPath.h"
-#include "third_party/skia/include/core/SkRect.h"
-
-#include <wtf/Assertions.h>
-
-using namespace std;
-using namespace skia;
-
-static const SkColor edgeColor     = SK_ColorBLACK;
-static const SkColor readOnlyColor = SkColorSetRGB(0xe9, 0xc2, 0xa6);
-static const SkColor fgColor       = SK_ColorBLACK;
-static const SkColor bgColors[]    = {
-    SK_ColorBLACK,                   // Unknown
-    SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled
-    SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly
-    SkColorSetRGB(0x89, 0xc4, 0xff), // Normal
-    SkColorSetRGB(0x43, 0xf9, 0xff), // Hot
-    SkColorSetRGB(0x20, 0xf6, 0xcc), // Focused
-    SkColorSetRGB(0x00, 0xf3, 0xac), // Hover
-    SkColorSetRGB(0xa9, 0xff, 0x12), // Pressed
-    SkColorSetRGB(0xcc, 0xcc, 0xcc)  // Indeterminate
-};
-
-static SkIRect validate(const SkIRect& rect, WebThemeControlDRT::Type ctype)
-{
-    switch (ctype) {
-    case WebThemeControlDRT::UncheckedBoxType:
-    case WebThemeControlDRT::CheckedBoxType:
-    case WebThemeControlDRT::UncheckedRadioType:
-    case WebThemeControlDRT::CheckedRadioType: {
-        SkIRect retval = rect;
-
-        // The maximum width and height is 13.
-        // Center the square in the passed rectangle.
-        const int maxControlSize = 13;
-        int controlSize = min(rect.width(), rect.height());
-        controlSize = min(controlSize, maxControlSize);
-
-        retval.fLeft   = rect.fLeft + (rect.width() / 2) - (controlSize / 2);
-        retval.fRight  = retval.fLeft + controlSize - 1;
-        retval.fTop    = rect.fTop + (rect.height() / 2) - (controlSize / 2);
-        retval.fBottom = retval.fTop + controlSize - 1;
-
-        return retval;
-    }
-
-    default:
-        return rect;
-    }
-}
-
-// WebThemeControlDRT
-
-WebThemeControlDRT::WebThemeControlDRT(PlatformCanvas* canvas,
-                                       const SkIRect& irect,
-                                       Type ctype,
-                                       State cstate)
-    : m_canvas(canvas)
-    , m_irect(validate(irect, ctype))
-    , m_type(ctype)
-    , m_state(cstate)
-    , m_left(m_irect.fLeft)
-    , m_right(m_irect.fRight)
-    , m_top(m_irect.fTop)
-    , m_bottom(m_irect.fBottom)
-    , m_height(m_irect.height())
-    , m_width(m_irect.width())
-    , m_edgeColor(edgeColor)
-    , m_bgColor(bgColors[cstate])
-    , m_fgColor(fgColor)
-{
-}
-
-WebThemeControlDRT::~WebThemeControlDRT()
-{
-}
-
-void WebThemeControlDRT::box(const SkIRect& rect, SkColor fillColor)
-{
-    SkPaint paint;
-
-    paint.setStyle(SkPaint::kFill_Style);
-    paint.setColor(fillColor);
-    m_canvas->drawIRect(rect, paint);
-
-    paint.setColor(m_edgeColor);
-    paint.setStyle(SkPaint::kStroke_Style);
-    m_canvas->drawIRect(rect, paint);
-}
-
-void WebThemeControlDRT::line(int x0, int y0, int x1, int y1, SkColor color)
-{
-    SkPaint paint;
-    paint.setColor(color);
-    m_canvas->drawLine(SkIntToScalar(x0), SkIntToScalar(y0),
-                       SkIntToScalar(x1), SkIntToScalar(y1),
-                       paint);
-}
-
-void WebThemeControlDRT::triangle(int x0, int y0,
-                                  int x1, int y1,
-                                  int x2, int y2,
-                                  SkColor color)
-{
-    SkPath path;
-    SkPaint paint;
-
-    paint.setColor(color);
-    paint.setStyle(SkPaint::kFill_Style);
-    path.incReserve(4);
-    path.moveTo(SkIntToScalar(x0), SkIntToScalar(y0));
-    path.lineTo(SkIntToScalar(x1), SkIntToScalar(y1));
-    path.lineTo(SkIntToScalar(x2), SkIntToScalar(y2));
-    path.close();
-    m_canvas->drawPath(path, paint);
-
-    paint.setColor(m_edgeColor);
-    paint.setStyle(SkPaint::kStroke_Style);
-    m_canvas->drawPath(path, paint);
-}
-
-void WebThemeControlDRT::roundRect(SkColor color)
-{
-    SkRect rect;
-    SkScalar radius = SkIntToScalar(5);
-    SkPaint paint;
-
-    rect.set(m_irect);
-    paint.setColor(color);
-    paint.setStyle(SkPaint::kFill_Style);
-    m_canvas->drawRoundRect(rect, radius, radius, paint);
-
-    paint.setColor(m_edgeColor);
-    paint.setStyle(SkPaint::kStroke_Style);
-    m_canvas->drawRoundRect(rect, radius, radius, paint);
-}
-
-void WebThemeControlDRT::oval(SkColor color)
-{
-    SkRect rect;
-    SkPaint paint;
-
-    rect.set(m_irect);
-    paint.setColor(color);
-    paint.setStyle(SkPaint::kFill_Style);
-    m_canvas->drawOval(rect, paint);
-
-    paint.setColor(m_edgeColor);
-    paint.setStyle(SkPaint::kStroke_Style);
-    m_canvas->drawOval(rect, paint);
-}
-
-void WebThemeControlDRT::circle(SkScalar radius, SkColor color)
-{
-    SkScalar cy = SkIntToScalar(m_top  + m_height / 2);
-    SkScalar cx = SkIntToScalar(m_left + m_width / 2);
-    SkPaint paint;
-
-    paint.setColor(color);
-    paint.setStyle(SkPaint::kFill_Style);
-    m_canvas->drawCircle(cx, cy, radius, paint);
-
-    paint.setColor(m_edgeColor);
-    paint.setStyle(SkPaint::kStroke_Style);
-    m_canvas->drawCircle(cx, cy, radius, paint);
-}
-
-void WebThemeControlDRT::nestedBoxes(int indentLeft,
-                                     int indentTop,
-                                     int indentRight,
-                                     int indentBottom,
-                                     SkColor outerColor,
-                                     SkColor innerColor)
-{
-    SkIRect lirect;
-    box(m_irect, outerColor);
-    lirect.set(m_irect.fLeft + indentLeft,
-               m_irect.fTop + indentTop,
-               m_irect.fRight - indentRight,
-               m_irect.fBottom - indentBottom);
-    box(lirect, innerColor);
-}
-
-void WebThemeControlDRT::markState()
-{
-    // The horizontal lines in a read only control are spaced by this amount.
-    const int readOnlyLineOffset = 5;
-
-    // The length of a triangle side for the corner marks.
-    const int triangleSize = 5;
-
-    switch (m_state) {
-    case UnknownState:
-    case DisabledState:
-    case NormalState:
-        // Don't visually mark these states (color is enough).
-        break;
-    case ReadOnlyState:
-        // Drawing lines across the control.
-        for (int i = m_top + readOnlyLineOffset; i < m_bottom; i += readOnlyLineOffset)
-            line(m_left + 1, i, m_right - 1, i, readOnlyColor);
-        break;
-
-    case HotState:
-        // Draw a triangle in the upper left corner of the control.
-        triangle(m_left,                 m_top,
-                 m_left + triangleSize,  m_top,
-                 m_left,                 m_top + triangleSize,    m_edgeColor);
-        break;
-
-    case HoverState:
-        // Draw a triangle in the upper right corner of the control.
-        triangle(m_right,                m_top,
-                 m_right,                m_top + triangleSize,
-                 m_right - triangleSize, m_top,                   m_edgeColor);
-        break;
-
-    case FocusedState:
-        // Draw a triangle in the bottom right corner of the control.
-        triangle(m_right,                m_bottom,
-                 m_right - triangleSize, m_bottom,
-                 m_right,                m_bottom - triangleSize, m_edgeColor);
-        break;
-
-    case PressedState:
-        // Draw a triangle in the bottom left corner of the control.
-        triangle(m_left,                 m_bottom,
-                 m_left,                 m_bottom - triangleSize,
-                 m_left + triangleSize,  m_bottom,                m_edgeColor);
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        CRASH();
-        break;
-    }
-}
-
-void WebThemeControlDRT::draw()
-{
-    int halfWidth = m_width / 2;
-    int halfHeight = m_height / 2;
-    int quarterWidth = m_width / 4;
-    int quarterHeight = m_height / 4;
-
-    // Indent amounts for the check in a checkbox or radio button.
-    const int checkIndent = 3;
-
-    // Indent amounts for short and long sides of the scrollbar notches.
-    const int notchLongOffset = 1;
-    const int notchShortOffset = 4;
-    const int noOffset = 0;
-
-    // Indent amounts for the short and long sides of a scroll thumb box.
-    const int thumbLongIndent = 0;
-    const int thumbShortIndent = 2;
-
-    // Indents for the crosshatch on a scroll grip.
-    const int gripLongIndent = 3;
-    const int gripShortIndent = 5;
-
-    // Indents for the the slider track.
-    const int sliderIndent = 2;
-
-    m_canvas->beginPlatformPaint();
-
-    switch (m_type) {
-    case UnknownType:
-        ASSERT_NOT_REACHED();
-        CRASH();
-        break;
-
-    case TextFieldType:
-        // We render this by hand outside of this function.
-        ASSERT_NOT_REACHED();
-        CRASH();
-        break;
-
-    case PushButtonType:
-        // push buttons render as a rounded rectangle
-        roundRect(m_bgColor);
-        break;
-
-    case UncheckedBoxType:
-        // Unchecked boxes are simply plain boxes.
-        box(m_irect, m_bgColor);
-        break;
-
-    case CheckedBoxType:
-        nestedBoxes(checkIndent, checkIndent, checkIndent, checkIndent, m_bgColor, m_fgColor);
-        break;
-
-    case IndeterminateCheckboxType:
-        // Indeterminate checkbox is a box containing '-'.
-        nestedBoxes(checkIndent, halfHeight, checkIndent, halfHeight, m_bgColor, m_fgColor);
-        break;
-
-    case UncheckedRadioType:
-        circle(SkIntToScalar(halfHeight), m_bgColor);
-        break;
-
-    case CheckedRadioType:
-        circle(SkIntToScalar(halfHeight), m_bgColor);
-        circle(SkIntToScalar(halfHeight - checkIndent), m_fgColor);
-        break;
-
-    case HorizontalScrollTrackBackType: {
-        // Draw a box with a notch at the left.
-        int longOffset = halfHeight - notchLongOffset;
-        int shortOffset = m_width - notchShortOffset;
-        nestedBoxes(noOffset, longOffset, shortOffset, longOffset, m_bgColor, m_edgeColor);
-        break;
-    }
-
-    case HorizontalScrollTrackForwardType: {
-        // Draw a box with a notch at the right.
-        int longOffset  = halfHeight - notchLongOffset;
-        int shortOffset = m_width - notchShortOffset;
-        nestedBoxes(shortOffset, longOffset, noOffset, longOffset, m_bgColor, m_fgColor);
-        break;
-    }
-
-    case VerticalScrollTrackBackType: {
-        // Draw a box with a notch at the top.
-        int longOffset  = halfWidth - notchLongOffset;
-        int shortOffset = m_height - notchShortOffset;
-        nestedBoxes(longOffset, noOffset, longOffset, shortOffset, m_bgColor, m_fgColor);
-        break;
-    }
-
-    case VerticalScrollTrackForwardType: {
-        // Draw a box with a notch at the bottom.
-        int longOffset  = halfWidth - notchLongOffset;
-        int shortOffset = m_height - notchShortOffset;
-        nestedBoxes(longOffset, shortOffset, longOffset, noOffset, m_bgColor, m_fgColor);
-        break;
-    }
-
-    case HorizontalScrollThumbType:
-        // Draw a narrower box on top of the outside box.
-        nestedBoxes(thumbLongIndent, thumbShortIndent, thumbLongIndent, thumbShortIndent, m_bgColor, m_bgColor);
-        break;
-
-    case VerticalScrollThumbType:
-        // Draw a shorter box on top of the outside box.
-        nestedBoxes(thumbShortIndent, thumbLongIndent, thumbShortIndent, thumbLongIndent, m_bgColor, m_bgColor);
-        break;
-
-    case HorizontalSliderThumbType:
-        // Slider thumbs are ovals.
-        oval(m_bgColor);
-        break;
-
-    case HorizontalScrollGripType: {
-        // Draw a horizontal crosshatch for the grip.
-        int longOffset = halfWidth - gripLongIndent;
-        line(m_left  + gripLongIndent, m_top    + halfHeight,
-             m_right - gripLongIndent, m_top    + halfHeight,      m_fgColor);
-        line(m_left  + longOffset,     m_top    + gripShortIndent,
-             m_left  + longOffset,     m_bottom - gripShortIndent, m_fgColor);
-        line(m_right - longOffset,     m_top    + gripShortIndent,
-             m_right - longOffset,     m_bottom - gripShortIndent, m_fgColor);
-        break;
-    }
-
-    case VerticalScrollGripType: {
-        // Draw a vertical crosshatch for the grip.
-        int longOffset = halfHeight - gripLongIndent;
-        line(m_left  + halfWidth,       m_top    + gripLongIndent,
-             m_left  + halfWidth,       m_bottom - gripLongIndent, m_fgColor);
-        line(m_left  + gripShortIndent, m_top    + longOffset,
-             m_right - gripShortIndent, m_top    + longOffset,     m_fgColor);
-        line(m_left  + gripShortIndent, m_bottom - longOffset,
-             m_right - gripShortIndent, m_bottom - longOffset,     m_fgColor);
-        break;
-    }
-
-    case LeftArrowType:
-        // Draw a left arrow inside a box.
-        box(m_irect, m_bgColor);
-        triangle(m_right - quarterWidth, m_top    + quarterHeight,
-                 m_right - quarterWidth, m_bottom - quarterHeight,
-                 m_left  + quarterWidth, m_top    + halfHeight,    m_fgColor);
-        break;
-
-    case RightArrowType:
-        // Draw a left arrow inside a box.
-        box(m_irect, m_bgColor);
-        triangle(m_left  + quarterWidth, m_top    + quarterHeight,
-                 m_right - quarterWidth, m_top    + halfHeight,
-                 m_left  + quarterWidth, m_bottom - quarterHeight, m_fgColor);
-        break;
-
-    case UpArrowType:
-        // Draw an up arrow inside a box.
-        box(m_irect, m_bgColor);
-        triangle(m_left  + quarterWidth, m_bottom - quarterHeight,
-                 m_left  + halfWidth,    m_top    + quarterHeight,
-                 m_right - quarterWidth, m_bottom - quarterHeight, m_fgColor);
-        break;
-
-    case DownArrowType:
-        // Draw a down arrow inside a box.
-        box(m_irect, m_bgColor);
-        triangle(m_left  + quarterWidth, m_top    + quarterHeight,
-                 m_right - quarterWidth, m_top    + quarterHeight,
-                 m_left  + halfWidth,    m_bottom - quarterHeight, m_fgColor);
-        break;
-
-    case HorizontalSliderTrackType: {
-        // Draw a narrow rect for the track plus box hatches on the ends.
-        SkIRect lirect;
-        lirect = m_irect;
-        lirect.inset(noOffset, halfHeight - sliderIndent);
-        box(lirect, m_bgColor);
-        line(m_left,  m_top, m_left,  m_bottom, m_edgeColor);
-        line(m_right, m_top, m_right, m_bottom, m_edgeColor);
-        break;
-    }
-
-    case DropDownButtonType:
-        // Draw a box with a big down arrow on top.
-        box(m_irect, m_bgColor);
-        triangle(m_left  + quarterWidth, m_top,
-                 m_right - quarterWidth, m_top,
-                 m_left  + halfWidth,    m_bottom, m_fgColor);
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        CRASH();
-        break;
-    }
-
-    markState();
-    m_canvas->endPlatformPaint();
-}
-
-// Because rendering a text field is dependent on input
-// parameters the other controls don't have, we render it directly
-// rather than trying to overcomplicate draw() further.
-void WebThemeControlDRT::drawTextField(bool drawEdges, bool fillContentArea, SkColor color)
-{
-    SkPaint paint;
-
-    m_canvas->beginPlatformPaint();
-    if (fillContentArea) {
-        paint.setColor(color);
-        paint.setStyle(SkPaint::kFill_Style);
-        m_canvas->drawIRect(m_irect, paint);
-    }
-    if (drawEdges) {
-        paint.setColor(m_edgeColor);
-        paint.setStyle(SkPaint::kStroke_Style);
-        m_canvas->drawIRect(m_irect, paint);
-    }
-
-    markState();
-    m_canvas->endPlatformPaint();
-}
-
-void WebThemeControlDRT::drawProgressBar(const SkIRect& fillRect)
-{
-    SkPaint paint;
-
-    m_canvas->beginPlatformPaint();
-    paint.setColor(m_bgColor);
-    paint.setStyle(SkPaint::kFill_Style);
-    m_canvas->drawIRect(m_irect, paint);
-
-    // Emulate clipping
-    SkIRect tofill;
-    tofill.intersect(m_irect, fillRect);
-    paint.setColor(m_fgColor);
-    paint.setStyle(SkPaint::kFill_Style);
-    m_canvas->drawIRect(tofill, paint);
-
-    markState();
-    m_canvas->endPlatformPaint();
-}
-
diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRT.h b/Tools/DumpRenderTree/chromium/WebThemeControlDRT.h
deleted file mode 100644
index 38831d9..0000000
--- a/Tools/DumpRenderTree/chromium/WebThemeControlDRT.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// WebThemeControlDRT implements the generic rendering of controls
-// needed by WebThemeEngineDRT. See the comments in that class
-// header file for why this class is needed and used.
-//
-// This class implements a generic set of widgets using Skia. The widgets
-// are optimized for testability, not a pleasing appearance.
-//
-
-#ifndef WebThemeControlDRT_h
-#define WebThemeControlDRT_h
-
-#include "skia/ext/platform_canvas.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include <wtf/Noncopyable.h>
-
-// Skia forward declarations
-struct SkIRect;
-
-class WebThemeControlDRT : public Noncopyable {
-public:
-    // This list of states mostly mirrors the list in WebCore/platform/ThemeTypes.h
-    // but is maintained separately since that isn't public and also to minimize
-    // dependencies.
-    // Note that the WebKit ThemeTypes seem to imply that a control can be
-    // in multiple states simultaneously but WebThemeEngine only allows for
-    // a single state at a time.
-    //
-    // Some definitions for the various states:
-    //   Disabled - indicates that a control can't be modified or selected
-    //              (corresponds to HTML 'disabled' attribute)
-    //   ReadOnly - indicates that a control can't be modified but can be
-    //              selected
-    //   Normal   - the normal state of control on the page when it isn't
-    //              focused or otherwise active
-    //   Hot      - when the mouse is hovering over a part of the control,
-    //              all the other parts are considered "hot"
-    //   Hover    - when the mouse is directly over a control (the CSS
-    //               :hover pseudo-class)
-    //   Focused  - when the control has the keyboard focus
-    //   Pressed  - when the control is being triggered (by a mousedown or
-    //              a key event).
-    //   Indeterminate - when set to indeterminate (only for progress bar)
-    enum State {
-        UnknownState = 0,
-        DisabledState,
-        ReadOnlyState,
-        NormalState,
-        HotState,
-        HoverState,
-        FocusedState,
-        PressedState,
-        IndeterminateState
-    };
-
-    // This list of types mostly mirrors the list in
-    // WebCore/platform/ThemeTypes.h but is maintained
-    // separately since that isn't public and also to minimize dependencies.
-    //
-    // Note that what the user might think of as a single control can be
-    // made up of multiple parts. For example, a single scroll bar contains
-    // six clickable parts - two arrows, the "thumb" indicating the current
-    // position on the bar, the other two parts of the bar (before and after
-    // the thumb) and the "gripper" on the thumb itself.
-    //
-    enum Type {
-        UnknownType = 0,
-        TextFieldType,
-        PushButtonType,
-        UncheckedBoxType,
-        CheckedBoxType,
-        IndeterminateCheckboxType,
-        UncheckedRadioType,
-        CheckedRadioType,
-        HorizontalScrollTrackBackType,
-        HorizontalScrollTrackForwardType,
-        HorizontalScrollThumbType,
-        HorizontalScrollGripType,
-        VerticalScrollTrackBackType,
-        VerticalScrollTrackForwardType,
-        VerticalScrollThumbType,
-        VerticalScrollGripType,
-        LeftArrowType,
-        RightArrowType,
-        UpArrowType,
-        DownArrowType,
-        HorizontalSliderTrackType,
-        HorizontalSliderThumbType,
-        DropDownButtonType,
-        ProgressBarType
-    };
-
-    // canvas is the canvas to draw onto, and rect gives the size of the
-    // control. ctype and cstate specify the type and state of the control.
-    WebThemeControlDRT(skia::PlatformCanvas* canvas,
-                       const SkIRect& rect,
-                       Type ctype,
-                       State cstate);
-    ~WebThemeControlDRT();
-
-    // Draws the control.
-    void draw();
-
-    // Use this for TextField controls instead, because the logic
-    // for drawing them is dependent on what WebKit tells us to do.
-    // If drawEdges is true, draw an edge around the control. If
-    // fillContentArea is true, fill the content area with the given color.
-    void drawTextField(bool drawEdges, bool fillContentArea, SkColor color);
-
-    // Use this for drawing ProgressBar controls instead, since we
-    // need to know the rect to fill inside the bar.
-    void drawProgressBar(const SkIRect& fillRect);
-
-private:
-    // Draws a box of size specified by irect, filled with the given color.
-    // The box will have a border drawn in the default edge color.
-    void box(const SkIRect& irect, SkColor color);
-
-
-    // Draws a triangle of size specified by the three pairs of coordinates,
-    // filled with the given color. The box will have an edge drawn in the
-    // default edge color.
-    void triangle(int x0, int y0, int x1, int y1, int x2, int y2, SkColor color);
-
-    // Draws a rectangle the size of the control with rounded corners, filled
-    // with the specified color (and with a border in the default edge color).
-    void roundRect(SkColor color);
-
-    // Draws an oval the size of the control, filled with the specified color
-    // and with a border in the default edge color.
-    void oval(SkColor color);
-
-    // Draws a circle centered in the control with the specified radius,
-    // filled with the specified color, and with a border draw in the
-    // default edge color.
-    void circle(SkScalar radius, SkColor color);
-
-    // Draws a box the size of the control, filled with the outerColor and
-    // with a border in the default edge color, and then draws another box
-    // indented on all four sides by the specified amounts, filled with the
-    // inner color and with a border in the default edge color.
-    void nestedBoxes(int indentLeft,
-                     int indentTop,
-                     int indentRight,
-                     int indentBottom,
-                     SkColor outerColor,
-                     SkColor innerColor);
-
-    // Draws a line between the two points in the given color.
-    void line(int x0, int y0, int x1, int y1, SkColor color);
-
-    // Draws a distinctive mark on the control for each state, so that the
-    // state of the control can be determined without needing to know which
-    // color is which.
-    void markState();
-
-    skia::PlatformCanvas* m_canvas;
-    const SkIRect m_irect;
-    const Type m_type;
-    const State m_state;
-    const SkColor m_edgeColor;
-    const SkColor m_bgColor;
-    const SkColor m_fgColor;
-
-    // The following are convenience accessors for m_irect.
-    const int m_left;
-    const int m_right;
-    const int m_top;
-    const int m_bottom;
-    const int m_width;
-    const int m_height;
-};
-
-#endif // WebThemeControlDRT_h
diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp
new file mode 100755
index 0000000..b1d9fa1
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp
@@ -0,0 +1,523 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This file implements a simple generic version of the WebThemeEngine,
+// which is used to draw all the native controls on a web page. We use this
+// file when running in layout test mode in order to remove any
+// platform-specific rendering differences due to themes, colors, etc.
+//
+
+#include "config.h"
+#include "WebThemeControlDRTWin.h"
+
+#include "skia/ext/platform_canvas.h"
+#include "skia/ext/skia_utils_win.h"
+#include "third_party/skia/include/core/SkPaint.h"
+#include "third_party/skia/include/core/SkPath.h"
+#include "third_party/skia/include/core/SkRect.h"
+
+#include <wtf/Assertions.h>
+
+using namespace std;
+using namespace skia;
+
+static const SkColor edgeColor     = SK_ColorBLACK;
+static const SkColor readOnlyColor = SkColorSetRGB(0xe9, 0xc2, 0xa6);
+static const SkColor fgColor       = SK_ColorBLACK;
+static const SkColor bgColors[]    = {
+    SK_ColorBLACK,                   // Unknown
+    SkColorSetRGB(0xc9, 0xc9, 0xc9), // Disabled
+    SkColorSetRGB(0xf3, 0xe0, 0xd0), // Readonly
+    SkColorSetRGB(0x89, 0xc4, 0xff), // Normal
+    SkColorSetRGB(0x43, 0xf9, 0xff), // Hot
+    SkColorSetRGB(0x20, 0xf6, 0xcc), // Focused
+    SkColorSetRGB(0x00, 0xf3, 0xac), // Hover
+    SkColorSetRGB(0xa9, 0xff, 0x12), // Pressed
+    SkColorSetRGB(0xcc, 0xcc, 0xcc)  // Indeterminate
+};
+
+static SkIRect validate(const SkIRect& rect, WebThemeControlDRTWin::Type ctype)
+{
+    switch (ctype) {
+    case WebThemeControlDRTWin::UncheckedBoxType:
+    case WebThemeControlDRTWin::CheckedBoxType:
+    case WebThemeControlDRTWin::UncheckedRadioType:
+    case WebThemeControlDRTWin::CheckedRadioType: {
+        SkIRect retval = rect;
+
+        // The maximum width and height is 13.
+        // Center the square in the passed rectangle.
+        const int maxControlSize = 13;
+        int controlSize = min(rect.width(), rect.height());
+        controlSize = min(controlSize, maxControlSize);
+
+        retval.fLeft   = rect.fLeft + (rect.width() / 2) - (controlSize / 2);
+        retval.fRight  = retval.fLeft + controlSize - 1;
+        retval.fTop    = rect.fTop + (rect.height() / 2) - (controlSize / 2);
+        retval.fBottom = retval.fTop + controlSize - 1;
+
+        return retval;
+    }
+
+    default:
+        return rect;
+    }
+}
+
+// WebThemeControlDRTWin
+
+WebThemeControlDRTWin::WebThemeControlDRTWin(PlatformCanvas* canvas,
+                                             const SkIRect& irect,
+                                             Type ctype,
+                                             State cstate)
+    : m_canvas(canvas)
+    , m_irect(validate(irect, ctype))
+    , m_type(ctype)
+    , m_state(cstate)
+    , m_left(m_irect.fLeft)
+    , m_right(m_irect.fRight)
+    , m_top(m_irect.fTop)
+    , m_bottom(m_irect.fBottom)
+    , m_height(m_irect.height())
+    , m_width(m_irect.width())
+    , m_edgeColor(edgeColor)
+    , m_bgColor(bgColors[cstate])
+    , m_fgColor(fgColor)
+{
+}
+
+WebThemeControlDRTWin::~WebThemeControlDRTWin()
+{
+}
+
+void WebThemeControlDRTWin::box(const SkIRect& rect, SkColor fillColor)
+{
+    SkPaint paint;
+
+    paint.setStyle(SkPaint::kFill_Style);
+    paint.setColor(fillColor);
+    m_canvas->drawIRect(rect, paint);
+
+    paint.setColor(m_edgeColor);
+    paint.setStyle(SkPaint::kStroke_Style);
+    m_canvas->drawIRect(rect, paint);
+}
+
+void WebThemeControlDRTWin::line(int x0, int y0, int x1, int y1, SkColor color)
+{
+    SkPaint paint;
+    paint.setColor(color);
+    m_canvas->drawLine(SkIntToScalar(x0), SkIntToScalar(y0),
+                       SkIntToScalar(x1), SkIntToScalar(y1),
+                       paint);
+}
+
+void WebThemeControlDRTWin::triangle(int x0, int y0,
+                                     int x1, int y1,
+                                     int x2, int y2,
+                                     SkColor color)
+{
+    SkPath path;
+    SkPaint paint;
+
+    paint.setColor(color);
+    paint.setStyle(SkPaint::kFill_Style);
+    path.incReserve(4);
+    path.moveTo(SkIntToScalar(x0), SkIntToScalar(y0));
+    path.lineTo(SkIntToScalar(x1), SkIntToScalar(y1));
+    path.lineTo(SkIntToScalar(x2), SkIntToScalar(y2));
+    path.close();
+    m_canvas->drawPath(path, paint);
+
+    paint.setColor(m_edgeColor);
+    paint.setStyle(SkPaint::kStroke_Style);
+    m_canvas->drawPath(path, paint);
+}
+
+void WebThemeControlDRTWin::roundRect(SkColor color)
+{
+    SkRect rect;
+    SkScalar radius = SkIntToScalar(5);
+    SkPaint paint;
+
+    rect.set(m_irect);
+    paint.setColor(color);
+    paint.setStyle(SkPaint::kFill_Style);
+    m_canvas->drawRoundRect(rect, radius, radius, paint);
+
+    paint.setColor(m_edgeColor);
+    paint.setStyle(SkPaint::kStroke_Style);
+    m_canvas->drawRoundRect(rect, radius, radius, paint);
+}
+
+void WebThemeControlDRTWin::oval(SkColor color)
+{
+    SkRect rect;
+    SkPaint paint;
+
+    rect.set(m_irect);
+    paint.setColor(color);
+    paint.setStyle(SkPaint::kFill_Style);
+    m_canvas->drawOval(rect, paint);
+
+    paint.setColor(m_edgeColor);
+    paint.setStyle(SkPaint::kStroke_Style);
+    m_canvas->drawOval(rect, paint);
+}
+
+void WebThemeControlDRTWin::circle(SkScalar radius, SkColor color)
+{
+    SkScalar cy = SkIntToScalar(m_top  + m_height / 2);
+    SkScalar cx = SkIntToScalar(m_left + m_width / 2);
+    SkPaint paint;
+
+    paint.setColor(color);
+    paint.setStyle(SkPaint::kFill_Style);
+    m_canvas->drawCircle(cx, cy, radius, paint);
+
+    paint.setColor(m_edgeColor);
+    paint.setStyle(SkPaint::kStroke_Style);
+    m_canvas->drawCircle(cx, cy, radius, paint);
+}
+
+void WebThemeControlDRTWin::nestedBoxes(int indentLeft,
+                                        int indentTop,
+                                        int indentRight,
+                                        int indentBottom,
+                                        SkColor outerColor,
+                                        SkColor innerColor)
+{
+    SkIRect lirect;
+    box(m_irect, outerColor);
+    lirect.set(m_irect.fLeft + indentLeft,
+               m_irect.fTop + indentTop,
+               m_irect.fRight - indentRight,
+               m_irect.fBottom - indentBottom);
+    box(lirect, innerColor);
+}
+
+void WebThemeControlDRTWin::markState()
+{
+    // The horizontal lines in a read only control are spaced by this amount.
+    const int readOnlyLineOffset = 5;
+
+    // The length of a triangle side for the corner marks.
+    const int triangleSize = 5;
+
+    switch (m_state) {
+    case UnknownState:
+    case DisabledState:
+    case NormalState:
+        // Don't visually mark these states (color is enough).
+        break;
+    case ReadOnlyState:
+        // Drawing lines across the control.
+        for (int i = m_top + readOnlyLineOffset; i < m_bottom; i += readOnlyLineOffset)
+            line(m_left + 1, i, m_right - 1, i, readOnlyColor);
+        break;
+
+    case HotState:
+        // Draw a triangle in the upper left corner of the control.
+        triangle(m_left,                 m_top,
+                 m_left + triangleSize,  m_top,
+                 m_left,                 m_top + triangleSize,    m_edgeColor);
+        break;
+
+    case HoverState:
+        // Draw a triangle in the upper right corner of the control.
+        triangle(m_right,                m_top,
+                 m_right,                m_top + triangleSize,
+                 m_right - triangleSize, m_top,                   m_edgeColor);
+        break;
+
+    case FocusedState:
+        // Draw a triangle in the bottom right corner of the control.
+        triangle(m_right,                m_bottom,
+                 m_right - triangleSize, m_bottom,
+                 m_right,                m_bottom - triangleSize, m_edgeColor);
+        break;
+
+    case PressedState:
+        // Draw a triangle in the bottom left corner of the control.
+        triangle(m_left,                 m_bottom,
+                 m_left,                 m_bottom - triangleSize,
+                 m_left + triangleSize,  m_bottom,                m_edgeColor);
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        CRASH();
+        break;
+    }
+}
+
+void WebThemeControlDRTWin::draw()
+{
+    int halfWidth = m_width / 2;
+    int halfHeight = m_height / 2;
+    int quarterWidth = m_width / 4;
+    int quarterHeight = m_height / 4;
+
+    // Indent amounts for the check in a checkbox or radio button.
+    const int checkIndent = 3;
+
+    // Indent amounts for short and long sides of the scrollbar notches.
+    const int notchLongOffset = 1;
+    const int notchShortOffset = 4;
+    const int noOffset = 0;
+
+    // Indent amounts for the short and long sides of a scroll thumb box.
+    const int thumbLongIndent = 0;
+    const int thumbShortIndent = 2;
+
+    // Indents for the crosshatch on a scroll grip.
+    const int gripLongIndent = 3;
+    const int gripShortIndent = 5;
+
+    // Indents for the the slider track.
+    const int sliderIndent = 2;
+
+    m_canvas->beginPlatformPaint();
+
+    switch (m_type) {
+    case UnknownType:
+        ASSERT_NOT_REACHED();
+        CRASH();
+        break;
+
+    case TextFieldType:
+        // We render this by hand outside of this function.
+        ASSERT_NOT_REACHED();
+        CRASH();
+        break;
+
+    case PushButtonType:
+        // push buttons render as a rounded rectangle
+        roundRect(m_bgColor);
+        break;
+
+    case UncheckedBoxType:
+        // Unchecked boxes are simply plain boxes.
+        box(m_irect, m_bgColor);
+        break;
+
+    case CheckedBoxType:
+        nestedBoxes(checkIndent, checkIndent, checkIndent, checkIndent, m_bgColor, m_fgColor);
+        break;
+
+    case IndeterminateCheckboxType:
+        // Indeterminate checkbox is a box containing '-'.
+        nestedBoxes(checkIndent, halfHeight, checkIndent, halfHeight, m_bgColor, m_fgColor);
+        break;
+
+    case UncheckedRadioType:
+        circle(SkIntToScalar(halfHeight), m_bgColor);
+        break;
+
+    case CheckedRadioType:
+        circle(SkIntToScalar(halfHeight), m_bgColor);
+        circle(SkIntToScalar(halfHeight - checkIndent), m_fgColor);
+        break;
+
+    case HorizontalScrollTrackBackType: {
+        // Draw a box with a notch at the left.
+        int longOffset = halfHeight - notchLongOffset;
+        int shortOffset = m_width - notchShortOffset;
+        nestedBoxes(noOffset, longOffset, shortOffset, longOffset, m_bgColor, m_edgeColor);
+        break;
+    }
+
+    case HorizontalScrollTrackForwardType: {
+        // Draw a box with a notch at the right.
+        int longOffset  = halfHeight - notchLongOffset;
+        int shortOffset = m_width - notchShortOffset;
+        nestedBoxes(shortOffset, longOffset, noOffset, longOffset, m_bgColor, m_fgColor);
+        break;
+    }
+
+    case VerticalScrollTrackBackType: {
+        // Draw a box with a notch at the top.
+        int longOffset  = halfWidth - notchLongOffset;
+        int shortOffset = m_height - notchShortOffset;
+        nestedBoxes(longOffset, noOffset, longOffset, shortOffset, m_bgColor, m_fgColor);
+        break;
+    }
+
+    case VerticalScrollTrackForwardType: {
+        // Draw a box with a notch at the bottom.
+        int longOffset  = halfWidth - notchLongOffset;
+        int shortOffset = m_height - notchShortOffset;
+        nestedBoxes(longOffset, shortOffset, longOffset, noOffset, m_bgColor, m_fgColor);
+        break;
+    }
+
+    case HorizontalScrollThumbType:
+        // Draw a narrower box on top of the outside box.
+        nestedBoxes(thumbLongIndent, thumbShortIndent, thumbLongIndent, thumbShortIndent, m_bgColor, m_bgColor);
+        break;
+
+    case VerticalScrollThumbType:
+        // Draw a shorter box on top of the outside box.
+        nestedBoxes(thumbShortIndent, thumbLongIndent, thumbShortIndent, thumbLongIndent, m_bgColor, m_bgColor);
+        break;
+
+    case HorizontalSliderThumbType:
+        // Slider thumbs are ovals.
+        oval(m_bgColor);
+        break;
+
+    case HorizontalScrollGripType: {
+        // Draw a horizontal crosshatch for the grip.
+        int longOffset = halfWidth - gripLongIndent;
+        line(m_left  + gripLongIndent, m_top    + halfHeight,
+             m_right - gripLongIndent, m_top    + halfHeight,      m_fgColor);
+        line(m_left  + longOffset,     m_top    + gripShortIndent,
+             m_left  + longOffset,     m_bottom - gripShortIndent, m_fgColor);
+        line(m_right - longOffset,     m_top    + gripShortIndent,
+             m_right - longOffset,     m_bottom - gripShortIndent, m_fgColor);
+        break;
+    }
+
+    case VerticalScrollGripType: {
+        // Draw a vertical crosshatch for the grip.
+        int longOffset = halfHeight - gripLongIndent;
+        line(m_left  + halfWidth,       m_top    + gripLongIndent,
+             m_left  + halfWidth,       m_bottom - gripLongIndent, m_fgColor);
+        line(m_left  + gripShortIndent, m_top    + longOffset,
+             m_right - gripShortIndent, m_top    + longOffset,     m_fgColor);
+        line(m_left  + gripShortIndent, m_bottom - longOffset,
+             m_right - gripShortIndent, m_bottom - longOffset,     m_fgColor);
+        break;
+    }
+
+    case LeftArrowType:
+        // Draw a left arrow inside a box.
+        box(m_irect, m_bgColor);
+        triangle(m_right - quarterWidth, m_top    + quarterHeight,
+                 m_right - quarterWidth, m_bottom - quarterHeight,
+                 m_left  + quarterWidth, m_top    + halfHeight,    m_fgColor);
+        break;
+
+    case RightArrowType:
+        // Draw a left arrow inside a box.
+        box(m_irect, m_bgColor);
+        triangle(m_left  + quarterWidth, m_top    + quarterHeight,
+                 m_right - quarterWidth, m_top    + halfHeight,
+                 m_left  + quarterWidth, m_bottom - quarterHeight, m_fgColor);
+        break;
+
+    case UpArrowType:
+        // Draw an up arrow inside a box.
+        box(m_irect, m_bgColor);
+        triangle(m_left  + quarterWidth, m_bottom - quarterHeight,
+                 m_left  + halfWidth,    m_top    + quarterHeight,
+                 m_right - quarterWidth, m_bottom - quarterHeight, m_fgColor);
+        break;
+
+    case DownArrowType:
+        // Draw a down arrow inside a box.
+        box(m_irect, m_bgColor);
+        triangle(m_left  + quarterWidth, m_top    + quarterHeight,
+                 m_right - quarterWidth, m_top    + quarterHeight,
+                 m_left  + halfWidth,    m_bottom - quarterHeight, m_fgColor);
+        break;
+
+    case HorizontalSliderTrackType: {
+        // Draw a narrow rect for the track plus box hatches on the ends.
+        SkIRect lirect;
+        lirect = m_irect;
+        lirect.inset(noOffset, halfHeight - sliderIndent);
+        box(lirect, m_bgColor);
+        line(m_left,  m_top, m_left,  m_bottom, m_edgeColor);
+        line(m_right, m_top, m_right, m_bottom, m_edgeColor);
+        break;
+    }
+
+    case DropDownButtonType:
+        // Draw a box with a big down arrow on top.
+        box(m_irect, m_bgColor);
+        triangle(m_left  + quarterWidth, m_top,
+                 m_right - quarterWidth, m_top,
+                 m_left  + halfWidth,    m_bottom, m_fgColor);
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        CRASH();
+        break;
+    }
+
+    markState();
+    m_canvas->endPlatformPaint();
+}
+
+// Because rendering a text field is dependent on input
+// parameters the other controls don't have, we render it directly
+// rather than trying to overcomplicate draw() further.
+void WebThemeControlDRTWin::drawTextField(bool drawEdges, bool fillContentArea, SkColor color)
+{
+    SkPaint paint;
+
+    m_canvas->beginPlatformPaint();
+    if (fillContentArea) {
+        paint.setColor(color);
+        paint.setStyle(SkPaint::kFill_Style);
+        m_canvas->drawIRect(m_irect, paint);
+    }
+    if (drawEdges) {
+        paint.setColor(m_edgeColor);
+        paint.setStyle(SkPaint::kStroke_Style);
+        m_canvas->drawIRect(m_irect, paint);
+    }
+
+    markState();
+    m_canvas->endPlatformPaint();
+}
+
+void WebThemeControlDRTWin::drawProgressBar(const SkIRect& fillRect)
+{
+    SkPaint paint;
+
+    m_canvas->beginPlatformPaint();
+    paint.setColor(m_bgColor);
+    paint.setStyle(SkPaint::kFill_Style);
+    m_canvas->drawIRect(m_irect, paint);
+
+    // Emulate clipping
+    SkIRect tofill;
+    tofill.intersect(m_irect, fillRect);
+    paint.setColor(m_fgColor);
+    paint.setStyle(SkPaint::kFill_Style);
+    m_canvas->drawIRect(tofill, paint);
+
+    markState();
+    m_canvas->endPlatformPaint();
+}
+
diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h
new file mode 100644
index 0000000..4e22461
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// WebThemeControlDRTWin implements the generic rendering of controls
+// needed by WebThemeEngineDRTWin. See the comments in that class
+// header file for why this class is needed and used.
+//
+// This class implements a generic set of widgets using Skia. The widgets
+// are optimized for testability, not a pleasing appearance.
+//
+
+#ifndef WebThemeControlDRTWin_h
+#define WebThemeControlDRTWin_h
+
+#include "skia/ext/platform_canvas.h"
+#include "third_party/skia/include/core/SkColor.h"
+#include <wtf/Noncopyable.h>
+
+// Skia forward declarations
+struct SkIRect;
+
+class WebThemeControlDRTWin : public Noncopyable {
+public:
+    // This list of states mostly mirrors the list in WebCore/platform/ThemeTypes.h
+    // but is maintained separately since that isn't public and also to minimize
+    // dependencies.
+    // Note that the WebKit ThemeTypes seem to imply that a control can be
+    // in multiple states simultaneously but WebThemeEngine only allows for
+    // a single state at a time.
+    //
+    // Some definitions for the various states:
+    //   Disabled - indicates that a control can't be modified or selected
+    //              (corresponds to HTML 'disabled' attribute)
+    //   ReadOnly - indicates that a control can't be modified but can be
+    //              selected
+    //   Normal   - the normal state of control on the page when it isn't
+    //              focused or otherwise active
+    //   Hot      - when the mouse is hovering over a part of the control,
+    //              all the other parts are considered "hot"
+    //   Hover    - when the mouse is directly over a control (the CSS
+    //               :hover pseudo-class)
+    //   Focused  - when the control has the keyboard focus
+    //   Pressed  - when the control is being triggered (by a mousedown or
+    //              a key event).
+    //   Indeterminate - when set to indeterminate (only for progress bar)
+    enum State {
+        UnknownState = 0,
+        DisabledState,
+        ReadOnlyState,
+        NormalState,
+        HotState,
+        HoverState,
+        FocusedState,
+        PressedState,
+        IndeterminateState
+    };
+
+    // This list of types mostly mirrors the list in
+    // WebCore/platform/ThemeTypes.h but is maintained
+    // separately since that isn't public and also to minimize dependencies.
+    //
+    // Note that what the user might think of as a single control can be
+    // made up of multiple parts. For example, a single scroll bar contains
+    // six clickable parts - two arrows, the "thumb" indicating the current
+    // position on the bar, the other two parts of the bar (before and after
+    // the thumb) and the "gripper" on the thumb itself.
+    //
+    enum Type {
+        UnknownType = 0,
+        TextFieldType,
+        PushButtonType,
+        UncheckedBoxType,
+        CheckedBoxType,
+        IndeterminateCheckboxType,
+        UncheckedRadioType,
+        CheckedRadioType,
+        HorizontalScrollTrackBackType,
+        HorizontalScrollTrackForwardType,
+        HorizontalScrollThumbType,
+        HorizontalScrollGripType,
+        VerticalScrollTrackBackType,
+        VerticalScrollTrackForwardType,
+        VerticalScrollThumbType,
+        VerticalScrollGripType,
+        LeftArrowType,
+        RightArrowType,
+        UpArrowType,
+        DownArrowType,
+        HorizontalSliderTrackType,
+        HorizontalSliderThumbType,
+        DropDownButtonType,
+        ProgressBarType
+    };
+
+    // canvas is the canvas to draw onto, and rect gives the size of the
+    // control. ctype and cstate specify the type and state of the control.
+    WebThemeControlDRTWin(skia::PlatformCanvas* canvas,
+                          const SkIRect& rect,
+                          Type ctype,
+                          State cstate);
+    ~WebThemeControlDRTWin();
+
+    // Draws the control.
+    void draw();
+
+    // Use this for TextField controls instead, because the logic
+    // for drawing them is dependent on what WebKit tells us to do.
+    // If drawEdges is true, draw an edge around the control. If
+    // fillContentArea is true, fill the content area with the given color.
+    void drawTextField(bool drawEdges, bool fillContentArea, SkColor color);
+
+    // Use this for drawing ProgressBar controls instead, since we
+    // need to know the rect to fill inside the bar.
+    void drawProgressBar(const SkIRect& fillRect);
+
+private:
+    // Draws a box of size specified by irect, filled with the given color.
+    // The box will have a border drawn in the default edge color.
+    void box(const SkIRect& irect, SkColor color);
+
+
+    // Draws a triangle of size specified by the three pairs of coordinates,
+    // filled with the given color. The box will have an edge drawn in the
+    // default edge color.
+    void triangle(int x0, int y0, int x1, int y1, int x2, int y2, SkColor color);
+
+    // Draws a rectangle the size of the control with rounded corners, filled
+    // with the specified color (and with a border in the default edge color).
+    void roundRect(SkColor color);
+
+    // Draws an oval the size of the control, filled with the specified color
+    // and with a border in the default edge color.
+    void oval(SkColor color);
+
+    // Draws a circle centered in the control with the specified radius,
+    // filled with the specified color, and with a border draw in the
+    // default edge color.
+    void circle(SkScalar radius, SkColor color);
+
+    // Draws a box the size of the control, filled with the outerColor and
+    // with a border in the default edge color, and then draws another box
+    // indented on all four sides by the specified amounts, filled with the
+    // inner color and with a border in the default edge color.
+    void nestedBoxes(int indentLeft,
+                     int indentTop,
+                     int indentRight,
+                     int indentBottom,
+                     SkColor outerColor,
+                     SkColor innerColor);
+
+    // Draws a line between the two points in the given color.
+    void line(int x0, int y0, int x1, int y1, SkColor color);
+
+    // Draws a distinctive mark on the control for each state, so that the
+    // state of the control can be determined without needing to know which
+    // color is which.
+    void markState();
+
+    skia::PlatformCanvas* m_canvas;
+    const SkIRect m_irect;
+    const Type m_type;
+    const State m_state;
+    const SkColor m_edgeColor;
+    const SkColor m_bgColor;
+    const SkColor m_fgColor;
+
+    // The following are convenience accessors for m_irect.
+    const int m_left;
+    const int m_right;
+    const int m_top;
+    const int m_bottom;
+    const int m_width;
+    const int m_height;
+};
+
+#endif // WebThemeControlDRTWin_h
diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp b/Tools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp
deleted file mode 100755
index 6a8af81..0000000
--- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRT.cpp
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "WebThemeEngineDRT.h"
-
-#include "WebRect.h"
-#include "WebThemeControlDRT.h"
-#include "third_party/skia/include/core/SkRect.h"
-
-// Although all this code is generic, we include these headers
-// to pull in the Windows #defines for the parts and states of
-// the controls.
-#include <vsstyle.h>
-#include <windows.h>
-
-#include <wtf/Assertions.h>
-
-using namespace WebKit;
-
-// We define this for clarity, although there really should be a DFCS_NORMAL in winuser.h.
-static const int dfcsNormal = 0x0000;
-
-static SkIRect webRectToSkIRect(const WebRect& webRect)
-{
-    SkIRect irect;
-    irect.set(webRect.x, webRect.y, webRect.x + webRect.width, webRect.y + webRect.height);
-    return irect;
-}
-
-static void drawControl(WebCanvas* canvas,
-                        const WebRect& rect,
-                        WebThemeControlDRT::Type ctype,
-                        WebThemeControlDRT::State cstate)
-{
-    WebThemeControlDRT control(canvas, webRectToSkIRect(rect), ctype, cstate);
-    control.draw();
-}
-
-static void drawTextField(WebCanvas* canvas,
-                          const WebRect& rect,
-                          WebThemeControlDRT::Type ctype,
-                          WebThemeControlDRT::State cstate,
-                          bool drawEdges,
-                          bool fillContentArea,
-                          WebColor color)
-{
-    WebThemeControlDRT control(canvas, webRectToSkIRect(rect), ctype, cstate);
-    control.drawTextField(drawEdges, fillContentArea, color);
-}
-
-static void drawProgressBar(WebCanvas* canvas,
-                            WebThemeControlDRT::Type ctype,
-                            WebThemeControlDRT::State cstate,
-                            const WebRect& barRect,
-                            const WebRect& fillRect)
-{
-    WebThemeControlDRT control(canvas, webRectToSkIRect(barRect), ctype, cstate);
-    control.drawProgressBar(webRectToSkIRect(fillRect));
-}
-
-// WebThemeEngineDRT
-
-void WebThemeEngineDRT::paintButton(WebCanvas* canvas,
-                                    int part,
-                                    int state,
-                                    int classicState,
-                                    const WebRect& rect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    if (part == BP_CHECKBOX) {
-        switch (state) {
-        case CBS_UNCHECKEDNORMAL:
-            ASSERT(classicState == dfcsNormal);
-            ctype = WebThemeControlDRT::UncheckedBoxType;
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case CBS_UNCHECKEDHOT:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
-            ctype = WebThemeControlDRT::UncheckedBoxType;
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case CBS_UNCHECKEDPRESSED:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
-            ctype = WebThemeControlDRT::UncheckedBoxType;
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case CBS_UNCHECKEDDISABLED:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
-            ctype = WebThemeControlDRT::UncheckedBoxType;
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        case CBS_CHECKEDNORMAL:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED));
-            ctype = WebThemeControlDRT::CheckedBoxType;
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case CBS_CHECKEDHOT:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT));
-            ctype = WebThemeControlDRT::CheckedBoxType;
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case CBS_CHECKEDPRESSED:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED));
-            ctype = WebThemeControlDRT::CheckedBoxType;
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case CBS_CHECKEDDISABLED:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE));
-            ctype = WebThemeControlDRT::CheckedBoxType;
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        case CBS_MIXEDNORMAL:
-            // Classic theme can't represent mixed state checkbox. We assume
-            // it's equivalent to unchecked.
-            ASSERT(classicState == DFCS_BUTTONCHECK);
-            ctype = WebThemeControlDRT::IndeterminateCheckboxType;
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case CBS_MIXEDHOT:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
-            ctype = WebThemeControlDRT::IndeterminateCheckboxType;
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case CBS_MIXEDPRESSED:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
-            ctype = WebThemeControlDRT::IndeterminateCheckboxType;
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case CBS_MIXEDDISABLED:
-            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
-            ctype = WebThemeControlDRT::IndeterminateCheckboxType;
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        default:
-            ASSERT_NOT_REACHED();
-            break;
-        }
-    } else if (BP_RADIOBUTTON == part) {
-        switch (state) {
-        case RBS_UNCHECKEDNORMAL:
-            ASSERT(classicState == DFCS_BUTTONRADIO);
-            ctype = WebThemeControlDRT::UncheckedRadioType;
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case RBS_UNCHECKEDHOT:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT));
-            ctype = WebThemeControlDRT::UncheckedRadioType;
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case RBS_UNCHECKEDPRESSED:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED));
-            ctype = WebThemeControlDRT::UncheckedRadioType;
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case RBS_UNCHECKEDDISABLED:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE));
-            ctype = WebThemeControlDRT::UncheckedRadioType;
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        case RBS_CHECKEDNORMAL:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED));
-            ctype = WebThemeControlDRT::CheckedRadioType;
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case RBS_CHECKEDHOT:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_HOT));
-            ctype = WebThemeControlDRT::CheckedRadioType;
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case RBS_CHECKEDPRESSED:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_PUSHED));
-            ctype = WebThemeControlDRT::CheckedRadioType;
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case RBS_CHECKEDDISABLED:
-            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_INACTIVE));
-            ctype = WebThemeControlDRT::CheckedRadioType;
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        default:
-            ASSERT_NOT_REACHED();
-            break;
-        }
-    } else if (BP_PUSHBUTTON == part) {
-        switch (state) {
-        case PBS_NORMAL:
-            ASSERT(classicState == DFCS_BUTTONPUSH);
-            ctype = WebThemeControlDRT::PushButtonType;
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case PBS_HOT:
-            ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT));
-            ctype = WebThemeControlDRT::PushButtonType;
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case PBS_PRESSED:
-            ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED));
-            ctype = WebThemeControlDRT::PushButtonType;
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case PBS_DISABLED:
-            ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE));
-            ctype = WebThemeControlDRT::PushButtonType;
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        case PBS_DEFAULTED:
-            ASSERT(classicState == DFCS_BUTTONPUSH);
-            ctype = WebThemeControlDRT::PushButtonType;
-            cstate = WebThemeControlDRT::FocusedState;
-            break;
-
-        default:
-            ASSERT_NOT_REACHED();
-            break;
-        }
-    } else {
-        ASSERT_NOT_REACHED();
-    }
-
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-
-void WebThemeEngineDRT::paintMenuList(WebCanvas* canvas,
-                                      int part,
-                                      int state,
-                                      int classicState,
-                                      const WebRect& rect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    if (CP_DROPDOWNBUTTON == part) {
-        ctype = WebThemeControlDRT::DropDownButtonType;
-        switch (state) {
-        case CBXS_NORMAL:
-            ASSERT(classicState == DFCS_MENUARROW);
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case CBXS_HOT:
-            ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT));
-            cstate = WebThemeControlDRT::HoverState;
-            break;
-
-        case CBXS_PRESSED:
-            ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED));
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        case CBXS_DISABLED:
-            ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE));
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        default:
-            CRASH();
-            break;
-        }
-    } else {
-        CRASH();
-    }
-
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-void WebThemeEngineDRT::paintScrollbarArrow(WebCanvas* canvas,
-                                            int state,
-                                            int classicState,
-                                            const WebRect& rect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    switch (state) {
-    case ABS_UPNORMAL:
-        ASSERT(classicState == DFCS_SCROLLUP);
-        ctype = WebThemeControlDRT::UpArrowType;
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case ABS_DOWNNORMAL:
-        ASSERT(classicState == DFCS_SCROLLDOWN);
-        ctype = WebThemeControlDRT::DownArrowType;
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case ABS_LEFTNORMAL:
-        ASSERT(classicState == DFCS_SCROLLLEFT);
-        ctype = WebThemeControlDRT::LeftArrowType;
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case ABS_RIGHTNORMAL:
-        ASSERT(classicState == DFCS_SCROLLRIGHT);
-        ctype = WebThemeControlDRT::RightArrowType;
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case ABS_UPHOT:
-        ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
-        ctype = WebThemeControlDRT::UpArrowType;
-        cstate = WebThemeControlDRT::HotState;
-        break;
-
-    case ABS_DOWNHOT:
-        ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
-        ctype = WebThemeControlDRT::DownArrowType;
-        cstate = WebThemeControlDRT::HotState;
-        break;
-
-    case ABS_LEFTHOT:
-        ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT));
-        ctype = WebThemeControlDRT::LeftArrowType;
-        cstate = WebThemeControlDRT::HotState;
-        break;
-
-    case ABS_RIGHTHOT:
-        ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT));
-        ctype = WebThemeControlDRT::RightArrowType;
-        cstate = WebThemeControlDRT::HotState;
-        break;
-
-    case ABS_UPHOVER:
-        ASSERT(classicState == DFCS_SCROLLUP);
-        ctype = WebThemeControlDRT::UpArrowType;
-        cstate = WebThemeControlDRT::HoverState;
-        break;
-
-    case ABS_DOWNHOVER:
-        ASSERT(classicState == DFCS_SCROLLDOWN);
-        ctype = WebThemeControlDRT::DownArrowType;
-        cstate = WebThemeControlDRT::HoverState;
-        break;
-
-    case ABS_LEFTHOVER:
-        ASSERT(classicState == DFCS_SCROLLLEFT);
-        ctype = WebThemeControlDRT::LeftArrowType;
-        cstate = WebThemeControlDRT::HoverState;
-        break;
-
-    case ABS_RIGHTHOVER:
-        ASSERT(classicState == DFCS_SCROLLRIGHT);
-        ctype = WebThemeControlDRT::RightArrowType;
-        cstate = WebThemeControlDRT::HoverState;
-        break;
-
-    case ABS_UPPRESSED:
-        ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT));
-        ctype = WebThemeControlDRT::UpArrowType;
-        cstate = WebThemeControlDRT::PressedState;
-        break;
-
-    case ABS_DOWNPRESSED:
-        ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT));
-        ctype = WebThemeControlDRT::DownArrowType;
-        cstate = WebThemeControlDRT::PressedState;
-        break;
-
-    case ABS_LEFTPRESSED:
-        ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT));
-        ctype = WebThemeControlDRT::LeftArrowType;
-        cstate = WebThemeControlDRT::PressedState;
-        break;
-
-    case ABS_RIGHTPRESSED:
-        ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT));
-        ctype = WebThemeControlDRT::RightArrowType;
-        cstate = WebThemeControlDRT::PressedState;
-        break;
-
-    case ABS_UPDISABLED:
-        ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
-        ctype = WebThemeControlDRT::UpArrowType;
-        cstate = WebThemeControlDRT::DisabledState;
-        break;
-
-    case ABS_DOWNDISABLED:
-        ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
-        ctype = WebThemeControlDRT::DownArrowType;
-        cstate = WebThemeControlDRT::DisabledState;
-        break;
-
-    case ABS_LEFTDISABLED:
-        ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE));
-        ctype = WebThemeControlDRT::LeftArrowType;
-        cstate = WebThemeControlDRT::DisabledState;
-        break;
-
-    case ABS_RIGHTDISABLED:
-        ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE));
-        ctype = WebThemeControlDRT::RightArrowType;
-        cstate = WebThemeControlDRT::DisabledState;
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-void WebThemeEngineDRT::paintScrollbarThumb(WebCanvas* canvas,
-                                            int part,
-                                            int state,
-                                            int classicState,
-                                            const WebRect& rect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    switch (part) {
-    case SBP_THUMBBTNHORZ:
-        ctype = WebThemeControlDRT::HorizontalScrollThumbType;
-        break;
-
-    case SBP_THUMBBTNVERT:
-        ctype = WebThemeControlDRT::VerticalScrollThumbType;
-        break;
-
-    case SBP_GRIPPERHORZ:
-        ctype = WebThemeControlDRT::HorizontalScrollGripType;
-        break;
-
-    case SBP_GRIPPERVERT:
-        ctype = WebThemeControlDRT::VerticalScrollGripType;
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    switch (state) {
-    case SCRBS_NORMAL:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case SCRBS_HOT:
-        ASSERT(classicState == DFCS_HOT);
-        cstate = WebThemeControlDRT::HotState;
-        break;
-
-    case SCRBS_HOVER:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::HoverState;
-        break;
-
-    case SCRBS_PRESSED:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::PressedState;
-        break;
-
-    case SCRBS_DISABLED:
-        ASSERT_NOT_REACHED(); // This should never happen in practice.
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-void WebThemeEngineDRT::paintScrollbarTrack(WebCanvas* canvas,
-                                            int part,
-                                            int state,
-                                            int classicState,
-                                            const WebRect& rect,
-                                            const WebRect& alignRect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    switch (part) {
-    case SBP_UPPERTRACKHORZ:
-        ctype = WebThemeControlDRT::HorizontalScrollTrackBackType;
-        break;
-
-    case SBP_LOWERTRACKHORZ:
-        ctype = WebThemeControlDRT::HorizontalScrollTrackForwardType;
-        break;
-
-    case SBP_UPPERTRACKVERT:
-        ctype = WebThemeControlDRT::VerticalScrollTrackBackType;
-        break;
-
-    case SBP_LOWERTRACKVERT:
-        ctype = WebThemeControlDRT::VerticalScrollTrackForwardType;
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    switch (state) {
-    case SCRBS_NORMAL:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case SCRBS_HOT:
-        ASSERT_NOT_REACHED(); // This should never happen in practice.
-        break;
-
-    case SCRBS_HOVER:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::HoverState;
-        break;
-
-    case SCRBS_PRESSED:
-        ASSERT_NOT_REACHED(); // This should never happen in practice.
-        break;
-
-    case SCRBS_DISABLED:
-        ASSERT(classicState == DFCS_INACTIVE);
-        cstate = WebThemeControlDRT::DisabledState;
-        break;
-
-    default:
-        CRASH();
-        break;
-    }
-
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-void WebThemeEngineDRT::paintSpinButton(WebCanvas* canvas,
-                                        int part,
-                                        int state,
-                                        int classicState,
-                                        const WebRect& rect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    if (part == SPNP_UP) {
-        ctype = WebThemeControlDRT::UpArrowType;
-        switch (state) {
-        case UPS_NORMAL:
-            ASSERT(classicState == DFCS_SCROLLUP);
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-        case UPS_DISABLED:
-            ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-        case UPS_PRESSED:
-            ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED));
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-        case UPS_HOT:
-            ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
-            cstate = WebThemeControlDRT::HoverState;
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-        }
-    } else if (part == SPNP_DOWN) {
-        ctype = WebThemeControlDRT::DownArrowType;
-        switch (state) {
-        case DNS_NORMAL:
-            ASSERT(classicState == DFCS_SCROLLDOWN);
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-        case DNS_DISABLED:
-            ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-        case DNS_PRESSED:
-            ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED));
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-        case DNS_HOT:
-            ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
-            cstate = WebThemeControlDRT::HoverState;
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-        }
-    } else
-        ASSERT_NOT_REACHED();
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-void WebThemeEngineDRT::paintTextField(WebCanvas* canvas,
-                                       int part,
-                                       int state,
-                                       int classicState,
-                                       const WebRect& rect,
-                                       WebColor color,
-                                       bool fillContentArea,
-                                       bool drawEdges)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    ASSERT(EP_EDITTEXT == part);
-    ctype = WebThemeControlDRT::TextFieldType;
-
-    switch (state) {
-    case ETS_NORMAL:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::NormalState;
-        break;
-
-    case ETS_HOT:
-        ASSERT(classicState == DFCS_HOT);
-        cstate = WebThemeControlDRT::HotState;
-        break;
-
-    case ETS_DISABLED:
-        ASSERT(classicState == DFCS_INACTIVE);
-        cstate = WebThemeControlDRT::DisabledState;
-        break;
-
-    case ETS_SELECTED:
-        ASSERT(classicState == DFCS_PUSHED);
-        cstate = WebThemeControlDRT::PressedState;
-        break;
-
-    case ETS_FOCUSED:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::FocusedState;
-        break;
-
-    case ETS_READONLY:
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::ReadOnlyState;
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color);
-}
-
-void WebThemeEngineDRT::paintTrackbar(WebCanvas* canvas,
-                                      int part,
-                                      int state,
-                                      int classicState,
-                                      const WebRect& rect)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::UnknownType;
-    WebThemeControlDRT::State cstate = WebThemeControlDRT::UnknownState;
-
-    if (TKP_THUMBBOTTOM == part) {
-        ctype = WebThemeControlDRT::HorizontalSliderThumbType;
-        switch (state) {
-        case TUS_NORMAL:
-            ASSERT(classicState == dfcsNormal);
-            cstate = WebThemeControlDRT::NormalState;
-            break;
-
-        case TUS_HOT:
-            ASSERT(classicState == DFCS_HOT);
-            cstate = WebThemeControlDRT::HotState;
-            break;
-
-        case TUS_DISABLED:
-            ASSERT(classicState == DFCS_INACTIVE);
-            cstate = WebThemeControlDRT::DisabledState;
-            break;
-
-        case TUS_PRESSED:
-            ASSERT(classicState == DFCS_PUSHED);
-            cstate = WebThemeControlDRT::PressedState;
-            break;
-
-        default:
-            ASSERT_NOT_REACHED();
-            break;
-        }
-    } else if (TKP_TRACK == part) {
-        ctype = WebThemeControlDRT::HorizontalSliderTrackType;
-        ASSERT(part == TUS_NORMAL);
-        ASSERT(classicState == dfcsNormal);
-        cstate = WebThemeControlDRT::NormalState;
-    } else {
-        ASSERT_NOT_REACHED();
-    }
-
-    drawControl(canvas, rect, ctype, cstate);
-}
-
-
-void WebThemeEngineDRT::paintProgressBar(WebKit::WebCanvas* canvas,
-                                         const WebKit::WebRect& barRect,
-                                         const WebKit::WebRect& valueRect,
-                                         bool determinate,
-                                         double)
-{
-    WebThemeControlDRT::Type ctype = WebThemeControlDRT::ProgressBarType;
-    WebThemeControlDRT::State cstate = determinate ? WebThemeControlDRT::NormalState 
-                                                   : WebThemeControlDRT::IndeterminateState;
-    drawProgressBar(canvas, ctype, cstate, barRect, valueRect);
-}
-
diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRT.h b/Tools/DumpRenderTree/chromium/WebThemeEngineDRT.h
deleted file mode 100644
index e50886b..0000000
--- a/Tools/DumpRenderTree/chromium/WebThemeEngineDRT.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This implements the WebThemeEngine API used by the Windows version of
-// Chromium to render native form controls like checkboxes, radio buttons,
-// and scroll bars.
-// The normal implementation (native_theme) renders the controls using either
-// the UXTheme theming engine present in XP, Vista, and Win 7, or the "classic"
-// theme used if that theme is selected in the Desktop settings.
-// Unfortunately, both of these themes render controls differently on the
-// different versions of Windows.
-//
-// In order to ensure maximum consistency of baselines across the different
-// Windows versions, we provide a simple implementation for DRT here
-// instead. These controls are actually platform-independent (they're rendered
-// using Skia) and could be used on Linux and the Mac as well, should we
-// choose to do so at some point.
-//
-
-#ifndef WebThemeEngineDRT_h
-#define WebThemeEngineDRT_h
-
-#include "win/WebThemeEngine.h"
-#include <wtf/Noncopyable.h>
-
-class WebThemeEngineDRT : public WebKit::WebThemeEngine, public Noncopyable {
-public:
-    WebThemeEngineDRT() {}
-
-    // WebThemeEngine methods:
-    virtual void paintButton(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&);
-
-    virtual void paintMenuList(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&);
-
-    virtual void paintScrollbarArrow(
-        WebKit::WebCanvas*, int state, int classicState,
-        const WebKit::WebRect&);
-
-    virtual void paintScrollbarThumb(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&);
-
-    virtual void paintScrollbarTrack(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&, const WebKit::WebRect& alignRect);
-
-    virtual void paintSpinButton(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&);
-
-    virtual void paintTextField(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&, WebKit::WebColor, bool fillContentArea,
-        bool drawEdges);
-
-    virtual void paintTrackbar(
-        WebKit::WebCanvas*, int part, int state, int classicState,
-        const WebKit::WebRect&);
-
-    virtual void paintProgressBar(
-        WebKit::WebCanvas*, const WebKit::WebRect& barRect,
-        const WebKit::WebRect& valueRect,
-        bool determinate, double time);
-};
-
-#endif // WebThemeEngineDRT_h
diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp
new file mode 100755
index 0000000..103b295
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.cpp
@@ -0,0 +1,758 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebThemeEngineDRTWin.h"
+
+#include "WebRect.h"
+#include "WebThemeControlDRTWin.h"
+#include "third_party/skia/include/core/SkRect.h"
+
+// Although all this code is generic, we include these headers
+// to pull in the Windows #defines for the parts and states of
+// the controls.
+#include <vsstyle.h>
+#include <windows.h>
+
+#include <wtf/Assertions.h>
+
+using namespace WebKit;
+
+// We define this for clarity, although there really should be a DFCS_NORMAL in winuser.h.
+static const int dfcsNormal = 0x0000;
+
+static SkIRect webRectToSkIRect(const WebRect& webRect)
+{
+    SkIRect irect;
+    irect.set(webRect.x, webRect.y, webRect.x + webRect.width, webRect.y + webRect.height);
+    return irect;
+}
+
+static void drawControl(WebCanvas* canvas,
+                        const WebRect& rect,
+                        WebThemeControlDRTWin::Type ctype,
+                        WebThemeControlDRTWin::State cstate)
+{
+    WebThemeControlDRTWin control(canvas, webRectToSkIRect(rect), ctype, cstate);
+    control.draw();
+}
+
+static void drawTextField(WebCanvas* canvas,
+                          const WebRect& rect,
+                          WebThemeControlDRTWin::Type ctype,
+                          WebThemeControlDRTWin::State cstate,
+                          bool drawEdges,
+                          bool fillContentArea,
+                          WebColor color)
+{
+    WebThemeControlDRTWin control(canvas, webRectToSkIRect(rect), ctype, cstate);
+    control.drawTextField(drawEdges, fillContentArea, color);
+}
+
+static void drawProgressBar(WebCanvas* canvas,
+                            WebThemeControlDRTWin::Type ctype,
+                            WebThemeControlDRTWin::State cstate,
+                            const WebRect& barRect,
+                            const WebRect& fillRect)
+{
+    WebThemeControlDRTWin control(canvas, webRectToSkIRect(barRect), ctype, cstate);
+    control.drawProgressBar(webRectToSkIRect(fillRect));
+}
+
+// WebThemeEngineDRTWin
+
+void WebThemeEngineDRTWin::paintButton(WebCanvas* canvas,
+                                       int part,
+                                       int state,
+                                       int classicState,
+                                       const WebRect& rect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    if (part == BP_CHECKBOX) {
+        switch (state) {
+        case CBS_UNCHECKEDNORMAL:
+            ASSERT(classicState == dfcsNormal);
+            ctype = WebThemeControlDRTWin::UncheckedBoxType;
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case CBS_UNCHECKEDHOT:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
+            ctype = WebThemeControlDRTWin::UncheckedBoxType;
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case CBS_UNCHECKEDPRESSED:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
+            ctype = WebThemeControlDRTWin::UncheckedBoxType;
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case CBS_UNCHECKEDDISABLED:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
+            ctype = WebThemeControlDRTWin::UncheckedBoxType;
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        case CBS_CHECKEDNORMAL:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED));
+            ctype = WebThemeControlDRTWin::CheckedBoxType;
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case CBS_CHECKEDHOT:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT));
+            ctype = WebThemeControlDRTWin::CheckedBoxType;
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case CBS_CHECKEDPRESSED:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_PUSHED));
+            ctype = WebThemeControlDRTWin::CheckedBoxType;
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case CBS_CHECKEDDISABLED:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE));
+            ctype = WebThemeControlDRTWin::CheckedBoxType;
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        case CBS_MIXEDNORMAL:
+            // Classic theme can't represent mixed state checkbox. We assume
+            // it's equivalent to unchecked.
+            ASSERT(classicState == DFCS_BUTTONCHECK);
+            ctype = WebThemeControlDRTWin::IndeterminateCheckboxType;
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case CBS_MIXEDHOT:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_HOT));
+            ctype = WebThemeControlDRTWin::IndeterminateCheckboxType;
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case CBS_MIXEDPRESSED:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_PUSHED));
+            ctype = WebThemeControlDRTWin::IndeterminateCheckboxType;
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case CBS_MIXEDDISABLED:
+            ASSERT(classicState == (DFCS_BUTTONCHECK | DFCS_INACTIVE));
+            ctype = WebThemeControlDRTWin::IndeterminateCheckboxType;
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        default:
+            ASSERT_NOT_REACHED();
+            break;
+        }
+    } else if (BP_RADIOBUTTON == part) {
+        switch (state) {
+        case RBS_UNCHECKEDNORMAL:
+            ASSERT(classicState == DFCS_BUTTONRADIO);
+            ctype = WebThemeControlDRTWin::UncheckedRadioType;
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case RBS_UNCHECKEDHOT:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_HOT));
+            ctype = WebThemeControlDRTWin::UncheckedRadioType;
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case RBS_UNCHECKEDPRESSED:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_PUSHED));
+            ctype = WebThemeControlDRTWin::UncheckedRadioType;
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case RBS_UNCHECKEDDISABLED:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_INACTIVE));
+            ctype = WebThemeControlDRTWin::UncheckedRadioType;
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        case RBS_CHECKEDNORMAL:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED));
+            ctype = WebThemeControlDRTWin::CheckedRadioType;
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case RBS_CHECKEDHOT:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_HOT));
+            ctype = WebThemeControlDRTWin::CheckedRadioType;
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case RBS_CHECKEDPRESSED:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_PUSHED));
+            ctype = WebThemeControlDRTWin::CheckedRadioType;
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case RBS_CHECKEDDISABLED:
+            ASSERT(classicState == (DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_INACTIVE));
+            ctype = WebThemeControlDRTWin::CheckedRadioType;
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        default:
+            ASSERT_NOT_REACHED();
+            break;
+        }
+    } else if (BP_PUSHBUTTON == part) {
+        switch (state) {
+        case PBS_NORMAL:
+            ASSERT(classicState == DFCS_BUTTONPUSH);
+            ctype = WebThemeControlDRTWin::PushButtonType;
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case PBS_HOT:
+            ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_HOT));
+            ctype = WebThemeControlDRTWin::PushButtonType;
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case PBS_PRESSED:
+            ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_PUSHED));
+            ctype = WebThemeControlDRTWin::PushButtonType;
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case PBS_DISABLED:
+            ASSERT(classicState == (DFCS_BUTTONPUSH | DFCS_INACTIVE));
+            ctype = WebThemeControlDRTWin::PushButtonType;
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        case PBS_DEFAULTED:
+            ASSERT(classicState == DFCS_BUTTONPUSH);
+            ctype = WebThemeControlDRTWin::PushButtonType;
+            cstate = WebThemeControlDRTWin::FocusedState;
+            break;
+
+        default:
+            ASSERT_NOT_REACHED();
+            break;
+        }
+    } else {
+        ASSERT_NOT_REACHED();
+    }
+
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+
+void WebThemeEngineDRTWin::paintMenuList(WebCanvas* canvas,
+                                         int part,
+                                         int state,
+                                         int classicState,
+                                         const WebRect& rect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    if (CP_DROPDOWNBUTTON == part) {
+        ctype = WebThemeControlDRTWin::DropDownButtonType;
+        switch (state) {
+        case CBXS_NORMAL:
+            ASSERT(classicState == DFCS_MENUARROW);
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case CBXS_HOT:
+            ASSERT(classicState == (DFCS_MENUARROW | DFCS_HOT));
+            cstate = WebThemeControlDRTWin::HoverState;
+            break;
+
+        case CBXS_PRESSED:
+            ASSERT(classicState == (DFCS_MENUARROW | DFCS_PUSHED));
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        case CBXS_DISABLED:
+            ASSERT(classicState == (DFCS_MENUARROW | DFCS_INACTIVE));
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        default:
+            CRASH();
+            break;
+        }
+    } else {
+        CRASH();
+    }
+
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+void WebThemeEngineDRTWin::paintScrollbarArrow(WebCanvas* canvas,
+                                               int state,
+                                               int classicState,
+                                               const WebRect& rect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    switch (state) {
+    case ABS_UPNORMAL:
+        ASSERT(classicState == DFCS_SCROLLUP);
+        ctype = WebThemeControlDRTWin::UpArrowType;
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case ABS_DOWNNORMAL:
+        ASSERT(classicState == DFCS_SCROLLDOWN);
+        ctype = WebThemeControlDRTWin::DownArrowType;
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case ABS_LEFTNORMAL:
+        ASSERT(classicState == DFCS_SCROLLLEFT);
+        ctype = WebThemeControlDRTWin::LeftArrowType;
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case ABS_RIGHTNORMAL:
+        ASSERT(classicState == DFCS_SCROLLRIGHT);
+        ctype = WebThemeControlDRTWin::RightArrowType;
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case ABS_UPHOT:
+        ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
+        ctype = WebThemeControlDRTWin::UpArrowType;
+        cstate = WebThemeControlDRTWin::HotState;
+        break;
+
+    case ABS_DOWNHOT:
+        ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
+        ctype = WebThemeControlDRTWin::DownArrowType;
+        cstate = WebThemeControlDRTWin::HotState;
+        break;
+
+    case ABS_LEFTHOT:
+        ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_HOT));
+        ctype = WebThemeControlDRTWin::LeftArrowType;
+        cstate = WebThemeControlDRTWin::HotState;
+        break;
+
+    case ABS_RIGHTHOT:
+        ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_HOT));
+        ctype = WebThemeControlDRTWin::RightArrowType;
+        cstate = WebThemeControlDRTWin::HotState;
+        break;
+
+    case ABS_UPHOVER:
+        ASSERT(classicState == DFCS_SCROLLUP);
+        ctype = WebThemeControlDRTWin::UpArrowType;
+        cstate = WebThemeControlDRTWin::HoverState;
+        break;
+
+    case ABS_DOWNHOVER:
+        ASSERT(classicState == DFCS_SCROLLDOWN);
+        ctype = WebThemeControlDRTWin::DownArrowType;
+        cstate = WebThemeControlDRTWin::HoverState;
+        break;
+
+    case ABS_LEFTHOVER:
+        ASSERT(classicState == DFCS_SCROLLLEFT);
+        ctype = WebThemeControlDRTWin::LeftArrowType;
+        cstate = WebThemeControlDRTWin::HoverState;
+        break;
+
+    case ABS_RIGHTHOVER:
+        ASSERT(classicState == DFCS_SCROLLRIGHT);
+        ctype = WebThemeControlDRTWin::RightArrowType;
+        cstate = WebThemeControlDRTWin::HoverState;
+        break;
+
+    case ABS_UPPRESSED:
+        ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED | DFCS_FLAT));
+        ctype = WebThemeControlDRTWin::UpArrowType;
+        cstate = WebThemeControlDRTWin::PressedState;
+        break;
+
+    case ABS_DOWNPRESSED:
+        ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED | DFCS_FLAT));
+        ctype = WebThemeControlDRTWin::DownArrowType;
+        cstate = WebThemeControlDRTWin::PressedState;
+        break;
+
+    case ABS_LEFTPRESSED:
+        ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_PUSHED | DFCS_FLAT));
+        ctype = WebThemeControlDRTWin::LeftArrowType;
+        cstate = WebThemeControlDRTWin::PressedState;
+        break;
+
+    case ABS_RIGHTPRESSED:
+        ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_PUSHED | DFCS_FLAT));
+        ctype = WebThemeControlDRTWin::RightArrowType;
+        cstate = WebThemeControlDRTWin::PressedState;
+        break;
+
+    case ABS_UPDISABLED:
+        ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
+        ctype = WebThemeControlDRTWin::UpArrowType;
+        cstate = WebThemeControlDRTWin::DisabledState;
+        break;
+
+    case ABS_DOWNDISABLED:
+        ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
+        ctype = WebThemeControlDRTWin::DownArrowType;
+        cstate = WebThemeControlDRTWin::DisabledState;
+        break;
+
+    case ABS_LEFTDISABLED:
+        ASSERT(classicState == (DFCS_SCROLLLEFT | DFCS_INACTIVE));
+        ctype = WebThemeControlDRTWin::LeftArrowType;
+        cstate = WebThemeControlDRTWin::DisabledState;
+        break;
+
+    case ABS_RIGHTDISABLED:
+        ASSERT(classicState == (DFCS_SCROLLRIGHT | DFCS_INACTIVE));
+        ctype = WebThemeControlDRTWin::RightArrowType;
+        cstate = WebThemeControlDRTWin::DisabledState;
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+void WebThemeEngineDRTWin::paintScrollbarThumb(WebCanvas* canvas,
+                                               int part,
+                                               int state,
+                                               int classicState,
+                                               const WebRect& rect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    switch (part) {
+    case SBP_THUMBBTNHORZ:
+        ctype = WebThemeControlDRTWin::HorizontalScrollThumbType;
+        break;
+
+    case SBP_THUMBBTNVERT:
+        ctype = WebThemeControlDRTWin::VerticalScrollThumbType;
+        break;
+
+    case SBP_GRIPPERHORZ:
+        ctype = WebThemeControlDRTWin::HorizontalScrollGripType;
+        break;
+
+    case SBP_GRIPPERVERT:
+        ctype = WebThemeControlDRTWin::VerticalScrollGripType;
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    switch (state) {
+    case SCRBS_NORMAL:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case SCRBS_HOT:
+        ASSERT(classicState == DFCS_HOT);
+        cstate = WebThemeControlDRTWin::HotState;
+        break;
+
+    case SCRBS_HOVER:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::HoverState;
+        break;
+
+    case SCRBS_PRESSED:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::PressedState;
+        break;
+
+    case SCRBS_DISABLED:
+        ASSERT_NOT_REACHED(); // This should never happen in practice.
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+void WebThemeEngineDRTWin::paintScrollbarTrack(WebCanvas* canvas,
+                                               int part,
+                                               int state,
+                                               int classicState,
+                                               const WebRect& rect,
+                                               const WebRect& alignRect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    switch (part) {
+    case SBP_UPPERTRACKHORZ:
+        ctype = WebThemeControlDRTWin::HorizontalScrollTrackBackType;
+        break;
+
+    case SBP_LOWERTRACKHORZ:
+        ctype = WebThemeControlDRTWin::HorizontalScrollTrackForwardType;
+        break;
+
+    case SBP_UPPERTRACKVERT:
+        ctype = WebThemeControlDRTWin::VerticalScrollTrackBackType;
+        break;
+
+    case SBP_LOWERTRACKVERT:
+        ctype = WebThemeControlDRTWin::VerticalScrollTrackForwardType;
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    switch (state) {
+    case SCRBS_NORMAL:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case SCRBS_HOT:
+        ASSERT_NOT_REACHED(); // This should never happen in practice.
+        break;
+
+    case SCRBS_HOVER:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::HoverState;
+        break;
+
+    case SCRBS_PRESSED:
+        ASSERT_NOT_REACHED(); // This should never happen in practice.
+        break;
+
+    case SCRBS_DISABLED:
+        ASSERT(classicState == DFCS_INACTIVE);
+        cstate = WebThemeControlDRTWin::DisabledState;
+        break;
+
+    default:
+        CRASH();
+        break;
+    }
+
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+void WebThemeEngineDRTWin::paintSpinButton(WebCanvas* canvas,
+                                           int part,
+                                           int state,
+                                           int classicState,
+                                           const WebRect& rect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    if (part == SPNP_UP) {
+        ctype = WebThemeControlDRTWin::UpArrowType;
+        switch (state) {
+        case UPS_NORMAL:
+            ASSERT(classicState == DFCS_SCROLLUP);
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+        case UPS_DISABLED:
+            ASSERT(classicState == (DFCS_SCROLLUP | DFCS_INACTIVE));
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+        case UPS_PRESSED:
+            ASSERT(classicState == (DFCS_SCROLLUP | DFCS_PUSHED));
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+        case UPS_HOT:
+            ASSERT(classicState == (DFCS_SCROLLUP | DFCS_HOT));
+            cstate = WebThemeControlDRTWin::HoverState;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    } else if (part == SPNP_DOWN) {
+        ctype = WebThemeControlDRTWin::DownArrowType;
+        switch (state) {
+        case DNS_NORMAL:
+            ASSERT(classicState == DFCS_SCROLLDOWN);
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+        case DNS_DISABLED:
+            ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_INACTIVE));
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+        case DNS_PRESSED:
+            ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_PUSHED));
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+        case DNS_HOT:
+            ASSERT(classicState == (DFCS_SCROLLDOWN | DFCS_HOT));
+            cstate = WebThemeControlDRTWin::HoverState;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    } else
+        ASSERT_NOT_REACHED();
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+void WebThemeEngineDRTWin::paintTextField(WebCanvas* canvas,
+                                          int part,
+                                          int state,
+                                          int classicState,
+                                          const WebRect& rect,
+                                          WebColor color,
+                                          bool fillContentArea,
+                                          bool drawEdges)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    ASSERT(EP_EDITTEXT == part);
+    ctype = WebThemeControlDRTWin::TextFieldType;
+
+    switch (state) {
+    case ETS_NORMAL:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::NormalState;
+        break;
+
+    case ETS_HOT:
+        ASSERT(classicState == DFCS_HOT);
+        cstate = WebThemeControlDRTWin::HotState;
+        break;
+
+    case ETS_DISABLED:
+        ASSERT(classicState == DFCS_INACTIVE);
+        cstate = WebThemeControlDRTWin::DisabledState;
+        break;
+
+    case ETS_SELECTED:
+        ASSERT(classicState == DFCS_PUSHED);
+        cstate = WebThemeControlDRTWin::PressedState;
+        break;
+
+    case ETS_FOCUSED:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::FocusedState;
+        break;
+
+    case ETS_READONLY:
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::ReadOnlyState;
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    drawTextField(canvas, rect, ctype, cstate, drawEdges, fillContentArea, color);
+}
+
+void WebThemeEngineDRTWin::paintTrackbar(WebCanvas* canvas,
+                                         int part,
+                                         int state,
+                                         int classicState,
+                                         const WebRect& rect)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::UnknownType;
+    WebThemeControlDRTWin::State cstate = WebThemeControlDRTWin::UnknownState;
+
+    if (TKP_THUMBBOTTOM == part) {
+        ctype = WebThemeControlDRTWin::HorizontalSliderThumbType;
+        switch (state) {
+        case TUS_NORMAL:
+            ASSERT(classicState == dfcsNormal);
+            cstate = WebThemeControlDRTWin::NormalState;
+            break;
+
+        case TUS_HOT:
+            ASSERT(classicState == DFCS_HOT);
+            cstate = WebThemeControlDRTWin::HotState;
+            break;
+
+        case TUS_DISABLED:
+            ASSERT(classicState == DFCS_INACTIVE);
+            cstate = WebThemeControlDRTWin::DisabledState;
+            break;
+
+        case TUS_PRESSED:
+            ASSERT(classicState == DFCS_PUSHED);
+            cstate = WebThemeControlDRTWin::PressedState;
+            break;
+
+        default:
+            ASSERT_NOT_REACHED();
+            break;
+        }
+    } else if (TKP_TRACK == part) {
+        ctype = WebThemeControlDRTWin::HorizontalSliderTrackType;
+        ASSERT(part == TUS_NORMAL);
+        ASSERT(classicState == dfcsNormal);
+        cstate = WebThemeControlDRTWin::NormalState;
+    } else {
+        ASSERT_NOT_REACHED();
+    }
+
+    drawControl(canvas, rect, ctype, cstate);
+}
+
+
+void WebThemeEngineDRTWin::paintProgressBar(WebKit::WebCanvas* canvas,
+                                            const WebKit::WebRect& barRect,
+                                            const WebKit::WebRect& valueRect,
+                                            bool determinate,
+                                            double)
+{
+    WebThemeControlDRTWin::Type ctype = WebThemeControlDRTWin::ProgressBarType;
+    WebThemeControlDRTWin::State cstate = determinate ? WebThemeControlDRTWin::NormalState
+                                                      : WebThemeControlDRTWin::IndeterminateState;
+    drawProgressBar(canvas, ctype, cstate, barRect, valueRect);
+}
+
diff --git a/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h
new file mode 100644
index 0000000..2e15cf8
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/WebThemeEngineDRTWin.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This implements the WebThemeEngine API used by the Windows version of
+// Chromium to render native form controls like checkboxes, radio buttons,
+// and scroll bars.
+// The normal implementation (native_theme) renders the controls using either
+// the UXTheme theming engine present in XP, Vista, and Win 7, or the "classic"
+// theme used if that theme is selected in the Desktop settings.
+// Unfortunately, both of these themes render controls differently on the
+// different versions of Windows.
+//
+// In order to ensure maximum consistency of baselines across the different
+// Windows versions, we provide a simple implementation for DRT here
+// instead. These controls are actually platform-independent (they're rendered
+// using Skia) and could be used on Linux and the Mac as well, should we
+// choose to do so at some point.
+//
+
+#ifndef WebThemeEngineDRTWin_h
+#define WebThemeEngineDRTWin_h
+
+#include "win/WebThemeEngine.h"
+#include <wtf/Noncopyable.h>
+
+class WebThemeEngineDRTWin : public WebKit::WebThemeEngine, public Noncopyable {
+public:
+    WebThemeEngineDRTWin() {}
+
+    // WebThemeEngine methods:
+    virtual void paintButton(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&);
+
+    virtual void paintMenuList(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&);
+
+    virtual void paintScrollbarArrow(
+        WebKit::WebCanvas*, int state, int classicState,
+        const WebKit::WebRect&);
+
+    virtual void paintScrollbarThumb(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&);
+
+    virtual void paintScrollbarTrack(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&, const WebKit::WebRect& alignRect);
+
+    virtual void paintSpinButton(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&);
+
+    virtual void paintTextField(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&, WebKit::WebColor, bool fillContentArea,
+        bool drawEdges);
+
+    virtual void paintTrackbar(
+        WebKit::WebCanvas*, int part, int state, int classicState,
+        const WebKit::WebRect&);
+
+    virtual void paintProgressBar(
+        WebKit::WebCanvas*, const WebKit::WebRect& barRect,
+        const WebKit::WebRect& valueRect,
+        bool determinate, double time);
+};
+
+#endif // WebThemeEngineDRTWin_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list