| 1 | /* |
| 2 | * Copyright (C) 2005-2017 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | |
| 23 | #include "ColorHash.h" |
| 24 | #include "ControlStates.h" |
| 25 | #include "GraphicsContext.h" |
| 26 | #include "PaintInfo.h" |
| 27 | #include "PopupMenuStyle.h" |
| 28 | #include "ScrollTypes.h" |
| 29 | #include "StyleColor.h" |
| 30 | #include "ThemeTypes.h" |
| 31 | #include <wtf/HashMap.h> |
| 32 | |
| 33 | namespace WebCore { |
| 34 | |
| 35 | class BorderData; |
| 36 | class Element; |
| 37 | class FileList; |
| 38 | class FillLayer; |
| 39 | class HTMLInputElement; |
| 40 | class Icon; |
| 41 | class Page; |
| 42 | class RenderAttachment; |
| 43 | class RenderBox; |
| 44 | class RenderMeter; |
| 45 | class RenderObject; |
| 46 | class RenderProgress; |
| 47 | class RenderStyle; |
| 48 | class StyleResolver; |
| 49 | |
| 50 | class RenderTheme { |
| 51 | protected: |
| 52 | RenderTheme(); |
| 53 | |
| 54 | virtual ~RenderTheme() = default; |
| 55 | |
| 56 | public: |
| 57 | // This function is to be implemented in platform-specific theme implementations to hand back the |
| 58 | // appropriate platform theme. |
| 59 | WEBCORE_EXPORT static RenderTheme& singleton(); |
| 60 | |
| 61 | virtual void purgeCaches(); |
| 62 | |
| 63 | // This method is called whenever style has been computed for an element and the appearance |
| 64 | // property has been set to a value other than "none". The theme should map in all of the appropriate |
| 65 | // metrics and defaults given the contents of the style. This includes sophisticated operations like |
| 66 | // selection of control size based off the font, the disabling of appearance when certain other properties like |
| 67 | // "border" are set, or if the appearance is not supported by the theme. |
| 68 | void adjustStyle(StyleResolver&, RenderStyle&, const Element*, bool UAHasAppearance, const BorderData&, const FillLayer&, const Color& backgroundColor); |
| 69 | |
| 70 | // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the |
| 71 | // text of a button, is always rendered by the engine itself. The boolean return value indicates |
| 72 | // whether the CSS border/background should also be painted. |
| 73 | bool paint(const RenderBox&, ControlStates&, const PaintInfo&, const LayoutRect&); |
| 74 | bool paintBorderOnly(const RenderBox&, const PaintInfo&, const LayoutRect&); |
| 75 | bool paintDecorations(const RenderBox&, const PaintInfo&, const LayoutRect&); |
| 76 | |
| 77 | // The remaining methods should be implemented by the platform-specific portion of the theme, e.g., |
| 78 | // RenderThemeMac.cpp for Mac OS X. |
| 79 | |
| 80 | // These methods return the theme's extra style sheets rules, to let each platform |
| 81 | // adjust the default CSS rules in html.css, quirks.css, mediaControls.css, or plugIns.css |
| 82 | virtual String () { return String(); } |
| 83 | virtual String () { return String(); } |
| 84 | virtual String () { return String(); } |
| 85 | #if ENABLE(VIDEO) |
| 86 | virtual String mediaControlsStyleSheet() { return String(); } |
| 87 | virtual String modernMediaControlsStyleSheet() { return String(); } |
| 88 | virtual String () { return String(); } |
| 89 | virtual String mediaControlsScript() { return String(); } |
| 90 | virtual String mediaControlsBase64StringForIconNameAndType(const String&, const String&) { return String(); } |
| 91 | virtual String mediaControlsFormattedStringForDuration(double) { return String(); } |
| 92 | #endif |
| 93 | #if ENABLE(FULLSCREEN_API) |
| 94 | virtual String () { return String(); } |
| 95 | #endif |
| 96 | #if ENABLE(SERVICE_CONTROLS) |
| 97 | virtual String imageControlsStyleSheet() const { return String(); } |
| 98 | #endif |
| 99 | #if ENABLE(DATALIST_ELEMENT) |
| 100 | String dataListStyleSheet() const; |
| 101 | #endif |
| 102 | #if ENABLE(INPUT_TYPE_COLOR) |
| 103 | String colorInputStyleSheet() const; |
| 104 | #endif |
| 105 | |
| 106 | // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline |
| 107 | // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of |
| 108 | // controls that need to do this. |
| 109 | virtual int baselinePosition(const RenderBox&) const; |
| 110 | |
| 111 | // A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like |
| 112 | // the baseline position API above). |
| 113 | bool isControlContainer(ControlPart) const; |
| 114 | |
| 115 | // A method asking if the control changes its tint when the window has focus or not. |
| 116 | virtual bool controlSupportsTints(const RenderObject&) const { return false; } |
| 117 | |
| 118 | // Whether or not the control has been styled enough by the author to disable the native appearance. |
| 119 | virtual bool isControlStyled(const RenderStyle&, const BorderData&, const FillLayer&, const Color& backgroundColor) const; |
| 120 | |
| 121 | // A general method asking if any control tinting is supported at all. |
| 122 | virtual bool supportsControlTints() const { return false; } |
| 123 | |
| 124 | // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint, |
| 125 | // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control. |
| 126 | virtual void adjustRepaintRect(const RenderObject&, FloatRect&); |
| 127 | |
| 128 | // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed |
| 129 | // or a control becomes disabled. |
| 130 | virtual bool stateChanged(const RenderObject&, ControlStates::States) const; |
| 131 | |
| 132 | // This method is called whenever the theme changes on the system in order to flush cached resources from the |
| 133 | // old theme. |
| 134 | virtual void themeChanged() { } |
| 135 | |
| 136 | // A method asking if the theme is able to draw the focus ring. |
| 137 | virtual bool supportsFocusRing(const RenderStyle&) const; |
| 138 | |
| 139 | // A method asking if the theme's controls actually care about redrawing when hovered. |
| 140 | virtual bool supportsHover(const RenderStyle&) const { return false; } |
| 141 | |
| 142 | // A method asking if the platform is able to show datalist suggestions for a given input type. |
| 143 | virtual bool supportsDataListUI(const AtomicString&) const { return false; } |
| 144 | |
| 145 | // Text selection colors. |
| 146 | Color activeSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 147 | Color inactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 148 | virtual Color transformSelectionBackgroundColor(const Color&, OptionSet<StyleColor::Options>) const; |
| 149 | Color activeSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 150 | Color inactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 151 | |
| 152 | // List box selection colors |
| 153 | Color activeListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 154 | Color activeListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 155 | Color inactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 156 | Color inactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 157 | |
| 158 | // Highlighting colors for search matches. |
| 159 | Color activeTextSearchHighlightColor(OptionSet<StyleColor::Options>) const; |
| 160 | Color inactiveTextSearchHighlightColor(OptionSet<StyleColor::Options>) const; |
| 161 | |
| 162 | virtual Color disabledTextColor(const Color& textColor, const Color& backgroundColor) const; |
| 163 | |
| 164 | Color focusRingColor(OptionSet<StyleColor::Options>) const; |
| 165 | virtual Color platformFocusRingColor(OptionSet<StyleColor::Options>) const { return Color(0, 0, 0); } |
| 166 | static void setCustomFocusRingColor(const Color&); |
| 167 | static float platformFocusRingWidth() { return 3; } |
| 168 | static float platformFocusRingOffset(float outlineWidth) { return std::max<float>(outlineWidth - platformFocusRingWidth(), 0); } |
| 169 | #if ENABLE(TOUCH_EVENTS) |
| 170 | static Color tapHighlightColor(); |
| 171 | virtual Color platformTapHighlightColor() const; |
| 172 | #endif |
| 173 | virtual void platformColorsDidChange(); |
| 174 | |
| 175 | virtual Seconds caretBlinkInterval() const { return 500_ms; } |
| 176 | |
| 177 | // System fonts and colors for CSS. |
| 178 | void systemFont(CSSValueID, FontCascadeDescription&) const; |
| 179 | virtual Color systemColor(CSSValueID, OptionSet<StyleColor::Options>) const; |
| 180 | |
| 181 | virtual int (const RenderStyle&) const { return 0; } |
| 182 | |
| 183 | virtual void adjustSliderThumbSize(RenderStyle&, const Element*) const; |
| 184 | |
| 185 | virtual LengthBox (const RenderStyle&) const { return { 0, 0, 0, 0 }; } |
| 186 | virtual bool () const { return false; } |
| 187 | virtual PopupMenuStyle::PopupMenuSize (const RenderStyle&, IntRect&) const { return PopupMenuStyle::PopupMenuSizeNormal; } |
| 188 | |
| 189 | virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; } |
| 190 | |
| 191 | // Returns the repeat interval of the animation for the progress bar. |
| 192 | virtual Seconds animationRepeatIntervalForProgressBar(RenderProgress&) const; |
| 193 | // Returns the duration of the animation for the progress bar. |
| 194 | virtual Seconds animationDurationForProgressBar(RenderProgress&) const; |
| 195 | virtual IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const; |
| 196 | |
| 197 | #if ENABLE(VIDEO) |
| 198 | // Media controls |
| 199 | virtual bool supportsClosedCaptioning() const { return false; } |
| 200 | virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return false; } |
| 201 | virtual bool usesMediaControlStatusDisplay() { return false; } |
| 202 | virtual bool usesMediaControlVolumeSlider() const { return true; } |
| 203 | virtual bool usesVerticalVolumeSlider() const { return true; } |
| 204 | virtual double mediaControlsFadeInDuration() { return 0.1; } |
| 205 | virtual Seconds mediaControlsFadeOutDuration() { return 300_ms; } |
| 206 | virtual String formatMediaControlsTime(float time) const; |
| 207 | virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const; |
| 208 | virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const; |
| 209 | |
| 210 | // Returns the media volume slider container's offset from the mute button. |
| 211 | virtual LayoutPoint volumeSliderOffsetFromMuteButton(const RenderBox&, const LayoutSize&) const; |
| 212 | #endif |
| 213 | |
| 214 | #if ENABLE(METER_ELEMENT) |
| 215 | virtual IntSize meterSizeForBounds(const RenderMeter&, const IntRect&) const; |
| 216 | virtual bool supportsMeter(ControlPart) const; |
| 217 | #endif |
| 218 | |
| 219 | #if ENABLE(DATALIST_ELEMENT) |
| 220 | // Returns the threshold distance for snapping to a slider tick mark. |
| 221 | virtual LayoutUnit sliderTickSnappingThreshold() const; |
| 222 | // Returns size of one slider tick mark for a horizontal track. |
| 223 | // For vertical tracks we rotate it and use it. i.e. Width is always length along the track. |
| 224 | virtual IntSize sliderTickSize() const = 0; |
| 225 | // Returns the distance of slider tick origin from the slider track center. |
| 226 | virtual int sliderTickOffsetFromTrackCenter() const = 0; |
| 227 | void paintSliderTicks(const RenderObject&, const PaintInfo&, const IntRect&); |
| 228 | #endif |
| 229 | |
| 230 | virtual bool shouldHaveSpinButton(const HTMLInputElement&) const; |
| 231 | virtual bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const; |
| 232 | |
| 233 | // Functions for <select> elements. |
| 234 | virtual bool () const { return false; } |
| 235 | virtual bool () const { return false; } |
| 236 | virtual bool () const { return false; } |
| 237 | |
| 238 | virtual String fileListDefaultLabel(bool multipleFilesAllowed) const; |
| 239 | virtual String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const; |
| 240 | |
| 241 | enum FileUploadDecorations { SingleFile, MultipleFiles }; |
| 242 | virtual bool paintFileUploadIconDecorations(const RenderObject& /*inputRenderer*/, const RenderObject& /*buttonRenderer*/, const PaintInfo&, const IntRect&, Icon*, FileUploadDecorations) { return true; } |
| 243 | |
| 244 | #if ENABLE(SERVICE_CONTROLS) |
| 245 | virtual IntSize imageControlsButtonSize(const RenderObject&) const { return IntSize(); } |
| 246 | virtual IntSize imageControlsButtonPositionOffset() const { return IntSize(); } |
| 247 | #endif |
| 248 | |
| 249 | #if ENABLE(ATTACHMENT_ELEMENT) |
| 250 | virtual LayoutSize attachmentIntrinsicSize(const RenderAttachment&) const { return LayoutSize(); } |
| 251 | virtual int attachmentBaseline(const RenderAttachment&) const { return -1; } |
| 252 | #endif |
| 253 | |
| 254 | enum class InnerSpinButtonLayout { Vertical, HorizontalUpLeft, HorizontalUpRight }; |
| 255 | virtual InnerSpinButtonLayout innerSpinButtonLayout(const RenderObject&) const { return InnerSpinButtonLayout::Vertical; } |
| 256 | |
| 257 | virtual bool shouldMockBoldSystemFontForAccessibility() const { return false; } |
| 258 | virtual void setShouldMockBoldSystemFontForAccessibility(bool) { } |
| 259 | |
| 260 | #if USE(SYSTEM_PREVIEW) |
| 261 | virtual void paintSystemPreviewBadge(Image&, const PaintInfo&, const FloatRect&); |
| 262 | #endif |
| 263 | |
| 264 | protected: |
| 265 | virtual FontCascadeDescription& cachedSystemFontDescription(CSSValueID systemFontID) const; |
| 266 | virtual void updateCachedSystemFontDescription(CSSValueID systemFontID, FontCascadeDescription&) const = 0; |
| 267 | |
| 268 | // The platform selection color. |
| 269 | virtual Color platformActiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 270 | virtual Color platformInactiveSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 271 | virtual Color platformActiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 272 | virtual Color platformInactiveSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 273 | |
| 274 | virtual Color platformActiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 275 | virtual Color platformInactiveListBoxSelectionBackgroundColor(OptionSet<StyleColor::Options>) const; |
| 276 | virtual Color platformActiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 277 | virtual Color platformInactiveListBoxSelectionForegroundColor(OptionSet<StyleColor::Options>) const; |
| 278 | |
| 279 | // The platform highlighting colors for search matches. |
| 280 | virtual Color platformActiveTextSearchHighlightColor(OptionSet<StyleColor::Options>) const; |
| 281 | virtual Color platformInactiveTextSearchHighlightColor(OptionSet<StyleColor::Options>) const; |
| 282 | |
| 283 | virtual bool supportsSelectionForegroundColors(OptionSet<StyleColor::Options>) const { return true; } |
| 284 | virtual bool supportsListBoxSelectionForegroundColors(OptionSet<StyleColor::Options>) const { return true; } |
| 285 | |
| 286 | #if !USE(NEW_THEME) |
| 287 | // Methods for each appearance value. |
| 288 | virtual void adjustCheckboxStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 289 | virtual bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 290 | virtual void setCheckboxSize(RenderStyle&) const { } |
| 291 | |
| 292 | virtual void adjustRadioStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 293 | virtual bool paintRadio(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 294 | virtual void setRadioSize(RenderStyle&) const { } |
| 295 | |
| 296 | virtual void adjustButtonStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 297 | virtual bool paintButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 298 | virtual void setButtonSize(RenderStyle&) const { } |
| 299 | |
| 300 | virtual void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 301 | virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 302 | #endif |
| 303 | |
| 304 | virtual bool paintCheckboxDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 305 | virtual bool paintRadioDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 306 | virtual bool paintButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 307 | |
| 308 | virtual void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 309 | virtual bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } |
| 310 | virtual bool paintTextFieldDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } |
| 311 | |
| 312 | virtual void adjustTextAreaStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 313 | virtual bool paintTextArea(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } |
| 314 | virtual bool paintTextAreaDecorations(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } |
| 315 | |
| 316 | virtual void (StyleResolver&, RenderStyle&, const Element*) const; |
| 317 | virtual bool (const RenderObject&, const PaintInfo&, const FloatRect&) { return true; } |
| 318 | virtual bool (const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 319 | |
| 320 | virtual void (StyleResolver&, RenderStyle&, const Element*) const; |
| 321 | virtual bool (const RenderBox&, const PaintInfo&, const FloatRect&) { return true; } |
| 322 | |
| 323 | virtual bool paintPushButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 324 | virtual bool paintSquareButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 325 | |
| 326 | #if ENABLE(METER_ELEMENT) |
| 327 | virtual void adjustMeterStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 328 | virtual bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&); |
| 329 | #endif |
| 330 | |
| 331 | virtual void adjustCapsLockIndicatorStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 332 | virtual bool paintCapsLockIndicator(const RenderObject&, const PaintInfo&, const IntRect&); |
| 333 | |
| 334 | #if ENABLE(APPLE_PAY) |
| 335 | virtual void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const { } |
| 336 | virtual bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 337 | #endif |
| 338 | |
| 339 | #if ENABLE(ATTACHMENT_ELEMENT) |
| 340 | virtual void adjustAttachmentStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 341 | virtual bool paintAttachment(const RenderObject&, const PaintInfo&, const IntRect&); |
| 342 | #endif |
| 343 | |
| 344 | #if ENABLE(DATALIST_ELEMENT) |
| 345 | virtual void adjustListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 346 | #endif |
| 347 | |
| 348 | virtual void adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 349 | virtual bool paintProgressBar(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 350 | |
| 351 | virtual void adjustSliderTrackStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 352 | virtual bool paintSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 353 | |
| 354 | virtual void adjustSliderThumbStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 355 | virtual bool paintSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 356 | virtual bool paintSliderThumbDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 357 | |
| 358 | virtual void adjustSearchFieldStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 359 | virtual bool paintSearchField(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 360 | virtual bool paintSearchFieldDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 361 | |
| 362 | virtual void adjustSearchFieldCancelButtonStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 363 | virtual bool paintSearchFieldCancelButton(const RenderBox&, const PaintInfo&, const IntRect&) { return true; } |
| 364 | |
| 365 | virtual void adjustSearchFieldDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 366 | virtual bool paintSearchFieldDecorationPart(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 367 | |
| 368 | virtual void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 369 | virtual bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) { return true; } |
| 370 | |
| 371 | virtual void adjustSearchFieldResultsButtonStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 372 | virtual bool paintSearchFieldResultsButton(const RenderBox&, const PaintInfo&, const IntRect&) { return true; } |
| 373 | |
| 374 | virtual void adjustMediaControlStyle(StyleResolver&, RenderStyle&, const Element*) const; |
| 375 | virtual bool paintMediaFullscreenButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 376 | virtual bool paintMediaPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 377 | virtual bool paintMediaOverlayPlayButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 378 | virtual bool paintMediaMuteButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 379 | virtual bool paintMediaSeekBackButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 380 | virtual bool paintMediaSeekForwardButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 381 | virtual bool paintMediaSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 382 | virtual bool paintMediaSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 383 | virtual bool paintMediaVolumeSliderContainer(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 384 | virtual bool paintMediaVolumeSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 385 | virtual bool paintMediaVolumeSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 386 | virtual bool paintMediaRewindButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 387 | virtual bool paintMediaReturnToRealtimeButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 388 | virtual bool paintMediaToggleClosedCaptionsButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 389 | virtual bool paintMediaControlsBackground(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 390 | virtual bool paintMediaCurrentTime(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 391 | virtual bool paintMediaTimeRemaining(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 392 | virtual bool paintMediaFullScreenVolumeSliderTrack(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 393 | virtual bool paintMediaFullScreenVolumeSliderThumb(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 394 | |
| 395 | virtual bool paintSnapshottedPluginOverlay(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 396 | |
| 397 | #if ENABLE(SERVICE_CONTROLS) |
| 398 | virtual bool paintImageControlsButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; } |
| 399 | #endif |
| 400 | |
| 401 | public: |
| 402 | void updateControlStatesForRenderer(const RenderBox&, ControlStates&) const; |
| 403 | ControlStates::States (const RenderObject&) const; |
| 404 | bool isActive(const RenderObject&) const; |
| 405 | bool isChecked(const RenderObject&) const; |
| 406 | bool isIndeterminate(const RenderObject&) const; |
| 407 | bool isEnabled(const RenderObject&) const; |
| 408 | bool isFocused(const RenderObject&) const; |
| 409 | bool isPressed(const RenderObject&) const; |
| 410 | bool isSpinUpButtonPartPressed(const RenderObject&) const; |
| 411 | bool isHovered(const RenderObject&) const; |
| 412 | bool isSpinUpButtonPartHovered(const RenderObject&) const; |
| 413 | bool isPresenting(const RenderObject&) const; |
| 414 | bool isReadOnlyControl(const RenderObject&) const; |
| 415 | bool isDefault(const RenderObject&) const; |
| 416 | |
| 417 | protected: |
| 418 | struct ColorCache { |
| 419 | HashMap<int, Color> systemStyleColors; |
| 420 | |
| 421 | Color systemLinkColor; |
| 422 | Color systemActiveLinkColor; |
| 423 | Color systemVisitedLinkColor; |
| 424 | Color systemFocusRingColor; |
| 425 | Color systemControlAccentColor; |
| 426 | |
| 427 | Color activeSelectionBackgroundColor; |
| 428 | Color inactiveSelectionBackgroundColor; |
| 429 | Color activeSelectionForegroundColor; |
| 430 | Color inactiveSelectionForegroundColor; |
| 431 | |
| 432 | Color activeListBoxSelectionBackgroundColor; |
| 433 | Color inactiveListBoxSelectionBackgroundColor; |
| 434 | Color activeListBoxSelectionForegroundColor; |
| 435 | Color inactiveListBoxSelectionForegroundColor; |
| 436 | |
| 437 | Color activeTextSearchHighlightColor; |
| 438 | Color inactiveTextSearchHighlightColor; |
| 439 | }; |
| 440 | |
| 441 | virtual ColorCache& colorCache(OptionSet<StyleColor::Options>) const; |
| 442 | |
| 443 | private: |
| 444 | mutable HashMap<uint8_t, ColorCache, DefaultHash<uint8_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint8_t>> m_colorCacheMap; |
| 445 | }; |
| 446 | |
| 447 | } // namespace WebCore |
| 448 | |