15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* 25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This file is part of the theme implementation for form controls in WebCore. 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is free software; you can redistribute it and/or 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modify it under the terms of the GNU Library General Public 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * License as published by the Free Software Foundation; either 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * version 2 of the License, or (at your option) any later version. 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is distributed in the hope that it will be useful, 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Library General Public License for more details. 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * You should have received a copy of the GNU Library General Public License 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * along with this library; see the file COPYING.LIB. If not, write to 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Boston, MA 02110-1301, USA. 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef RenderTheme_h 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define RenderTheme_h 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#if USE(NEW_THEME) 27a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles)#include "platform/Theme.h" 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#else 2951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "platform/ThemeTypes.h" 305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif 3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/rendering/RenderObject.h" 32e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "core/rendering/style/CachedUAStyle.h" 331e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "platform/scroll/ScrollTypes.h" 34e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "wtf/PassRefPtr.h" 35e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "wtf/RefCounted.h" 360019e4eead4d990e4304c54a9028aca9122fb256Ben Murdoch#include "wtf/text/WTFString.h" 375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 38c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class Element; 415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class FileList; 425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class HTMLInputElement; 435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderMeter; 445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderProgress; 455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 46e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderTheme : public RefCounted<RenderTheme> { 485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)protected: 495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) RenderTheme(); 505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public: 525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual ~RenderTheme() { } 535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // This function is to be implemented in your platform-specific theme implementation to hand back the 55c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles) // appropriate platform theme. 56c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles) static RenderTheme& theme(); 575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 5893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) static void setSizeIfAuto(RenderStyle*, const IntSize&); 5993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // This method is called whenever style has been computed for an element and the appearance 615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // property has been set to a value other than "none". The theme should map in all of the appropriate 625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // metrics and defaults given the contents of the style. This includes sophisticated operations like 635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // selection of control size based off the font, the disabling of appearance when certain other properties like 645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // "border" are set, or if the appearance is not supported by the theme. 655d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) void adjustStyle(RenderStyle*, Element*, const CachedUAStyle*); 665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // This method is called to paint the widget as a background of the RenderObject. A widget's foreground, e.g., the 685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // text of a button, is always rendered by the engine itself. The boolean return value indicates 695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // whether the CSS border/background should also be painted. 705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool paint(RenderObject*, const PaintInfo&, const IntRect&); 715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&); 725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&); 735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // The remaining methods should be implemented by the platform-specific portion of the theme, e.g., 755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // RenderThemeMac.cpp for Mac OS X. 765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // These methods return the theme's extra style sheets rules, to let each platform 7853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) // adjust the default CSS rules in html.css, quirks.css or mediaControls.css. 7993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual String extraDefaultStyleSheet(); 805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual String extraQuirksStyleSheet() { return String(); } 81926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) virtual String extraMediaControlsStyleSheet() { return String(); } 82926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) virtual String extraFullScreenStyleSheet() { return String(); } 835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline 855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of 865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // controls that need to do this. 875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int baselinePosition(const RenderObject*) const; 885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like 905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // the baseline position API above). 915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isControlContainer(ControlPart) const; 925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Whether or not the control has been styled enough by the author to disable the native appearance. 945d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) virtual bool isControlStyled(const RenderStyle*, const CachedUAStyle*) const; 955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 969e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls issues paint invalidations, 975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control. 989e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) virtual void adjustPaintInvalidationRect(const RenderObject*, IntRect&); 995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed 1015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // or a control becomes disabled. 1025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool stateChanged(RenderObject*, ControlState) const; 1035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 104591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch bool shouldDrawDefaultFocusRing(RenderObject*) const; 1055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // A method asking if the theme's controls actually care about redrawing when hovered. 1075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool supportsHover(const RenderStyle*) const { return false; } 1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // A method asking if the platform is able to show a calendar picker for a given input type. 11193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool supportsCalendarPicker(const AtomicString&) const; 1125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif 1135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Text selection colors. 1155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color activeSelectionBackgroundColor() const; 1165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color inactiveSelectionBackgroundColor() const; 1175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color activeSelectionForegroundColor() const; 1185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color inactiveSelectionForegroundColor() const; 1195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // List box selection colors 1215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color activeListBoxSelectionBackgroundColor() const; 1225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color activeListBoxSelectionForegroundColor() const; 1235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color inactiveListBoxSelectionBackgroundColor() const; 1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) Color inactiveListBoxSelectionForegroundColor() const; 1255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Highlighting colors for TextMatches. 1275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformActiveTextSearchHighlightColor() const; 1285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformInactiveTextSearchHighlightColor() const; 1295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 13009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) Color focusRingColor() const; 1315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformFocusRingColor() const { return Color(0, 0, 0); } 13209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) void setCustomFocusRingColor(const Color&); 1335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static Color tapHighlightColor(); 1345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformTapHighlightColor() const { return RenderTheme::defaultTapHighlightColor; } 1355d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) virtual Color platformDefaultCompositionBackgroundColor() const { return defaultCompositionBackgroundColor; } 1365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual void platformColorsDidChange(); 1375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual double caretBlinkInterval() const { return 0.5; } 1395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // System fonts and colors for CSS. 1415267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void systemFont(CSSValueID, FontDescription&) const = 0; 1425267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual Color systemColor(CSSValueID) const; 1435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int minimumMenuListSize(RenderStyle*) const { return 0; } 1455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual void adjustSliderThumbSize(RenderStyle*, Element*) const; 1475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int popupInternalPaddingLeft(RenderStyle*) const { return 0; } 1495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; } 1505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; } 1515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; } 1525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool popupOptionSupportsTextIndent() const { return false; } 1535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; } 1555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Method for painting the caps lock indicator 1575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; }; 1585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Returns the repeat interval of the animation for the progress bar. 1605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; 1615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Returns the duration of the animation for the progress bar. 1625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual double animationDurationForProgressBar(RenderProgress*) const; 1635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Media controls 1655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual String formatMediaControlsTime(float time) const; 1665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const; 1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; 1695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool supportsMeter(ControlPart) const; 1705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Returns size of one slider tick mark for a horizontal track. 1725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // For vertical tracks we rotate it and use it. i.e. Width is always length along the track. 1735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual IntSize sliderTickSize() const = 0; 1745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Returns the distance of slider tick origin from the slider track center. 1755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual int sliderTickOffsetFromTrackCenter() const = 0; 1765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void paintSliderTicks(RenderObject*, const PaintInfo&, const IntRect&); 1775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1785c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool shouldShowPlaceholderWhenFocused() const { return false; } 1795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool shouldHaveSpinButton(HTMLInputElement*) const; 1805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Functions for <select> elements. 1825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool delegatesMenuListRendering() const { return false; } 1835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool popsMenuByArrowKeys() const { return false; } 184197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch virtual bool popsMenuBySpaceKey() const { return false; } 185197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch virtual bool popsMenuByReturnKey() const { return false; } 186197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch virtual bool popsMenuByAltDownUpOrF4Key() const { return false; } 1875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1881e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) virtual String fileListNameForWidth(Locale&, const FileList*, const Font&, int width) const; 1895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool shouldOpenPickerWithF4Key() const; 1915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 19209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) virtual bool supportsSelectionForegroundColors() const { return true; } 19309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) 1947242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual bool isModalColorChooser() const { return true; } 1957242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci 1965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)protected: 1975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // The platform selection color. 1985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformActiveSelectionBackgroundColor() const; 1995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformInactiveSelectionBackgroundColor() const; 2005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformActiveSelectionForegroundColor() const; 2015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformInactiveSelectionForegroundColor() const; 2025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformActiveListBoxSelectionBackgroundColor() const; 2045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformInactiveListBoxSelectionBackgroundColor() const; 2055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformActiveListBoxSelectionForegroundColor() const; 2065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual Color platformInactiveListBoxSelectionForegroundColor() const; 2075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 208591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch // A method asking if the theme is able to draw the focus ring. 209591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch virtual bool supportsFocusRing(const RenderStyle*) const; 2105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#if !USE(NEW_THEME) 2125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Methods for each appearance value. 2135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustCheckboxStyle(RenderStyle*, Element*) const; 2145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual void setCheckboxSize(RenderStyle*) const { } 2165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2175267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustRadioStyle(RenderStyle*, Element*) const; 2185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual void setRadioSize(RenderStyle*) const { } 2205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2215267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustButtonStyle(RenderStyle*, Element*) const; 2225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2245267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustInnerSpinButtonStyle(RenderStyle*, Element*) const; 2255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif 2275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2325267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustMenuListStyle(RenderStyle*, Element*) const; 2335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2355267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustMenuListButtonStyle(RenderStyle*, Element*) const; 2365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); 2395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustSliderThumbStyle(RenderStyle*, Element*) const; 2455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustSearchFieldStyle(RenderStyle*, Element*) const; 2485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustSearchFieldCancelButtonStyle(RenderStyle*, Element*) const; 2515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustSearchFieldDecorationStyle(RenderStyle*, Element*) const; 2545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) virtual void adjustSearchFieldResultsDecorationStyle(RenderStyle*, Element*) const; 2575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaOverlayPlayButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2697242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci virtual bool paintMediaCastButton(RenderObject*, const PaintInfo&, const IntRect&) { return true; }; 2705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaTimeRemaining(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaFullScreenVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) virtual bool paintMediaFullScreenVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&) { return true; } 2755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 27693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) virtual bool shouldUseFallbackTheme(RenderStyle*) const; 2775267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) void adjustStyleUsingFallbackTheme(RenderStyle*, Element*); 27893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) bool paintUsingFallbackTheme(RenderObject*, const PaintInfo&, const IntRect&); 2795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) void adjustCheckboxStyleUsingFallbackTheme(RenderStyle*, Element*) const; 28093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) bool paintCheckboxUsingFallbackTheme(RenderObject*, const PaintInfo&, const IntRect&); 2815267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles) void adjustRadioStyleUsingFallbackTheme(RenderStyle*, Element*) const; 28293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) bool paintRadioUsingFallbackTheme(RenderObject*, const PaintInfo&, const IntRect&); 28393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 2845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public: 2855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Methods for state querying 2865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) ControlStates controlStatesForRenderer(const RenderObject* o) const; 2875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isActive(const RenderObject*) const; 2885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isChecked(const RenderObject*) const; 2895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isIndeterminate(const RenderObject*) const; 2905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isEnabled(const RenderObject*) const; 2915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isFocused(const RenderObject*) const; 2925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isPressed(const RenderObject*) const; 2935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isSpinUpButtonPartPressed(const RenderObject*) const; 2945c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isHovered(const RenderObject*) const; 2955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isSpinUpButtonPartHovered(const RenderObject*) const; 2965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) bool isReadOnlyControl(const RenderObject*) const; 2975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private: 29909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) Color m_customFocusRingColor; 30009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) bool m_hasCustomFocusRingColor; 3015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 3025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // This color is expected to be drawn on a semi-transparent overlay, 3035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // making it more transparent than its alpha value indicates. 3045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static const RGBA32 defaultTapHighlightColor = 0x66000000; 3055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 3065d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55; 3075d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) 3085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#if USE(NEW_THEME) 309c0e19a689c8ac22cdc96b291a8d33a5d3b0b34a4Torne (Richard Coles) Theme* m_platformTheme; // The platform-specific theme. 3105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif 3115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}; 3125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 313c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 3145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 3155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // RenderTheme_h 316