Commit 084394f0 authored by hyatt@apple.com's avatar hyatt@apple.com

2008-10-17 David Hyatt <hyatt@apple.com>

        Beginning of the RenderTheme re-architecture (to share more code).  Add the new Theme API header
        file.  Add new USE(NEW_THEME) switch that is enabled on Mac.  The Mac theme will be converted first.

        Reviewed by Tim Hatcher

        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * config.h:
        * platform/Theme.h: Added.
        (WebCore::Theme::Theme):
        (WebCore::Theme::~Theme):
        (WebCore::Theme::baselinePositionAdjustment):
        (WebCore::Theme::controlHasInactiveAppearance):
        (WebCore::Theme::controlsCanHaveInactiveAppearance):
        (WebCore::Theme::controlsCanHaveHoveredAppearance):
        (WebCore::Theme::controlDrawsBorder):
        (WebCore::Theme::controlDrawsBackground):
        (WebCore::Theme::controlDrawsFocusOutline):
        (WebCore::Theme::selectionColor):
        (WebCore::Theme::textSearchHighlightColor):
        (WebCore::Theme::systemColor):
        (WebCore::Theme::systemFont):
        (WebCore::Theme::caretBlinkFrequency):
        (WebCore::Theme::themeChanged):
        (WebCore::Theme::controlSize):
        (WebCore::Theme::controlFont):
        (WebCore::Theme::controlPadding):
        (WebCore::Theme::controlInternalPadding):
        (WebCore::Theme::controlBorder):
        (WebCore::Theme::controlBorderRadius):
        (WebCore::Theme::paint):
        (WebCore::Theme::inflateControlPaintRect):
        * platform/ThemeTypes.h: Added.
        (WebCore::):
        (WebCore::ControlBox::ControlBox):
        (WebCore::ControlBox::top):
        (WebCore::ControlBox::right):
        (WebCore::ControlBox::bottom):
        (WebCore::ControlBox::left):
        * platform/mac/ThemeMac.h: Added.
        (WebCore::ThemeMac::ThemeMac):
        (WebCore::ThemeMac::~ThemeMac):
        * platform/mac/ThemeMac.mm: Added.
        (WebCore::platformTheme):
        * rendering/RenderTheme.cpp:
        (WebCore::RenderTheme::RenderTheme):
        * rendering/RenderTheme.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37662 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 39622594
