void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const { // If the webview has a custom palette, use it if (!m_page) return; Chrome* chrome = m_page->chrome(); if (!chrome) return; ChromeClient* chromeClient = chrome->client(); if (!chromeClient) return; QWebPageClient* pageClient = chromeClient->platformPageClient(); if (!pageClient) return; palette = pageClient->palette(); }
void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const { #if USE(QT_MOBILE_THEME) static QPalette lightGrayPalette(Qt::lightGray); palette = lightGrayPalette; return; #endif // If the webview has a custom palette, use it if (!m_page) return; Chrome* chrome = m_page->chrome(); if (!chrome) return; ChromeClient* chromeClient = chrome->client(); if (!chromeClient) return; QWebPageClient* pageClient = chromeClient->platformPageClient(); if (!pageClient) return; palette = pageClient->palette(); }
ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) const { // Default bits: no focus, no mouse over option.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); if (!isEnabled(o)) option.state &= ~QStyle::State_Enabled; if (isReadOnlyControl(o)) // Readonly is supported on textfields. option.state |= QStyle::State_ReadOnly; if (supportsFocus(o->style()->appearance()) && isFocused(o)) { option.state |= QStyle::State_HasFocus; option.state |= QStyle::State_KeyboardFocusChange; } if (isHovered(o)) option.state |= QStyle::State_MouseOver; option.direction = Qt::LeftToRight; if (o->style() && o->style()->direction() == WebCore::RTL) option.direction = Qt::RightToLeft; ControlPart result = o->style()->appearance(); switch (result) { case PushButtonPart: case SquareButtonPart: case ButtonPart: case ButtonBevelPart: case ListItemPart: case MenulistButtonPart: case SearchFieldResultsButtonPart: case SearchFieldCancelButtonPart: { if (isPressed(o)) option.state |= QStyle::State_Sunken; else if (result == PushButtonPart) option.state |= QStyle::State_Raised; break; } } if (result == RadioPart || result == CheckboxPart) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); #ifdef Q_WS_MAEMO_5 static QPalette lightGrayPalette(Qt::lightGray); option.palette = lightGrayPalette; #else // If the owner widget has a custom palette, use it Page* page = o->document()->page(); if (page) { ChromeClient* client = page->chrome()->client(); QWebPageClient* pageClient = client->platformPageClient(); if (pageClient) option.palette = pageClient->palette(); } #endif return result; }