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
|
/*
* Copyright (C) 2006-2022 Apple Inc. All rights reserved.
* 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.
*
*/
#pragma once
#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:
friend NeverDestroyed<RenderThemeWin>;
String extraDefaultStyleSheet() override;
String extraQuirksStyleSheet() override;
// A method asking if the theme's controls actually care about redrawing when hovered.
bool supportsHover(const RenderStyle&) const override;
Color platformActiveSelectionBackgroundColor(OptionSet<StyleColorOptions>) const override;
Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColorOptions>) const override;
Color platformActiveSelectionForegroundColor(OptionSet<StyleColorOptions>) const override;
Color platformInactiveSelectionForegroundColor(OptionSet<StyleColorOptions>) const override;
Color systemColor(CSSValueID, OptionSet<StyleColorOptions>) const override;
bool paintCheckbox(const RenderObject& o, const PaintInfo& i, const FloatRect& r) override
{ return paintButton(o, i, IntRect(r)); }
void setCheckboxSize(RenderStyle&) const override;
bool paintRadio(const RenderObject& o, const PaintInfo& i, const FloatRect& r) override
{ return paintButton(o, i, IntRect(r)); }
void setRadioSize(RenderStyle& style) const override
{ return setCheckboxSize(style); }
bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const override;
bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override;
bool paintTextArea(const RenderObject& o, const PaintInfo& i, const FloatRect& r) override
{ return paintTextField(o, i, r); }
void adjustMenuListStyle(RenderStyle&, const Element*) const override;
bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override;
void adjustMenuListButtonStyle(RenderStyle&, const Element*) const override;
void paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override;
void adjustSliderThumbSize(RenderStyle&, const Element*) const override;
bool popupOptionSupportsTextIndent() const override { return true; }
void adjustSearchFieldStyle(RenderStyle&, const Element*) const override;
bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override;
void adjustSearchFieldCancelButtonStyle(RenderStyle&, const Element*) const override;
bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
void adjustSearchFieldDecorationPartStyle(RenderStyle&, const Element*) const override;
bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) override { return false; }
void adjustSearchFieldResultsDecorationPartStyle(RenderStyle&, const Element*) const override;
bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override;
void adjustSearchFieldResultsButtonStyle(RenderStyle&, const Element*) const override;
bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
void themeChanged() override;
void adjustButtonStyle(RenderStyle& style, const Element*) const override { }
void adjustTextFieldStyle(RenderStyle& style, const Element*) const override { }
void adjustTextAreaStyle(RenderStyle& style, const Element*) const override { }
static void setWebKitIsBeingUnloaded();
static String stringWithContentsOfFile(const String& name, const String& type);
bool supportsFocusRing(const RenderStyle&) const override;
#if ENABLE(VIDEO)
String mediaControlsStyleSheet() override;
Vector<String, 2> mediaControlsScripts() override;
#endif
IntSize meterSizeForBounds(const RenderMeter&, const IntRect&) const override;
bool supportsMeter(ControlPart, const HTMLMeterElement&) const override;
void adjustMeterStyle(RenderStyle&, const Element*) const override;
bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&) override;
private:
enum ControlSubPart {
None,
SpinButtonDown,
SpinButtonUp,
};
RenderThemeWin();
virtual ~RenderThemeWin();
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;
};
} // namespace WebCore
|