1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
/*
* This file is part of the WebKit project.
*
* Copyright (C) 2006, 2008, 2013, 2014 Apple Inc.
* Copyright (C) 2009 Kenneth Rohde Christiansen
*
* 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"
#ifdef 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) {}
ThemeData(int part, int state)
: m_part(part)
, m_state(state)
, m_classicState(0)
{ }
unsigned m_part;
unsigned m_state;
unsigned m_classicState;
};
class RenderThemeWin final: public RenderTheme {
public:
static Ref<RenderTheme> create();
virtual String extraDefaultStyleSheet() override;
virtual String extraQuirksStyleSheet() override;
// A method asking if the theme's controls actually care about redrawing when hovered.
virtual bool supportsHover(const RenderStyle&) const override;
virtual Color platformActiveSelectionBackgroundColor() const override;
virtual Color platformInactiveSelectionBackgroundColor() const override;
virtual Color platformActiveSelectionForegroundColor() const override;
virtual Color platformInactiveSelectionForegroundColor() const override;
virtual Color systemColor(CSSValueID) const override;
virtual bool paintCheckbox(const RenderObject& o, const PaintInfo& i, const IntRect& r) override
{ return paintButton(o, i, r); }
virtual void setCheckboxSize(RenderStyle&) const override;
virtual bool paintRadio(const RenderObject& o, const PaintInfo& i, const IntRect& r) override
{ return paintButton(o, i, r); }
virtual void setRadioSize(RenderStyle& style) const override
{ return setCheckboxSize(style); }
virtual bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
virtual void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
virtual bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override;
virtual bool paintTextArea(const RenderObject& o, const PaintInfo& i, const FloatRect& r) override
{ return paintTextField(o, i, r); }
virtual void adjustMenuListStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override;
virtual void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
virtual bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override;
virtual void adjustSliderThumbSize(RenderStyle&, Element*) const override;
virtual bool popupOptionSupportsTextIndent() const override { return true; }
virtual void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override;
virtual void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
virtual void adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) override { return false; }
virtual void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override;
virtual void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
virtual void themeChanged() override;
virtual void adjustButtonStyle(StyleResolver&, RenderStyle& style, Element*) const override { }
virtual void adjustTextFieldStyle(StyleResolver&, RenderStyle& style, Element*) const override { }
virtual void adjustTextAreaStyle(StyleResolver&, RenderStyle& style, Element*) const override { }
static void setWebKitIsBeingUnloaded();
static String stringWithContentsOfFile(CFStringRef name, CFStringRef type);
virtual bool supportsFocusRing(const RenderStyle&) const override;
#if ENABLE(VIDEO)
virtual String mediaControlsStyleSheet() override;
virtual String mediaControlsScript() override;
#endif
#if ENABLE(METER_ELEMENT)
virtual IntSize meterSizeForBounds(const RenderMeter&, const IntRect&) const override;
virtual bool supportsMeter(ControlPart) const override;
virtual void adjustMeterStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&) override;
#endif
private:
enum ControlSubPart {
None,
SpinButtonDown,
SpinButtonUp,
};
RenderThemeWin();
virtual ~RenderThemeWin();
// System fonts.
virtual void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override;
void addIntrinsicMargins(RenderStyle&) const;
void close();
unsigned determineState(const RenderObject&);
unsigned determineClassicState(const RenderObject&, ControlSubPart = None);
unsigned determineSliderThumbState(const RenderObject&);
unsigned determineButtonState(const RenderObject&);
unsigned determineSpinButtonState(const RenderObject&, ControlSubPart = None);
bool supportsFocus(ControlPart) const;
ThemeData getThemeData(const RenderObject&, ControlSubPart = None);
ThemeData getClassicThemeData(const RenderObject&, ControlSubPart = None);
HANDLE buttonTheme() const;
HANDLE textFieldTheme() const;
HANDLE menuListTheme() const;
HANDLE sliderTheme() const;
HANDLE spinButtonTheme() const;
HANDLE progressBarTheme() const;
mutable HANDLE m_buttonTheme;
mutable HANDLE m_textFieldTheme;
mutable HANDLE m_menuListTheme;
mutable HANDLE m_sliderTheme;
mutable HANDLE m_spinButtonTheme;
mutable HANDLE m_progressBarTheme;
String m_mediaControlsScript;
String m_mediaControlsStyleSheet;
};
};
#endif
|