| 1 | /* |
| 2 | * This file is part of the WebKit project. |
| 3 | * |
| 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. |
| 9 | * All rights reserved. |
| 10 | * |
| 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. |
| 15 | * |
| 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. |
| 20 | * |
| 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. |
| 25 | * |
| 26 | */ |
| 27 | |
| 28 | #pragma once |
| 29 | |
| 30 | #include "RenderTheme.h" |
| 31 | |
| 32 | namespace WebCore { |
| 33 | |
| 34 | class RenderThemeGtk final : public RenderTheme { |
| 35 | public: |
| 36 | friend NeverDestroyed<RenderThemeGtk>; |
| 37 | |
| 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; |
| 44 | #endif |
| 45 | |
| 46 | private: |
| 47 | // System fonts. |
| 48 | void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override; |
| 49 | |
| 50 | public: |
| 51 | #ifndef GTK_API_VERSION_2 |
| 52 | |
| 53 | // A method asking if the theme's controls actually care about redrawing when hovered. |
| 54 | bool supportsHover(const RenderStyle&) const override { return true; } |
| 55 | |
| 56 | // A method asking if the theme is able to draw the focus ring. |
| 57 | bool supportsFocusRing(const RenderStyle&) const override; |
| 58 | |
| 59 | // A method asking if the control changes its tint when the window has focus or not. |
| 60 | bool controlSupportsTints(const RenderObject&) const override; |
| 61 | |
| 62 | // A general method asking if any control tinting is supported at all. |
| 63 | bool supportsControlTints() const override { return true; } |
| 64 | |
| 65 | void adjustRepaintRect(const RenderObject&, FloatRect&) override; |
| 66 | |
| 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; |
| 71 | |
| 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; |
| 77 | |
| 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; |
| 83 | |
| 84 | Color disabledTextColor(const Color&, const Color&) const override; |
| 85 | |
| 86 | Seconds caretBlinkInterval() const override; |
| 87 | |
| 88 | void platformColorsDidChange() override; |
| 89 | |
| 90 | // System colors. |
| 91 | Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const override; |
| 92 | |
| 93 | bool () const override { return true; } |
| 94 | |
| 95 | #if ENABLE(VIDEO) |
| 96 | String () override; |
| 97 | String formatMediaControlsCurrentTime(float currentTime, float duration) const override; |
| 98 | bool supportsClosedCaptioning() const override { return true; } |
| 99 | String mediaControlsScript() override; |
| 100 | |
| 101 | #if ENABLE(FULLSCREEN_API) |
| 102 | String () override; |
| 103 | #endif |
| 104 | #endif |
| 105 | |
| 106 | bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const override; |
| 107 | |
| 108 | private: |
| 109 | RenderThemeGtk(); |
| 110 | virtual ~RenderThemeGtk(); |
| 111 | |
| 112 | bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override; |
| 113 | void setCheckboxSize(RenderStyle&) const override; |
| 114 | |
| 115 | bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) override; |
| 116 | void setRadioSize(RenderStyle&) const override; |
| 117 | |
| 118 | void adjustButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 119 | bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) override; |
| 120 | |
| 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; |
| 124 | |
| 125 | LengthBox (const RenderStyle&) const override; |
| 126 | |
| 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 (StyleResolver&, RenderStyle&, const Element*) const override; |
| 132 | void (StyleResolver&, RenderStyle&, const Element*) const override; |
| 133 | bool (const RenderObject&, const PaintInfo&, const FloatRect&) override; |
| 134 | bool (const RenderBox&, const PaintInfo&, const FloatRect&) override; |
| 135 | |
| 136 | void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 137 | bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override; |
| 138 | |
| 139 | void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 140 | bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) override; |
| 141 | |
| 142 | void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 143 | bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) override; |
| 144 | |
| 145 | void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 146 | bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) override; |
| 147 | |
| 148 | bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) override; |
| 149 | void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 150 | |
| 151 | bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) override; |
| 152 | void adjustSliderThumbStyle(StyleResolver&, RenderStyle&, const Element*) const override; |
| 153 | |
| 154 | void adjustSliderThumbSize(RenderStyle&, const Element*) const override; |
| 155 | |
| 156 | #if ENABLE(VIDEO) |
| 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; |
| 170 | #endif |
| 171 | #endif |
| 172 | |
| 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; |
| 178 | |
| 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; |
| 182 | |
| 183 | String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const override; |
| 184 | |
| 185 | static void setTextInputBorders(RenderStyle&); |
| 186 | |
| 187 | #if ENABLE(VIDEO) |
| 188 | bool paintMediaButton(const RenderObject&, GraphicsContext&, const IntRect&, const char* iconName); |
| 189 | #endif |
| 190 | |
| 191 | static IntRect calculateProgressRect(const RenderObject&, const IntRect&); |
| 192 | #endif // GTK_API_VERSION_2 |
| 193 | }; |
| 194 | |
| 195 | } // namespace WebCore |
| 196 | |