summaryrefslogtreecommitdiff
path: root/Source/WebKit/qt
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/qt')
-rw-r--r--Source/WebKit/qt/Api/qwebframe.cpp88
-rw-r--r--Source/WebKit/qt/Api/qwebhistory.cpp2
-rw-r--r--Source/WebKit/qt/Api/qwebpage.cpp19
-rw-r--r--Source/WebKit/qt/Api/qwebpage_p.h1
-rw-r--r--Source/WebKit/qt/Api/qwebplugindatabase.cpp4
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.cpp12
-rw-r--r--Source/WebKit/qt/ChangeLog418
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h2
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp4
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp26
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h7
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h1
-rw-r--r--Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp5
-rw-r--r--Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h1
-rw-r--r--Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp10
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp6
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp4
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp506
-rw-r--r--Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h98
-rw-r--r--Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp827
-rw-r--r--Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h148
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp253
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h63
-rw-r--r--Source/WebKit/qt/declarative/experimental/experimental.pri2
-rw-r--r--Source/WebKit/qt/declarative/public.pri2
-rw-r--r--Source/WebKit/qt/docs/webkitsnippets/simple/simple.pro2
-rw-r--r--Source/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro4
-rw-r--r--Source/WebKit/qt/tests/tests.pri2
30 files changed, 1090 insertions, 1437 deletions
diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp
index adbfa1ccd..0accd3362 100644
--- a/Source/WebKit/qt/Api/qwebframe.cpp
+++ b/Source/WebKit/qt/Api/qwebframe.cpp
@@ -106,90 +106,6 @@ QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT int qt_defaultDpi();
QT_END_NAMESPACE
-bool QWEBKIT_EXPORT qtwebkit_webframe_scrollOverflow(QWebFrame* qFrame, int dx, int dy, const QPoint& pos)
-{
- WebCore::Frame* frame = QWebFramePrivate::core(qFrame);
- if (!frame || !frame->document() || !frame->view() || !frame->eventHandler())
- return false;
-
- QPoint contentsPos = frame->view()->windowToContents(pos);
- Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y());
- if (!node)
- return false;
-
- RenderObject* renderer = node->renderer();
- if (!renderer)
- return false;
-
- if (renderer->isListBox())
- return false;
-
- RenderLayer* renderLayer = renderer->enclosingLayer();
- if (!renderLayer)
- return false;
-
- bool scrolledHorizontal = false;
- bool scrolledVertical = false;
-
- do {
- if (dx > 0)
- scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx);
- else if (dx < 0)
- scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx));
-
- if (dy > 0)
- scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy);
- else if (dy < 0)
- scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy));
-
- if (scrolledHorizontal || scrolledVertical)
- return true;
-
- renderLayer = renderLayer->parent();
- } while (renderLayer);
-
- return false;
-}
-
-
-/*!
- \internal
- Scrolls nested frames starting at this frame, \a dx pixels to the right
- and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts
- to scroll elements with CSS overflow at position pos, followed by this frame. If this
- frame doesn't scroll, attempts to scroll the parent
-*/
-void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint& pos)
-{
- if (!qFrame)
- return;
-
- if (qtwebkit_webframe_scrollOverflow(qFrame, dx, dy, pos))
- return;
-
- bool scrollHorizontal = false;
- bool scrollVertical = false;
-
- do {
- if (dx > 0) // scroll right
- scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal);
- else if (dx < 0) // scroll left
- scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal);
-
- if (dy > 0) // scroll down
- scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical);
- else if (dy < 0) //scroll up
- scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical);
-
- if (scrollHorizontal || scrollVertical) {
- qFrame->scroll(dx, dy);
- return;
- }
-
- qFrame = qFrame->parentFrame();
- } while (qFrame);
-}
-
static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl)
{
switch (cacheLoadControl) {
@@ -1695,9 +1611,9 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult
boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect() : IntRect();
WebCore::Image *img = hitTest.image();
if (img) {
- QImage *pix = img->nativeImageForCurrentFrame();
+ QPixmap *pix = img->nativeImageForCurrentFrame();
if (pix)
- pixmap = QPixmap::fromImage(*pix);
+ pixmap = *pix;
}
WebCore::Frame *wframe = hitTest.targetFrame();
if (wframe)
diff --git a/Source/WebKit/qt/Api/qwebhistory.cpp b/Source/WebKit/qt/Api/qwebhistory.cpp
index 4bf63583b..f7849666e 100644
--- a/Source/WebKit/qt/Api/qwebhistory.cpp
+++ b/Source/WebKit/qt/Api/qwebhistory.cpp
@@ -158,7 +158,7 @@ QDateTime QWebHistoryItem::lastVisited() const
QIcon QWebHistoryItem::icon() const
{
if (d->item)
- return QPixmap::fromImage(*WebCore::iconDatabase().synchronousNativeIconForPageURL(d->item->url(), WebCore::IntSize(16, 16)));
+ return *WebCore::iconDatabase().synchronousNativeIconForPageURL(d->item->url(), WebCore::IntSize(16, 16));
return QIcon();
}
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp
index 5a844be3d..9019f4688 100644
--- a/Source/WebKit/qt/Api/qwebpage.cpp
+++ b/Source/WebKit/qt/Api/qwebpage.cpp
@@ -757,21 +757,6 @@ void QWebPagePrivate::mouseTripleClickEvent(T *ev)
ev->setAccepted(accepted);
}
-void QWebPagePrivate::handleClipboard(QEvent* ev, Qt::MouseButton button)
-{
-#ifndef QT_NO_CLIPBOARD
- if (QApplication::clipboard()->supportsSelection()) {
- WebCore::Frame* focusFrame = page->focusController()->focusedOrMainFrame();
- if (button == Qt::MidButton) {
- if (focusFrame) {
- focusFrame->editor()->command(AtomicString("PasteGlobalSelection")).execute();
- ev->setAccepted(true);
- }
- }
- }
-#endif
-}
-
template<class T>
void QWebPagePrivate::mouseReleaseEvent(T *ev)
{
@@ -787,8 +772,6 @@ void QWebPagePrivate::mouseReleaseEvent(T *ev)
accepted = frame->eventHandler()->handleMouseReleaseEvent(mev);
ev->setAccepted(accepted);
- if (!ev->isAccepted())
- handleClipboard(ev, ev->button());
handleSoftwareInputPanel(ev->button(), QPointF(ev->pos()).toPoint());
}
@@ -2254,7 +2237,7 @@ static void extractContentTypeFromPluginVector(const Vector<PluginPackage*>& plu
MIMEToDescriptionsMap::const_iterator map_it = plugins[i]->mimeToDescriptions().begin();
MIMEToDescriptionsMap::const_iterator map_end = plugins[i]->mimeToDescriptions().end();
for (; map_it != map_end; ++map_it)
- *list << map_it->first;
+ *list << map_it->key;
}
}
diff --git a/Source/WebKit/qt/Api/qwebpage_p.h b/Source/WebKit/qt/Api/qwebpage_p.h
index a8e373bca..86577d351 100644
--- a/Source/WebKit/qt/Api/qwebpage_p.h
+++ b/Source/WebKit/qt/Api/qwebpage_p.h
@@ -127,7 +127,6 @@ public:
void shortcutOverrideEvent(QKeyEvent*);
void leaveEvent(QEvent*);
- void handleClipboard(QEvent*, Qt::MouseButton);
void handleSoftwareInputPanel(Qt::MouseButton, const QPoint&);
bool handleScrolling(QKeyEvent*, WebCore::Frame*);
diff --git a/Source/WebKit/qt/Api/qwebplugindatabase.cpp b/Source/WebKit/qt/Api/qwebplugindatabase.cpp
index a7a3b5f2c..c5328c8f6 100644
--- a/Source/WebKit/qt/Api/qwebplugindatabase.cpp
+++ b/Source/WebKit/qt/Api/qwebplugindatabase.cpp
@@ -122,8 +122,8 @@ QList<QWebPluginInfo::MimeType> QWebPluginInfo::mimeTypes() const
for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
MimeType mimeType;
- mimeType.name = it->first;
- mimeType.description = it->second;
+ mimeType.name = it->key;
+ mimeType.description = it->value;
QStringList fileExtensions;
Vector<String> extensions = m_package->mimeToExtensions().get(mimeType.name);
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp
index ebecc7f5d..ba7187df7 100644
--- a/Source/WebKit/qt/Api/qwebsettings.cpp
+++ b/Source/WebKit/qt/Api/qwebsettings.cpp
@@ -723,12 +723,12 @@ void QWebSettings::clearIconDatabase()
QIcon QWebSettings::iconForUrl(const QUrl& url)
{
WebCore::initializeWebCoreQt();
- QImage* icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(WebCore::KURL(url).string(),
+ QPixmap* icon = WebCore::iconDatabase().synchronousNativeIconForPageURL(WebCore::KURL(url).string(),
WebCore::IntSize(16, 16));
if (!icon)
return QIcon();
- return QPixmap::fromImage(*icon);
+ return* icon;
}
/*
@@ -771,7 +771,7 @@ static const char* resourceNameForWebGraphic(QWebSettings::WebGraphic type)
void QWebSettings::setWebGraphic(WebGraphic type, const QPixmap& graphic)
{
WebCore::initializeWebCoreQt();
- WebCore::Image::setPlatformResource(resourceNameForWebGraphic(type), graphic.toImage());
+ WebCore::Image::setPlatformResource(resourceNameForWebGraphic(type), graphic);
}
/*!
@@ -786,10 +786,10 @@ QPixmap QWebSettings::webGraphic(WebGraphic type)
RefPtr<WebCore::Image> img = WebCore::Image::loadPlatformResource(resourceNameForWebGraphic(type));
if (!img)
return QPixmap();
- QImage* image = img->nativeImageForCurrentFrame();
- if (!image)
+ QPixmap* pixmap = img->nativeImageForCurrentFrame();
+ if (!pixmap)
return QPixmap();
- return QPixmap::fromImage(*image);
+ return *pixmap;
}
/*!
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index 612b867d2..177837e5a 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,421 @@
+2012-10-15 Simon Hausmann <simon.hausmann@digia.com>
+
+ [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets
+ https://bugs.webkit.org/show_bug.cgi?id=88162
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Rename the QtWebKit module to QtWebKitWidgets.
+
+ * declarative/experimental/experimental.pri:
+ * declarative/public.pri:
+ * docs/webkitsnippets/simple/simple.pro:
+ * docs/webkitsnippets/webpage/webpage.pro:
+ * tests/tests.pri:
+
+2012-10-10 Jon Lee <jonlee@apple.com>
+
+ [WK2] Activate plugins when user clicks on snapshot
+ https://bugs.webkit.org/show_bug.cgi?id=98328
+ <rdar://problem/12426681>
+
+ Reviewed by Brady Eidson.
+
+ * WebCoreSupport/FrameLoaderClientQt.h:
+ (WebCore::FrameLoaderClientQt::recreatePlugin): Stub implementation of recreatePlugin().
+
+2012-10-10 Balazs Kelemen <kbalazs@webkit.org>
+
+ [Qt] Test drivers should handle repaint rects
+ https://bugs.webkit.org/show_bug.cgi?id=68870
+
+ Reviewed by Zoltan Herczeg.
+
+ Added helpers to enable and get the repaint rects.
+
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+ (DumpRenderTreeSupportQt::setTrackRepaintRects):
+ (DumpRenderTreeSupportQt::trackRepaintRects):
+ (DumpRenderTreeSupportQt::getTrackedRepaintRects):
+ * WebCoreSupport/DumpRenderTreeSupportQt.h:
+
+2012-10-08 Simon Hausmann <simon.hausmann@digia.com>
+
+ [Qt] Make RenderThemeQStyle/ScrollbarThemeQStyle compile without QStyle/QtWidgets
+ https://bugs.webkit.org/show_bug.cgi?id=98268
+
+ Reviewed by Tor Arne Vestbø.
+
+ Extracted QStyle/QWidget related code into a QWebStyle class that implements the QStyleFacade interface.
+
+ QStyleFacade is a pure interface that lives in WebCore/platform/qt
+ (next to RenderThemeQStyle and ScrollbarThemeQStyle) and provides a
+ minimal interface of what we need to draw with QStyle as well as basic
+ hit testing and metric retrieval. It also provides a
+ QStyleFacadeOption class that aggregates common meta-data for
+ rendering primitives, such as direction, rectangle, state (sunken,
+ enabled, etc.) or palette. It also provides some more slider/scrollbar
+ specific fields in a slider sub-structure.
+
+ RenderThemeQStyle/ScrollbarThemeQStyle used to instantiate specific QStyleOption sub-classes and populate
+ them with state information from render objects, before calling straight to QStyle. Most of the common code
+ was encapsulated in StylePainterQStyle.
+
+ The new RenderThemeQStyle/ScrolllbarThemeQStyle uses common code in
+ StylePainterQStyle to populate state into QStyleFacadeOption before
+ calling into QStyleFacade.
+
+ The style facade is then implemented by QStyleFacadeImp, which extracts
+ meta-data from QStyleFacadeOption arguments, populates style
+ primitive specific QStyleOption objects and then calls on QStyle.
+
+ RenderThemeQStyle/ScrollbarThemeQStyle can only use interface methods
+ from QStyleFacade. QStyleFacadeImp on the other hand will live in the
+ separate QtWebKitWidgets library in the future and therefore cannot use
+ any WebCore types.
+
+ * WebCoreSupport/InitWebCoreQt.cpp:
+ (WebCore::initializeWebCoreQt):
+ * WebCoreSupport/QStyleFacadeImp.cpp: Added.
+ (WebKit):
+ (WebKit::convertToQStyleState):
+ (WebKit::convertToQStyleSubControl):
+ (WebKit::initGenericStyleOption):
+ (WebKit::initSpecificStyleOption):
+ (MappedStyleOption):
+ (WebKit::MappedStyleOption::MappedStyleOption):
+ (WebKit::convertPixelMetric):
+ (WebKit::convertToQStyleFacadeSubControl):
+ (WebKit::QStyleFacadeImp::QStyleFacadeImp):
+ (WebKit::QStyleFacadeImp::~QStyleFacadeImp):
+ (WebKit::QStyleFacadeImp::buttonSubElementRect):
+ (WebKit::QStyleFacadeImp::findFrameLineWidth):
+ (WebKit::QStyleFacadeImp::simplePixelMetric):
+ (WebKit::QStyleFacadeImp::buttonMargin):
+ (WebKit::QStyleFacadeImp::sliderLength):
+ (WebKit::QStyleFacadeImp::sliderThickness):
+ (WebKit::QStyleFacadeImp::progressBarChunkWidth):
+ (WebKit::QStyleFacadeImp::getButtonMetrics):
+ (WebKit::QStyleFacadeImp::sizeFromContents):
+ (WebKit::QStyleFacadeImp::paintButton):
+ (WebKit::QStyleFacadeImp::paintTextField):
+ (WebKit::QStyleFacadeImp::paintComboBox):
+ (WebKit::QStyleFacadeImp::paintComboBoxArrow):
+ (WebKit::QStyleFacadeImp::paintSliderTrack):
+ (WebKit::QStyleFacadeImp::paintSliderThumb):
+ (WebKit::QStyleFacadeImp::paintInnerSpinButton):
+ (WebKit::QStyleFacadeImp::paintProgressBar):
+ (WebKit::QStyleFacadeImp::scrollBarExtent):
+ (WebKit::QStyleFacadeImp::scrollBarMiddleClickAbsolutePositionStyleHint):
+ (WebKit::QStyleFacadeImp::paintScrollCorner):
+ (WebKit::QStyleFacadeImp::hitTestScrollBar):
+ (WebKit::QStyleFacadeImp::scrollBarSubControlRect):
+ (WebKit::QStyleFacadeImp::paintScrollBar):
+ (WebKit::QStyleFacadeImp::widgetForPainter):
+ (WebKit::QStyleFacadeImp::style):
+ * WebCoreSupport/QStyleFacadeImp.h: Added.
+ (WebCore):
+ (WebKit):
+ (QStyleFacadeImp):
+ (WebKit::QStyleFacadeImp::create):
+ (WebKit::QStyleFacadeImp::isValid):
+
+2012-10-08 Zoltan Horvath <zoltan@webkit.org>
+
+ [Qt] r122720 causes performance regression with DirectFB on ARMv7
+ https://bugs.webkit.org/show_bug.cgi?id=97548
+
+ Reviewed by Jocelyn Turcotte.
+
+ Revert the rest of r122720. This change modifies the NativeImagePtr from QImage* to QPixmap*.
+
+ Covered by existing tests.
+
+ * Api/qwebframe.cpp:
+ (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+ * Api/qwebhistory.cpp:
+ (QWebHistoryItem::icon):
+ * Api/qwebsettings.cpp:
+ (QWebSettings::iconForUrl):
+ (QWebSettings::setWebGraphic):
+ (QWebSettings::webGraphic):
+ * WebCoreSupport/DragClientQt.cpp:
+ (WebCore::DragClientQt::startDrag):
+ * WebCoreSupport/InitWebCoreQt.cpp:
+ (WebCore::initializeWebCoreQt):
+
+2012-10-07 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ Rename first/second to key/value in HashMap iterators
+ https://bugs.webkit.org/show_bug.cgi?id=82784
+
+ Reviewed by Eric Seidel.
+
+ * Api/qwebpage.cpp:
+ (extractContentTypeFromPluginVector):
+ * Api/qwebplugindatabase.cpp:
+ (QWebPluginInfo::mimeTypes):
+ * WebCoreSupport/PlatformStrategiesQt.cpp:
+ (PlatformStrategiesQt::getPluginInfo):
+
+2012-10-05 Simon Hausmann <simon.hausmann@digia.com>
+
+ Unreviewed, rolling out r130495.
+ http://trac.webkit.org/changeset/130495
+ https://bugs.webkit.org/show_bug.cgi?id=98268
+
+ Made WK2 tests crash.
+
+ * WebCoreSupport/InitWebCoreQt.cpp:
+ (WebCore::initializeWebCoreQt):
+ * WebCoreSupport/QStyleFacadeImp.cpp: Removed.
+ * WebCoreSupport/QStyleFacadeImp.h: Removed.
+ * WebCoreSupport/RenderThemeQStyle.cpp: Renamed from Source/WebCore/platform/qt/RenderThemeQStyle.cpp.
+ (WebCore):
+ (WebCore::initStyleOption):
+ (WebCore::RenderThemeQStyle::getStylePainter):
+ (WebCore::StylePainterQStyle::StylePainterQStyle):
+ (WebCore::StylePainterQStyle::init):
+ (WebCore::RenderThemeQStyle::create):
+ (WebCore::RenderThemeQStyle::RenderThemeQStyle):
+ (WebCore::RenderThemeQStyle::~RenderThemeQStyle):
+ (WebCore::RenderThemeQStyle::fallbackStyle):
+ (WebCore::RenderThemeQStyle::setPaletteFromPageClientIfExists):
+ (WebCore::RenderThemeQStyle::qStyle):
+ (WebCore::RenderThemeQStyle::findFrameLineWidth):
+ (WebCore::RenderThemeQStyle::inflateButtonRect):
+ (WebCore::RenderThemeQStyle::computeSizeBasedOnStyle):
+ (WebCore::RenderThemeQStyle::adjustButtonStyle):
+ (WebCore::RenderThemeQStyle::setButtonPadding):
+ (WebCore::RenderThemeQStyle::paintButton):
+ (WebCore::RenderThemeQStyle::paintTextField):
+ (WebCore::RenderThemeQStyle::adjustTextAreaStyle):
+ (WebCore::RenderThemeQStyle::paintTextArea):
+ (WebCore::RenderThemeQStyle::setPopupPadding):
+ (WebCore::RenderThemeQStyle::colorPalette):
+ (WebCore::RenderThemeQStyle::paintMenuList):
+ (WebCore::RenderThemeQStyle::adjustMenuListButtonStyle):
+ (WebCore::RenderThemeQStyle::paintMenuListButton):
+ (WebCore::RenderThemeQStyle::animationDurationForProgressBar):
+ (WebCore::RenderThemeQStyle::paintProgressBar):
+ (WebCore::RenderThemeQStyle::paintSliderTrack):
+ (WebCore::RenderThemeQStyle::adjustSliderTrackStyle):
+ (WebCore::RenderThemeQStyle::paintSliderThumb):
+ (WebCore::RenderThemeQStyle::adjustSliderThumbStyle):
+ (WebCore::RenderThemeQStyle::paintSearchField):
+ (WebCore::RenderThemeQStyle::adjustSearchFieldDecorationStyle):
+ (WebCore::RenderThemeQStyle::paintSearchFieldDecoration):
+ (WebCore::RenderThemeQStyle::adjustSearchFieldResultsDecorationStyle):
+ (WebCore::RenderThemeQStyle::paintSearchFieldResultsDecoration):
+ (WebCore::RenderThemeQStyle::paintInnerSpinButton):
+ (WebCore::RenderThemeQStyle::initializeCommonQStyleOptions):
+ (WebCore::RenderThemeQStyle::adjustSliderThumbSize):
+ * WebCoreSupport/RenderThemeQStyle.h: Renamed from Source/WebCore/platform/qt/RenderThemeQStyle.h.
+ (WebCore):
+ (RenderThemeQStyle):
+ (StylePainterQStyle):
+ (WebCore::StylePainterQStyle::isValid):
+ (WebCore::StylePainterQStyle::drawPrimitive):
+ (WebCore::StylePainterQStyle::drawControl):
+ (WebCore::StylePainterQStyle::drawComplexControl):
+ * WebCoreSupport/ScrollbarThemeQStyle.cpp: Renamed from Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp.
+ (WebCore):
+ (WebCore::ScrollbarThemeQStyle::~ScrollbarThemeQStyle):
+ (WebCore::scPart):
+ (WebCore::scrollbarPart):
+ (WebCore::styleOptionSlider):
+ (WebCore::ScrollbarThemeQStyle::paint):
+ (WebCore::ScrollbarThemeQStyle::hitTest):
+ (WebCore::ScrollbarThemeQStyle::shouldCenterOnThumb):
+ (WebCore::ScrollbarThemeQStyle::invalidatePart):
+ (WebCore::ScrollbarThemeQStyle::scrollbarThickness):
+ (WebCore::ScrollbarThemeQStyle::thumbPosition):
+ (WebCore::ScrollbarThemeQStyle::thumbLength):
+ (WebCore::ScrollbarThemeQStyle::trackPosition):
+ (WebCore::ScrollbarThemeQStyle::trackLength):
+ (WebCore::ScrollbarThemeQStyle::paintScrollCorner):
+ (WebCore::ScrollbarThemeQStyle::style):
+ * WebCoreSupport/ScrollbarThemeQStyle.h: Renamed from Source/WebCore/platform/qt/ScrollbarThemeQStyle.h.
+ (WebCore):
+ (ScrollbarThemeQStyle):
+
+2012-10-05 Simon Hausmann <simon.hausmann@digia.com>
+
+ [Qt] Make RenderThemeQStyle/ScrollbarThemeQStyle compile without QStyle/QtWidgets
+ https://bugs.webkit.org/show_bug.cgi?id=98268
+
+ Reviewed by Tor Arne Vestbø.
+
+ Extracted QStyle/QWidget related code into a QWebStyle class that implements the QStyleFacade interface.
+
+ QStyleFacade is a pure interface that lives in WebCore/platform/qt
+ (next to RenderThemeQStyle and ScrollbarThemeQStyle) and provides a
+ minimal interface of what we need to draw with QStyle as well as basic
+ hit testing and metric retrieval. It also provides a
+ QStyleFacadeOption class that aggregates common meta-data for
+ rendering primitives, such as direction, rectangle, state (sunken,
+ enabled, etc.) or palette. It also provides some more slider/scrollbar
+ specific fields in a slider sub-structure.
+
+ RenderThemeQStyle/ScrollbarThemeQStyle used to instantiate specific QStyleOption sub-classes and populate
+ them with state information from render objects, before calling straight to QStyle. Most of the common code
+ was encapsulated in StylePainterQStyle.
+
+ The new RenderThemeQStyle/ScrolllbarThemeQStyle uses common code in
+ StylePainterQStyle to populate state into QStyleFacadeOption before
+ calling into QStyleFacade.
+
+ The style facade is then implemented by QStyleFacadeImp, which extracts
+ meta-data from QStyleFacadeOption arguments, populates style
+ primitive specific QStyleOption objects and then calls on QStyle.
+
+ RenderThemeQStyle/ScrollbarThemeQStyle can only use interface methods
+ from QStyleFacade. QStyleFacadeImp on the other hand will live in the
+ separate QtWebKitWidgets library in the future and therefore cannot use
+ any WebCore types.
+
+ * WebCoreSupport/InitWebCoreQt.cpp:
+ (WebCore::initializeWebCoreQt):
+ * WebCoreSupport/QStyleFacadeImp.cpp: Added.
+ (WebKit):
+ (WebKit::convertToQStyleState):
+ (WebKit::convertToQStyleSubControl):
+ (WebKit::initGenericStyleOption):
+ (WebKit::initSpecificStyleOption):
+ (MappedStyleOption):
+ (WebKit::MappedStyleOption::MappedStyleOption):
+ (WebKit::convertPixelMetric):
+ (WebKit::convertToQStyleFacadeSubControl):
+ (WebKit::QStyleFacadeImp::QStyleFacadeImp):
+ (WebKit::QStyleFacadeImp::~QStyleFacadeImp):
+ (WebKit::QStyleFacadeImp::buttonSubElementRect):
+ (WebKit::QStyleFacadeImp::findFrameLineWidth):
+ (WebKit::QStyleFacadeImp::simplePixelMetric):
+ (WebKit::QStyleFacadeImp::buttonMargin):
+ (WebKit::QStyleFacadeImp::sliderLength):
+ (WebKit::QStyleFacadeImp::sliderThickness):
+ (WebKit::QStyleFacadeImp::progressBarChunkWidth):
+ (WebKit::QStyleFacadeImp::getButtonMetrics):
+ (WebKit::QStyleFacadeImp::sizeFromContents):
+ (WebKit::QStyleFacadeImp::paintButton):
+ (WebKit::QStyleFacadeImp::paintTextField):
+ (WebKit::QStyleFacadeImp::paintComboBox):
+ (WebKit::QStyleFacadeImp::paintComboBoxArrow):
+ (WebKit::QStyleFacadeImp::paintSliderTrack):
+ (WebKit::QStyleFacadeImp::paintSliderThumb):
+ (WebKit::QStyleFacadeImp::paintInnerSpinButton):
+ (WebKit::QStyleFacadeImp::paintProgressBar):
+ (WebKit::QStyleFacadeImp::scrollBarExtent):
+ (WebKit::QStyleFacadeImp::scrollBarMiddleClickAbsolutePositionStyleHint):
+ (WebKit::QStyleFacadeImp::paintScrollCorner):
+ (WebKit::QStyleFacadeImp::hitTestScrollBar):
+ (WebKit::QStyleFacadeImp::scrollBarSubControlRect):
+ (WebKit::QStyleFacadeImp::paintScrollBar):
+ (WebKit::QStyleFacadeImp::widgetForPainter):
+ (WebKit::QStyleFacadeImp::style):
+ * WebCoreSupport/QStyleFacadeImp.h: Added.
+ (WebCore):
+ (WebKit):
+ (QStyleFacadeImp):
+ (WebKit::QStyleFacadeImp::create):
+ (WebKit::QStyleFacadeImp::isValid):
+
+2012-10-05 Simon Hausmann <simon.hausmann@digia.com>
+
+ [Qt] Remove dead code
+ https://bugs.webkit.org/show_bug.cgi?id=98491
+
+ Reviewed by Jocelyn Turcotte.
+
+ This code was added long time ago for a Symbian related project and is
+ not needed anymore.
+
+ * Api/qwebframe.cpp:
+
+2012-10-04 Simon Fraser <simon.fraser@apple.com>
+
+ Final part of "sync" to "flush" renaming
+ https://bugs.webkit.org/show_bug.cgi?id=98430
+
+ Reviewed by Tim Horton.
+
+ Change method names on GraphicsLayer and GraphicsLayerClient that
+ refer to "sync" to use the term "flush" instead, to be consistent
+ with the rest of the code.
+
+ * WebCoreSupport/PageClientQt.cpp:
+ (WebCore::TextureMapperLayerClientQt::syncRootLayer):
+
+2012-10-04 Simon Fraser <simon.fraser@apple.com>
+
+ Standardize on "flush" terminology for compositing layer flushing/syncing
+ https://bugs.webkit.org/show_bug.cgi?id=98321
+
+ Reviewed by Simon Fraser.
+
+ Rename compositing-related methods that refer to "syncing" to instead
+ refer to "flushing".
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::scheduleCompositingLayerFlush):
+ * WebCoreSupport/ChromeClientQt.h:
+ (ChromeClientQt):
+ * WebCoreSupport/PageClientQt.cpp:
+ (WebCore::PageClientQGraphicsWidget::syncLayers):
+
+2012-10-03 Balazs Kelemen <kbalazs@webkit.org>
+
+ [Qt] Enable mock scrollbars
+ https://bugs.webkit.org/show_bug.cgi?id=98011
+
+ Reviewed by Csaba Osztrogonác.
+
+ Added helper to enable mock scrollbars.
+
+ * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+ (DumpRenderTreeSupportQt::enableMockScrollbars):
+ * WebCoreSupport/DumpRenderTreeSupportQt.h:
+
+2012-10-01 Brady Eidson <beidson@apple.com>
+
+ Remove the Safari 2 -> Safari 3 icon database import code.
+ https://bugs.webkit.org/show_bug.cgi?id=98113
+
+ Reviewed by Maciej Stachowiak.
+
+ Nuke the performImport() IconDatabaseClient method.
+
+ * WebCoreSupport/IconDatabaseClientQt.cpp:
+ * WebCoreSupport/IconDatabaseClientQt.h:
+ (IconDatabaseClientQt):
+
+2012-09-28 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
+
+ Code inside FrameLoaderClient::canShowMIMEType() implementations can be shared among different WK ports
+ https://bugs.webkit.org/show_bug.cgi?id=97547
+
+ Reviewed by Adam Barth.
+
+ Newly added WebCore::MIMETypeRegistry::canShowMIMEType() function is used
+ inside WebCore::FrameLoaderClientQt::canShowMIMEType().
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::canShowMIMEType):
+
+2012-09-27 Allan Sandfeld Jensen <allan.jensen@digia.com>
+
+ Unify event handling of middle mouse button.
+ https://bugs.webkit.org/show_bug.cgi?id=97690
+
+ Reviewed by Tony Chang.
+
+ Remove port specific handling of middle mouse button press.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::mouseReleaseEvent):
+ * Api/qwebpage_p.h:
+ (QWebPagePrivate):
+
2012-09-26 Simon Hausmann <simon.hausmann@digia.com>
[Qt] Remove Qt Quick 1 support
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 912320ccd..eaaeb012f 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -680,7 +680,7 @@ void ChromeClientQt::setNeedsOneShotDrawingSynchronization()
platformPageClient()->markForSync(false);
}
-void ChromeClientQt::scheduleCompositingLayerSync()
+void ChromeClientQt::scheduleCompositingLayerFlush()
{
// we want the layers to synchronize ASAP
if (platformPageClient())
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index 27368e7f1..f7359d2e2 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -144,7 +144,7 @@ public:
// This is a hook for WebCore to tell us what we need to do with the GraphicsLayers.
virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
virtual void setNeedsOneShotDrawingSynchronization();
- virtual void scheduleCompositingLayerSync();
+ virtual void scheduleCompositingLayerFlush();
virtual CompositingTriggerFlags allowedCompositingTriggers() const;
#endif
virtual bool allowsAcceleratedCompositing() const;
diff --git a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index 8b648c19e..cb6328340 100644
--- a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
@@ -97,9 +97,9 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint&, const IntP
if (view) {
QDrag* drag = new QDrag(view);
if (dragImage)
- drag->setPixmap(QPixmap::fromImage(*dragImage));
+ drag->setPixmap(*dragImage);
else if (clipboardData && clipboardData->hasImage())
- drag->setPixmap(QPixmap::fromImage(qvariant_cast<QImage>(clipboardData->imageData())));
+ drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData()));
DragOperation dragOperationMask = clipboard->sourceOperation();
drag->setMimeData(clipboardData);
Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 1ec3644e0..77a5c2994 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -835,7 +835,7 @@ void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, in
void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode)
{
- page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), nullptr, nullptr, WebCore::InjectInAllFrames);
+ page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames);
}
void DumpRenderTreeSupportQt::removeUserStyleSheets(QWebPage* page)
@@ -939,6 +939,11 @@ bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const
return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl);
}
+void DumpRenderTreeSupportQt::enableMockScrollbars()
+{
+ Settings::setMockScrollbarsEnabled(true);
+}
+
QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId)
{
QUrl res;
@@ -1087,6 +1092,25 @@ QImage DumpRenderTreeSupportQt::paintPagesWithBoundaries(QWebFrame* qframe)
return image;
}
+void DumpRenderTreeSupportQt::setTrackRepaintRects(QWebFrame* frame, bool enable)
+{
+ QWebFramePrivate::core(frame)->view()->setTracksRepaints(enable);
+}
+
+bool DumpRenderTreeSupportQt::trackRepaintRects(QWebFrame* frame)
+{
+ return QWebFramePrivate::core(frame)->view()->isTrackingRepaints();
+}
+
+void DumpRenderTreeSupportQt::getTrackedRepaintRects(QWebFrame* frame, QVector<QRect>& result)
+{
+ Frame* coreFrame = QWebFramePrivate::core(frame);
+ const Vector<IntRect>& rects = coreFrame->view()->trackedRepaintRects();
+ result.resize(rects.size());
+ for (size_t i = 0; i < rects.size(); ++i)
+ result.append(rects[i]);
+}
+
// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
index cefb9d1c8..8874a942e 100644
--- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
@@ -26,6 +26,7 @@
#include "qwebkitglobal.h"
#include <QNetworkCookieJar>
#include <QVariant>
+#include <QVector>
typedef const struct OpaqueJSContext* JSContextRef;
@@ -209,7 +210,13 @@ public:
static bool thirdPartyCookiePolicyAllows(QWebPage*, const QUrl&, const QUrl& firstPartyUrl);
+ static void enableMockScrollbars();
+
static QImage paintPagesWithBoundaries(QWebFrame*);
+
+ static void setTrackRepaintRects(QWebFrame*, bool enable);
+ static bool trackRepaintRects(QWebFrame*);
+ static void getTrackedRepaintRects(QWebFrame*, QVector<QRect>& result);
};
#endif
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 3320ea755..6600acc82 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -630,13 +630,7 @@ bool FrameLoaderClientQt::canShowMIMEType(const String& MIMEType) const
{
String type = MIMEType;
type.makeLower();
- if (MIMETypeRegistry::isSupportedImageMIMEType(type))
- return true;
-
- if (MIMETypeRegistry::isSupportedNonImageMIMEType(type))
- return true;
-
- if (MIMETypeRegistry::isSupportedMediaMIMEType(type))
+ if (MIMETypeRegistry::canShowMIMEType(type))
return true;
if (m_frame && m_frame->settings() && m_frame->settings()->arePluginsEnabled()
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 542129238..03102de3e 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -207,6 +207,7 @@ public:
virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
+ virtual void recreatePlugin(Widget*) { }
virtual void redirectDataToPlugin(Widget* pluginWidget);
virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
diff --git a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp
index baaecaef5..01d9faaae 100644
--- a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.cpp
@@ -53,11 +53,6 @@ IconDatabaseClientQt::~IconDatabaseClientQt()
{
}
-bool IconDatabaseClientQt::performImport()
-{
- return true;
-}
-
void IconDatabaseClientQt::didRemoveAllIcons()
{
}
diff --git a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h
index 59e9839f8..6ac211980 100644
--- a/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/IconDatabaseClientQt.h
@@ -38,7 +38,6 @@ class IconDatabaseClientQt : public QObject, public IconDatabaseClient {
public:
static IconDatabaseClientQt* instance();
- virtual bool performImport();
virtual void didRemoveAllIcons();
virtual void didImportIconURLForPageURL(const String&);
virtual void didImportIconDataForPageURL(const String&);
diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
index c63ccb042..d6065c14e 100644
--- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
@@ -33,6 +33,7 @@
#include "Image.h"
#include "NotImplemented.h"
#include "PlatformStrategiesQt.h"
+#include "QStyleFacadeImp.h"
#include "RenderThemeQStyle.h"
#include "ScriptController.h"
#include "ScrollbarThemeQStyle.h"
@@ -52,8 +53,10 @@ namespace WebKit {
// Called also from WebKit2's WebProcess.
Q_DECL_EXPORT void initializeWebKit2Theme()
{
- if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle")
+ if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle") {
+ WebCore::RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create);
WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle);
+ }
}
}
@@ -76,6 +79,7 @@ void initializeWebCoreQt()
PlatformStrategiesQt::initialize();
QtWebElementRuntime::initialize();
+ RenderThemeQStyle::setStyleFactoryFunction(WebKit::QStyleFacadeImp::create);
RenderThemeQt::setCustomTheme(RenderThemeQStyle::create, new ScrollbarThemeQStyle);
#if USE(QTKIT)
@@ -83,9 +87,9 @@ void initializeWebCoreQt()
#endif
// QWebSettings::SearchCancelButtonGraphic
- Image::setPlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton).toImage());
+ Image::setPlatformResource("searchCancelButton", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
// QWebSettings::SearchCancelButtonPressedGraphic
- Image::setPlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton).toImage());
+ Image::setPlatformResource("searchCancelButtonPressed", QApplication::style()->standardPixmap(QStyle::SP_DialogCloseButton));
initialized = true;
}
diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index 2be1b3b3f..141f98e30 100644
--- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -110,7 +110,7 @@ TextureMapperLayerClientQt::~TextureMapperLayerClientQt()
void TextureMapperLayerClientQt::syncRootLayer()
{
- m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly();
+ m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly();
}
TextureMapperLayer* TextureMapperLayerClientQt::rootLayer()
@@ -141,7 +141,7 @@ void PageClientQWidget::syncLayers(Timer<PageClientQWidget>*)
{
if (TextureMapperLayerClient)
TextureMapperLayerClient->syncRootLayer();
- QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateIncludingSubframes();
+ QWebFramePrivate::core(page->mainFrame())->view()->flushCompositingStateIncludingSubframes();
if (!TextureMapperLayerClient)
return;
if (TextureMapperLayerClient->rootLayer()->descendantsOrSelfHaveRunningAnimations() && !syncTimer.isActive())
@@ -271,7 +271,7 @@ void PageClientQGraphicsWidget::syncLayers()
if (TextureMapperLayerClient)
TextureMapperLayerClient->syncRootLayer();
- QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateIncludingSubframes();
+ QWebFramePrivate::core(page->mainFrame())->view()->flushCompositingStateIncludingSubframes();
if (!TextureMapperLayerClient)
return;
diff --git a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
index cd4ab0d72..7d4b0b75f 100644
--- a/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PlatformStrategiesQt.cpp
@@ -133,8 +133,8 @@ void PlatformStrategiesQt::getPluginInfo(const WebCore::Page* page, Vector<WebCo
for (MIMEToDescriptionsMap::const_iterator it = mimeToDescriptions.begin(); it != end; ++it) {
MimeClassInfo mime;
- mime.type = it->first;
- mime.desc = it->second;
+ mime.type = it->key;
+ mime.desc = it->value;
mime.extensions = package->mimeToExtensions().get(mime.type);
info.mimes.append(mime);
diff --git a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp b/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp
new file mode 100644
index 000000000..b9e478709
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.cpp
@@ -0,0 +1,506 @@
+/*
+ * This file is part of the theme implementation for form controls in WebCore.
+ *
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ * Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "QStyleFacadeImp.h"
+
+#include <QApplication>
+#include <QLineEdit>
+#include <QMacStyle>
+#include <QPainter>
+#include <QPushButton>
+#ifndef QT_NO_STYLE_PLASTIQUE
+#include <QPlastiqueStyle>
+#endif
+#include <QStyleFactory>
+#include <QStyleOption>
+
+#include <QWebPageClient.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static QStyle::State convertToQStyleState(QStyleFacade::State state)
+{
+ QStyle::State result;
+#define CONVERT_STATE(ProxiedState, Value) \
+ if (state & QStyleFacade::ProxiedState) \
+ result |= QStyle::ProxiedState;
+
+ FOR_EACH_MAPPED_STATE(CONVERT_STATE, )
+
+#undef CONVERT_STATE
+
+ return result;
+}
+
+static QStyle::SubControl convertToQStyleSubControl(QStyleFacade::SubControl sc)
+{
+#define CONVERT_SUBCONTROL(F, Value) \
+ case QStyleFacade::F: return QStyle::F
+
+ switch (sc) {
+ FOR_EACH_SUBCONTROL(CONVERT_SUBCONTROL, SEMICOLON);
+ }
+ ASSERT_NOT_REACHED();
+ return QStyle::SC_None;
+#undef CONVERT_SUBCONTROL
+}
+
+static void initGenericStyleOption(QStyleOption* option, QWidget* widget, const QStyleFacadeOption& facadeOption)
+{
+ if (widget)
+ option->init(widget);
+ else
+ // If a widget is not directly available for rendering, we fallback to default
+ // value for an active widget.
+ option->state = QStyle::State_Active | QStyle::State_Enabled;
+
+ option->rect = facadeOption.rect;
+ option->state = convertToQStyleState(facadeOption.state);
+ option->direction = facadeOption.direction;
+ option->palette = facadeOption.palette;
+}
+
+static void initSpecificStyleOption(QStyleOption*, const QStyleFacadeOption&)
+{
+}
+
+static void initSpecificStyleOption(QStyleOptionSlider* sliderOption, const QStyleFacadeOption& facadeOption)
+{
+ sliderOption->orientation = facadeOption.slider.orientation;
+ sliderOption->upsideDown = facadeOption.slider.upsideDown;
+ sliderOption->minimum = facadeOption.slider.minimum;
+ sliderOption->maximum = facadeOption.slider.maximum;
+ sliderOption->sliderPosition = facadeOption.slider.position;
+ sliderOption->sliderValue = facadeOption.slider.value;
+ sliderOption->singleStep = facadeOption.slider.singleStep;
+ sliderOption->pageStep = facadeOption.slider.pageStep;
+ sliderOption->activeSubControls = convertToQStyleSubControl(facadeOption.slider.activeSubControls);
+}
+
+template <typename StyleOption>
+class MappedStyleOption : public StyleOption {
+
+public:
+ MappedStyleOption(QWidget* widget, const QStyleFacadeOption& facadeOption)
+ {
+ initGenericStyleOption(this, widget, facadeOption);
+ initSpecificStyleOption(this, facadeOption);
+ }
+};
+
+static QStyle::PixelMetric convertPixelMetric(QStyleFacade::PixelMetric state)
+{
+#define CONVERT_METRIC(Metric) \
+ case QStyleFacade::Metric: return QStyle::Metric
+
+ switch (state) {
+ FOR_EACH_MAPPED_METRIC(CONVERT_METRIC, SEMICOLON);
+ }
+ ASSERT_NOT_REACHED();
+ return QStyle::PM_CustomBase;
+
+#undef CONVERT_METRIC
+}
+
+static QStyleFacade::SubControl convertToQStyleFacadeSubControl(QStyle::SubControl sc)
+{
+#define CONVERT_SUBCONTROL(F, Value) \
+ case QStyle::F: return QStyleFacade::F
+
+ switch (sc) {
+ FOR_EACH_SUBCONTROL(CONVERT_SUBCONTROL, SEMICOLON);
+ }
+ ASSERT_NOT_REACHED();
+ return QStyleFacade::SC_None;
+#undef CONVERT_SUBCONTROL
+}
+
+QStyleFacadeImp::QStyleFacadeImp(Page* page)
+ : m_page(page)
+ , m_style(0)
+{
+ m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
+ m_ownFallbackStyle = true;
+ if (!m_fallbackStyle) {
+ m_fallbackStyle = QApplication::style();
+ m_ownFallbackStyle = false;
+ }
+}
+
+QStyleFacadeImp::~QStyleFacadeImp()
+{
+ if (m_ownFallbackStyle)
+ delete m_fallbackStyle;
+}
+
+QRect QStyleFacadeImp::buttonSubElementRect(QStyleFacade::ButtonSubElement buttonElement, State state, const QRect& originalRect) const
+{
+ QStyleOptionButton option;
+ option.state = convertToQStyleState(state);
+ option.rect = originalRect;
+
+ QStyle::SubElement subElement = QStyle::SE_CustomBase;
+ switch (buttonElement) {
+ case PushButtonLayoutItem: subElement = QStyle::SE_PushButtonLayoutItem; break;
+ case PushButtonContents: subElement = QStyle::SE_PushButtonContents; break;
+ default: ASSERT_NOT_REACHED();
+ }
+ return style()->subElementRect(subElement, &option);
+}
+
+int QStyleFacadeImp::findFrameLineWidth() const
+{
+ if (!m_lineEdit)
+ m_lineEdit.reset(new QLineEdit());
+
+ return style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, m_lineEdit.data());
+}
+
+int QStyleFacadeImp::simplePixelMetric(QStyleFacade::PixelMetric metric, State state) const
+{
+ QStyleOption opt;
+ opt.state = convertToQStyleState(state);
+ return style()->pixelMetric(convertPixelMetric(metric), &opt, 0);
+}
+
+int QStyleFacadeImp::buttonMargin(State state, const QRect& originalRect) const
+{
+ QStyleOptionButton styleOption;
+ styleOption.state = convertToQStyleState(state);
+ styleOption.rect = originalRect;
+ return style()->pixelMetric(QStyle::PM_ButtonMargin, &styleOption, 0);
+}
+
+int QStyleFacadeImp::sliderLength(Qt::Orientation orientation) const
+{
+ QStyleOptionSlider opt;
+ opt.orientation = orientation;
+ return style()->pixelMetric(QStyle::PM_SliderLength, &opt);
+}
+
+int QStyleFacadeImp::sliderThickness(Qt::Orientation orientation) const
+{
+ QStyleOptionSlider opt;
+ opt.orientation = orientation;
+ return style()->pixelMetric(QStyle::PM_SliderThickness, &opt);
+}
+
+int QStyleFacadeImp::progressBarChunkWidth(const QSize& size) const
+{
+ QStyleOptionProgressBarV2 option;
+ option.rect.setSize(size);
+ // FIXME: Until http://bugreports.qt.nokia.com/browse/QTBUG-9171 is fixed,
+ // we simulate one square animating across the progress bar.
+ return style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &option);
+}
+
+void QStyleFacadeImp::getButtonMetrics(QString *buttonFontFamily, int *buttonFontPixelSize) const
+{
+ QPushButton button;
+ QFont defaultButtonFont = QApplication::font(&button);
+ *buttonFontFamily = defaultButtonFont.family();
+ *buttonFontPixelSize = 0;
+#ifdef Q_WS_MAC
+ button.setAttribute(Qt::WA_MacSmallSize);
+ QFontInfo fontInfo(defaultButtonFont);
+ *buttonFontPixelSize = fontInfo.pixelSize();
+#endif
+}
+
+QSize QStyleFacadeImp::comboBoxSizeFromContents(State state, const QSize& contentsSize) const
+{
+ QStyleOptionComboBox opt;
+ opt.state = convertToQStyleState(state);
+ return style()->sizeFromContents(QStyle::CT_ComboBox, &opt, contentsSize);
+}
+
+QSize QStyleFacadeImp::pushButtonSizeFromContents(State state, const QSize& contentsSize) const
+{
+ QStyleOptionButton opt;
+ opt.state = convertToQStyleState(state);
+ return style()->sizeFromContents(QStyle::CT_PushButton, &opt, contentsSize);
+}
+
+void QStyleFacadeImp::paintButton(QPainter* painter, QStyleFacade::ButtonType type, const QStyleFacadeOption &proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+ MappedStyleOption<QStyleOptionButton> option(widget, proxyOption);
+
+ if (type == PushButton)
+ style()->drawControl(QStyle::CE_PushButton, &option, painter, widget);
+ else if (type == RadioButton)
+ style()->drawControl(QStyle::CE_RadioButton, &option, painter, widget);
+ else if (type == CheckBox)
+ style()->drawControl(QStyle::CE_CheckBox, &option, painter, widget);
+}
+
+void QStyleFacadeImp::paintTextField(QPainter *painter, const QStyleFacadeOption &proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionFrameV2> panel(widget, proxyOption);
+
+ panel.lineWidth = findFrameLineWidth();
+ panel.features = QStyleOptionFrameV2::None;
+
+ style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, painter, widget);
+}
+
+void QStyleFacadeImp::paintComboBox(QPainter *painter, const QStyleFacadeOption &proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionComboBox> opt(widget, proxyOption);
+
+ IntRect rect = opt.rect;
+
+#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+ // QMacStyle makes the combo boxes a little bit smaller to leave space for the focus rect.
+ // Because of it, the combo button is drawn at a point to the left of where it was expect to be and may end up
+ // overlapped with the text. This will force QMacStyle to draw the combo box with the expected width.
+ if (qobject_cast<QMacStyle*>(m_style))
+ rect.inflateX(3);
+#endif
+
+ const QPoint topLeft = rect.location();
+ painter->translate(topLeft);
+ opt.rect.moveTo(QPoint(0, 0));
+ opt.rect.setSize(rect.size());
+
+ style()->drawComplexControl(QStyle::CC_ComboBox, &opt, painter, widget);
+ painter->translate(-topLeft);
+}
+
+void QStyleFacadeImp::paintComboBoxArrow(QPainter *painter, const QStyleFacadeOption &proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionComboBox> opt(widget, proxyOption);
+ opt.subControls = QStyle::SC_ComboBoxArrow;
+ // for drawing the combo box arrow, rely only on the fallback style
+ m_fallbackStyle->drawComplexControl(QStyle::CC_ComboBox, &opt, painter, widget);
+}
+
+void QStyleFacadeImp::paintSliderTrack(QPainter* painter, const QStyleFacadeOption& proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionSlider> option(widget, proxyOption);
+ option.subControls = QStyle::SC_SliderGroove;
+
+ option.upsideDown = proxyOption.slider.upsideDown;
+ option.minimum = proxyOption.slider.minimum;
+ option.maximum = proxyOption.slider.maximum;
+ option.sliderPosition = proxyOption.slider.position;
+ option.orientation = proxyOption.slider.orientation;
+
+ style()->drawComplexControl(QStyle::CC_Slider, &option, painter, widget);
+
+ if (option.state & QStyle::State_HasFocus) {
+ QStyleOptionFocusRect focusOption;
+ focusOption.rect = option.rect;
+ style()->drawPrimitive(QStyle::PE_FrameFocusRect, &focusOption, painter, widget);
+ }
+}
+
+void QStyleFacadeImp::paintSliderThumb(QPainter* painter, const QStyleFacadeOption& proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionSlider> option(widget, proxyOption);
+
+ option.subControls = QStyle::SC_SliderHandle;
+ if (option.state & QStyle::State_Sunken)
+ option.activeSubControls = QStyle::SC_SliderHandle;
+
+ style()->drawComplexControl(QStyle::CC_Slider, &option, painter, widget);
+}
+
+void QStyleFacadeImp::paintInnerSpinButton(QPainter* painter, const QStyleFacadeOption& proxyOption, bool spinBoxUp)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionSpinBox> option(widget, proxyOption);
+
+ option.subControls = QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
+ if (!(option.state & QStyle::State_ReadOnly)) {
+ if (option.state & QStyle::State_Enabled)
+ option.stepEnabled = QAbstractSpinBox::StepUpEnabled | QAbstractSpinBox::StepDownEnabled;
+ if (option.state & QStyle::State_Sunken) {
+ if (spinBoxUp)
+ option.activeSubControls = QStyle::SC_SpinBoxUp;
+ else
+ option.activeSubControls = QStyle::SC_SpinBoxDown;
+ }
+ }
+
+ IntRect buttonRect = option.rect;
+ // Default to moving the buttons a little bit within the editor frame.
+ int inflateX = -2;
+ int inflateY = -2;
+#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
+ // QMacStyle will position the aqua buttons flush to the right.
+ // This will move them more within the control for better style, a la
+ // Chromium look & feel.
+ if (qobject_cast<QMacStyle*>(m_style)) {
+ inflateX = -4;
+ // Render mini aqua spin buttons for QMacStyle to fit nicely into
+ // the editor area, like Chromium.
+ option.state |= QStyle::State_Mini;
+ }
+#endif
+#if !defined(QT_NO_STYLE_PLASTIQUE)
+ // QPlastiqueStyle looks best when the spin buttons are flush with the frame's edge.
+ if (qobject_cast<QPlastiqueStyle*>(style())) {
+ inflateX = 0;
+ inflateY = 0;
+ }
+#endif
+
+ buttonRect.inflateX(inflateX);
+ buttonRect.inflateY(inflateY);
+ option.rect = buttonRect;
+
+ style()->drawComplexControl(QStyle::CC_SpinBox, &option, painter, widget);
+}
+
+void QStyleFacadeImp::paintProgressBar(QPainter* painter, const QStyleFacadeOption& proxyOption, double progress, double animationProgress)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionProgressBarV2> option(widget, proxyOption);
+
+ option.maximum = std::numeric_limits<int>::max();
+ option.minimum = 0;
+ option.progress = progress * std::numeric_limits<int>::max();
+
+ const QPoint topLeft = option.rect.topLeft();
+ painter->translate(topLeft);
+ option.rect.moveTo(QPoint(0, 0));
+
+ if (progress < 0) {
+ // FIXME: Until http://bugreports.qt.nokia.com/browse/QTBUG-9171 is fixed,
+ // we simulate one square animating across the progress bar.
+ style()->drawControl(QStyle::CE_ProgressBarGroove, &option, painter, widget);
+ int chunkWidth = style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &option);
+ QColor color = (option.palette.highlight() == option.palette.background()) ? option.palette.color(QPalette::Active, QPalette::Highlight) : option.palette.color(QPalette::Highlight);
+ if (option.direction == Qt::RightToLeft)
+ painter->fillRect(option.rect.right() - chunkWidth - animationProgress * option.rect.width(), 0, chunkWidth, option.rect.height(), color);
+ else
+ painter->fillRect(animationProgress * option.rect.width(), 0, chunkWidth, option.rect.height(), color);
+ } else
+ style()->drawControl(QStyle::CE_ProgressBar, &option, painter, widget);
+
+ painter->translate(-topLeft);
+}
+
+int QStyleFacadeImp::scrollBarExtent(bool mini)
+{
+ QStyleOptionSlider o;
+ o.orientation = Qt::Vertical;
+ o.state &= ~QStyle::State_Horizontal;
+ if (mini)
+ o.state |= QStyle::State_Mini;
+ return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0);
+}
+
+bool QStyleFacadeImp::scrollBarMiddleClickAbsolutePositionStyleHint() const
+{
+ return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition);
+}
+
+void QStyleFacadeImp::paintScrollCorner(QPainter* painter, const QRect& rect)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ QStyleOption option;
+ option.rect = rect;
+ style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, painter, widget);
+}
+
+QStyleFacade::SubControl QStyleFacadeImp::hitTestScrollBar(const QStyleFacadeOption &proxyOption, const QPoint &pos)
+{
+ MappedStyleOption<QStyleOptionSlider> opt(0, proxyOption);
+ QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, pos, 0);
+ return convertToQStyleFacadeSubControl(sc);
+}
+
+QRect QStyleFacadeImp::scrollBarSubControlRect(const QStyleFacadeOption &proxyOption, QStyleFacade::SubControl subControl)
+{
+ MappedStyleOption<QStyleOptionSlider> opt(0, proxyOption);
+ return style()->subControlRect(QStyle::CC_ScrollBar, &opt, convertToQStyleSubControl(subControl), 0);
+}
+
+void QStyleFacadeImp::paintScrollBar(QPainter *painter, const QStyleFacadeOption &proxyOption)
+{
+ QWidget* widget = qobject_cast<QWidget*>(widgetForPainter(painter));
+
+ MappedStyleOption<QStyleOptionSlider> opt(widget, proxyOption);
+
+#ifdef Q_WS_MAC
+ // FIXME: We also need to check the widget style but today ScrollbarTheme is not aware of the page so we
+ // can't get the widget.
+ if (qobject_cast<QMacStyle*>(m_style))
+ m_style->drawComplexControl(QStyle::CC_ScrollBar, &opt, painter, widget);
+ else
+#endif
+ {
+ // The QStyle expects the background to be already filled.
+ painter->fillRect(opt.rect, opt.palette.background());
+
+ const QPoint topLeft = opt.rect.topLeft();
+ painter->translate(topLeft);
+ opt.rect.moveTo(QPoint(0, 0));
+ style()->drawComplexControl(QStyle::CC_ScrollBar, &opt, painter, widget);
+ opt.rect.moveTo(topLeft);
+ }
+}
+
+QObject* QStyleFacadeImp::widgetForPainter(QPainter* painter)
+{
+ QPaintDevice* dev = 0;
+ if (painter)
+ dev = painter->device();
+ if (dev && dev->devType() == QInternal::Widget)
+ return static_cast<QWidget*>(dev);
+ return 0;
+}
+
+QStyle* QStyleFacadeImp::style() const
+{
+ if (m_style)
+ return m_style;
+
+ m_style = QStyleFacade::styleForPage(m_page);
+
+ if (!m_style)
+ m_style = QApplication::style();
+
+ return m_style;
+}
+
+}
diff --git a/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h b/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h
new file mode 100644
index 000000000..bf95d310e
--- /dev/null
+++ b/Source/WebKit/qt/WebCoreSupport/QStyleFacadeImp.h
@@ -0,0 +1,98 @@
+/*
+ * This file is part of the theme implementation for form controls in WebCore.
+ *
+ * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ * Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef QStyleFacadeImp_h
+#define QStyleFacadeImp_h
+
+#include <QStyleFacade.h>
+
+QT_BEGIN_NAMESPACE
+class QStyle;
+class QLineEdit;
+class QStyleOption;
+class QStyleOptionSlider;
+class QPainter;
+class QObject;
+QT_END_NAMESPACE
+
+namespace WebCore {
+class Page;
+}
+
+namespace WebKit {
+
+class QStyleFacadeImp : public WebCore::QStyleFacade {
+public:
+ QStyleFacadeImp(WebCore::Page* = 0);
+ virtual ~QStyleFacadeImp();
+
+ static WebCore::QStyleFacade* create(WebCore::Page* page)
+ { return new QStyleFacadeImp(page); }
+
+ virtual QRect buttonSubElementRect(ButtonSubElement, State, const QRect& originalRect) const;
+
+ virtual int findFrameLineWidth() const;
+ virtual int simplePixelMetric(PixelMetric, State = State_None) const;
+ virtual int buttonMargin(State, const QRect& originalRect) const;
+ virtual int sliderLength(Qt::Orientation) const;
+ virtual int sliderThickness(Qt::Orientation) const;
+ virtual int progressBarChunkWidth(const QSize&) const;
+ virtual void getButtonMetrics(QString* buttonFontFamily, int* buttonFontPixelSize) const;
+
+ virtual QSize comboBoxSizeFromContents(State, const QSize& contentsSize) const;
+ virtual QSize pushButtonSizeFromContents(State, const QSize& contentsSize) const;
+
+ virtual void paintButton(QPainter*, ButtonType, const WebCore::QStyleFacadeOption &proxyOption);
+ virtual void paintTextField(QPainter*, const WebCore::QStyleFacadeOption&);
+ virtual void paintComboBox(QPainter*, const WebCore::QStyleFacadeOption&);
+ virtual void paintComboBoxArrow(QPainter*, const WebCore::QStyleFacadeOption&);
+
+ virtual void paintSliderTrack(QPainter*, const WebCore::QStyleFacadeOption&);
+ virtual void paintSliderThumb(QPainter*, const WebCore::QStyleFacadeOption&);
+ virtual void paintInnerSpinButton(QPainter*, const WebCore::QStyleFacadeOption&, bool spinBoxUp);
+ virtual void paintProgressBar(QPainter*, const WebCore::QStyleFacadeOption&, double progress, double animationProgress);
+
+ virtual int scrollBarExtent(bool mini);
+ virtual bool scrollBarMiddleClickAbsolutePositionStyleHint() const;
+ virtual void paintScrollCorner(QPainter*, const QRect&);
+
+ virtual SubControl hitTestScrollBar(const WebCore::QStyleFacadeOption&, const QPoint& pos);
+ virtual QRect scrollBarSubControlRect(const WebCore::QStyleFacadeOption&, SubControl);
+ virtual void paintScrollBar(QPainter*, const WebCore::QStyleFacadeOption&);
+
+ virtual QObject* widgetForPainter(QPainter*);
+
+ virtual bool isValid() const { return style(); }
+
+private:
+ QStyle* style() const;
+
+ WebCore::Page* m_page;
+ mutable QStyle* m_style;
+ QStyle* m_fallbackStyle;
+ bool m_ownFallbackStyle;
+ mutable QScopedPointer<QLineEdit> m_lineEdit;
+};
+
+}
+
+#endif // QStyleFacadeImp_h
diff --git a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp
deleted file mode 100644
index 8bc0df497..000000000
--- a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
- * This file is part of the WebKit project.
- *
- * Copyright (C) 2008-2012 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * 2006 Dirk Mueller <mueller@kde.org>
- * 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2008 Holger Hans Peter Freyther
- *
- * All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "RenderThemeQStyle.h"
-
-#include "CSSFontSelector.h"
-#include "CSSValueKeywords.h"
-#include "Chrome.h"
-#include "ChromeClient.h"
-#include "Color.h"
-#include "Document.h"
-#include "Font.h"
-#include "FontSelector.h"
-#include "GraphicsContext.h"
-#include "HTMLInputElement.h"
-#include "HTMLNames.h"
-#include "LocalizedStrings.h"
-#include "NotImplemented.h"
-#include "Page.h"
-#include "PaintInfo.h"
-#include "QWebPageClient.h"
-#include "RenderBox.h"
-#if ENABLE(PROGRESS_ELEMENT)
-#include "RenderProgress.h"
-#endif
-#include "RenderSlider.h"
-#include "ScrollbarThemeQStyle.h"
-#include "SliderThumbElement.h"
-#include "StyleResolver.h"
-#include "UserAgentStyleSheets.h"
-
-#include <QApplication>
-#include <QColor>
-#include <QFile>
-#include <QFontMetrics>
-#include <QLineEdit>
-#include <QMacStyle>
-#include <QPainter>
-#ifndef QT_NO_STYLE_PLASTIQUE
-#include <QPlastiqueStyle>
-#endif
-#include <QPushButton>
-#include <QStyleFactory>
-#include <QStyleOptionButton>
-#include <QStyleOptionFrameV2>
-#if ENABLE(PROGRESS_ELEMENT)
-#include <QStyleOptionProgressBarV2>
-#endif
-#include <QStyleOptionSlider>
-#include <QWidget>
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-inline static void initStyleOption(QWidget* widget, QStyleOption& option)
-{
- if (widget)
- option.initFrom(widget);
- else {
- // If a widget is not directly available for rendering, we fallback to default
- // value for an active widget.
- option.state = QStyle::State_Active | QStyle::State_Enabled;
- }
-}
-
-
-QSharedPointer<StylePainter> RenderThemeQStyle::getStylePainter(const PaintInfo& paintInfo)
-{
- return QSharedPointer<StylePainter>(new StylePainterQStyle(this, paintInfo));
-}
-
-StylePainterQStyle::StylePainterQStyle(RenderThemeQStyle* theme, const PaintInfo& paintInfo)
- : StylePainter(theme, paintInfo)
-{
- init(paintInfo.context ? paintInfo.context : 0, theme->qStyle());
-}
-
-StylePainterQStyle::StylePainterQStyle(ScrollbarThemeQStyle* theme, GraphicsContext* context)
- : StylePainter()
-{
- init(context, theme->style());
-}
-
-void StylePainterQStyle::init(GraphicsContext* context, QStyle* themeStyle)
-{
- painter = static_cast<QPainter*>(context->platformContext());
- widget = 0;
- QPaintDevice* dev = 0;
- if (painter)
- dev = painter->device();
- if (dev && dev->devType() == QInternal::Widget)
- widget = static_cast<QWidget*>(dev);
- style = themeStyle;
-
- StylePainter::init(context);
-}
-
-PassRefPtr<RenderTheme> RenderThemeQStyle::create(Page* page)
-{
- return adoptRef(new RenderThemeQStyle(page));
-}
-
-RenderThemeQStyle::RenderThemeQStyle(Page* page)
- : RenderThemeQt(page)
-#ifndef QT_NO_LINEEDIT
- , m_lineEdit(0)
-#endif
-{
- QPushButton button;
- QFont defaultButtonFont = QApplication::font(&button);
- m_buttonFontFamily = defaultButtonFont.family();
-#ifdef Q_WS_MAC
- button.setAttribute(Qt::WA_MacSmallSize);
- QFontInfo fontInfo(defaultButtonFont);
- m_buttonFontPixelSize = fontInfo.pixelSize();
-#endif
-
- m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
-}
-
-RenderThemeQStyle::~RenderThemeQStyle()
-{
- delete m_fallbackStyle;
-#ifndef QT_NO_LINEEDIT
- delete m_lineEdit;
-#endif
-}
-
-
-// for some widget painting, we need to fallback to Windows style
-QStyle* RenderThemeQStyle::fallbackStyle() const
-{
- return (m_fallbackStyle) ? m_fallbackStyle : QApplication::style();
-}
-
-void RenderThemeQStyle::setPaletteFromPageClientIfExists(QPalette& palette) const
-{
- if (!m_page)
- return;
-
- ASSERT(m_page->chrome());
- ChromeClient* chromeClient = m_page->chrome()->client();
- if (!chromeClient)
- return;
-
- if (QWebPageClient* pageClient = chromeClient->platformPageClient())
- palette = pageClient->palette();
-}
-
-QStyle* RenderThemeQStyle::qStyle() const
-{
- if (m_page) {
- QWebPageClient* pageClient = m_page->chrome()->client()->platformPageClient();
-
- if (pageClient)
- return pageClient->style();
- }
-
- return QApplication::style();
-}
-
-int RenderThemeQStyle::findFrameLineWidth(QStyle* style) const
-{
-#ifndef QT_NO_LINEEDIT
- if (!m_lineEdit)
- m_lineEdit = new QLineEdit();
-#endif
-
- QStyleOptionFrameV2 opt;
- QWidget* widget = 0;
-#ifndef QT_NO_LINEEDIT
- widget = m_lineEdit;
-#endif
- return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, widget);
-}
-
-QRect RenderThemeQStyle::inflateButtonRect(const QRect& originalRect) const
-{
- QStyleOptionButton option;
- option.state |= QStyle::State_Small;
- option.rect = originalRect;
-
- QRect layoutRect = qStyle()->subElementRect(QStyle::SE_PushButtonLayoutItem, &option, 0);
- if (!layoutRect.isNull()) {
- int paddingLeft = layoutRect.left() - originalRect.left();
- int paddingRight = originalRect.right() - layoutRect.right();
- int paddingTop = layoutRect.top() - originalRect.top();
- int paddingBottom = originalRect.bottom() - layoutRect.bottom();
-
- return originalRect.adjusted(-paddingLeft, -paddingTop, paddingRight, paddingBottom);
- }
- return originalRect;
-}
-
-void RenderThemeQStyle::computeSizeBasedOnStyle(RenderStyle* renderStyle) const
-{
- QSize size(0, 0);
- const QFontMetrics fm(renderStyle->font().syntheticFont());
- QStyle* style = qStyle();
-
- switch (renderStyle->appearance()) {
- case TextAreaPart:
- case SearchFieldPart:
- case TextFieldPart: {
- int padding = findFrameLineWidth(style);
- renderStyle->setPaddingLeft(Length(padding, Fixed));
- renderStyle->setPaddingRight(Length(padding, Fixed));
- renderStyle->setPaddingTop(Length(padding, Fixed));
- renderStyle->setPaddingBottom(Length(padding, Fixed));
- break;
- }
- default:
- break;
- }
- // If the width and height are both specified, then we have nothing to do.
- if (!renderStyle->width().isIntrinsicOrAuto() && !renderStyle->height().isAuto())
- return;
-
- switch (renderStyle->appearance()) {
- case CheckboxPart: {
- QStyleOption styleOption;
- styleOption.state |= QStyle::State_Small;
- int checkBoxWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &styleOption);
- checkBoxWidth *= renderStyle->effectiveZoom();
- size = QSize(checkBoxWidth, checkBoxWidth);
- break;
- }
- case RadioPart: {
- QStyleOption styleOption;
- styleOption.state |= QStyle::State_Small;
- int radioWidth = style->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, &styleOption);
- radioWidth *= renderStyle->effectiveZoom();
- size = QSize(radioWidth, radioWidth);
- break;
- }
- case PushButtonPart:
- case ButtonPart: {
- QStyleOptionButton styleOption;
- styleOption.state |= QStyle::State_Small;
- QSize contentSize = fm.size(Qt::TextShowMnemonic, QString::fromLatin1("X"));
- QSize pushButtonSize = style->sizeFromContents(QStyle::CT_PushButton,
- &styleOption, contentSize, 0);
- styleOption.rect = QRect(0, 0, pushButtonSize.width(), pushButtonSize.height());
- QRect layoutRect = style->subElementRect(QStyle::SE_PushButtonLayoutItem,
- &styleOption, 0);
-
- // If the style supports layout rects we use that, and compensate accordingly
- // in paintButton() below.
- if (!layoutRect.isNull())
- size.setHeight(layoutRect.height());
- else
- size.setHeight(pushButtonSize.height());
-
- break;
- }
- case MenulistPart: {
- QStyleOptionComboBox styleOption;
- styleOption.state |= QStyle::State_Small;
- int contentHeight = qMax(fm.lineSpacing(), 14) + 2;
- QSize menuListSize = style->sizeFromContents(QStyle::CT_ComboBox,
- &styleOption, QSize(0, contentHeight), 0);
- size.setHeight(menuListSize.height());
- break;
- }
- default:
- break;
- }
-
- // FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
- if (renderStyle->width().isIntrinsicOrAuto() && size.width() > 0)
- renderStyle->setMinWidth(Length(size.width(), Fixed));
- if (renderStyle->height().isAuto() && size.height() > 0)
- renderStyle->setMinHeight(Length(size.height(), Fixed));
-}
-
-
-
-void RenderThemeQStyle::adjustButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element*) const
-{
- // Ditch the border.
- style->resetBorder();
-
-#ifdef Q_WS_MAC
- if (style->appearance() == PushButtonPart) {
- // The Mac ports ignore the specified height for <input type="button"> elements
- // unless a border and/or background CSS property is also specified.
- style->setHeight(Length(Auto));
- }
-#endif
-
- FontDescription fontDescription = style->fontDescription();
- fontDescription.setIsAbsoluteSize(true);
-
-#ifdef Q_WS_MAC // Use fixed font size and family on Mac (like Safari does)
- fontDescription.setSpecifiedSize(m_buttonFontPixelSize);
- fontDescription.setComputedSize(m_buttonFontPixelSize);
-#else
- fontDescription.setSpecifiedSize(style->fontSize());
- fontDescription.setComputedSize(style->fontSize());
-#endif
-
- FontFamily fontFamily;
- fontFamily.setFamily(m_buttonFontFamily);
- fontDescription.setFamily(fontFamily);
- style->setFontDescription(fontDescription);
- style->font().update(styleResolver->fontSelector());
- style->setLineHeight(RenderStyle::initialLineHeight());
- setButtonSize(style);
- setButtonPadding(style);
-}
-
-void RenderThemeQStyle::setButtonPadding(RenderStyle* style) const
-{
- QStyleOptionButton styleOption;
- styleOption.state |= QStyle::State_Small;
-
- // Fake a button rect here, since we're just computing deltas
- QRect originalRect = QRect(0, 0, 100, 30);
- styleOption.rect = originalRect;
-
- // Default padding is based on the button margin pixel metric
- int buttonMargin = qStyle()->pixelMetric(QStyle::PM_ButtonMargin, &styleOption, 0);
- int paddingLeft = buttonMargin;
- int paddingRight = buttonMargin;
- int paddingTop = buttonMargin;
- int paddingBottom = buttonMargin;
-
- // Then check if the style uses layout margins
- QRect layoutRect = qStyle()->subElementRect(QStyle::SE_PushButtonLayoutItem,
- &styleOption, 0);
- if (!layoutRect.isNull()) {
- QRect contentsRect = qStyle()->subElementRect(QStyle::SE_PushButtonContents,
- &styleOption, 0);
- paddingLeft = contentsRect.left() - layoutRect.left();
- paddingRight = layoutRect.right() - contentsRect.right();
- paddingTop = contentsRect.top() - layoutRect.top();
-
- // Can't use this right now because we don't have the baseline to compensate
- // paddingBottom = layoutRect.bottom() - contentsRect.bottom();
- }
- style->setPaddingLeft(Length(paddingLeft, Fixed));
- style->setPaddingRight(Length(paddingRight, Fixed));
- style->setPaddingTop(Length(paddingTop, Fixed));
- style->setPaddingBottom(Length(paddingBottom, Fixed));
-}
-
-bool RenderThemeQStyle::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- StylePainterQStyle p(this, i);
- if (!p.isValid())
- return true;
-
- QStyleOptionButton option;
- initStyleOption(p.widget, option);
- option.rect = r;
- option.state |= QStyle::State_Small;
-
- ControlPart appearance = initializeCommonQStyleOptions(option, o);
- if (appearance == PushButtonPart || appearance == ButtonPart) {
- option.rect = inflateButtonRect(option.rect);
- p.drawControl(QStyle::CE_PushButton, option);
- } else if (appearance == RadioPart)
- p.drawControl(QStyle::CE_RadioButton, option);
- else if (appearance == CheckboxPart)
- p.drawControl(QStyle::CE_CheckBox, option);
-
- return false;
-}
-
-bool RenderThemeQStyle::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- StylePainterQStyle p(this, i);
- if (!p.isValid())
- return true;
-
- QStyleOptionFrameV2 panel;
- initStyleOption(p.widget, panel);
- panel.rect = r;
- panel.lineWidth = findFrameLineWidth(qStyle());
- panel.state |= QStyle::State_Sunken;
- panel.features = QStyleOptionFrameV2::None;
-
- // Get the correct theme data for a text field
- ControlPart appearance = initializeCommonQStyleOptions(panel, o);
- if (appearance != TextFieldPart
- && appearance != SearchFieldPart
- && appearance != TextAreaPart
- && appearance != ListboxPart)
- return true;
-
- // Now paint the text field.
- p.drawPrimitive(QStyle::PE_PanelLineEdit, panel);
- return false;
-}
-
-void RenderThemeQStyle::adjustTextAreaStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
-{
- adjustTextFieldStyle(styleResolver, style, element);
-}
-
-bool RenderThemeQStyle::paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- return paintTextField(o, i, r);
-}
-
-void RenderThemeQStyle::setPopupPadding(RenderStyle* style) const
-{
- const int paddingLeft = 4;
- const int paddingRight = style->width().isFixed() || style->width().isPercent() ? 5 : 8;
-
- style->setPaddingLeft(Length(paddingLeft, Fixed));
-
- QStyleOptionComboBox opt;
- int w = qStyle()->pixelMetric(QStyle::PM_ButtonIconSize, &opt, 0);
- style->setPaddingRight(Length(paddingRight + w, Fixed));
-
- style->setPaddingTop(Length(2, Fixed));
- style->setPaddingBottom(Length(2, Fixed));
-}
-
-QPalette RenderThemeQStyle::colorPalette() const
-{
- QPalette palette = RenderThemeQt::colorPalette();
- setPaletteFromPageClientIfExists(palette);
- return palette;
-}
-
-bool RenderThemeQStyle::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& r)
-{
- StylePainterQStyle p(this, i);
- if (!p.isValid())
- return true;
-
- QStyleOptionComboBox opt;
- initStyleOption(p.widget, opt);
- initializeCommonQStyleOptions(opt, o);
-
- IntRect rect = r;
-
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- // QMacStyle makes the combo boxes a little bit smaller to leave space for the focus rect.
- // Because of it, the combo button is drawn at a point to the left of where it was expect to be and may end up
- // overlapped with the text. This will force QMacStyle to draw the combo box with the expected width.
- if (qobject_cast<QMacStyle*>(p.style))
- rect.inflateX(3);
-#endif
-
- const QPoint topLeft = rect.location();
- p.painter->translate(topLeft);
- opt.rect.moveTo(QPoint(0, 0));
- opt.rect.setSize(rect.size());
-
- p.drawComplexControl(QStyle::CC_ComboBox, opt);
- p.painter->translate(-topLeft);
- return false;
-}
-
-void RenderThemeQStyle::adjustMenuListButtonStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e) const
-{
- // WORKAROUND because html.css specifies -webkit-border-radius for <select> so we override it here
- // see also http://bugs.webkit.org/show_bug.cgi?id=18399
- style->resetBorderRadius();
-
- RenderThemeQt::adjustMenuListButtonStyle(styleResolver, style, e);
-}
-
-bool RenderThemeQStyle::paintMenuListButton(RenderObject* o, const PaintInfo& i,
- const IntRect& r)
-{
- StylePainterQStyle p(this, i);
- if (!p.isValid())
- return true;
-
- QStyleOptionComboBox option;
- initStyleOption(p.widget, option);
- initializeCommonQStyleOptions(option, o);
- option.rect = r;
-
- // for drawing the combo box arrow, rely only on the fallback style
- p.style = fallbackStyle();
- option.subControls = QStyle::SC_ComboBoxArrow;
- p.drawComplexControl(QStyle::CC_ComboBox, option);
-
- return false;
-}
-
-#if ENABLE(PROGRESS_ELEMENT)
-double RenderThemeQStyle::animationDurationForProgressBar(RenderProgress* renderProgress) const
-{
- if (renderProgress->position() >= 0)
- return 0;
-
- QStyleOptionProgressBarV2 option;
- option.rect.setSize(renderProgress->pixelSnappedSize());
- // FIXME: Until http://bugreports.qt.nokia.com/browse/QTBUG-9171 is fixed,
- // we simulate one square animating across the progress bar.
- return (option.rect.width() / qStyle()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &option)) * animationRepeatIntervalForProgressBar(renderProgress);
-}
-
-bool RenderThemeQStyle::paintProgressBar(RenderObject* o, const PaintInfo& pi, const IntRect& r)
-{
- if (!o->isProgress())
- return true;
-
- StylePainterQStyle p(this, pi);
- if (!p.isValid())
- return true;
-
- QStyleOptionProgressBarV2 option;
- initStyleOption(p.widget, option);
- initializeCommonQStyleOptions(option, o);
-
- RenderProgress* renderProgress = toRenderProgress(o);
- option.rect = r;
- option.maximum = std::numeric_limits<int>::max();
- option.minimum = 0;
- option.progress = (renderProgress->position() * std::numeric_limits<int>::max());
-
- const QPoint topLeft = r.location();
- p.painter->translate(topLeft);
- option.rect.moveTo(QPoint(0, 0));
- option.rect.setSize(r.size());
-
- if (option.progress < 0) {
- // FIXME: Until http://bugreports.qt.nokia.com/browse/QTBUG-9171 is fixed,
- // we simulate one square animating across the progress bar.
- p.drawControl(QStyle::CE_ProgressBarGroove, option);
- int chunkWidth = qStyle()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &option);
- QColor color = (option.palette.highlight() == option.palette.background()) ? option.palette.color(QPalette::Active, QPalette::Highlight) : option.palette.color(QPalette::Highlight);
- if (renderProgress->style()->direction() == RTL)
- p.painter->fillRect(option.rect.right() - chunkWidth - renderProgress->animationProgress() * option.rect.width(), 0, chunkWidth, option.rect.height(), color);
- else
- p.painter->fillRect(renderProgress->animationProgress() * option.rect.width(), 0, chunkWidth, option.rect.height(), color);
- } else
- p.drawControl(QStyle::CE_ProgressBar, option);
-
- p.painter->translate(-topLeft);
-
- return false;
-}
-#endif
-
-bool RenderThemeQStyle::paintSliderTrack(RenderObject* o, const PaintInfo& pi,
- const IntRect& r)
-{
- StylePainterQStyle p(this, pi);
- if (!p.isValid())
- return true;
-
- const QPoint topLeft = r.location();
- p.painter->translate(topLeft);
-
- QStyleOptionSlider option;
- initStyleOption(p.widget, option);
- option.subControls = QStyle::SC_SliderGroove;
- ControlPart appearance = initializeCommonQStyleOptions(option, o);
- option.rect = r;
- option.rect.moveTo(QPoint(0, 0));
- if (appearance == SliderVerticalPart)
- option.orientation = Qt::Vertical;
- if (isPressed(o))
- option.state |= QStyle::State_Sunken;
-
- // some styles need this to show a highlight on one side of the groove
- HTMLInputElement* slider = o->node()->toInputElement();
- if (slider) {
- option.upsideDown = (appearance == SliderHorizontalPart) && !o->style()->isLeftToRightDirection();
- // Use the width as a multiplier in case the slider values are <= 1
- const int width = r.width() > 0 ? r.width() : 100;
- option.maximum = slider->maximum() * width;
- option.minimum = slider->minimum() * width;
- if (!option.upsideDown)
- option.sliderPosition = slider->valueAsNumber() * width;
- else
- option.sliderPosition = option.minimum + option.maximum - slider->valueAsNumber() * width;
- }
-
- p.drawComplexControl(QStyle::CC_Slider, option);
-
- if (option.state & QStyle::State_HasFocus) {
- QStyleOptionFocusRect focusOption;
- focusOption.rect = r;
- p.drawPrimitive(QStyle::PE_FrameFocusRect, focusOption);
- }
- p.painter->translate(-topLeft);
- return false;
-}
-
-void RenderThemeQStyle::adjustSliderTrackStyle(StyleResolver*, RenderStyle* style, Element*) const
-{
- style->setBoxShadow(nullptr);
-}
-
-bool RenderThemeQStyle::paintSliderThumb(RenderObject* o, const PaintInfo& pi,
- const IntRect& r)
-{
- StylePainterQStyle p(this, pi);
- if (!p.isValid())
- return true;
-
- const QPoint topLeft = r.location();
- p.painter->translate(topLeft);
-
- QStyleOptionSlider option;
- initStyleOption(p.widget, option);
- option.subControls = QStyle::SC_SliderHandle;
- ControlPart appearance = initializeCommonQStyleOptions(option, o);
- option.rect = r;
- option.rect.moveTo(QPoint(0, 0));
- if (appearance == SliderThumbVerticalPart)
- option.orientation = Qt::Vertical;
- if (isPressed(o)) {
- option.activeSubControls = QStyle::SC_SliderHandle;
- option.state |= QStyle::State_Sunken;
- }
-
- p.drawComplexControl(QStyle::CC_Slider, option);
- p.painter->translate(-topLeft);
- return false;
-}
-
-void RenderThemeQStyle::adjustSliderThumbStyle(StyleResolver* styleResolver, RenderStyle* style, Element* element) const
-{
- RenderTheme::adjustSliderThumbStyle(styleResolver, style, element);
- style->setBoxShadow(nullptr);
-}
-
-bool RenderThemeQStyle::paintSearchField(RenderObject* o, const PaintInfo& pi,
- const IntRect& r)
-{
- return paintTextField(o, pi, r);
-}
-
-void RenderThemeQStyle::adjustSearchFieldDecorationStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e) const
-{
- notImplemented();
- RenderTheme::adjustSearchFieldDecorationStyle(styleResolver, style, e);
-}
-
-bool RenderThemeQStyle::paintSearchFieldDecoration(RenderObject* o, const PaintInfo& pi,
- const IntRect& r)
-{
- notImplemented();
- return RenderTheme::paintSearchFieldDecoration(o, pi, r);
-}
-
-void RenderThemeQStyle::adjustSearchFieldResultsDecorationStyle(StyleResolver* styleResolver, RenderStyle* style, Element* e) const
-{
- notImplemented();
- RenderTheme::adjustSearchFieldResultsDecorationStyle(styleResolver, style, e);
-}
-
-bool RenderThemeQStyle::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& pi,
- const IntRect& r)
-{
- notImplemented();
- return RenderTheme::paintSearchFieldResultsDecoration(o, pi, r);
-}
-
-#ifndef QT_NO_SPINBOX
-
-bool RenderThemeQStyle::paintInnerSpinButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& rect)
-{
- StylePainterQStyle p(this, paintInfo);
- if (!p.isValid())
- return true;
-
- QStyleOptionSpinBox option;
- initStyleOption(p.widget, option);
- option.subControls = QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
- if (!isReadOnlyControl(o)) {
- if (isEnabled(o))
- option.stepEnabled = QAbstractSpinBox::StepUpEnabled | QAbstractSpinBox::StepDownEnabled;
- if (isPressed(o)) {
- option.state |= QStyle::State_Sunken;
- if (isSpinUpButtonPartPressed(o))
- option.activeSubControls = QStyle::SC_SpinBoxUp;
- else
- option.activeSubControls = QStyle::SC_SpinBoxDown;
- }
- }
- // Render the spin buttons for LTR or RTL accordingly.
- option.direction = o->style()->isLeftToRightDirection() ? Qt::LeftToRight : Qt::RightToLeft;
-
- IntRect buttonRect = rect;
- // Default to moving the buttons a little bit within the editor frame.
- int inflateX = -2;
- int inflateY = -2;
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- // QMacStyle will position the aqua buttons flush to the right.
- // This will move them more within the control for better style, a la
- // Chromium look & feel.
- if (qobject_cast<QMacStyle*>(p.style)) {
- inflateX = -4;
- // Render mini aqua spin buttons for QMacStyle to fit nicely into
- // the editor area, like Chromium.
- option.state |= QStyle::State_Mini;
- }
-#endif
-#if !defined(QT_NO_STYLE_PLASTIQUE)
- // QPlastiqueStyle looks best when the spin buttons are flush with the frame's edge.
- if (qobject_cast<QPlastiqueStyle*>(p.style)) {
- inflateX = 0;
- inflateY = 0;
- }
-#endif
-
- buttonRect.inflateX(inflateX);
- buttonRect.inflateY(inflateY);
- option.rect = buttonRect;
-
- p.drawComplexControl(QStyle::CC_SpinBox, option);
- return false;
-}
-#endif
-
-ControlPart RenderThemeQStyle::initializeCommonQStyleOptions(QStyleOption& option, RenderObject* o) const
-{
- // Default bits: no focus, no mouse over
- option.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver);
-
- if (isReadOnlyControl(o))
- // Readonly is supported on textfields.
- option.state |= QStyle::State_ReadOnly;
-
- option.direction = Qt::LeftToRight;
-
- if (isHovered(o))
- option.state |= QStyle::State_MouseOver;
-
- setPaletteFromPageClientIfExists(option.palette);
-
- if (!isEnabled(o)) {
- option.palette.setCurrentColorGroup(QPalette::Disabled);
- option.state &= ~QStyle::State_Enabled;
- }
-
- RenderStyle* style = o->style();
- if (!style)
- return NoControlPart;
-
- ControlPart result = style->appearance();
- if (supportsFocus(result) && isFocused(o)) {
- option.state |= QStyle::State_HasFocus;
- option.state |= QStyle::State_KeyboardFocusChange;
- }
-
- if (style->direction() == WebCore::RTL)
- option.direction = Qt::RightToLeft;
-
- 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 || result == ButtonPart)
- option.state |= QStyle::State_Raised;
- break;
- }
- case RadioPart:
- case CheckboxPart:
- option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off);
- }
-
- return result;
-}
-
-void RenderThemeQStyle::adjustSliderThumbSize(RenderStyle* style, Element* element) const
-{
- const ControlPart part = style->appearance();
- if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart) {
- QStyleOptionSlider option;
- if (part == SliderThumbVerticalPart)
- option.orientation = Qt::Vertical;
-
- QStyle* qstyle = qStyle();
-
- int length = qstyle->pixelMetric(QStyle::PM_SliderLength, &option);
- int thickness = qstyle->pixelMetric(QStyle::PM_SliderThickness, &option);
- if (option.orientation == Qt::Vertical) {
- style->setWidth(Length(thickness, Fixed));
- style->setHeight(Length(length, Fixed));
- } else {
- style->setWidth(Length(length, Fixed));
- style->setHeight(Length(thickness, Fixed));
- }
- } else
- RenderThemeQt::adjustSliderThumbSize(style, element);
-}
-
-}
-
-// vim: ts=4 sw=4 et
diff --git a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h
deleted file mode 100644
index 2cc999308..000000000
--- a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * This file is part of the theme implementation for form controls in WebCore.
- *
- * Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies).
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-#ifndef RenderThemeQStyle_h
-#define RenderThemeQStyle_h
-
-#include "RenderThemeQt.h"
-
-#include <QStyle>
-
-QT_BEGIN_NAMESPACE
-#ifndef QT_NO_LINEEDIT
-class QLineEdit;
-#endif
-class QPainter;
-class QWidget;
-QT_END_NAMESPACE
-
-namespace WebCore {
-
-class ScrollbarThemeQStyle;
-
-class RenderThemeQStyle : public RenderThemeQt {
-private:
- RenderThemeQStyle(Page*);
- virtual ~RenderThemeQStyle();
-
-public:
- static PassRefPtr<RenderTheme> create(Page*);
-
- virtual void adjustSliderThumbSize(RenderStyle*, Element*) const;
-
- QStyle* qStyle() const;
-
-protected:
- virtual void adjustButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void adjustTextAreaStyle(StyleResolver*, RenderStyle*, Element*) const;
-
- virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void adjustMenuListButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
-
-#if ENABLE(PROGRESS_ELEMENT)
- // Returns the duration of the animation for the progress bar.
- virtual double animationDurationForProgressBar(RenderProgress*) const;
- virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
-#endif
-
- virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void adjustSliderTrackStyle(StyleResolver*, RenderStyle*, Element*) const;
-
- virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
- virtual void adjustSliderThumbStyle(StyleResolver*, RenderStyle*, Element*) const;
-
- virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustSearchFieldDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&);
-
- virtual void adjustSearchFieldResultsDecorationStyle(StyleResolver*, RenderStyle*, Element*) const;
- virtual bool paintSearchFieldResultsDecoration(RenderObject*, const PaintInfo&, const IntRect&);
-
-#ifndef QT_NO_SPINBOX
- virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
-#endif
-
-protected:
- virtual void computeSizeBasedOnStyle(RenderStyle*) const;
-
- virtual QSharedPointer<StylePainter> getStylePainter(const PaintInfo&);
-
- virtual QRect inflateButtonRect(const QRect& originalRect) const;
-
- virtual void setPopupPadding(RenderStyle*) const;
-
- virtual QPalette colorPalette() const;
-
-private:
- ControlPart initializeCommonQStyleOptions(QStyleOption&, RenderObject*) const;
-
- void setButtonPadding(RenderStyle*) const;
-
- int findFrameLineWidth(QStyle*) const;
-
- QStyle* fallbackStyle() const;
-
- void setPaletteFromPageClientIfExists(QPalette&) const;
-
-#ifdef Q_OS_MAC
- int m_buttonFontPixelSize;
-#endif
-
- QStyle* m_fallbackStyle;
-#ifndef QT_NO_LINEEDIT
- mutable QLineEdit* m_lineEdit;
-#endif
-};
-
-class StylePainterQStyle : public StylePainter {
-public:
- explicit StylePainterQStyle(RenderThemeQStyle*, const PaintInfo&);
- explicit StylePainterQStyle(ScrollbarThemeQStyle*, GraphicsContext*);
-
- bool isValid() const { return style && StylePainter::isValid(); }
-
- QWidget* widget;
- QStyle* style;
-
- void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption& opt)
- { style->drawPrimitive(pe, &opt, painter, widget); }
- void drawControl(QStyle::ControlElement ce, const QStyleOption& opt)
- { style->drawControl(ce, &opt, painter, widget); }
- void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex& opt)
- { style->drawComplexControl(cc, &opt, painter, widget); }
-
-private:
- void init(GraphicsContext*, QStyle*);
-
- Q_DISABLE_COPY(StylePainterQStyle)
-};
-
-}
-
-#endif // RenderThemeQStyle_h
diff --git a/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp b/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp
deleted file mode 100644
index b0827fea4..000000000
--- a/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All Rights Reserved.
- * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- *
- * 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 "ScrollbarThemeQStyle.h"
-
-#include "GraphicsContext.h"
-#include "PlatformMouseEvent.h"
-#include "RenderThemeQStyle.h"
-#include "RenderThemeQtMobile.h"
-#include "ScrollView.h"
-#include "Scrollbar.h"
-
-#include <QApplication>
-#ifdef Q_WS_MAC
-#include <QMacStyle>
-#endif
-#include <QMenu>
-#include <QPainter>
-#include <QStyle>
-#include <QStyleOptionSlider>
-
-namespace WebCore {
-
-ScrollbarThemeQStyle::~ScrollbarThemeQStyle()
-{
-}
-
-static QStyle::SubControl scPart(const ScrollbarPart& part)
-{
- switch (part) {
- case NoPart:
- return QStyle::SC_None;
- case BackButtonStartPart:
- case BackButtonEndPart:
- return QStyle::SC_ScrollBarSubLine;
- case BackTrackPart:
- return QStyle::SC_ScrollBarSubPage;
- case ThumbPart:
- return QStyle::SC_ScrollBarSlider;
- case ForwardTrackPart:
- return QStyle::SC_ScrollBarAddPage;
- case ForwardButtonStartPart:
- case ForwardButtonEndPart:
- return QStyle::SC_ScrollBarAddLine;
- }
-
- return QStyle::SC_None;
-}
-
-static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc)
-{
- switch (sc) {
- case QStyle::SC_None:
- return NoPart;
- case QStyle::SC_ScrollBarSubLine:
- return BackButtonStartPart;
- case QStyle::SC_ScrollBarSubPage:
- return BackTrackPart;
- case QStyle::SC_ScrollBarSlider:
- return ThumbPart;
- case QStyle::SC_ScrollBarAddPage:
- return ForwardTrackPart;
- case QStyle::SC_ScrollBarAddLine:
- return ForwardButtonStartPart;
- }
- return NoPart;
-}
-
-static QStyleOptionSlider* styleOptionSlider(ScrollbarThemeClient* scrollbar, QWidget* widget = 0)
-{
- static QStyleOptionSlider opt;
- if (widget)
- opt.initFrom(widget);
- else
- opt.state |= QStyle::State_Active;
-
- opt.state &= ~QStyle::State_HasFocus;
-
- opt.rect = scrollbar->frameRect();
- if (scrollbar->enabled())
- opt.state |= QStyle::State_Enabled;
- if (scrollbar->controlSize() != RegularScrollbar)
- opt.state |= QStyle::State_Mini;
- opt.orientation = (scrollbar->orientation() == VerticalScrollbar) ? Qt::Vertical : Qt::Horizontal;
-
- if (scrollbar->orientation() == HorizontalScrollbar)
- opt.state |= QStyle::State_Horizontal;
- else
- opt.state &= ~QStyle::State_Horizontal;
-
- opt.sliderValue = scrollbar->value();
- opt.sliderPosition = opt.sliderValue;
- opt.pageStep = scrollbar->pageStep();
- opt.singleStep = scrollbar->lineStep();
- opt.minimum = 0;
- opt.maximum = qMax(0, scrollbar->maximum());
- ScrollbarPart pressedPart = scrollbar->pressedPart();
- ScrollbarPart hoveredPart = scrollbar->hoveredPart();
- if (pressedPart != NoPart) {
- opt.activeSubControls = scPart(scrollbar->pressedPart());
- if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart
- || pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart
- || pressedPart == ThumbPart)
- opt.state |= QStyle::State_Sunken;
- } else
- opt.activeSubControls = scPart(hoveredPart);
- if (hoveredPart != NoPart)
- opt.state |= QStyle::State_MouseOver;
- return &opt;
-}
-
-bool ScrollbarThemeQStyle::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& dirtyRect)
-{
- if (graphicsContext->updatingControlTints()) {
- scrollbar->invalidateRect(dirtyRect);
- return false;
- }
-
- StylePainterQStyle p(this, graphicsContext);
- if (!p.isValid())
- return true;
-
- p.painter->save();
- QStyleOptionSlider* opt = styleOptionSlider(scrollbar, p.widget);
-
- p.painter->setClipRect(opt->rect.intersected(dirtyRect), Qt::IntersectClip);
-
-#ifdef Q_WS_MAC
- // FIXME: We also need to check the widget style but today ScrollbarTheme is not aware of the page so we
- // can't get the widget.
- if (qobject_cast<QMacStyle*>(style()))
- p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
- else
-#endif
- {
- // The QStyle expects the background to be already filled.
- p.painter->fillRect(opt->rect, opt->palette.background());
-
- const QPoint topLeft = opt->rect.topLeft();
- p.painter->translate(topLeft);
- opt->rect.moveTo(QPoint(0, 0));
- p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
- opt->rect.moveTo(topLeft);
- }
- p.painter->restore();
-
- return true;
-}
-
-ScrollbarPart ScrollbarThemeQStyle::hitTest(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt)
-{
- QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
- const QPoint pos = scrollbar->convertFromContainingWindow(evt.position());
- opt->rect.moveTo(QPoint(0, 0));
- QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0);
- return scrollbarPart(sc);
-}
-
-bool ScrollbarThemeQStyle::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)
-{
- // Middle click centers slider thumb (if supported).
- return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton;
-}
-
-void ScrollbarThemeQStyle::invalidatePart(ScrollbarThemeClient* scrollbar, ScrollbarPart)
-{
- // FIXME: Do more precise invalidation.
- scrollbar->invalidate();
-}
-
-int ScrollbarThemeQStyle::scrollbarThickness(ScrollbarControlSize controlSize)
-{
- QStyleOptionSlider o;
- o.orientation = Qt::Vertical;
- o.state &= ~QStyle::State_Horizontal;
- if (controlSize != RegularScrollbar)
- o.state |= QStyle::State_Mini;
- return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0);
-}
-
-int ScrollbarThemeQStyle::thumbPosition(ScrollbarThemeClient* scrollbar)
-{
- if (scrollbar->enabled()) {
- float pos = (float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum();
- return (pos < 1 && pos > 0) ? 1 : pos;
- }
- return 0;
-}
-
-int ScrollbarThemeQStyle::thumbLength(ScrollbarThemeClient* scrollbar)
-{
- QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
- IntRect thumb = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0);
- return scrollbar->orientation() == HorizontalScrollbar ? thumb.width() : thumb.height();
-}
-
-int ScrollbarThemeQStyle::trackPosition(ScrollbarThemeClient* scrollbar)
-{
- QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
- IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0);
- return scrollbar->orientation() == HorizontalScrollbar ? track.x() - scrollbar->x() : track.y() - scrollbar->y();
-}
-
-int ScrollbarThemeQStyle::trackLength(ScrollbarThemeClient* scrollbar)
-{
- QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
- IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0);
- return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height();
-}
-
-void ScrollbarThemeQStyle::paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& rect)
-{
- StylePainterQStyle p(this, context);
- if (!p.isValid())
- return;
-
- QStyleOption option;
- option.rect = rect;
- p.drawPrimitive(QStyle::PE_PanelScrollAreaCorner, option);
-}
-
-QStyle* ScrollbarThemeQStyle::style() const
-{
- return QApplication::style();
-}
-
-}
-
diff --git a/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h b/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h
deleted file mode 100644
index 2537b9ae4..000000000
--- a/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 ScrollbarThemeQStyle_h
-#define ScrollbarThemeQStyle_h
-
-#include "ScrollbarTheme.h"
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-class QStyle;
-QT_END_NAMESPACE
-
-namespace WebCore {
-
-class ScrollbarThemeQStyle : public ScrollbarTheme {
-public:
- virtual ~ScrollbarThemeQStyle();
-
- virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& dirtyRect);
- virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect);
-
- virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const PlatformMouseEvent&);
-
- virtual bool shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent&);
-
- virtual void invalidatePart(ScrollbarThemeClient*, ScrollbarPart);
-
- virtual int thumbPosition(ScrollbarThemeClient*);
- virtual int thumbLength(ScrollbarThemeClient*);
- virtual int trackPosition(ScrollbarThemeClient*);
- virtual int trackLength(ScrollbarThemeClient*);
-
- virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
-
- QStyle* style() const;
-};
-
-}
-#endif
diff --git a/Source/WebKit/qt/declarative/experimental/experimental.pri b/Source/WebKit/qt/declarative/experimental/experimental.pri
index 2586bb784..1792b0ebb 100644
--- a/Source/WebKit/qt/declarative/experimental/experimental.pri
+++ b/Source/WebKit/qt/declarative/experimental/experimental.pri
@@ -24,7 +24,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
wince*:LIBS += $$QMAKE_LIBS_GUI
-QT += widgets network quick quick-private webkit webkit-private
+QT += widgets network quick quick-private webkitwidgets webkitwidgets-private
DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}
diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri
index ee233eb5d..bf4e1f701 100644
--- a/Source/WebKit/qt/declarative/public.pri
+++ b/Source/WebKit/qt/declarative/public.pri
@@ -24,7 +24,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
wince*:LIBS += $$QMAKE_LIBS_GUI
-QT += webkit webkit-private widgets quick quick-private
+QT += webkitwidgets webkitwidgets-private widgets quick quick-private
WEBKIT += wtf
diff --git a/Source/WebKit/qt/docs/webkitsnippets/simple/simple.pro b/Source/WebKit/qt/docs/webkitsnippets/simple/simple.pro
index 61cd3bfcd..7fe095809 100644
--- a/Source/WebKit/qt/docs/webkitsnippets/simple/simple.pro
+++ b/Source/WebKit/qt/docs/webkitsnippets/simple/simple.pro
@@ -1,2 +1,2 @@
-QT += webkit
+QT += webkitwidgets
SOURCES = main.cpp
diff --git a/Source/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro b/Source/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro
index fcad03b15..8d9c6938e 100644
--- a/Source/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro
+++ b/Source/WebKit/qt/docs/webkitsnippets/webpage/webpage.pro
@@ -1,3 +1,3 @@
CONFIG += console
-QT += webkit
-SOURCES = main.cpp \ No newline at end of file
+QT += webkitwidgets
+SOURCES = main.cpp
diff --git a/Source/WebKit/qt/tests/tests.pri b/Source/WebKit/qt/tests/tests.pri
index 5437baacc..b48806286 100644
--- a/Source/WebKit/qt/tests/tests.pri
+++ b/Source/WebKit/qt/tests/tests.pri
@@ -16,7 +16,7 @@ INCLUDEPATH += \
$$PWD \
$$PWD/../Api
-QT += testlib network webkit widgets
+QT += testlib network webkitwidgets widgets
# This define is used by some tests to look up resources in the source tree
DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"