#ifndef RenderTheme_h
#define RenderTheme_h
#if USE(NEW_THEME)
#include "Theme.h"
#else
#include "ThemeTypes.h"
#endif
#include "RenderObject.h"
#include "RenderTheme.h"
#include "ScrollTypes.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class Element;
class PopupMenu;
class RenderMenuList;
class CSSStyleSheet;
class RenderTheme : public RefCounted<RenderTheme> {
protected:
RenderTheme();
public:
virtual ~RenderTheme() { }
static PassRefPtr<RenderTheme> themeForPage(Page* page);
static inline PassRefPtr<RenderTheme> defaultTheme()
{
return themeForPage(0);
};
void adjustStyle(CSSStyleSelector*, RenderStyle*, Element*, bool UAHasAppearance,
const BorderData&, const FillLayer&, const Color& backgroundColor);
bool paint(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
bool paintBorderOnly(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
bool paintDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual String extraDefaultStyleSheet() { return String(); }
virtual String extraQuirksStyleSheet() { return String(); }
#if ENABLE(VIDEO)
virtual String extraMediaControlsStyleSheet() { return String(); };
#endif
virtual int baselinePosition(const RenderObject*) const;
bool isControlContainer(ControlPart) const;
virtual bool controlSupportsTints(const RenderObject*) const { return false; }
virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const;
virtual bool supportsControlTints() const { return false; }
virtual void adjustRepaintRect(const RenderObject*, IntRect&);
virtual bool stateChanged(RenderObject*, ControlState) const;
virtual void themeChanged() { }
virtual bool supportsFocusRing(const RenderStyle*) const;
virtual bool supportsHover(const RenderStyle*) const { return false; }
Color activeSelectionBackgroundColor() const;
Color inactiveSelectionBackgroundColor() const;
Color activeSelectionForegroundColor() const;
Color inactiveSelectionForegroundColor() const;
Color activeListBoxSelectionBackgroundColor() const;
Color activeListBoxSelectionForegroundColor() const;
Color inactiveListBoxSelectionBackgroundColor() const;
Color inactiveListBoxSelectionForegroundColor() const;
virtual Color platformActiveTextSearchHighlightColor() const;
virtual Color platformInactiveTextSearchHighlightColor() const;
static Color focusRingColor();
virtual Color platformFocusRingColor() const { return Color(0, 0, 0); }
static void setCustomFocusRingColor(const Color&);
virtual void platformColorsDidChange();
virtual double caretBlinkInterval() const { return 0.5; }
virtual Color systemColor(int cssValueId) const;
virtual int minimumMenuListSize(RenderStyle*) const { return 0; }
virtual void adjustSliderThumbSize(RenderObject*) 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 bool popupOptionSupportsTextIndent() const { return false; }
virtual int buttonInternalPaddingLeft() const { return 0; }
virtual int buttonInternalPaddingRight() const { return 0; }
virtual int buttonInternalPaddingTop() const { return 0; }
virtual int buttonInternalPaddingBottom() const { return 0; }
virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; }
virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return 0; };
virtual bool paintCheckboxDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintRadioDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintPushButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintSquareButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintTextFieldDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintTextAreaDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMenuListDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMenuListButtonDecorations(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
#if ENABLE(VIDEO)
virtual bool hitTestMediaControlPart(RenderObject*, const IntPoint& absPoint);
#endif
protected:
virtual Color platformActiveSelectionBackgroundColor() const;
virtual Color platformInactiveSelectionBackgroundColor() const;
virtual Color platformActiveSelectionForegroundColor() const;
virtual Color platformInactiveSelectionForegroundColor() const;
virtual Color platformActiveListBoxSelectionBackgroundColor() const;
virtual Color platformInactiveListBoxSelectionBackgroundColor() const;
virtual Color platformActiveListBoxSelectionForegroundColor() const;
virtual Color platformInactiveListBoxSelectionForegroundColor() const;
virtual bool supportsSelectionForegroundColors() const { return true; }
virtual bool supportsListBoxSelectionForegroundColors() const { return true; }
#if !USE(NEW_THEME)
virtual void adjustCheckboxStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void setCheckboxSize(RenderStyle*) const { }
virtual void adjustRadioStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void setRadioSize(RenderStyle*) const { }
virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void setButtonSize(RenderStyle*) const { }
#endif
virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaRewindButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaReturnToRealtimeButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
virtual bool paintMediaTimeRemaining(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return true; }
public:
ControlStates controlStatesForRenderer(const RenderObject* o) const;
bool isActive(const RenderObject*) const;
bool isChecked(const RenderObject*) const;
bool isIndeterminate(const RenderObject*) const;
bool isEnabled(const RenderObject*) const;
bool isFocused(const RenderObject*) const;
bool isPressed(const RenderObject*) const;
bool isHovered(const RenderObject*) const;
bool isReadOnlyControl(const RenderObject*) const;
bool isDefault(const RenderObject*) const;
private:
mutable Color m_activeSelectionBackgroundColor;
mutable Color m_inactiveSelectionBackgroundColor;
mutable Color m_activeSelectionForegroundColor;
mutable Color m_inactiveSelectionForegroundColor;
mutable Color m_activeListBoxSelectionBackgroundColor;
mutable Color m_inactiveListBoxSelectionBackgroundColor;
mutable Color m_activeListBoxSelectionForegroundColor;
mutable Color m_inactiveListBoxSelectionForegroundColor;
#if USE(NEW_THEME)
Theme* m_theme; #endif
};
}
#endif // RenderTheme_h