15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This file is part of the WebKit project.
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2006 Apple Computer, Inc.
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2007 Holger Hans Peter Freyther
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2007 Alp Toker <alp@atoker.com>
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2008, 2009 Google, Inc.
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * All rights reserved.
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is free software; you can redistribute it and/or
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modify it under the terms of the GNU Library General Public
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * License as published by the Free Software Foundation; either
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * version 2 of the License, or (at your option) any later version.
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * This library is distributed in the hope that it will be useful,
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Library General Public License for more details.
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * You should have received a copy of the GNU Library General Public License
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * along with this library; see the file COPYING.LIB.  If not, write to
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Boston, MA 02110-1301, USA.
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef RenderThemeChromiumSkia_h
295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define RenderThemeChromiumSkia_h
305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/rendering/RenderTheme.h"
325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)namespace WebCore {
345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderProgress;
365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class RenderThemeChromiumSkia : public RenderTheme {
38926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)public:
39926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    RenderThemeChromiumSkia();
40926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual ~RenderThemeChromiumSkia();
415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
42926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual String extraDefaultStyleSheet();
43926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual String extraQuirksStyleSheet();
44926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
45926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual Color platformTapHighlightColor() const OVERRIDE
46926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    {
47926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        return Color(defaultTapHighlightColor);
48926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    }
495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
50926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // A method asking if the theme's controls actually care about redrawing when hovered.
51926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool supportsHover(const RenderStyle*) const;
525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
53926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // A method asking if the theme is able to draw the focus ring.
54926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool supportsFocusRing(const RenderStyle*) const;
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
56926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool supportsClosedCaptioning() const OVERRIDE;
57926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // The platform selection color.
58926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual Color platformActiveSelectionBackgroundColor() const;
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual Color platformInactiveSelectionBackgroundColor() const;
60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual Color platformActiveSelectionForegroundColor() const;
61926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual Color platformInactiveSelectionForegroundColor() const;
62926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual Color platformFocusRingColor() const;
635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
64926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // To change the blink interval, override caretBlinkIntervalInternal instead of this one so that we may share layout test code an intercepts.
65926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual double caretBlinkInterval() const;
665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
67926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // System fonts.
685267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void systemFont(CSSValueID, FontDescription&) const;
695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
70926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual int minimumMenuListSize(RenderStyle*) const;
715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
72926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual void setCheckboxSize(RenderStyle*) const;
735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
74926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual void setRadioSize(RenderStyle*) const;
755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
765267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustButtonStyle(RenderStyle*, Element*) const;
775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
78926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
805267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustSearchFieldStyle(RenderStyle*, Element*) const;
81926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustSearchFieldCancelButtonStyle(RenderStyle*, Element*) const;
84926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintSearchFieldCancelButton(RenderObject*, const PaintInfo&, const IntRect&);
855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustSearchFieldDecorationStyle(RenderStyle*, Element*) const;
875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
885267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustSearchFieldResultsDecorationStyle(RenderStyle*, Element*) const;
89926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
91926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
92926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
93926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
94926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
95926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&);
96926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
97926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
98926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
99926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual String formatMediaControlsTime(float time) const;
100926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
101926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
1025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
103926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // MenuList refers to an unstyled menulist (meaning a menulist without
104926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // background-color or border set) and MenuListButton refers to a styled
105926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // menulist (a menulist with background-color or border set). They have
106926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // this distinction to support showing aqua style themes whenever they
107926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // possibly can, which is something we don't want to replicate.
108926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    //
109926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // In short, we either go down the MenuList code path or the MenuListButton
110926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // codepath. We never go down both. And in both cases, they render the
111926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // entire menulist.
1125267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustMenuListStyle(RenderStyle*, Element*) const;
1135267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    virtual void adjustMenuListButtonStyle(RenderStyle*, Element*) const;
114926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
1155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
116926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
117926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual double animationDurationForProgressBar(RenderProgress*) const;
1185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
119926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // These methods define the padding for the MenuList's inner block.
120926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual int popupInternalPaddingLeft(RenderStyle*) const;
121926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual int popupInternalPaddingRight(RenderStyle*) const;
122926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual int popupInternalPaddingTop(RenderStyle*) const;
123926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual int popupInternalPaddingBottom(RenderStyle*) const;
1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
125926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // Media controls
126926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; }
127926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool usesVerticalVolumeSlider() const { return false; }
1285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
129926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // Provide a way to pass the default font size from the Settings object
130926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // to the render theme. FIXME: http://b/1129186 A cleaner way would be
131926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // to remove the default font size from this object and have callers
132926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // that need the value to get it directly from the appropriate Settings
133926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // object.
134926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    static void setDefaultFontSize(int);
1355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
136926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)protected:
137926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual double caretBlinkIntervalInternal() const;
1385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
139926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual int menuListArrowPadding() const;
1405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
141926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const;
142926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const;
143926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    IntRect progressValueRectFor(RenderProgress*, const IntRect&) const;
1445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
145926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    class DirectionFlippingScope {
146926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    public:
147926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        DirectionFlippingScope(RenderObject*, const PaintInfo&, const IntRect&);
148926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        ~DirectionFlippingScope();
1495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
150926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    private:
151926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        bool m_needsFlipping;
152926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        const PaintInfo& m_paintInfo;
153926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    };
1545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private:
1565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    virtual bool shouldShowPlaceholderWhenFocused() const OVERRIDE;
1575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    int menuListInternalPadding(RenderStyle*, int paddingType) const;
1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
1605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
161926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
162926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black.
1635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
1645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} // namespace WebCore
1665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // RenderThemeChromiumSkia_h
168