summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/SConscript.port2
-rw-r--r--webkit/build/WebCore/SConscript1
-rw-r--r--webkit/build/WebCore/WebCore.vcproj8
-rw-r--r--webkit/build/port/port.vcproj12
-rw-r--r--webkit/glue/webframe_impl.cc2
-rw-r--r--webkit/glue/webview_impl.cc2
-rw-r--r--webkit/port/rendering/RenderThemeWin.cpp624
-rw-r--r--webkit/port/rendering/RenderThemeWin.h136
8 files changed, 11 insertions, 776 deletions
diff --git a/webkit/SConscript.port b/webkit/SConscript.port
index 86a0e32..731c84c 100644
--- a/webkit/SConscript.port
+++ b/webkit/SConscript.port
@@ -116,8 +116,6 @@ if env.Bit('windows'):
'$PORT_DIR/platform/graphics/chromium/ThemeHelperChromiumWin.cpp',
'$PORT_DIR/platform/graphics/chromium/UniscribeHelper.cpp',
'$PORT_DIR/platform/graphics/chromium/UniscribeHelperTextRun.cpp',
-
- '$PORT_DIR/rendering/RenderThemeWin.cpp',
])
if env.Bit('linux'):
diff --git a/webkit/build/WebCore/SConscript b/webkit/build/WebCore/SConscript
index ab3abce..f5e748d 100644
--- a/webkit/build/WebCore/SConscript
+++ b/webkit/build/WebCore/SConscript
@@ -578,6 +578,7 @@ input_files = [
'$WEBCORE_DIR/rendering/RenderTextControl.cpp',
'$WEBCORE_DIR/rendering/RenderTextFragment.cpp',
'$WEBCORE_DIR/rendering/RenderTheme.cpp',
+ '$WEBCORE_DIR/rendering/RenderThemeChromiumWin.cpp',
'$WEBCORE_DIR/rendering/RenderTreeAsText.cpp',
'$WEBCORE_DIR/rendering/RenderVideo.cpp',
'$WEBCORE_DIR/rendering/RenderView.cpp',
diff --git a/webkit/build/WebCore/WebCore.vcproj b/webkit/build/WebCore/WebCore.vcproj
index 6b9303a..7f5732b 100644
--- a/webkit/build/WebCore/WebCore.vcproj
+++ b/webkit/build/WebCore/WebCore.vcproj
@@ -2998,6 +2998,14 @@
>
</File>
<File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\rendering\RenderThemeChromiumWin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\third_party\WebKit\WebCore\rendering\RenderThemeChromiumWin.h"
+ >
+ </File>
+ <File
RelativePath="..\..\..\third_party\WebKit\WebCore\rendering\RenderTreeAsText.cpp"
>
</File>
diff --git a/webkit/build/port/port.vcproj b/webkit/build/port/port.vcproj
index 1e278e0..5319a1e 100644
--- a/webkit/build/port/port.vcproj
+++ b/webkit/build/port/port.vcproj
@@ -1326,18 +1326,6 @@
</Filter>
</Filter>
<Filter
- Name="rendering"
- >
- <File
- RelativePath="..\..\port\rendering\RenderThemeWin.cpp"
- >
- </File>
- <File
- RelativePath="..\..\port\rendering\RenderThemeWin.h"
- >
- </File>
- </Filter>
- <Filter
Name="bridge"
>
<Filter
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 9f9dd1d..25cdce7 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -99,7 +99,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "PlatformContextSkia.h"
#include "RenderFrame.h"
#if defined(OS_WIN)
-#include "RenderThemeWin.h"
+#include "RenderThemeChromiumWin.h"
#endif
#include "RenderWidget.h"
#include "ReplaceSelectionCommand.h"
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 8a1aee6..59ffd3b 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -67,7 +67,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "PopupMenuChromium.h"
#include "PopupMenuClient.h"
#if defined(OS_WIN)
-#include "RenderThemeWin.h"
+#include "RenderThemeChromiumWin.h"
#endif
#include "RenderView.h"
#include "ResourceHandle.h"
diff --git a/webkit/port/rendering/RenderThemeWin.cpp b/webkit/port/rendering/RenderThemeWin.cpp
deleted file mode 100644
index 87d1606..0000000
--- a/webkit/port/rendering/RenderThemeWin.cpp
+++ /dev/null
@@ -1,624 +0,0 @@
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "RenderThemeWin.h"
-
-#include <windows.h>
-#include <uxtheme.h>
-#include <vssym32.h>
-
-#include "ChromiumBridge.h"
-#include "ChromiumUtilsWin.h"
-#include "CSSStyleSheet.h"
-#include "CSSValueKeywords.h"
-#include "Document.h"
-#include "FontSelector.h"
-#include "FontUtilsChromiumWin.h"
-#include "GraphicsContext.h"
-#include "ScrollbarTheme.h"
-#include "SkiaUtils.h"
-#include "ThemeHelperChromiumWin.h"
-#include "UserAgentStyleSheets.h"
-
-// FIXME(brettw): this dependency should eventually be removed.
-#include "skia/ext/skia_utils_win.h"
-
-namespace {
-
-#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(structName, member) \
- offsetof(structName, member) + \
- (sizeof static_cast<structName*>(0)->member)
-#define NONCLIENTMETRICS_SIZE_PRE_VISTA \
- SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
-
-void getNonClientMetrics(NONCLIENTMETRICS* metrics) {
- static UINT size = WebCore::ChromiumUtils::isVistaOrGreater() ?
- sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
- metrics->cbSize = size;
- bool success =
- !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, size, metrics, 0);
- ASSERT(success);
-}
-
-enum PaddingType {
- TopPadding,
- RightPadding,
- BottomPadding,
- LeftPadding
-};
-
-const int kStyledMenuListInternalPadding[4] = { 1, 4, 1, 4 };
-
-// The default variable-width font size. We use this as the default font
-// size for the "system font", and as a base size (which we then shrink) for
-// form control fonts.
-float DefaultFontSize = 16.0;
-
-WebCore::FontDescription smallSystemFont;
-WebCore::FontDescription menuFont;
-WebCore::FontDescription labelFont;
-
-} // namespace
-
-namespace WebCore {
-
-bool RenderThemeWin::m_findInPageMode = false;
-
-// Internal static helper functions. We don't put them in an anonymous
-// namespace so they have easier access to the WebCore namespace.
-
-static bool supportsFocus(ControlPart appearance)
-{
- switch (appearance) {
- case PushButtonPart:
- case ButtonPart:
- case DefaultButtonPart:
- case TextFieldPart:
- case TextAreaPart:
- return true;
- default:
- return false;
- }
-
- return false;
-}
-
-static void setFixedPadding(RenderStyle* style, const int padding[4])
-{
- style->setPaddingLeft(Length(padding[LeftPadding], Fixed));
- style->setPaddingRight(Length(padding[RightPadding], Fixed));
- style->setPaddingTop(Length(padding[TopPadding], Fixed));
- style->setPaddingBottom(Length(padding[BottomPadding], Fixed));
-}
-
-// Return the height of system font |font| in pixels. We use this size by
-// default for some non-form-control elements.
-static float systemFontSize(const LOGFONT& font)
-{
- float size = -font.lfHeight;
- if (size < 0) {
- HFONT hFont = CreateFontIndirect(&font);
- if (hFont) {
- HDC hdc = GetDC(0); // What about printing? Is this the right DC?
- if (hdc) {
- HGDIOBJ hObject = SelectObject(hdc, hFont);
- TEXTMETRIC tm;
- GetTextMetrics(hdc, &tm);
- SelectObject(hdc, hObject);
- ReleaseDC(0, hdc);
- size = tm.tmAscent;
- }
- DeleteObject(hFont);
- }
- }
-
- // The "codepage 936" bit here is from Gecko; apparently this helps make
- // fonts more legible in Simplified Chinese where the default font size is
- // too small.
- // TODO(pkasting): http://b/1119883 Since this is only used for "small
- // caption", "menu", and "status bar" objects, I'm not sure how much this
- // even matters. Plus the Gecko patch went in back in 2002, and maybe this
- // isn't even relevant anymore. We should investigate whether this should
- // be removed, or perhaps broadened to be "any CJK locale".
- return ((size < 12.0f) && (GetACP() == 936)) ? 12.0f : size;
-}
-
-// We aim to match IE here.
-// -IE uses a font based on the encoding as the default font for form controls.
-// -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT),
-// which returns MS Shell Dlg)
-// -Safari uses Lucida Grande.
-//
-// TODO(ojan): Fix this!
-// The only case where we know we don't match IE is for ANSI encodings. IE uses
-// MS Shell Dlg there, which we render incorrectly at certain pixel sizes
-// (e.g. 15px). So, for now we just use Arial.
-static wchar_t* defaultGUIFont(Document* document)
-{
- UScriptCode dominantScript = document->dominantScript();
- const wchar_t* family = NULL;
-
- // TODO(jungshik) : Special-casing of Latin/Greeek/Cyrillic should go away
- // once GetFontFamilyForScript is enhanced to support GenericFamilyType for
- // real. For now, we make sure that we use Arial to match IE for those
- // scripts.
- if (dominantScript != USCRIPT_LATIN &&
- dominantScript != USCRIPT_CYRILLIC &&
- dominantScript != USCRIPT_GREEK &&
- dominantScript != USCRIPT_INVALID_CODE) {
- family = getFontFamilyForScript(dominantScript, FontDescription::NoFamily);
- if (family)
- return const_cast<wchar_t*>(family);
- }
- return L"Arial";
-}
-
-// Converts |points| to pixels. One point is 1/72 of an inch.
-static float pointsToPixels(float points)
-{
- static float pixelsPerInch = 0.0f;
- if (!pixelsPerInch) {
- HDC hdc = GetDC(0); // What about printing? Is this the right DC?
- if (hdc) { // Can this ever actually be NULL?
- pixelsPerInch = GetDeviceCaps(hdc, LOGPIXELSY);
- ReleaseDC(0, hdc);
- } else {
- pixelsPerInch = 96.0f;
- }
- }
-
- static const float POINTS_PER_INCH = 72.0f;
- return points / POINTS_PER_INCH * pixelsPerInch;
-}
-
-static void setSizeIfAuto(RenderStyle* style, const IntSize& size)
-{
- if (style->width().isIntrinsicOrAuto())
- style->setWidth(Length(size.width(), Fixed));
- if (style->height().isAuto())
- style->setHeight(Length(size.height(), Fixed));
-}
-
-static double querySystemBlinkInterval(double defaultInterval)
-{
- UINT blinkTime = ::GetCaretBlinkTime();
- if (blinkTime == 0)
- return defaultInterval;
- if (blinkTime == INFINITE)
- return 0;
- return blinkTime / 1000.0;
-}
-
-// Implement WebCore::theme() for getting the global RenderTheme.
-RenderTheme* theme()
-{
- static RenderThemeWin winTheme;
- return &winTheme;
-}
-
-String RenderThemeWin::extraDefaultStyleSheet()
-{
- return String(themeWinUserAgentStyleSheet, sizeof(themeWinUserAgentStyleSheet));
-}
-
-String RenderThemeWin::extraQuirksStyleSheet()
-{
- return String(themeWinQuirksUserAgentStyleSheet, sizeof(themeWinQuirksUserAgentStyleSheet));
-}
-
-bool RenderThemeWin::supportsFocusRing(const RenderStyle* style) const
-{
- // Let webkit draw one of its halo rings around any focused element,
- // except push buttons. For buttons we use the windows PBS_DEFAULTED
- // styling to give it a blue border.
- return style->appearance() == ButtonPart ||
- style->appearance() == PushButtonPart;
-}
-
-Color RenderThemeWin::platformActiveSelectionBackgroundColor() const
-{
- if (ChromiumBridge::layoutTestMode())
- return Color("#0000FF"); // Royal blue.
- if (m_findInPageMode)
- return Color(255, 150, 50, 200); // Orange.
- COLORREF color = GetSysColor(COLOR_HIGHLIGHT);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255);
-}
-
-Color RenderThemeWin::platformInactiveSelectionBackgroundColor() const
-{
- if (ChromiumBridge::layoutTestMode())
- return Color("#999999"); // Medium gray.
- if (m_findInPageMode)
- return Color(255, 150, 50, 200); // Orange.
- COLORREF color = GetSysColor(COLOR_GRAYTEXT);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255);
-}
-
-Color RenderThemeWin::platformActiveSelectionForegroundColor() const
-{
- if (ChromiumBridge::layoutTestMode())
- return Color("#FFFFCC"); // Pale yellow.
- COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT);
- return Color(GetRValue(color), GetGValue(color), GetBValue(color), 255);
-}
-
-Color RenderThemeWin::platformInactiveSelectionForegroundColor() const
-{
- return Color::white;
-}
-
-Color RenderThemeWin::platformTextSearchHighlightColor() const
-{
- return Color(255, 255, 150);
-}
-
-double RenderThemeWin::caretBlinkInterval() const
-{
- // Disable the blinking caret in layout test mode, as it introduces
- // a race condition for the pixel tests. http://b/1198440
- if (ChromiumBridge::layoutTestMode())
- return 0;
-
- // This involves a system call, so we cache the result.
- static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBlinkInterval());
- return blinkInterval;
-}
-
-void RenderThemeWin::systemFont(int propId, Document* document, FontDescription& fontDescription) const
-{
- // This logic owes much to RenderThemeSafari.cpp.
- FontDescription* cachedDesc = NULL;
- wchar_t* faceName = 0;
- float fontSize = 0;
- switch (propId) {
- case CSSValueSmallCaption:
- cachedDesc = &smallSystemFont;
- if (!smallSystemFont.isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = metrics.lfSmCaptionFont.lfFaceName;
- fontSize = systemFontSize(metrics.lfSmCaptionFont);
- }
- break;
- case CSSValueMenu:
- cachedDesc = &menuFont;
- if (!menuFont.isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = metrics.lfMenuFont.lfFaceName;
- fontSize = systemFontSize(metrics.lfMenuFont);
- }
- break;
- case CSSValueStatusBar:
- cachedDesc = &labelFont;
- if (!labelFont.isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = metrics.lfStatusFont.lfFaceName;
- fontSize = systemFontSize(metrics.lfStatusFont);
- }
- break;
- case CSSValueWebkitMiniControl:
- case CSSValueWebkitSmallControl:
- case CSSValueWebkitControl:
- faceName = defaultGUIFont(document);
- // Why 2 points smaller? Because that's what Gecko does.
- fontSize = DefaultFontSize - pointsToPixels(2);
- break;
- default:
- faceName = defaultGUIFont(document);
- fontSize = DefaultFontSize;
- break;
- }
-
- if (!cachedDesc)
- cachedDesc = &fontDescription;
-
- if (fontSize) {
- ASSERT(faceName);
- cachedDesc->firstFamily().setFamily(AtomicString(faceName,
- wcslen(faceName)));
- cachedDesc->setIsAbsoluteSize(true);
- cachedDesc->setGenericFamily(FontDescription::NoFamily);
- cachedDesc->setSpecifiedSize(fontSize);
- cachedDesc->setWeight(FontWeightNormal);
- cachedDesc->setItalic(false);
- }
- fontDescription = *cachedDesc;
-}
-
-int RenderThemeWin::minimumMenuListSize(RenderStyle* style) const
-{
- return 0;
-}
-
-void RenderThemeWin::setCheckboxSize(RenderStyle* style) const
-{
- // If the width and height are both specified, then we have nothing to do.
- if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
- return;
-
- // FIXME: A hard-coded size of 13 is used. This is wrong but necessary for now. It matches Firefox.
- // At different DPI settings on Windows, querying the theme gives you a larger size that accounts for
- // the higher DPI. Until our entire engine honors a DPI setting other than 96, we can't rely on the theme's
- // metrics.
- const IntSize size(13, 13);
- setSizeIfAuto(style, size);
-}
-
-void RenderThemeWin::setRadioSize(RenderStyle* style) const
-{
- // Use same sizing for radio box as checkbox.
- setCheckboxSize(style);
-}
-
-bool RenderThemeWin::paintButton(RenderObject* o,
- const RenderObject::PaintInfo& i,
- const IntRect& r)
-{
- const ThemeData& themeData = getThemeData(o);
-
- WebCore::ThemeHelperWin helper(i.context, r);
- ChromiumBridge::paintButton(helper.context(),
- themeData.m_part,
- themeData.m_state,
- themeData.m_classicState,
- helper.rect());
- return false;
-}
-
-bool RenderThemeWin::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
-{
- return paintTextFieldInternal(o, i, r, true);
-}
-
-bool RenderThemeWin::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
-{
- return paintTextField(o, i, r);
-}
-
-void RenderThemeWin::adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
-{
- // Height is locked to auto on all browsers.
- style->setLineHeight(RenderStyle::initialLineHeight());
-}
-
-// Used to paint unstyled menulists (i.e. with the default border)
-bool RenderThemeWin::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
-{
- int borderRight = o->borderRight();
- int borderLeft = o->borderLeft();
- int borderTop = o->borderTop();
- int borderBottom = o->borderBottom();
-
- // If all the borders are 0, then tell skia not to paint the border on the textfield.
- // TODO(ojan): http://b/1210017 Figure out how to get Windows to not draw individual
- // borders and then pass that to skia so we can avoid drawing any borders that are
- // set to 0. For non-zero borders, we draw the border, but webkit just draws
- // over it.
- bool drawEdges = !(borderRight == 0 && borderLeft == 0 && borderTop == 0 && borderBottom == 0);
-
- paintTextFieldInternal(o, i, r, drawEdges);
-
- // Take padding and border into account.
- // If the MenuList is smaller than the size of a button, make sure to
- // shrink it appropriately and not put its x position to the left of
- // the menulist.
- const int buttonWidth = GetSystemMetrics(SM_CXVSCROLL);
- int spacingLeft = borderLeft + o->paddingLeft();
- int spacingRight = borderRight + o->paddingRight();
- int spacingTop = borderTop + o->paddingTop();
- int spacingBottom = borderBottom + o->paddingBottom();
-
- int buttonX;
- if (r.right() - r.x() < buttonWidth) {
- buttonX = r.x();
- } else {
- buttonX = o->style()->direction() == LTR ? r.right() - spacingRight - buttonWidth : r.x() + spacingLeft;
- }
-
- // Compute the rectangle of the button in the destination image.
- IntRect rect(buttonX,
- r.y() + spacingTop,
- std::min(buttonWidth, r.right() - r.x()),
- r.height() - (spacingTop + spacingBottom));
-
- // Get the correct theme data for a textfield and paint the menu.
- WebCore::ThemeHelperWin helper(i.context, rect);
- ChromiumBridge::paintMenuList(helper.context(),
- CP_DROPDOWNBUTTON,
- determineState(o),
- determineClassicState(o),
- helper.rect());
- return false;
-}
-
-void RenderThemeWin::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
-{
- adjustMenuListStyle(selector, style, e);
-}
-
-// Used to paint styled menulists (i.e. with a non-default border)
-bool RenderThemeWin::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
-{
- return paintMenuList(o, i, r);
-}
-
-int RenderThemeWin::popupInternalPaddingLeft(RenderStyle* style) const
-{
- return menuListInternalPadding(style, LeftPadding);
-}
-
-int RenderThemeWin::popupInternalPaddingRight(RenderStyle* style) const
-{
- return menuListInternalPadding(style, RightPadding);
-}
-
-int RenderThemeWin::popupInternalPaddingTop(RenderStyle* style) const
-{
- return menuListInternalPadding(style, TopPadding);
-}
-
-int RenderThemeWin::popupInternalPaddingBottom(RenderStyle* style) const
-{
- return menuListInternalPadding(style, BottomPadding);
-}
-
-void RenderThemeWin::adjustButtonInnerStyle(RenderStyle* style) const
-{
- // This inner padding matches Firefox.
- style->setPaddingTop(Length(1, Fixed));
- style->setPaddingRight(Length(3, Fixed));
- style->setPaddingBottom(Length(1, Fixed));
- style->setPaddingLeft(Length(3, Fixed));
-}
-
-// static
-void RenderThemeWin::setDefaultFontSize(int fontSize) {
- DefaultFontSize = static_cast<float>(fontSize);
-
- // Reset cached fonts.
- smallSystemFont = menuFont = labelFont = FontDescription();
-}
-
-unsigned RenderThemeWin::determineState(RenderObject* o)
-{
- unsigned result = TS_NORMAL;
- ControlPart appearance = o->style()->appearance();
- if (!isEnabled(o))
- result = TS_DISABLED;
- else if (isReadOnlyControl(o) && (TextFieldPart == appearance || TextAreaPart == appearance))
- result = ETS_READONLY; // Readonly is supported on textfields.
- else if (isPressed(o)) // Active overrides hover and focused.
- result = TS_PRESSED;
- else if (supportsFocus(appearance) && isFocused(o))
- result = ETS_FOCUSED;
- else if (isHovered(o))
- result = TS_HOT;
- if (isChecked(o))
- result += 4; // 4 unchecked states, 4 checked states.
- return result;
-}
-
-unsigned RenderThemeWin::determineClassicState(RenderObject* o)
-{
- unsigned result = 0;
- if (!isEnabled(o))
- result = DFCS_INACTIVE;
- else if (isPressed(o)) // Active supersedes hover
- result = DFCS_PUSHED;
- else if (isHovered(o))
- result = DFCS_HOT;
- if (isChecked(o))
- result |= DFCS_CHECKED;
- return result;
-}
-
-ThemeData RenderThemeWin::getThemeData(RenderObject* o)
-{
- ThemeData result;
- switch (o->style()->appearance()) {
- case PushButtonPart:
- case ButtonPart:
- result.m_part = BP_PUSHBUTTON;
- result.m_classicState = DFCS_BUTTONPUSH;
- break;
- case CheckboxPart:
- result.m_part = BP_CHECKBOX;
- result.m_classicState = DFCS_BUTTONCHECK;
- break;
- case RadioPart:
- result.m_part = BP_RADIOBUTTON;
- result.m_classicState = DFCS_BUTTONRADIO;
- break;
- case ListboxPart:
- case MenulistPart:
- case TextFieldPart:
- case TextAreaPart:
- result.m_part = ETS_NORMAL;
- break;
- }
-
- result.m_state = determineState(o);
- result.m_classicState |= determineClassicState(o);
-
- return result;
-}
-
-bool RenderThemeWin::paintTextFieldInternal(RenderObject* o,
- const RenderObject::PaintInfo& i,
- const IntRect& r,
- bool drawEdges)
-{
- // Nasty hack to make us not paint the border on text fields with a
- // border-radius. Webkit paints elements with border-radius for us.
- // TODO(ojan): Get rid of this if-check once we can properly clip rounded
- // borders: http://b/1112604 and http://b/1108635
- // TODO(ojan): make sure we do the right thing if css background-clip is
- // set.
- if (o->style()->hasBorderRadius())
- return false;
-
- const ThemeData& themeData = getThemeData(o);
-
- WebCore::ThemeHelperWin helper(i.context, r);
- ChromiumBridge::paintTextField(helper.context(),
- themeData.m_part,
- themeData.m_state,
- themeData.m_classicState,
- helper.rect(),
- o->style()->backgroundColor(),
- true,
- drawEdges);
- return false;
-}
-
-int RenderThemeWin::menuListInternalPadding(RenderStyle* style, int paddingType) const
-{
- // This internal padding is in addition to the user-supplied padding.
- // Matches the FF behavior.
- int padding = kStyledMenuListInternalPadding[paddingType];
-
- // Reserve the space for right arrow here. The rest of the padding is
- // set by adjustMenuListStyle, since PopMenuWin.cpp uses the padding from
- // RenderMenuList to lay out the individual items in the popup.
- // If the MenuList actually has appearance "NoAppearance", then that means
- // we don't draw a button, so don't reserve space for it.
- const int bar_type = style->direction() == LTR ? RightPadding : LeftPadding;
- if (paddingType == bar_type && style->appearance() != NoControlPart)
- padding += ScrollbarTheme::nativeTheme()->scrollbarThickness();
-
- return padding;
-}
-
-// static
-void RenderThemeWin::setFindInPageMode(bool enable) {
- if (m_findInPageMode == enable)
- return;
-
- m_findInPageMode = enable;
- theme()->platformColorsDidChange();
-}
-
-} // namespace WebCore
diff --git a/webkit/port/rendering/RenderThemeWin.h b/webkit/port/rendering/RenderThemeWin.h
deleted file mode 100644
index 0dd3494..0000000
--- a/webkit/port/rendering/RenderThemeWin.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef RenderThemeWin_h
-#define RenderThemeWin_h
-
-#include "RenderTheme.h"
-
-#if WIN32
-typedef void* HANDLE;
-typedef struct HINSTANCE__* HINSTANCE;
-typedef HINSTANCE HMODULE;
-#endif
-
-namespace WebCore {
-
-struct ThemeData {
- ThemeData() : m_part(0), m_state(0), m_classicState(0) {}
-
- unsigned m_part;
- unsigned m_state;
- unsigned m_classicState;
-};
-
-class RenderThemeWin : public RenderTheme {
-public:
- RenderThemeWin() { }
- ~RenderThemeWin() { }
-
- virtual String extraDefaultStyleSheet();
- virtual String extraQuirksStyleSheet();
-
- // A method asking if the theme's controls actually care about redrawing when hovered.
- virtual bool supportsHover(const RenderStyle*) const { return true; }
-
- // A method asking if the theme is able to draw the focus ring.
- virtual bool supportsFocusRing(const RenderStyle*) const;
-
- // The platform selection color.
- virtual Color platformActiveSelectionBackgroundColor() const;
- virtual Color platformInactiveSelectionBackgroundColor() const;
- virtual Color platformActiveSelectionForegroundColor() const;
- virtual Color platformInactiveSelectionForegroundColor() const;
- virtual Color platformTextSearchHighlightColor() const;
-
- virtual double caretBlinkInterval() const;
-
- // System fonts.
- virtual void systemFont(int propId, Document*, FontDescription&) const;
-
- virtual int minimumMenuListSize(RenderStyle*) const;
-
- virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
- { return paintButton(o, i, r); }
- virtual void setCheckboxSize(RenderStyle*) const;
-
- virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
- { return paintButton(o, i, r); }
- virtual void setRadioSize(RenderStyle* style) const;
-
- virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
- virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
- virtual bool paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
- { return paintTextField(o, i, r); }
-
- virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
- // MenuList refers to an unstyled menulist (meaning a menulist without
- // background-color or border set) and MenuListButton refers to a styled
- // menulist (a menulist with background-color or border set). They have
- // this distinction to support showing aqua style themes whenever they
- // possibly can, which is something we don't want to replicate.
- //
- // In short, we either go down the MenuList code path or the MenuListButton
- // codepath. We never go down both. And in both cases, they render the
- // entire menulist.
- virtual void adjustMenuListStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
- virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
- virtual void adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const;
- virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
- // These methods define the padding for the MenuList's inner block.
- virtual int popupInternalPaddingLeft(RenderStyle*) const;
- virtual int popupInternalPaddingRight(RenderStyle*) const;
- virtual int popupInternalPaddingTop(RenderStyle*) const;
- virtual int popupInternalPaddingBottom(RenderStyle*) const;
-
- virtual void adjustButtonInnerStyle(RenderStyle* style) const;
-
- // Provide a way to pass the default font size from the Settings object to
- // the render theme. TODO(tc): http://b/1129186 A cleaner way would be to
- // remove the default font size from this object and have callers that need
- // the value to get it directly from the appropriate Settings object.
- static void setDefaultFontSize(int);
-
- // Enables/Disables FindInPage mode, which (if enabled) overrides the
- // selection rect color to be orange.
- static void setFindInPageMode(bool);
-private:
- unsigned determineState(RenderObject*);
- unsigned determineClassicState(RenderObject*);
-
- ThemeData getThemeData(RenderObject*);
-
- bool paintTextFieldInternal(RenderObject*, const RenderObject::PaintInfo&, const IntRect&, bool);
-
- int menuListInternalPadding(RenderStyle* style, int paddingType) const;
-
- // A flag specifying whether we are in Find-in-page mode or not.
- static bool m_findInPageMode;
-};
-
-}
-
-#endif