Home | History | Annotate | Download | only in rendering
      1 /*
      2  * This file is part of the WebKit project.
      3  *
      4  * Copyright (C) 2006 Apple Computer, Inc.
      5  * Copyright (C) 2006 Michael Emmel mike.emmel (at) gmail.com
      6  * Copyright (C) 2007 Holger Hans Peter Freyther
      7  * Copyright (C) 2007 Alp Toker <alp (at) atoker.com>
      8  * Copyright (C) 2008, 2009 Google, Inc.
      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 #ifndef RenderThemeChromiumSkia_h
     29 #define RenderThemeChromiumSkia_h
     30 
     31 #include "RenderTheme.h"
     32 
     33 namespace WebCore {
     34 
     35     class RenderThemeChromiumSkia : public RenderTheme {
     36     public:
     37         RenderThemeChromiumSkia();
     38         virtual ~RenderThemeChromiumSkia();
     39 
     40         virtual String extraDefaultStyleSheet();
     41         virtual String extraQuirksStyleSheet();
     42 #if ENABLE(VIDEO)
     43         virtual String extraMediaControlsStyleSheet();
     44 #endif
     45 
     46         // A method asking if the theme's controls actually care about redrawing when hovered.
     47         virtual bool supportsHover(const RenderStyle*) const;
     48 
     49         // A method asking if the theme is able to draw the focus ring.
     50         virtual bool supportsFocusRing(const RenderStyle*) const;
     51 
     52         // The platform selection color.
     53         virtual Color platformActiveSelectionBackgroundColor() const;
     54         virtual Color platformInactiveSelectionBackgroundColor() const;
     55         virtual Color platformActiveSelectionForegroundColor() const;
     56         virtual Color platformInactiveSelectionForegroundColor() const;
     57         virtual Color platformFocusRingColor() const;
     58 
     59         // To change the blink interval, override caretBlinkIntervalInternal instead of this one so that we may share layout test code an intercepts.
     60         virtual double caretBlinkInterval() const;
     61 
     62         // System fonts.
     63         virtual void systemFont(int propId, FontDescription&) const;
     64 
     65         virtual int minimumMenuListSize(RenderStyle*) const;
     66 
     67         virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     68         virtual void setCheckboxSize(RenderStyle*) const;
     69 
     70         virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     71         virtual void setRadioSize(RenderStyle*) const;
     72 
     73         virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     74         virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     75 
     76         virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     77 
     78         virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     79 
     80         virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     81         virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     82 
     83         virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     84         virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     85 
     86         virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     87 
     88         virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     89         virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     90 
     91         virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     92         virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     93 
     94         virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     95         virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     96         virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     97         virtual void adjustSliderThumbSize(RenderObject*) const;
     98         virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
     99         virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    100         virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    101         virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    102 
    103         // MenuList refers to an unstyled menulist (meaning a menulist without
    104         // background-color or border set) and MenuListButton refers to a styled
    105         // menulist (a menulist with background-color or border set). They have
    106         // this distinction to support showing aqua style themes whenever they
    107         // possibly can, which is something we don't want to replicate.
    108         //
    109         // In short, we either go down the MenuList code path or the MenuListButton
    110         // codepath. We never go down both. And in both cases, they render the
    111         // entire menulist.
    112         virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    113         virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    114         virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
    115         virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    116 
    117         virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    118         virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
    119 
    120         // These methods define the padding for the MenuList's inner block.
    121         virtual int popupInternalPaddingLeft(RenderStyle*) const;
    122         virtual int popupInternalPaddingRight(RenderStyle*) const;
    123         virtual int popupInternalPaddingTop(RenderStyle*) const;
    124         virtual int popupInternalPaddingBottom(RenderStyle*) const;
    125 
    126         virtual int buttonInternalPaddingLeft() const;
    127         virtual int buttonInternalPaddingRight() const;
    128         virtual int buttonInternalPaddingTop() const;
    129         virtual int buttonInternalPaddingBottom() const;
    130 
    131 #if ENABLE(VIDEO)
    132         // Media controls
    133         virtual bool shouldRenderMediaControlPart(ControlPart, Element*);
    134 #endif
    135 
    136         // Provide a way to pass the default font size from the Settings object
    137         // to the render theme.  FIXME: http://b/1129186 A cleaner way would be
    138         // to remove the default font size from this object and have callers
    139         // that need the value to get it directly from the appropriate Settings
    140         // object.
    141         static void setDefaultFontSize(int);
    142 
    143     protected:
    144         static const String& defaultGUIFont();
    145 
    146         // The default variable-width font size.  We use this as the default font
    147         // size for the "system font", and as a base size (which we then shrink) for
    148         // form control fonts.
    149         static float defaultFontSize;
    150 
    151         virtual double caretBlinkIntervalInternal() const;
    152 
    153     private:
    154         int menuListInternalPadding(RenderStyle*, int paddingType) const;
    155         bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
    156     };
    157 
    158 } // namespace WebCore
    159 
    160 #endif // RenderThemeChromiumSkia_h
    161