2008-10-17 David Hyatt <hyatt@apple.com>
Beginning of the RenderTheme re-architecture (to share more code). Add the new Theme API header
file. Add new USE(NEW_THEME) switch that is enabled on Mac. The Mac theme will be converted first.
Reviewed by Tim Hatcher
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* config.h:
* platform/Theme.h: Added.
(WebCore::Theme::Theme):
(WebCore::Theme::~Theme):
(WebCore::Theme::baselinePositionAdjustment):
(WebCore::Theme::controlHasInactiveAppearance):
(WebCore::Theme::controlsCanHaveInactiveAppearance):
(WebCore::Theme::controlsCanHaveHoveredAppearance):
(WebCore::Theme::controlDrawsBorder):
(WebCore::Theme::controlDrawsBackground):
(WebCore::Theme::controlDrawsFocusOutline):
(WebCore::Theme::selectionColor):
(WebCore::Theme::textSearchHighlightColor):
(WebCore::Theme::systemColor):
(WebCore::Theme::systemFont):
(WebCore::Theme::caretBlinkFrequency):
(WebCore::Theme::themeChanged):
(WebCore::Theme::controlSize):
(WebCore::Theme::controlFont):
(WebCore::Theme::controlPadding):
(WebCore::Theme::controlInternalPadding):
(WebCore::Theme::controlBorder):
(WebCore::Theme::controlBorderRadius):
(WebCore::Theme::paint):
(WebCore::Theme::inflateControlPaintRect):
* platform/ThemeTypes.h: Added.
(WebCore::):
(WebCore::ControlBox::ControlBox):
(WebCore::ControlBox::top):
(WebCore::ControlBox::right):
(WebCore::ControlBox::bottom):
(WebCore::ControlBox::left):
* platform/mac/ThemeMac.h: Added.
(WebCore::ThemeMac::ThemeMac):
(WebCore::ThemeMac::~ThemeMac):
* platform/mac/ThemeMac.mm: Added.
(WebCore::platformTheme):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::RenderTheme):
* rendering/RenderTheme.h:
2008-10-17 Marco Barisione <marco.barisione@collabora.co.uk>
Reviewed by Sam Weinig. Landed by Jan Alonzo.
......
......@@ -3195,6 +3195,14 @@
RelativePath="..\platform\text\TextStyle.h"
>
</File>
<File
RelativePath="..\platform\Theme.h"
>
</File>
<File
RelativePath="..\platform\ThemeTypes.h"
>
</File>
<File
RelativePath="..\platform\Timer.cpp"
>
......
......@@ -4018,6 +4018,10 @@
BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */; };
BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */; };
BCE3BEC30D222B1D007E06E4 /* TagNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */; };
BCE658FF0EA9248A007E4533 /* Theme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE658FE0EA9248A007E4533 /* Theme.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCE659A90EA927B9007E4533 /* ThemeTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE659A80EA927B9007E4533 /* ThemeTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCE659E60EA92FB2007E4533 /* ThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE659E50EA92FB2007E4533 /* ThemeMac.h */; };
BCE659E90EA92FFA007E4533 /* ThemeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCE659E80EA92FFA007E4533 /* ThemeMac.mm */; };
BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */; };
BCE99EC30DCA624100182683 /* JSXSLTProcessorConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */; };
BCE99EC40DCA624100182683 /* JSXSLTProcessorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */; };
......@@ -8578,6 +8582,10 @@
BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSLocationCustom.cpp; sourceTree = "<group>"; };
BCE3BEC00D222B1D007E06E4 /* TagNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagNodeList.cpp; sourceTree = "<group>"; };
BCE3BEC10D222B1D007E06E4 /* TagNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagNodeList.h; sourceTree = "<group>"; };
BCE658FE0EA9248A007E4533 /* Theme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Theme.h; sourceTree = "<group>"; };
BCE659A80EA927B9007E4533 /* ThemeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeTypes.h; sourceTree = "<group>"; };
BCE659E50EA92FB2007E4533 /* ThemeMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThemeMac.h; sourceTree = "<group>"; };
BCE659E80EA92FFA007E4533 /* ThemeMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ThemeMac.mm; sourceTree = "<group>"; };
BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHistoryCustom.cpp; sourceTree = "<group>"; };
BCE99EC10DCA624100182683 /* JSXSLTProcessorConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXSLTProcessorConstructor.cpp; sourceTree = "<group>"; };
BCE99EC20DCA624100182683 /* JSXSLTProcessorConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessorConstructor.h; sourceTree = "<group>"; };
......@@ -9460,6 +9468,8 @@
6582A14809999D6C00BEEB6D /* mac */ = {
isa = PBXGroup;
children = (
BCE659E50EA92FB2007E4533 /* ThemeMac.h */,
BCE659E80EA92FFA007E4533 /* ThemeMac.mm */,
BCEF869E0E844E9D00A85CD5 /* ScrollbarThemeMac.mm */,
51E1ECAD0C91C54600DC255B /* AutodrainedPool.mm */,
65A640F00533BB1F0085E777 /* BlockExceptions.h */,
......@@ -13201,6 +13211,8 @@
F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */,
9352071709BD3BA500F2038D /* StaticConstructors.h */,
93E62D990985F41600E1B5E3 /* SystemTime.h */,
BCE658FE0EA9248A007E4533 /* Theme.h */,
BCE659A80EA927B9007E4533 /* ThemeTypes.h */,
51DF6D7D0B92A16D00C2DC85 /* ThreadCheck.h */,
93309EA1099EB78C0056E581 /* Timer.cpp */,
9305B24C098F1B6B00C28855 /* Timer.h */,
......@@ -15988,6 +16000,9 @@
1CF6BE150E9BB4670025E1CD /* ObjCNodeFilterCondition.h in Headers */,
A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */,
939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */,
BCE658FF0EA9248A007E4533 /* Theme.h in Headers */,
BCE659A90EA927B9007E4533 /* ThemeTypes.h in Headers */,
BCE659E60EA92FB2007E4533 /* ThemeMac.h in Headers */,
E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -17856,6 +17871,7 @@
1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */,
BC80FA130EA287B000B0821D /* Length.cpp in Sources */,
939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */,
BCE659E90EA92FFA007E4533 /* ThemeMac.mm in Sources */,
E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -112,6 +112,7 @@
#define WTF_USE_ATSUI 1
#define WTF_USE_CORE_TEXT 0
#endif
#define WTF_USE_NEW_THEME 1
#endif
#if PLATFORM(SYMBIAN)
......
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Theme_h
#define Theme_h
#include "Color.h"
#include "Font.h"
#include "IntSize.h"
#include "IntRect.h"
#include "PlatformString.h"
#include "ThemeTypes.h"
namespace WebCore {
class GraphicsContext;
// Unlike other platform classes, Theme does extensively use virtual functions. This design allows a platform to switch between multiple themes at runtime.
class Theme {
public:
Theme() { }
virtual ~Theme() { }
// A method to obtain the baseline position adjustment 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. The adjustment is an offset that adds to the baseline, e.g., marginTop() + height() + |offset|.
virtual int baselinePositionAdjustment(ControlPart) const { return 0; }
// A method asking if the control changes its appearance when the window is inactive.
virtual bool controlHasInactiveAppearance(ControlPart) const { return false; }
// General methods for whether or not any of the controls in the theme change appearance when the window is inactive or
// when hovered over.
virtual bool controlsCanHaveInactiveAppearance() const { return false; }
virtual bool controlsCanHaveHoveredAppearance() const { return false; }
// Used by RenderTheme::isControlStyled to figure out if the native look and feel should be turned off.
virtual bool controlDrawsBorder(ControlPart) const { return true; }
virtual bool controlDrawsBackground(ControlPart) const { return true; }
virtual bool controlDrawsFocusOutline(ControlPart) const { return true; }
// Methods for obtaining platform-specific colors.
virtual Color selectionColor(ControlPart, ControlState, SelectionPart) const { return Color(); }
virtual Color textSearchHighlightColor() const { return Color(); }
// CSS system colors and fonts
virtual Color systemColor(ThemeColor) const { return Color(); }
virtual Font systemFont(ThemeFont, FontDescription&) const { return Font(); }
// How fast the caret blinks in text fields.
virtual double caretBlinkFrequency() const { return 0.5; }
// Notification when the theme has changed
virtual void themeChanged() { }
// Methods used to adjust the RenderStyles of controls.
virtual IntSize controlSize(ControlPart, const Font&) { return IntSize(); }
virtual Font controlFont(ControlPart, const Font& font) { return font; }
virtual ControlBox controlPadding(ControlPart, ControlBox box, const Font&) { return box; }
virtual ControlBox controlInternalPadding(ControlPart) { return ControlBox(); }
virtual ControlBox controlBorder(ControlPart, ControlBox box, const Font&) { return box; }
virtual int controlBorderRadius(ControlPart, const Font&) { return 0; }
// Method for painting a control.
virtual void paint(ControlPart, ControlStates, GraphicsContext*, const IntRect&) { };
// 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 inflateControlPaintRect(ControlPart, ControlStates, IntRect&) { }
// This method is called once, from RenderTheme::adjustDefaultStyleSheet(), to let each platform adjust
// the default CSS rules in html4.css.
static String defaultStyleSheet();
private:
mutable Color m_activeSelectionColor;
mutable Color m_inactiveSelectionColor;
};
// Function to obtain the theme. This is implemented in the platform-specific subclasses.
Theme* platformTheme();
} // namespace WebCore
#endif // Theme_h
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ThemeTypes_h
#define ThemeTypes_h
namespace WebCore {
enum ControlState {
HoverState = 1,
PressedState = 1 << 1,
FocusState = 1 << 2,
EnabledState = 1 << 3,
CheckedState = 1 << 4,
ReadOnlyState = 1 << 5,
DefaultState = 1 << 6,
WindowInactiveState = 1 << 7,
AllStates = 0xffffffff
};
typedef unsigned ControlStates;
enum ControlPart {
NoControlPart, CheckboxPart, RadioPart, PushButtonPart, SquareButtonPart, ButtonPart,
ButtonBevelPart, DefaultButtonPart, ListboxPart, ListItemPart,
MediaFullscreenButtonPart, MediaMuteButtonPart, MediaPlayButtonPart,
MediaSeekBackButtonPart, MediaSeekForwardButtonPart, MediaSliderPart, MediaSliderThumbPart,
MenulistPart, MenulistButtonPart, MenulistTextPart, MenulistTextFieldPart,
SliderHorizontalPart, SliderVerticalPart, SliderThumbHorizontalPart,
SliderThumbVerticalPart, CaretPart, SearchFieldPart, SearchFieldDecorationPart,
SearchFieldResultsDecorationPart, SearchFieldResultsButtonPart,
SearchFieldCancelButtonPart, TextFieldPart, TextAreaPart, CapsLockIndicatorPart
};
enum SelectionPart {
SelectionBackground, SelectionForeground
};
enum ThemeFont {
CaptionFont, IconFont, MenuFont, MessageBoxFont, SmallCaptionFont, StatusBarFont, MiniControlFont, SmallControlFont, ControlFont
};
enum ThemeColor {
ActiveBorderColor, ActiveCaptionColor, AppWorkspaceColor, BackgroundColor, ButtonFaceColor, ButtonHighlightColor, ButtonShadowColor,
ButtonTextColor, CaptionTextColor, GrayTextColor, HighlightColor, HighlightTextColor, InactiveBorderColor, InactiveCaptionColor,
InactiveCaptionTextColor, InfoBackgroundColor, InfoTextColor, MatchColor, MenuTextColor, ScrollbarColor, ThreeDDarkDhasowColor,
ThreeDFaceColor, ThreeDHighlightColor, ThreeDLightShadowColor, ThreeDShadowCLor, WindowColor, WindowFrameColor, WindowTextColor,
FocusRingColor
};
class ControlBox {
public:
ControlBox(int t = 0, int r = 0, int b = 0, int l = 0)
: m_top(t)
, m_right(r)
, m_bottom(b)
, m_left(l)
{ }
int top() const { return m_top; }
int right() const { return m_right; }
int bottom() const { return m_bottom; }
int left() const { return m_left; }
private:
int m_top;
int m_right;
int m_bottom;
int m_left;
};
}
#endif
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ThemeMac_h
#define ThemeMac_h
#include "Theme.h"
namespace WebCore {
class ThemeMac : public Theme {
public:
ThemeMac() { }
virtual ~ThemeMac() { }
};
} // namespace WebCore
#endif // ThemeMac_h
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "ThemeMac.h"
namespace WebCore {
Theme* platformTheme()
{
static ThemeMac themeMac;
return &themeMac;
}
}
......@@ -40,6 +40,13 @@ namespace WebCore {
using namespace HTMLNames;
RenderTheme::RenderTheme()
#if USE(NEW_THEME)
: m_theme(platformTheme())
#endif
{
}
void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e,
bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
{
......
......@@ -24,6 +24,11 @@
#define RenderTheme_h
#include "RenderObject.h"
#if USE(NEW_THEME)
#include "Theme.h"
#else
#include "ThemeTypes.h"
#endif
namespace WebCore {
......@@ -32,19 +37,9 @@ class PopupMenu;
class RenderMenuList;
class CSSStyleSheet;
enum ControlState {
HoverState,
PressedState,
FocusState,
EnabledState,
CheckedState,
ReadOnlyState,
DefaultState
};
class RenderTheme {
public:
RenderTheme() { }
RenderTheme();
virtual ~RenderTheme() { }
// This method is called whenever style has been computed for an element and the appearance
......@@ -212,6 +207,9 @@ protected:
private:
mutable Color m_activeSelectionColor;
mutable Color m_inactiveSelectionColor;
#if USE(NEW_THEME)
Theme* m_theme; // The platform-specific theme.
#endif
};
// Function to obtain the theme. This is implemented in your platform-specific theme implementation to hand
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment