From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/rendering/RenderTheme.h | 320 ++++++++++++++++++--------------- 1 file changed, 172 insertions(+), 148 deletions(-) (limited to 'Source/WebCore/rendering/RenderTheme.h') diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h index 2b7fa153c..122271e7d 100644 --- a/Source/WebCore/rendering/RenderTheme.h +++ b/Source/WebCore/rendering/RenderTheme.h @@ -1,7 +1,7 @@ /* * This file is part of the theme implementation for form controls in WebCore. * - * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. + * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,17 +20,20 @@ * */ -#ifndef RenderTheme_h -#define RenderTheme_h +#pragma once +#include "BorderData.h" +#include "ControlStates.h" +#include "FillLayer.h" #if USE(NEW_THEME) #include "Theme.h" #else #include "ThemeTypes.h" #endif -#include "RenderObject.h" +#include "PaintInfo.h" +#include "PopupMenuStyle.h" #include "ScrollTypes.h" -#include +#include #include namespace WebCore { @@ -40,15 +43,16 @@ class Element; class FileList; class HTMLInputElement; class Icon; +class Page; class PopupMenu; +class RenderAttachment; +class RenderBox; class RenderMenuList; -#if ENABLE(METER_ELEMENT) class RenderMeter; -#endif -#if ENABLE(PROGRESS_ELEMENT) +class RenderObject; class RenderProgress; -#endif class RenderSnapshottedPlugIn; +class StyleResolver; class RenderTheme : public RefCounted { protected: @@ -60,27 +64,29 @@ public: // This function is to be implemented in your platform-specific theme implementation to hand back the // appropriate platform theme. When the theme is needed in non-page dependent code, a default theme is // used as fallback, which is returned for a nulled page, so the platform code needs to account for this. - static PassRefPtr themeForPage(Page* page); + static Ref themeForPage(Page*); // When the theme is needed in non-page dependent code, the defaultTheme() is used as fallback. - static inline PassRefPtr defaultTheme() + static inline Ref defaultTheme() { - return themeForPage(0); + return themeForPage(nullptr); }; + virtual void purgeCaches() { } + // This method is called whenever style has been computed for an element and the appearance // property has been set to a value other than "none". The theme should map in all of the appropriate // metrics and defaults given the contents of the style. This includes sophisticated operations like // selection of control size based off the font, the disabling of appearance when certain other properties like // "border" are set, or if the appearance is not supported by the theme. - void adjustStyle(StyleResolver&, RenderStyle&, Element*, bool UAHasAppearance, const BorderData&, const FillLayer&, const Color& backgroundColor); + void adjustStyle(StyleResolver&, RenderStyle&, const Element*, bool UAHasAppearance, const BorderData&, const FillLayer&, const Color& backgroundColor); // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the // text of a button, is always rendered by the engine itself. The boolean return value indicates // whether the CSS border/background should also be painted. - bool paint(RenderObject*, const PaintInfo&, const IntRect&); - bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&); - bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&); + bool paint(const RenderBox&, ControlStates&, const PaintInfo&, const LayoutRect&); + bool paintBorderOnly(const RenderBox&, const PaintInfo&, const LayoutRect&); + bool paintDecorations(const RenderBox&, const PaintInfo&, const LayoutRect&); // The remaining methods should be implemented by the platform-specific portion of the theme, e.g., // RenderThemeMac.cpp for Mac OS X. @@ -92,48 +98,53 @@ public: virtual String extraPlugInsStyleSheet() { return String(); } #if ENABLE(VIDEO) virtual String mediaControlsStyleSheet() { return String(); } + virtual String modernMediaControlsStyleSheet() { return String(); } virtual String extraMediaControlsStyleSheet() { return String(); } - virtual String mediaControlsScript() { return String() ; } + virtual String mediaControlsScript() { return String(); } + virtual String mediaControlsBase64StringForIconAndPlatform(const String&, const String&) { return String(); } #endif #if ENABLE(FULLSCREEN_API) virtual String extraFullScreenStyleSheet() { return String(); } #endif +#if ENABLE(SERVICE_CONTROLS) + virtual String imageControlsStyleSheet() const { return String(); } +#endif // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual int baselinePosition(const RenderObject*) const; + virtual int baselinePosition(const RenderBox&) const; // A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like // the baseline position API above). bool isControlContainer(ControlPart) const; // A method asking if the control changes its tint when the window has focus or not. - virtual bool controlSupportsTints(const RenderObject*) const { return false; } + virtual bool controlSupportsTints(const RenderObject&) const { return false; } // Whether or not the control has been styled enough by the author to disable the native appearance. - virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const; + virtual bool isControlStyled(const RenderStyle&, const BorderData&, const FillLayer&, const Color& backgroundColor) const; // A general method asking if any control tinting is supported at all. virtual bool supportsControlTints() const { return false; } // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint, // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control. - virtual void adjustRepaintRect(const RenderObject*, IntRect&); + virtual void adjustRepaintRect(const RenderObject&, FloatRect&); // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed // or a control becomes disabled. - virtual bool stateChanged(RenderObject*, ControlState) const; + virtual bool stateChanged(const RenderObject&, ControlStates::States) const; // This method is called whenever the theme changes on the system in order to flush cached resources from the // old theme. virtual void themeChanged() { } // A method asking if the theme is able to draw the focus ring. - virtual bool supportsFocusRing(const RenderStyle*) const; + virtual bool supportsFocusRing(const RenderStyle&) const; // A method asking if the theme's controls actually care about redrawing when hovered. - virtual bool supportsHover(const RenderStyle*) const { return false; } + virtual bool supportsHover(const RenderStyle&) const { return false; } // A method asking if the platform is able to show datalist suggestions for a given input type. virtual bool supportsDataListUI(const AtomicString&) const { return false; } @@ -159,40 +170,35 @@ public: static Color focusRingColor(); virtual Color platformFocusRingColor() const { return Color(0, 0, 0); } static void setCustomFocusRingColor(const Color&); + static float platformFocusRingWidth() { return 3; } + static float platformFocusRingOffset(float outlineWidth) { return std::max(outlineWidth - platformFocusRingWidth(), 0); } #if ENABLE(TOUCH_EVENTS) static Color tapHighlightColor(); - virtual Color platformTapHighlightColor() const { return RenderTheme::defaultTapHighlightColor; } + virtual Color platformTapHighlightColor() const; #endif virtual void platformColorsDidChange(); virtual double caretBlinkInterval() const { return 0.5; } // System fonts and colors for CSS. - virtual void systemFont(CSSValueID, FontDescription&) const = 0; + void systemFont(CSSValueID, FontCascadeDescription&) const; virtual Color systemColor(CSSValueID) const; - virtual int minimumMenuListSize(RenderStyle*) const { return 0; } + virtual int minimumMenuListSize(const RenderStyle&) const { return 0; } - virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; + virtual void adjustSliderThumbSize(RenderStyle&, const Element*) const; - virtual int popupInternalPaddingLeft(RenderStyle*) const { return 0; } - virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; } - virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; } - virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; } + virtual LengthBox popupInternalPaddingBox(const RenderStyle&) const { return { 0, 0, 0, 0 }; } virtual bool popupOptionSupportsTextIndent() const { return false; } + virtual PopupMenuStyle::PopupMenuSize popupMenuSize(const RenderStyle&, IntRect&) const { return PopupMenuStyle::PopupMenuSizeNormal; } virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; } - // Method for painting the caps lock indicator - virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; }; - -#if ENABLE(PROGRESS_ELEMENT) // Returns the repeat interval of the animation for the progress bar. - virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; + virtual double animationRepeatIntervalForProgressBar(RenderProgress&) const; // Returns the duration of the animation for the progress bar. - virtual double animationDurationForProgressBar(RenderProgress*) const; - virtual IntRect progressBarRectForBounds(const RenderObject*, const IntRect&) const; -#endif + virtual double animationDurationForProgressBar(RenderProgress&) const; + virtual IntRect progressBarRectForBounds(const RenderObject&, const IntRect&) const; #if ENABLE(VIDEO) // Media controls @@ -208,11 +214,11 @@ public: virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const; // Returns the media volume slider container's offset from the mute button. - virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; + virtual LayoutPoint volumeSliderOffsetFromMuteButton(const RenderBox&, const LayoutSize&) const; #endif #if ENABLE(METER_ELEMENT) - virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; + virtual IntSize meterSizeForBounds(const RenderMeter&, const IntRect&) const; virtual bool supportsMeter(ControlPart) const; #endif @@ -224,11 +230,11 @@ public: virtual IntSize sliderTickSize() const = 0; // Returns the distance of slider tick origin from the slider track center. virtual int sliderTickOffsetFromTrackCenter() const = 0; - void paintSliderTicks(RenderObject*, const PaintInfo&, const IntRect&); + void paintSliderTicks(const RenderObject&, const PaintInfo&, const IntRect&); #endif - virtual bool shouldShowPlaceholderWhenFocused() const { return false; } - virtual bool shouldHaveSpinButton(HTMLInputElement*) const; + virtual bool shouldHaveSpinButton(const HTMLInputElement&) const; + virtual bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const; // Functions for