From 5f1ab04193ad0130ca8204aadaceae083aca9881 Mon Sep 17 00:00:00 2001 From: Feng Qian Date: Wed, 17 Jun 2009 12:12:20 -0700 Subject: Get WebKit r44544. --- WebCore/rendering/RenderThemeWin.cpp | 114 +++++++++++++++++++++++++++++++---- 1 file changed, 103 insertions(+), 11 deletions(-) (limited to 'WebCore/rendering/RenderThemeWin.cpp') diff --git a/WebCore/rendering/RenderThemeWin.cpp b/WebCore/rendering/RenderThemeWin.cpp index 0518ef0..1fa5162 100644 --- a/WebCore/rendering/RenderThemeWin.cpp +++ b/WebCore/rendering/RenderThemeWin.cpp @@ -21,17 +21,20 @@ #include "config.h" #include "RenderThemeWin.h" -#include "CSSStyleSheet.h" #include "CSSValueKeywords.h" -#include "Document.h" +#include "Element.h" +#include "Frame.h" #include "GraphicsContext.h" -#include "HTMLElement.h" -#include "HTMLSelectElement.h" -#include "Icon.h" #include "RenderSlider.h" +#include "Settings.h" #include "SoftLinking.h" +#include "SystemInfo.h" #include "UserAgentStyleSheets.h" +#if ENABLE(VIDEO) +#include "RenderMediaControls.h" +#endif + #include /* @@ -54,10 +57,14 @@ // Textfield constants #define TFP_TEXTFIELD 1 +#define EP_EDITBORDER_NOSCROLL 6 #define TFS_READONLY 6 -// ComboBox constants (from tmschema.h) +// ComboBox constants (from vsstyle.h) #define CP_DROPDOWNBUTTON 1 +#define CP_BORDER 4 +#define CP_READONLY 5 +#define CP_DROPDOWNBUTTONRIGHT 6 // TrackBar (slider) parts #define TKP_TRACK 1 @@ -92,6 +99,8 @@ SOFT_LINK(uxtheme, IsThemeBackgroundPartiallyTransparent, BOOL, WINAPI, (HANDLE static bool haveTheme; +static const unsigned vistaMenuListButtonOutset = 1; + using namespace std; namespace WebCore { @@ -114,6 +123,12 @@ static const float defaultSearchFieldResultsButtonWidth = 18; static bool gWebKitIsBeingUnloaded; +static bool documentIsInApplicationChromeMode(const Document* document) +{ + Settings* settings = document->settings(); + return settings && settings->inApplicationChromeMode(); +} + void RenderThemeWin::setWebKitIsBeingUnloaded() { gWebKitIsBeingUnloaded = true; @@ -493,8 +508,13 @@ ThemeData RenderThemeWin::getThemeData(RenderObject* o) break; case MenulistPart: case MenulistButtonPart: - result.m_part = CP_DROPDOWNBUTTON; - result.m_state = determineState(o); + result.m_part = isRunningOnVistaOrLater() ? CP_DROPDOWNBUTTONRIGHT : CP_DROPDOWNBUTTON; + if (isRunningOnVistaOrLater() && documentIsInApplicationChromeMode(o->document())) { + // The "readonly" look we use in application chrome mode + // only uses a "normal" look for the drop down button. + result.m_state = TS_NORMAL; + } else + result.m_state = determineState(o); break; case RadioPart: result.m_part = BP_RADIO; @@ -503,7 +523,7 @@ ThemeData RenderThemeWin::getThemeData(RenderObject* o) case SearchFieldPart: case TextFieldPart: case TextAreaPart: - result.m_part = TFP_TEXTFIELD; + result.m_part = isRunningOnVistaOrLater() ? EP_EDITBORDER_NOSCROLL : TFP_TEXTFIELD; result.m_state = determineState(o); break; case SliderHorizontalPart: @@ -615,8 +635,20 @@ bool RenderThemeWin::paintTextField(RenderObject* o, const RenderObject::PaintIn bool RenderThemeWin::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - // The outer box of a menu list is just a text field. Paint it first. - drawControl(i.context, o, textFieldTheme(), ThemeData(TFP_TEXTFIELD, determineState(o)), r); + HANDLE theme; + int part; + if (haveTheme && isRunningOnVistaOrLater()) { + theme = menuListTheme(); + if (documentIsInApplicationChromeMode(o->document())) + part = CP_READONLY; + else + part = CP_BORDER; + } else { + theme = textFieldTheme(); + part = TFP_TEXTFIELD; + } + + drawControl(i.context, o, theme, ThemeData(part, determineState(o)), r); return paintMenuListButton(o, i, r); } @@ -669,6 +701,13 @@ bool RenderThemeWin::paintMenuListButton(RenderObject* o, const RenderObject::Pa buttonRect.setX(buttonRect.right() - dropDownButtonWidth); buttonRect.setWidth(dropDownButtonWidth); + if (isRunningOnVistaOrLater()) { + // Outset the top, right, and bottom borders of the button so that they coincide with the