Commit 35dbea40 authored by hausmann@webkit.org's avatar hausmann@webkit.org

[Qt] Clean up code to determine palette from page client in RenderThemeQt

https://bugs.webkit.org/show_bug.cgi?id=34052

Patch by Simon Hausmann <hausmann@webkit.org> on 2010-01-25
Reviewed by Kenneth Christiansen.

Use the RenderTheme's associated page instead of going through the
render tree and the document.

* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::setPaletteFromPageClientIfExists):
(WebCore::RenderThemeQt::initializeCommonQStyleOptions):
* platform/qt/RenderThemeQt.h:

git-svn-id: svn://svn.chromium.org/blink/trunk@53801 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 25a17af6
2010-01-25 Simon Hausmann <hausmann@webkit.org>
Reviewed by Kenneth Christiansen.
[Qt] Clean up code to determine palette from page client in RenderThemeQt
https://bugs.webkit.org/show_bug.cgi?id=34052
Use the RenderTheme's associated page instead of going through the
render tree and the document.
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::setPaletteFromPageClientIfExists):
(WebCore::RenderThemeQt::initializeCommonQStyleOptions):
* platform/qt/RenderThemeQt.h:
2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> 2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com>
Reviewed by Simon Hausmann. Reviewed by Simon Hausmann.
...@@ -768,13 +768,12 @@ bool RenderThemeQt::supportsFocus(ControlPart appearance) const ...@@ -768,13 +768,12 @@ bool RenderThemeQt::supportsFocus(ControlPart appearance) const
} }
} }
static inline void setPaletteFromPageClientIfExists(QPalette &palette, const RenderObject *o) void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const
{ {
// If the webview has a custom palette, use it // If the webview has a custom palette, use it
Page* page = o->document()->page(); if (!m_page)
if (!page)
return; return;
Chrome* chrome = page->chrome(); Chrome* chrome = m_page->chrome();
if (!chrome) if (!chrome)
return; return;
ChromeClient* chromeClient = chrome->client(); ChromeClient* chromeClient = chrome->client();
...@@ -803,7 +802,7 @@ ControlPart RenderThemeQt::initializeCommonQStyleOptions(QStyleOption& option, R ...@@ -803,7 +802,7 @@ ControlPart RenderThemeQt::initializeCommonQStyleOptions(QStyleOption& option, R
if (isHovered(o)) if (isHovered(o))
option.state |= QStyle::State_MouseOver; option.state |= QStyle::State_MouseOver;
setPaletteFromPageClientIfExists(option.palette, o); setPaletteFromPageClientIfExists(option.palette);
RenderStyle* style = o->style(); RenderStyle* style = o->style();
if (!style) if (!style)
return NoControlPart; return NoControlPart;
......
...@@ -140,6 +140,8 @@ private: ...@@ -140,6 +140,8 @@ private:
void setButtonPadding(RenderStyle*) const; void setButtonPadding(RenderStyle*) const;
void setPopupPadding(RenderStyle*) const; void setPopupPadding(RenderStyle*) const;
void setPaletteFromPageClientIfExists(QPalette&) const;
QStyle* qStyle() const; QStyle* qStyle() const;
QStyle* fallbackStyle(); QStyle* fallbackStyle();
......
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