Changeset 109542 in webkit
- Timestamp:
- Mar 2, 2012 2:43:22 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 1 copied
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r109418 r109542 1 2012-03-02 Simon Hausmann <simon.hausmann@nokia.com> 2 3 [Qt] Move QStyle theming code out of WebCore into WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=80128 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 * Source/api.pri: Adjust to moving source files. 9 1 10 2012-03-01 Ryosuke Niwa <rniwa@webkit.org> 2 11 -
trunk/Source/WebCore/ChangeLog
r109541 r109542 1 2012-03-02 Simon Hausmann <simon.hausmann@nokia.com> 2 3 [Qt] Move QStyle theming code out of WebCore into WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=80128 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Moved QStyle dependant code into WebKit1, where it's okay to depend on 9 QtWidgets/QStyle. Added factory hooks into RenderThemeQt to allow changing 10 the default "mobile" style to QStyle on start-up. 11 12 * Target.pri: 13 * platform/qt/RenderThemeQt.cpp: 14 (WebCore): 15 (WebCore::RenderThemeQt::setCustomTheme): 16 (WebCore::RenderThemeQt::customScrollbarTheme): 17 (WebCore::createTheme): 18 (WebCore::RenderTheme::themeForPage): 19 (WebCore::RenderThemeQt::extraDefaultStyleSheet): 20 * platform/qt/RenderThemeQt.h: 21 (WebCore): 22 (RenderThemeQt): 23 * platform/qt/RenderThemeQtMobile.cpp: 24 * platform/qt/ScrollbarThemeQt.cpp: 25 (WebCore::ScrollbarTheme::nativeTheme): 26 1 27 2012-03-02 Luke Macpherson <macpherson@chromium.org> 2 28 -
trunk/Source/WebCore/Target.pri
r109538 r109542 2866 2866 } 2867 2867 2868 contains(DEFINES, HAVE_QSTYLE=1) {2869 HEADERS += platform/qt/RenderThemeQStyle.h \2870 platform/qt/ScrollbarThemeQt.h2871 SOURCES += platform/qt/RenderThemeQStyle.cpp2872 }2873 2874 2868 contains(DEFINES, ENABLE_SMOOTH_SCROLLING=1) { 2875 2869 win32-*|wince* { -
trunk/Source/WebCore/platform/qt/RenderThemeQt.cpp
r108261 r109542 55 55 #endif 56 56 #include "RenderTheme.h" 57 #include "RenderThemeQtMobile.h" 57 58 #include "ScrollbarTheme.h" 58 59 #include "TimeRanges.h" … … 83 84 static const float defaultSearchFieldResultsButtonWidth = 18; 84 85 86 static QtThemeFactoryFunction themeFactory; 87 static ScrollbarTheme* scrollbarTheme; 88 85 89 RenderThemeQt::RenderThemeQt(Page* page) 86 90 : RenderTheme() … … 90 94 } 91 95 92 bool RenderThemeQt::useMobileTheme() 93 { 94 #if HAVE(QSTYLE) 95 return !qgetenv("QT_WEBKIT_USE_MOBILE_THEME").isNull(); 96 #else 97 return true; 98 #endif 96 void RenderThemeQt::setCustomTheme(QtThemeFactoryFunction factory, ScrollbarTheme* customScrollbarTheme) 97 { 98 themeFactory = factory; 99 scrollbarTheme = customScrollbarTheme; 100 } 101 102 ScrollbarTheme* RenderThemeQt::customScrollbarTheme() 103 { 104 return scrollbarTheme; 105 } 106 107 static PassRefPtr<RenderTheme> createTheme(Page* page) 108 { 109 if (themeFactory) 110 return themeFactory(page); 111 return RenderThemeQtMobile::create(page); 112 } 113 114 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) 115 { 116 if (page) 117 return createTheme(page); 118 static RenderTheme* fallback = createTheme(0).leakRef(); 119 return fallback; 99 120 } 100 121 … … 117 138 StringBuilder result; 118 139 result.append(RenderTheme::extraDefaultStyleSheet()); 119 if (useMobileTheme()) { 140 // When no theme factory is provided we default to using our platform independent "Mobile Qt" theme, 141 // which requires the following stylesheets. 142 if (!themeFactory) { 120 143 result.append(String(themeQtNoListboxesUserAgentStyleSheet, sizeof(themeQtNoListboxesUserAgentStyleSheet))); 121 144 result.append(String(mobileThemeQtUserAgentStyleSheet, sizeof(mobileThemeQtUserAgentStyleSheet))); -
trunk/Source/WebCore/platform/qt/RenderThemeQt.h
r108261 r109542 41 41 class HTMLMediaElement; 42 42 class StylePainter; 43 class ScrollbarTheme; 44 45 typedef PassRefPtr<RenderTheme> (*QtThemeFactoryFunction)(Page* page); 43 46 44 47 class RenderThemeQt : public RenderTheme { … … 47 50 RenderThemeQt(Page*); 48 51 49 static bool useMobileTheme(); 52 static void setCustomTheme(QtThemeFactoryFunction, ScrollbarTheme* customScrollbarTheme); 53 static ScrollbarTheme* customScrollbarTheme(); 50 54 51 55 String extraDefaultStyleSheet(); -
trunk/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp
r104834 r109542 42 42 #include "RenderProgress.h" 43 43 #endif 44 #if HAVE(QSTYLE)45 #include "RenderThemeQStyle.h"46 #endif47 48 44 #include <QColor> 49 45 #include <QFile> … … 551 547 } 552 548 553 static PassRefPtr<RenderTheme> createTheme(Page* page)554 {555 #if HAVE(QSTYLE)556 if (!RenderThemeQt::useMobileTheme())557 return RenderThemeQStyle::create(page);558 #endif559 return RenderThemeQtMobile::create(page);560 }561 562 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)563 {564 if (page)565 return createTheme(page);566 static RenderTheme* fallback = createTheme(0).leakRef();567 return fallback;568 }569 570 549 RenderThemeQtMobile::RenderThemeQtMobile(Page* page) 571 550 : RenderThemeQt(page) -
trunk/Source/WebCore/platform/qt/ScrollbarThemeQt.cpp
r109451 r109542 27 27 28 28 #include "config.h" 29 30 #if !HAVE(QSTYLE)31 29 #include "ScrollbarTheme.h" 32 30 33 #else 34 #include "ScrollbarThemeQt.h" 35 36 #include "GraphicsContext.h" 37 #include "PlatformMouseEvent.h" 38 #include "RenderThemeQStyle.h" 39 #include "RenderThemeQtMobile.h" 40 #include "ScrollView.h" 41 #include "Scrollbar.h" 42 43 #include <QApplication> 44 #ifdef Q_WS_MAC 45 #include <QMacStyle> 46 #endif 47 #include <QMenu> 48 #include <QPainter> 49 #include <QStyle> 50 #include <QStyleOptionSlider> 51 #endif // HAVE(QSTYLE) 31 #include "RenderThemeQt.h" 52 32 53 33 namespace WebCore { … … 58 38 if (theme) 59 39 return theme; 60 #if HAVE(QSTYLE) 61 if (!RenderThemeQt::useMobileTheme()) 62 theme = new ScrollbarThemeQt(); 63 else 64 #endif 40 theme = RenderThemeQt::customScrollbarTheme(); 41 if (!theme) 65 42 theme = new ScrollbarTheme(); 66 43 return theme; 67 44 } 68 45 69 #if HAVE(QSTYLE)70 ScrollbarThemeQt::~ScrollbarThemeQt()71 {72 46 } 73 47 74 static QStyle::SubControl scPart(const ScrollbarPart& part)75 {76 switch (part) {77 case NoPart:78 return QStyle::SC_None;79 case BackButtonStartPart:80 case BackButtonEndPart:81 return QStyle::SC_ScrollBarSubLine;82 case BackTrackPart:83 return QStyle::SC_ScrollBarSubPage;84 case ThumbPart:85 return QStyle::SC_ScrollBarSlider;86 case ForwardTrackPart:87 return QStyle::SC_ScrollBarAddPage;88 case ForwardButtonStartPart:89 case ForwardButtonEndPart:90 return QStyle::SC_ScrollBarAddLine;91 }92 93 return QStyle::SC_None;94 }95 96 static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc)97 {98 switch (sc) {99 case QStyle::SC_None:100 return NoPart;101 case QStyle::SC_ScrollBarSubLine:102 return BackButtonStartPart;103 case QStyle::SC_ScrollBarSubPage:104 return BackTrackPart;105 case QStyle::SC_ScrollBarSlider:106 return ThumbPart;107 case QStyle::SC_ScrollBarAddPage:108 return ForwardTrackPart;109 case QStyle::SC_ScrollBarAddLine:110 return ForwardButtonStartPart;111 }112 return NoPart;113 }114 115 static QStyleOptionSlider* styleOptionSlider(ScrollbarThemeClient* scrollbar, QWidget* widget = 0)116 {117 static QStyleOptionSlider opt;118 if (widget)119 opt.initFrom(widget);120 else121 opt.state |= QStyle::State_Active;122 123 opt.state &= ~QStyle::State_HasFocus;124 125 opt.rect = scrollbar->frameRect();126 if (scrollbar->enabled())127 opt.state |= QStyle::State_Enabled;128 if (scrollbar->controlSize() != RegularScrollbar)129 opt.state |= QStyle::State_Mini;130 opt.orientation = (scrollbar->orientation() == VerticalScrollbar) ? Qt::Vertical : Qt::Horizontal;131 132 if (scrollbar->orientation() == HorizontalScrollbar)133 opt.state |= QStyle::State_Horizontal;134 else135 opt.state &= ~QStyle::State_Horizontal;136 137 opt.sliderValue = scrollbar->value();138 opt.sliderPosition = opt.sliderValue;139 opt.pageStep = scrollbar->pageStep();140 opt.singleStep = scrollbar->lineStep();141 opt.minimum = 0;142 opt.maximum = qMax(0, scrollbar->maximum());143 ScrollbarPart pressedPart = scrollbar->pressedPart();144 ScrollbarPart hoveredPart = scrollbar->hoveredPart();145 if (pressedPart != NoPart) {146 opt.activeSubControls = scPart(scrollbar->pressedPart());147 if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart148 || pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart149 || pressedPart == ThumbPart)150 opt.state |= QStyle::State_Sunken;151 } else152 opt.activeSubControls = scPart(hoveredPart);153 if (hoveredPart != NoPart)154 opt.state |= QStyle::State_MouseOver;155 return &opt;156 }157 158 bool ScrollbarThemeQt::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)159 {160 if (graphicsContext->updatingControlTints()) {161 scrollbar->invalidateRect(damageRect);162 return false;163 }164 165 StylePainterQStyle p(this, graphicsContext);166 if (!p.isValid())167 return true;168 169 p.painter->save();170 QStyleOptionSlider* opt = styleOptionSlider(scrollbar, p.widget);171 172 p.painter->setClipRect(opt->rect.intersected(damageRect), Qt::IntersectClip);173 174 #ifdef Q_WS_MAC175 // FIXME: We also need to check the widget style but today ScrollbarTheme is not aware of the page so we176 // can't get the widget.177 if (qobject_cast<QMacStyle*>(style()))178 p.drawComplexControl(QStyle::CC_ScrollBar, *opt);179 else180 #endif181 {182 // The QStyle expects the background to be already filled.183 p.painter->fillRect(opt->rect, opt->palette.background());184 185 const QPoint topLeft = opt->rect.topLeft();186 p.painter->translate(topLeft);187 opt->rect.moveTo(QPoint(0, 0));188 p.drawComplexControl(QStyle::CC_ScrollBar, *opt);189 opt->rect.moveTo(topLeft);190 }191 p.painter->restore();192 193 return true;194 }195 196 ScrollbarPart ScrollbarThemeQt::hitTest(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt)197 {198 QStyleOptionSlider* opt = styleOptionSlider(scrollbar);199 const QPoint pos = scrollbar->convertFromContainingWindow(evt.position());200 opt->rect.moveTo(QPoint(0, 0));201 QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0);202 return scrollbarPart(sc);203 }204 205 bool ScrollbarThemeQt::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)206 {207 // Middle click centers slider thumb (if supported).208 return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton;209 }210 211 void ScrollbarThemeQt::invalidatePart(ScrollbarThemeClient* scrollbar, ScrollbarPart)212 {213 // FIXME: Do more precise invalidation.214 scrollbar->invalidate();215 }216 217 int ScrollbarThemeQt::scrollbarThickness(ScrollbarControlSize controlSize)218 {219 QStyleOptionSlider o;220 o.orientation = Qt::Vertical;221 o.state &= ~QStyle::State_Horizontal;222 if (controlSize != RegularScrollbar)223 o.state |= QStyle::State_Mini;224 return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0);225 }226 227 int ScrollbarThemeQt::thumbPosition(ScrollbarThemeClient* scrollbar)228 {229 if (scrollbar->enabled()) {230 float pos = (float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum();231 return (pos < 1 && pos > 0) ? 1 : pos;232 }233 return 0;234 }235 236 int ScrollbarThemeQt::thumbLength(ScrollbarThemeClient* scrollbar)237 {238 QStyleOptionSlider* opt = styleOptionSlider(scrollbar);239 IntRect thumb = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0);240 return scrollbar->orientation() == HorizontalScrollbar ? thumb.width() : thumb.height();241 }242 243 int ScrollbarThemeQt::trackPosition(ScrollbarThemeClient* scrollbar)244 {245 QStyleOptionSlider* opt = styleOptionSlider(scrollbar);246 IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0);247 return scrollbar->orientation() == HorizontalScrollbar ? track.x() - scrollbar->x() : track.y() - scrollbar->y();248 }249 250 int ScrollbarThemeQt::trackLength(ScrollbarThemeClient* scrollbar)251 {252 QStyleOptionSlider* opt = styleOptionSlider(scrollbar);253 IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0);254 return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height();255 }256 257 void ScrollbarThemeQt::paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& rect)258 {259 StylePainterQStyle p(this, context);260 if (!p.isValid())261 return;262 263 QStyleOption option;264 option.rect = rect;265 p.drawPrimitive(QStyle::PE_PanelScrollAreaCorner, option);266 }267 268 QStyle* ScrollbarThemeQt::style() const269 {270 return QApplication::style();271 }272 273 #endif // HAVE(QSTYLE)274 }275 -
trunk/Source/WebKit/qt/Api/qwebpage.cpp
r108643 r109542 3291 3291 d->page->contextMenuController()->clearContextMenu(); 3292 3292 3293 #if HAVE(QSTYLE) 3294 if (!RenderThemeQt::useMobileTheme()) { 3295 if (QWebFrame* webFrame = frameAt(event->pos())) { 3296 Frame* frame = QWebFramePrivate::core(webFrame); 3297 if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position())) 3298 return handleScrollbarContextMenuEvent(scrollbar, event); 3299 } 3300 } 3301 #endif 3293 if (QWebFrame* webFrame = frameAt(event->pos())) { 3294 Frame* frame = QWebFramePrivate::core(webFrame); 3295 if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position())) 3296 return handleScrollbarContextMenuEvent(scrollbar, event); 3297 } 3302 3298 3303 3299 WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); -
trunk/Source/WebKit/qt/ChangeLog
r109101 r109542 1 2012-03-02 Simon Hausmann <simon.hausmann@nokia.com> 2 3 [Qt] Move QStyle theming code out of WebCore into WebKit1 4 https://bugs.webkit.org/show_bug.cgi?id=80128 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Moved the bulk of the QStyle dependant code here, where it's okay to depend on QtWidgets/QStyle. 9 Install the QStyle factory functions in initWebCoreQt.cpp. 10 11 * Api/qwebpage.cpp: 12 (QWebPage::swallowContextMenuEvent): 13 * WebCoreSupport/InitWebCoreQt.cpp: 14 (WebCore::initializeWebCoreQt): 15 * WebCoreSupport/RenderThemeQStyle.cpp: Renamed from Source/WebCore/platform/qt/RenderThemeQStyle.cpp. 16 (WebCore): 17 (WebCore::initStyleOption): 18 (WebCore::RenderThemeQStyle::getStylePainter): 19 (WebCore::StylePainterQStyle::StylePainterQStyle): 20 (WebCore::StylePainterQStyle::init): 21 (WebCore::RenderThemeQStyle::create): 22 (WebCore::RenderThemeQStyle::RenderThemeQStyle): 23 (WebCore::RenderThemeQStyle::~RenderThemeQStyle): 24 (WebCore::RenderThemeQStyle::fallbackStyle): 25 (WebCore::RenderThemeQStyle::qStyle): 26 (WebCore::RenderThemeQStyle::findFrameLineWidth): 27 (WebCore::RenderThemeQStyle::inflateButtonRect): 28 (WebCore::RenderThemeQStyle::computeSizeBasedOnStyle): 29 (WebCore::RenderThemeQStyle::adjustButtonStyle): 30 (WebCore::RenderThemeQStyle::setButtonPadding): 31 (WebCore::RenderThemeQStyle::paintButton): 32 (WebCore::RenderThemeQStyle::paintTextField): 33 (WebCore::RenderThemeQStyle::adjustTextAreaStyle): 34 (WebCore::RenderThemeQStyle::paintTextArea): 35 (WebCore::RenderThemeQStyle::setPopupPadding): 36 (WebCore::RenderThemeQStyle::paintMenuList): 37 (WebCore::RenderThemeQStyle::adjustMenuListButtonStyle): 38 (WebCore::RenderThemeQStyle::paintMenuListButton): 39 (WebCore::RenderThemeQStyle::animationDurationForProgressBar): 40 (WebCore::RenderThemeQStyle::paintProgressBar): 41 (WebCore::RenderThemeQStyle::paintSliderTrack): 42 (WebCore::RenderThemeQStyle::adjustSliderTrackStyle): 43 (WebCore::RenderThemeQStyle::paintSliderThumb): 44 (WebCore::RenderThemeQStyle::adjustSliderThumbStyle): 45 (WebCore::RenderThemeQStyle::paintSearchField): 46 (WebCore::RenderThemeQStyle::adjustSearchFieldDecorationStyle): 47 (WebCore::RenderThemeQStyle::paintSearchFieldDecoration): 48 (WebCore::RenderThemeQStyle::adjustSearchFieldResultsDecorationStyle): 49 (WebCore::RenderThemeQStyle::paintSearchFieldResultsDecoration): 50 (WebCore::RenderThemeQStyle::paintInnerSpinButton): 51 (WebCore::RenderThemeQStyle::initializeCommonQStyleOptions): 52 (WebCore::RenderThemeQStyle::adjustSliderThumbSize): 53 * WebCoreSupport/RenderThemeQStyle.h: Renamed from Source/WebCore/platform/qt/RenderThemeQStyle.h. 54 (WebCore): 55 (RenderThemeQStyle): 56 (StylePainterQStyle): 57 (WebCore::StylePainterQStyle::isValid): 58 (WebCore::StylePainterQStyle::drawPrimitive): 59 (WebCore::StylePainterQStyle::drawControl): 60 (WebCore::StylePainterQStyle::drawComplexControl): 61 * WebCoreSupport/ScrollbarThemeQStyle.cpp: Copied from Source/WebCore/platform/qt/ScrollbarThemeQt.cpp. 62 (WebCore): 63 (WebCore::ScrollbarThemeQStyle::~ScrollbarThemeQStyle): 64 (WebCore::scPart): 65 (WebCore::scrollbarPart): 66 (WebCore::styleOptionSlider): 67 (WebCore::ScrollbarThemeQStyle::paint): 68 (WebCore::ScrollbarThemeQStyle::hitTest): 69 (WebCore::ScrollbarThemeQStyle::shouldCenterOnThumb): 70 (WebCore::ScrollbarThemeQStyle::invalidatePart): 71 (WebCore::ScrollbarThemeQStyle::scrollbarThickness): 72 (WebCore::ScrollbarThemeQStyle::thumbPosition): 73 (WebCore::ScrollbarThemeQStyle::thumbLength): 74 (WebCore::ScrollbarThemeQStyle::trackPosition): 75 (WebCore::ScrollbarThemeQStyle::trackLength): 76 (WebCore::ScrollbarThemeQStyle::paintScrollCorner): 77 (WebCore::ScrollbarThemeQStyle::style): 78 * WebCoreSupport/ScrollbarThemeQStyle.h: Renamed from Source/WebCore/platform/qt/ScrollbarThemeQt.h. 79 (WebCore): 80 (ScrollbarThemeQStyle): 81 1 82 2012-02-27 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 83 -
trunk/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
r107811 r109542 34 34 #include "NotImplemented.h" 35 35 #include "PlatformStrategiesQt.h" 36 #include "RenderThemeQStyle.h" 36 37 #include "ScriptController.h" 38 #include "ScrollbarThemeQStyle.h" 37 39 #include "SecurityPolicy.h" 38 40 #if USE(QTKIT) … … 63 65 QtWebElementRuntime::initialize(); 64 66 67 RenderThemeQt::setCustomTheme(RenderThemeQStyle::create, new ScrollbarThemeQStyle); 68 65 69 #if USE(QTKIT) 66 70 InitWebCoreSystemInterface(); -
trunk/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp
r109541 r109542 2 2 * This file is part of the WebKit project. 3 3 * 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)4 * Copyright (C) 2008-2012 Nokia Corporation and/or its subsidiary(-ies) 5 5 * 6 6 * Copyright (C) 2006 Zack Rusin <zack@kde.org> … … 53 53 #endif 54 54 #include "RenderSlider.h" 55 #include "ScrollbarThemeQ t.h"55 #include "ScrollbarThemeQStyle.h" 56 56 #include "SliderThumbElement.h" 57 57 #include "UserAgentStyleSheets.h" … … 81 81 using namespace HTMLNames; 82 82 83 inline static void initStyleOption(QWidget *widget, QStyleOption& option)83 inline static void initStyleOption(QWidget* widget, QStyleOption& option) 84 84 { 85 85 if (widget) 86 86 option.initFrom(widget); 87 87 else { 88 /* 89 If a widget is not directly available for rendering, we fallback to default 90 value for an active widget. 91 */ 88 // If a widget is not directly available for rendering, we fallback to default 89 // value for an active widget. 92 90 option.state = QStyle::State_Active | QStyle::State_Enabled; 93 91 } … … 106 104 } 107 105 108 StylePainterQStyle::StylePainterQStyle(ScrollbarThemeQ t* theme, GraphicsContext* context)106 StylePainterQStyle::StylePainterQStyle(ScrollbarThemeQStyle* theme, GraphicsContext* context) 109 107 : StylePainter() 110 108 { -
trunk/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h
r109541 r109542 2 2 * This file is part of the theme implementation for form controls in WebCore. 3 3 * 4 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).4 * Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 37 37 namespace WebCore { 38 38 39 class ScrollbarThemeQ t;39 class ScrollbarThemeQStyle; 40 40 41 41 class RenderThemeQStyle : public RenderThemeQt { … … 120 120 public: 121 121 explicit StylePainterQStyle(RenderThemeQStyle*, const PaintInfo&); 122 explicit StylePainterQStyle(ScrollbarThemeQ t*, GraphicsContext*);122 explicit StylePainterQStyle(ScrollbarThemeQStyle*, GraphicsContext*); 123 123 124 124 bool isValid() const { return style && StylePainter::isValid(); } -
trunk/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp
r109541 r109542 27 27 28 28 #include "config.h" 29 30 #if !HAVE(QSTYLE) 31 #include "ScrollbarTheme.h" 32 33 #else 34 #include "ScrollbarThemeQt.h" 29 #include "ScrollbarThemeQStyle.h" 35 30 36 31 #include "GraphicsContext.h" … … 49 44 #include <QStyle> 50 45 #include <QStyleOptionSlider> 51 #endif // HAVE(QSTYLE)52 46 53 47 namespace WebCore { 54 48 55 ScrollbarTheme* ScrollbarTheme::nativeTheme() 56 { 57 static ScrollbarTheme* theme = 0; 58 if (theme) 59 return theme; 60 #if HAVE(QSTYLE) 61 if (!RenderThemeQt::useMobileTheme()) 62 theme = new ScrollbarThemeQt(); 63 else 64 #endif 65 theme = new ScrollbarTheme(); 66 return theme; 67 } 68 69 #if HAVE(QSTYLE) 70 ScrollbarThemeQt::~ScrollbarThemeQt() 49 ScrollbarThemeQStyle::~ScrollbarThemeQStyle() 71 50 { 72 51 } … … 156 135 } 157 136 158 bool ScrollbarThemeQ t::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)137 bool ScrollbarThemeQStyle::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& dirtyRect) 159 138 { 160 139 if (graphicsContext->updatingControlTints()) { 161 scrollbar->invalidateRect(d amageRect);140 scrollbar->invalidateRect(dirtyRect); 162 141 return false; 163 142 } … … 170 149 QStyleOptionSlider* opt = styleOptionSlider(scrollbar, p.widget); 171 150 172 p.painter->setClipRect(opt->rect.intersected(d amageRect), Qt::IntersectClip);151 p.painter->setClipRect(opt->rect.intersected(dirtyRect), Qt::IntersectClip); 173 152 174 153 #ifdef Q_WS_MAC … … 194 173 } 195 174 196 ScrollbarPart ScrollbarThemeQ t::hitTest(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt)175 ScrollbarPart ScrollbarThemeQStyle::hitTest(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt) 197 176 { 198 177 QStyleOptionSlider* opt = styleOptionSlider(scrollbar); … … 203 182 } 204 183 205 bool ScrollbarThemeQ t::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)184 bool ScrollbarThemeQStyle::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt) 206 185 { 207 186 // Middle click centers slider thumb (if supported). … … 209 188 } 210 189 211 void ScrollbarThemeQ t::invalidatePart(ScrollbarThemeClient* scrollbar, ScrollbarPart)190 void ScrollbarThemeQStyle::invalidatePart(ScrollbarThemeClient* scrollbar, ScrollbarPart) 212 191 { 213 192 // FIXME: Do more precise invalidation. … … 215 194 } 216 195 217 int ScrollbarThemeQ t::scrollbarThickness(ScrollbarControlSize controlSize)196 int ScrollbarThemeQStyle::scrollbarThickness(ScrollbarControlSize controlSize) 218 197 { 219 198 QStyleOptionSlider o; … … 225 204 } 226 205 227 int ScrollbarThemeQ t::thumbPosition(ScrollbarThemeClient* scrollbar)206 int ScrollbarThemeQStyle::thumbPosition(ScrollbarThemeClient* scrollbar) 228 207 { 229 208 if (scrollbar->enabled()) { … … 234 213 } 235 214 236 int ScrollbarThemeQ t::thumbLength(ScrollbarThemeClient* scrollbar)215 int ScrollbarThemeQStyle::thumbLength(ScrollbarThemeClient* scrollbar) 237 216 { 238 217 QStyleOptionSlider* opt = styleOptionSlider(scrollbar); … … 241 220 } 242 221 243 int ScrollbarThemeQ t::trackPosition(ScrollbarThemeClient* scrollbar)222 int ScrollbarThemeQStyle::trackPosition(ScrollbarThemeClient* scrollbar) 244 223 { 245 224 QStyleOptionSlider* opt = styleOptionSlider(scrollbar); … … 248 227 } 249 228 250 int ScrollbarThemeQ t::trackLength(ScrollbarThemeClient* scrollbar)229 int ScrollbarThemeQStyle::trackLength(ScrollbarThemeClient* scrollbar) 251 230 { 252 231 QStyleOptionSlider* opt = styleOptionSlider(scrollbar); … … 255 234 } 256 235 257 void ScrollbarThemeQ t::paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& rect)236 void ScrollbarThemeQStyle::paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& rect) 258 237 { 259 238 StylePainterQStyle p(this, context); … … 266 245 } 267 246 268 QStyle* ScrollbarThemeQ t::style() const247 QStyle* ScrollbarThemeQStyle::style() const 269 248 { 270 249 return QApplication::style(); 271 250 } 272 251 273 #endif // HAVE(QSTYLE) 274 } 275 252 } 253 -
trunk/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h
r109541 r109542 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 #ifndef ScrollbarThemeQ t_h27 #define ScrollbarThemeQ t_h26 #ifndef ScrollbarThemeQStyle_h 27 #define ScrollbarThemeQStyle_h 28 28 29 29 #include "ScrollbarTheme.h" … … 37 37 namespace WebCore { 38 38 39 class ScrollbarThemeQ t: public ScrollbarTheme {39 class ScrollbarThemeQStyle : public ScrollbarTheme { 40 40 public: 41 virtual ~ScrollbarThemeQ t();41 virtual ~ScrollbarThemeQStyle(); 42 42 43 virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& d amageRect);43 virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& dirtyRect); 44 44 virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect); 45 45 -
trunk/Source/api.pri
r107915 r109542 60 60 $$PWD/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \ 61 61 $$PWD/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \ 62 $$PWD/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp \ 63 $$PWD/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp \ 62 64 $$PWD/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \ 63 65 $$PWD/WebKit/qt/WebCoreSupport/TextCheckerClientQt.cpp \ … … 75 77 $$PWD/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \ 76 78 $$PWD/WebKit/qt/WebCoreSupport/PageClientQt.h \ 79 $$PWD/WebKit/qt/WebCoreSupport/PopupMenuQt.h \ 77 80 $$PWD/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \ 78 $$PWD/WebKit/qt/WebCoreSupport/PopupMenuQt.h \ 81 $$PWD/WebKit/qt/WebCoreSupport/QtStyleOptionWebComboBox.h.h \ 82 $$PWD/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h \ 83 $$PWD/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h \ 79 84 $$PWD/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \ 80 85 $$PWD/WebKit/qt/WebCoreSupport/TextCheckerClientQt.h \
Note: See TracChangeset
for help on using the changeset viewer.