2 * This file is part of the WebKit project.
4 * Copyright (C) 2006 Apple Inc.
5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
6 * Copyright (C) 2007 Holger Hans Peter Freyther
7 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
8 * Copyright (C) 2010 Igalia S.L.
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
30 #include "RenderTheme.h"
34 class RenderThemeGtk final : public RenderTheme {
36 friend NeverDestroyed<RenderThemeGtk>;
38 #if ENABLE(DATALIST_ELEMENT)
39 // Returns size of one slider tick mark for a horizontal track.
40 // For vertical tracks we rotate it and use it. i.e. Width is always length along the track.
41 IntSize sliderTickSize() const override;
42 // Returns the distance of slider tick origin from the slider track center.
43 int sliderTickOffsetFromTrackCenter() const override;
48 void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override;
51 #ifndef GTK_API_VERSION_2
53 // A method asking if the theme's controls actually care about redrawing when hovered.
54 bool supportsHover(const RenderStyle&) const override { return true; }
56 // A method asking if the theme is able to draw the focus ring.
57 bool supportsFocusRing(const RenderStyle&) const override;
59 // A method asking if the control changes its tint when the window has focus or not.
60 bool controlSupportsTints(const RenderObject&) const override;
62 // A general method asking if any control tinting is supported at all.
63 bool supportsControlTints() const override { return true; }
65 void adjustRepaintRect(const RenderObject&, FloatRect&) override;
67 // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
68 // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
69 // controls that need to do this.
70 int baselinePosition(const RenderBox&) const override;
72 // The platform selection color.
73 Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
74 Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
75 Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
76 Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
78 // List Box selection color
79 Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
80 Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
81 Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const override;
82 Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const override;
84 Color disabledTextColor(const Color&, const Color&) const override;
86 Seconds caretBlinkInterval() const override;
88 void platformColorsDidChange() override;
91 Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override;
93 bool popsMenuBySpaceOrReturn() const override { return true; }
96 String extraMediaControlsStyleSheet() override;
97 String formatMediaControlsCurrentTime(float currentTime, float duration) const override;
98 bool supportsClosedCaptioning() const override { return true; }
99 String mediaControlsScript() override;
101 #if ENABLE(FULLSCREEN_API)
102 String extraFullScreenStyleSheet() override;
106 bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const override;
110 virtual ~RenderThemeGtk();
112 bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override;
113 void setCheckboxSize(RenderStyle&) const override;
115 bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) override;
116 void setRadioSize(RenderStyle&) const override;
118 void adjustButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
119 bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
121 void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
122 bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) override;
123 bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) override;
125 LengthBox popupInternalPaddingBox(const RenderStyle&) const override;
127 // The Mac port differentiates between the "menu list" and the "menu list button."
128 // The former is used when a menu list button has been styled. This is used to ensure
129 // Aqua themed controls whenever possible. We always want to use GTK+ theming, so
130 // we don't maintain this differentiation.
131 void adjustMenuListStyle(StyleResolver&, RenderStyle&, const Element*) const override;
132 void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
133 bool paintMenuList(const RenderObject&, const PaintInfo&, const FloatRect&) override;
134 bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
136 void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const override;
137 bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override;
139 void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override;
140 bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override;
142 void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
143 bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
145 void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
146 bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override;
148 bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
149 void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const override;
151 bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override;
152 void adjustSliderThumbStyle(StyleResolver&, RenderStyle&, const Element*) const override;
154 void adjustSliderThumbSize(RenderStyle&, const Element*) const override;
157 bool hasOwnDisabledStateHandlingFor(ControlPart) const override;
158 bool paintMediaFullscreenButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
159 bool paintMediaPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
160 bool paintMediaMuteButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
161 bool paintMediaSeekBackButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
162 bool paintMediaSeekForwardButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
163 bool paintMediaSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
164 bool paintMediaSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override;
165 bool paintMediaVolumeSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override;
166 bool paintMediaVolumeSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override;
167 bool paintMediaCurrentTime(const RenderObject&, const PaintInfo&, const IntRect&) override;
168 #if ENABLE(VIDEO_TRACK)
169 bool paintMediaToggleClosedCaptionsButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
173 Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const override;
174 Seconds animationDurationForProgressBar(RenderProgress&) const override;
175 void adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const override;
176 IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const override;
177 bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) override;
179 InnerSpinButtonLayout innerSpinButtonLayout(const RenderObject&) const override;
180 void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override;
181 bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
183 String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const override;
185 static void setTextInputBorders(RenderStyle&);
188 bool paintMediaButton(const RenderObject&, GraphicsContext&, const IntRect&, const char* iconName);
191 static IntRect calculateProgressRect(const RenderObject&, const IntRect&);
192 #endif // GTK_API_VERSION_2
195 } // namespace WebCore