summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
commit5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch)
tree8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/WebCore/rendering/RenderThemeChromiumLinux.cpp
parent33b26980cb24288b5a9f2590ccf32a949281bb79 (diff)
downloadqtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1 widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're working on completing the entire split as part of https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/WebCore/rendering/RenderThemeChromiumLinux.cpp')
-rw-r--r--Source/WebCore/rendering/RenderThemeChromiumLinux.cpp76
1 files changed, 47 insertions, 29 deletions
diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp
index 3dae06e07..8af4fc782 100644
--- a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp
+++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp
@@ -28,12 +28,15 @@
#include "CSSValueKeywords.h"
#include "Color.h"
#include "PaintInfo.h"
-#include "PlatformSupport.h"
+#include "PlatformContextSkia.h"
#include "RenderObject.h"
#include "RenderProgress.h"
#include "RenderSlider.h"
#include "ScrollbarTheme.h"
#include "UserAgentStyleSheets.h"
+#include <public/Platform.h>
+#include <public/WebRect.h>
+#include <public/linux/WebThemeEngine.h>
namespace WebCore {
@@ -50,19 +53,18 @@ double RenderThemeChromiumLinux::m_caretBlinkInterval;
static const unsigned defaultButtonBackgroundColor = 0xffdddddd;
-static PlatformSupport::ThemePaintState getWebThemeState(const RenderTheme* theme, const RenderObject* o)
+static WebKit::WebThemeEngine::State getWebThemeState(const RenderTheme* theme, const RenderObject* o)
{
if (!theme->isEnabled(o))
- return PlatformSupport::StateDisabled;
+ return WebKit::WebThemeEngine::StateDisabled;
if (theme->isPressed(o))
- return PlatformSupport::StatePressed;
+ return WebKit::WebThemeEngine::StatePressed;
if (theme->isHovered(o))
- return PlatformSupport::StateHover;
+ return WebKit::WebThemeEngine::StateHover;
- return PlatformSupport::StateNormal;
+ return WebKit::WebThemeEngine::StateNormal;
}
-
PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create()
{
return adoptRef(new RenderThemeChromiumLinux());
@@ -160,7 +162,7 @@ int RenderThemeChromiumLinux::sliderTickOffsetFromTrackCenter() const
void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderStyle* style, Element* element) const
{
- IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartSliderThumb);
+ IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartSliderThumb);
if (style->appearance() == SliderThumbHorizontalPart) {
style->setWidth(Length(size.width(), Fixed));
@@ -201,11 +203,12 @@ void RenderThemeChromiumLinux::setSelectionColors(
bool RenderThemeChromiumLinux::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
extraParams.button.checked = isChecked(o);
extraParams.button.indeterminate = isIndeterminate(o);
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartCheckbox, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartCheckbox, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
@@ -215,16 +218,17 @@ void RenderThemeChromiumLinux::setCheckboxSize(RenderStyle* style) const
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
return;
- IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartCheckbox);
+ IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartCheckbox);
setSizeIfAuto(style, size);
}
bool RenderThemeChromiumLinux::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
extraParams.button.checked = isChecked(o);
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartRadio, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartRadio, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
@@ -234,20 +238,21 @@ void RenderThemeChromiumLinux::setRadioSize(RenderStyle* style) const
if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
return;
- IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartRadio);
+ IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartRadio);
setSizeIfAuto(style, size);
}
bool RenderThemeChromiumLinux::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
extraParams.button.isDefault = isDefault(o);
extraParams.button.hasBorder = true;
extraParams.button.backgroundColor = defaultButtonBackgroundColor;
if (o->hasBackground())
extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartButton, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
@@ -260,17 +265,19 @@ bool RenderThemeChromiumLinux::paintTextField(RenderObject* o, const PaintInfo&
ControlPart part = o->style()->appearance();
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
extraParams.textField.isTextArea = part == TextAreaPart;
extraParams.textField.isListbox = part == ListboxPart;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
+
// Fallback to white if the specified color object is invalid.
Color backgroundColor(Color::white);
if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid())
backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor);
extraParams.textField.backgroundColor = backgroundColor.rgb();
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartTextField, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartTextField, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
@@ -282,7 +289,7 @@ bool RenderThemeChromiumLinux::paintMenuList(RenderObject* o, const PaintInfo& i
const int right = rect.x() + rect.width();
const int middle = rect.y() + rect.height() / 2;
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13;
extraParams.menuList.arrowY = middle;
const RenderBox* box = toRenderBox(o);
@@ -294,16 +301,19 @@ bool RenderThemeChromiumLinux::paintMenuList(RenderObject* o, const PaintInfo& i
if (o->hasBackground())
extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb();
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartMenuList, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
+
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartMenuList, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart;
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartSliderTrack, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
#if ENABLE(DATALIST_ELEMENT)
paintSliderTicks(o, i, rect);
@@ -314,17 +324,18 @@ bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo
bool RenderThemeChromiumLinux::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart;
extraParams.slider.inDrag = isPressed(o);
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartSliderThumb, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartSliderThumb, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
void RenderThemeChromiumLinux::adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle* style, Element*) const
{
- IntSize size = PlatformSupport::getThemePartSize(PlatformSupport::PartInnerSpinButton);
+ IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartInnerSpinButton);
style->setWidth(Length(size.width(), Fixed));
style->setMinWidth(Length(size.width(), Fixed));
@@ -332,11 +343,12 @@ void RenderThemeChromiumLinux::adjustInnerSpinButtonStyle(StyleResolver*, Render
bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect)
{
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState);
extraParams.innerSpin.readOnly = isReadOnlyControl(o);
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartInnerSpinButton, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartInnerSpinButton, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
@@ -350,7 +362,7 @@ bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo
RenderProgress* renderProgress = toRenderProgress(o);
IntRect valueRect = progressValueRectFor(renderProgress, rect);
- PlatformSupport::ThemePaintExtraParams extraParams;
+ WebKit::WebThemeEngine::ExtraParams extraParams;
extraParams.progressBar.determinate = renderProgress->isDeterminate();
extraParams.progressBar.valueRectX = valueRect.x();
extraParams.progressBar.valueRectY = valueRect.y();
@@ -358,10 +370,16 @@ bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo
extraParams.progressBar.valueRectHeight = valueRect.height();
DirectionFlippingScope scope(o, i, rect);
- PlatformSupport::paintThemePart(i.context, PlatformSupport::PartProgressBar, getWebThemeState(this, o), rect, &extraParams);
+ WebKit::WebCanvas* canvas = i.context->platformContext()->canvas();
+ WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEngine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraParams);
return false;
}
#endif
+bool RenderThemeChromiumLinux::shouldOpenPickerWithF4Key() const
+{
+ return true;
+}
+
} // namespace WebCore