summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/qt
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/platform/qt
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/platform/qt')
-rw-r--r--WebCore/platform/qt/CookieJarQt.cpp4
-rw-r--r--WebCore/platform/qt/FileSystemQt.cpp5
-rw-r--r--WebCore/platform/qt/KURLQt.cpp55
-rw-r--r--WebCore/platform/qt/Localizations.cpp11
-rw-r--r--WebCore/platform/qt/MIMETypeRegistryQt.cpp6
-rw-r--r--WebCore/platform/qt/Maemo5Webstyle.cpp268
-rw-r--r--WebCore/platform/qt/Maemo5Webstyle.h47
-rw-r--r--WebCore/platform/qt/PlatformKeyboardEventQt.cpp13
-rw-r--r--WebCore/platform/qt/QWebPageClient.h6
-rw-r--r--WebCore/platform/qt/QtAbstractWebPopup.cpp22
-rw-r--r--WebCore/platform/qt/QtAbstractWebPopup.h6
-rw-r--r--WebCore/platform/qt/QtStyleOptionWebComboBox.h59
-rw-r--r--WebCore/platform/qt/RenderThemeQt.cpp303
-rw-r--r--WebCore/platform/qt/RenderThemeQt.h33
-rw-r--r--WebCore/platform/qt/ScrollbarThemeQt.cpp4
-rw-r--r--WebCore/platform/qt/SharedTimerQt.cpp24
-rw-r--r--WebCore/platform/qt/TemporaryLinkStubs.cpp2
17 files changed, 758 insertions, 110 deletions
diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp
index 01d1756..15053eb 100644
--- a/WebCore/platform/qt/CookieJarQt.cpp
+++ b/WebCore/platform/qt/CookieJarQt.cpp
@@ -67,7 +67,6 @@ void setCookies(Document* document, const KURL& url, const String& value)
return;
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(QString(value).toAscii());
-#if QT_VERSION >= 0x040500
QList<QNetworkCookie>::Iterator it = cookies.begin();
while (it != cookies.end()) {
if (it->isHttpOnly())
@@ -75,7 +74,6 @@ void setCookies(Document* document, const KURL& url, const String& value)
else
++it;
}
-#endif
jar->setCookiesFromUrl(cookies, u);
}
@@ -92,10 +90,8 @@ String cookies(const Document* document, const KURL& url)
QStringList resultCookies;
foreach (QNetworkCookie networkCookie, cookies) {
-#if QT_VERSION >= 0x040500
if (networkCookie.isHttpOnly())
continue;
-#endif
resultCookies.append(QString::fromAscii(
networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData()));
}
diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp
index 4093fad..1da3c68 100644
--- a/WebCore/platform/qt/FileSystemQt.cpp
+++ b/WebCore/platform/qt/FileSystemQt.cpp
@@ -32,8 +32,8 @@
#include "config.h"
#include "FileSystem.h"
-#include "CString.h"
#include "PlatformString.h"
+#include <wtf/text/CString.h>
#include <QDateTime>
#include <QFile>
@@ -154,11 +154,12 @@ bool unloadModule(PlatformModule module)
return ::FreeLibrary(module);
#else
+#ifndef QT_NO_LIBRARY
if (module->unload()) {
delete module;
return true;
}
-
+#endif
return false;
#endif
}
diff --git a/WebCore/platform/qt/KURLQt.cpp b/WebCore/platform/qt/KURLQt.cpp
index 3bb3db2..ea1a795 100644
--- a/WebCore/platform/qt/KURLQt.cpp
+++ b/WebCore/platform/qt/KURLQt.cpp
@@ -19,22 +19,14 @@
*/
#include "config.h"
#include "KURL.h"
-#include "CString.h"
#include "TextEncoding.h"
+#include <wtf/text/CString.h>
#include "NotImplemented.h"
#include "qurl.h"
namespace WebCore {
-#if QT_VERSION < 0x040500
-static const char hexnumbers[] = "0123456789ABCDEF";
-static inline char toHex(char c)
-{
- return hexnumbers[c & 0xf];
-}
-#endif
-
KURL::KURL(const QUrl& url)
{
*this = KURL(KURL(), url.toEncoded().constData(), UTF8Encoding());
@@ -42,53 +34,8 @@ KURL::KURL(const QUrl& url)
KURL::operator QUrl() const
{
-#if QT_VERSION < 0x040500
- unsigned length = m_string.length();
-
- QByteArray ba;
- ba.reserve(length);
-
- int path = -1;
- int host = m_string.find("://");
- if (host != -1) {
- host += 3;
-
- path = m_string.find('/', host);
- }
-
- for (unsigned i = 0; i < length; ++i) {
- const char chr = static_cast<char>(m_string[i]);
-
- switch (chr) {
- encode:
- case '{':
- case '}':
- case '|':
- case '\\':
- case '^':
- case '`':
- ba.append('%');
- ba.append(toHex((chr & 0xf0) >> 4));
- ba.append(toHex(chr & 0xf));
- break;
- case '[':
- case ']':
- // special case: if this is the host part, don't encode
- // otherwise, encode
- if (host == -1 || (path != -1 && i >= path))
- goto encode;
- // fall through
- default:
- ba.append(chr);
- break;
- }
- }
-#else
- // Qt 4.5 or later
- // No need for special encoding
QString str = QString::fromRawData(reinterpret_cast<const QChar*>(m_string.characters()), m_string.length());
QByteArray ba = str.toUtf8();
-#endif
QUrl url = QUrl::fromEncoded(ba);
return url;
diff --git a/WebCore/platform/qt/Localizations.cpp b/WebCore/platform/qt/Localizations.cpp
index c919193..8fdd666 100644
--- a/WebCore/platform/qt/Localizations.cpp
+++ b/WebCore/platform/qt/Localizations.cpp
@@ -350,6 +350,17 @@ String AXMenuListActionVerb()
{
return String();
}
+
+String missingPluginText()
+{
+ return QCoreApplication::translate("QWebPage", "Missing Plug-in", "Label text to be used when a plug-in is missing");
+}
+
+String crashedPluginText()
+{
+ notImplemented();
+ return String();
+}
String multipleFileUploadText(unsigned)
{
diff --git a/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/WebCore/platform/qt/MIMETypeRegistryQt.cpp
index 22cee6f..4161f81 100644
--- a/WebCore/platform/qt/MIMETypeRegistryQt.cpp
+++ b/WebCore/platform/qt/MIMETypeRegistryQt.cpp
@@ -82,4 +82,10 @@ String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
return "application/octet-stream";
}
+bool MIMETypeRegistry::isApplicationPluginMIMEType(const String& mimeType)
+{
+ return mimeType.startsWith("application/x-qt-plugin", false)
+ || mimeType.startsWith("application/x-qt-styled-widget", false);
+}
+
}
diff --git a/WebCore/platform/qt/Maemo5Webstyle.cpp b/WebCore/platform/qt/Maemo5Webstyle.cpp
new file mode 100644
index 0000000..42b0b71
--- /dev/null
+++ b/WebCore/platform/qt/Maemo5Webstyle.cpp
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2010 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 "Maemo5Webstyle.h"
+
+#include "QtStyleOptionWebComboBox.h"
+
+#include <QPainter>
+#include <QPixmapCache>
+#include <QStyleOption>
+
+Maemo5WebStyle::Maemo5WebStyle()
+{
+}
+
+static inline void drawRectangularControlBackground(QPainter* painter, const QPen& pen, const QRect& rect, const QBrush& brush)
+{
+ QPen oldPen = painter->pen();
+ QBrush oldBrush = painter->brush();
+ painter->setPen(pen);
+ painter->setBrush(brush);
+
+ int line = 1;
+ painter->drawRect(rect.adjusted(line, line, -line, -line));
+
+ painter->setPen(oldPen);
+ painter->setBrush(oldBrush);
+}
+
+void Maemo5WebStyle::drawChecker(QPainter* painter, int size, QColor color) const
+{
+ int border = qMin(qMax(1, int(0.2 * size)), 6);
+ int checkerSize = size - 2 * border;
+ int width = checkerSize / 3;
+ int middle = qMax(3 * checkerSize / 7, 3);
+ int x = ((size - checkerSize) >> 1);
+ int y = ((size - checkerSize) >> 1) + (checkerSize - width - middle);
+ QVector<QLineF> lines(checkerSize + 1);
+ painter->setPen(color);
+ for (int i = 0; i < middle; ++i) {
+ lines[i] = QLineF(x, y, x, y + width);
+ ++x;
+ ++y;
+ }
+ for (int i = middle; i <= checkerSize; ++i) {
+ lines[i] = QLineF(x, y, x, y + width);
+ ++x;
+ --y;
+ }
+ painter->drawLines(lines.constData(), lines.size());
+}
+
+QPixmap Maemo5WebStyle::findChecker(const QRect& rect, bool disabled) const
+{
+ int size = qMin(rect.width(), rect.height());
+ QPixmap result;
+ static const QString prefix = "$qt-maemo5-" + QLatin1String(metaObject()->className()) + "-checker-";
+ QString key = prefix + QString::number(size) + "-" + (disabled ? "disabled" : "enabled");
+ if (!QPixmapCache::find(key, result)) {
+ result = QPixmap(size, size);
+ result.fill(Qt::transparent);
+ QPainter painter(&result);
+ drawChecker(&painter, size, disabled ? Qt::gray : Qt::black);
+ QPixmapCache::insert(key, result);
+ }
+ return result;
+}
+
+void Maemo5WebStyle::drawRadio(QPainter* painter, const QSize& size, bool checked, QColor color) const
+{
+ painter->setRenderHint(QPainter::Antialiasing, true);
+
+ // deflate one pixel
+ QRect rect = QRect(QPoint(1, 1), QSize(size.width() - 2, size.height() - 2));
+
+ QPen pen(Qt::black);
+ pen.setWidth(1);
+ painter->setPen(color);
+ painter->setBrush(Qt::white);
+ painter->drawEllipse(rect);
+ int border = 0.1 * (rect.width() + rect.height());
+ border = qMin(qMax(2, border), 10);
+ rect.adjust(border, border, -border, -border);
+ if (checked) {
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(color);
+ painter->drawEllipse(rect);
+ }
+}
+
+QPixmap Maemo5WebStyle::findRadio(const QSize& size, bool checked, bool disabled) const
+{
+ QPixmap result;
+ static const QString prefix = "$qt-maemo5-" + QLatin1String(metaObject()->className()) + "-radio-";
+ QString key = prefix + QString::number(size.width()) + "-" + QString::number(size.height()) +
+ + "-" + (disabled ? "disabled" : "enabled") + (checked ? "-checked" : "");
+ if (!QPixmapCache::find(key, result)) {
+ result = QPixmap(size);
+ result.fill(Qt::transparent);
+ QPainter painter(&result);
+ drawRadio(&painter, size, checked, disabled ? Qt::gray : Qt::black);
+ QPixmapCache::insert(key, result);
+ }
+ return result;
+}
+
+void Maemo5WebStyle::drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const
+{
+ switch (element) {
+ case CE_CheckBox: {
+ QRect rect = option->rect;
+ const bool disabled = !(option->state & State_Enabled);
+ drawRectangularControlBackground(painter, QPen(disabled ? Qt::gray : Qt::black), rect, option->palette.base());
+ rect.adjust(1, 1, -1, -1);
+
+ if (option->state & State_Off)
+ break;
+
+ QPixmap checker = findChecker(rect, disabled);
+ if (checker.isNull())
+ break;
+
+ int x = (rect.width() - checker.width()) >> 1;
+ int y = (rect.height() - checker.height()) >> 1;
+ painter->drawPixmap(rect.x() + x, rect.y() + y, checker);
+ break;
+ }
+ case CE_RadioButton: {
+ const bool disabled = !(option->state & State_Enabled);
+ QPixmap radio = findRadio(option->rect.size(), option->state & State_On, disabled);
+ if (radio.isNull())
+ break;
+ painter->drawPixmap(option->rect.x(), option->rect.y(), radio);
+ break;
+ }
+ default:
+ QWindowsStyle::drawControl(element, option, painter, widget);
+ }
+}
+
+void Maemo5WebStyle::drawMultipleComboButton(QPainter* painter, const QSize& size, QColor color) const
+{
+ int rectWidth = size.width() - 1;
+ int width = qMax(2, rectWidth >> 3);
+ int distance = (rectWidth - 3 * width) >> 1;
+ int top = (size.height() - width) >> 1;
+
+ painter->setPen(color);
+ painter->setBrush(color);
+
+ painter->drawRect(0, top, width, width);
+ painter->drawRect(width + distance, top, width, width);
+ painter->drawRect(2 * (width + distance), top, width, width);
+}
+
+void Maemo5WebStyle::drawSimpleComboButton(QPainter* painter, const QSize& size, QColor color) const
+{
+ QPolygon polygon;
+ int width = size.width();
+ polygon.setPoints(3, 0, 0, width - 1, 0, width >> 1, size.height());
+ painter->setPen(color);
+ painter->setBrush(color);
+ painter->drawPolygon(polygon);
+}
+
+QSize Maemo5WebStyle::getButtonImageSize(const QSize& buttonSize) const
+{
+ const int border = qMax(3, buttonSize.width() >> 3) << 1;
+
+ int width = buttonSize.width() - border;
+ int height = buttonSize.height() - border;
+
+ if (width < 0 || height < 0)
+ return QSize();
+
+ if (height >= (width >> 1))
+ width = width >> 1 << 1;
+ else
+ width = height << 1;
+
+ return QSize(width + 1, width >> 1);
+}
+
+QPixmap Maemo5WebStyle::findComboButton(const QSize& size, bool multiple, bool disabled) const
+{
+ QPixmap result;
+ QSize imageSize = getButtonImageSize(size);
+
+ if (imageSize.isNull())
+ return QPixmap();
+ static const QString prefix = "$qt-maemo5-" + QLatin1String(metaObject()->className()) + "-combo-";
+ QString key = prefix + (multiple ? "multiple-" : "simple-") +
+ QString::number(imageSize.width()) + "-" + QString::number(imageSize.height()) +
+ + "-" + (disabled ? "disabled" : "enabled");
+ if (!QPixmapCache::find(key, result)) {
+ result = QPixmap(imageSize);
+ result.fill(Qt::transparent);
+ QPainter painter(&result);
+ if (multiple)
+ drawMultipleComboButton(&painter, imageSize, disabled ? Qt::gray : Qt::black);
+ else
+ drawSimpleComboButton(&painter, imageSize, disabled ? Qt::gray : Qt::black);
+ QPixmapCache::insert(key, result);
+ }
+ return result;
+}
+
+void Maemo5WebStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget) const
+{
+ switch (control) {
+ case CC_ComboBox: {
+
+ bool multiple = false;
+ const bool disabled = !(option->state & State_Enabled);
+
+ const QStyleOptionComboBox* cmb = 0;
+ const WebCore::QtStyleOptionWebComboBox* webCombo = static_cast<const WebCore::QtStyleOptionWebComboBox*>(option);
+
+ if (webCombo) {
+ multiple = webCombo->multiple();
+ cmb = webCombo;
+ } else
+ cmb = qstyleoption_cast<const QStyleOptionComboBox*>(option);
+
+ if (!cmb) {
+ QWindowsStyle::drawComplexControl(control, option, painter, widget);
+ break;
+ }
+
+ if (!(cmb->subControls & SC_ComboBoxArrow))
+ break;
+
+ QRect rect = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
+ QPixmap pic = findComboButton(rect.size(), multiple, disabled);
+
+ if (pic.isNull())
+ break;
+
+ int x = (rect.width() - pic.width()) >> 1;
+ int y = (rect.height() - pic.height()) >> 1;
+ painter->drawPixmap(rect.x() + x, rect.y() + y, pic);
+
+ painter->setPen(disabled ? Qt::gray : Qt::darkGray);
+ painter->drawLine(rect.left() - 2, rect.top() + 2, rect.left() - 2, rect.bottom() - 2);
+
+ break;
+ }
+ default:
+ QWindowsStyle::drawComplexControl(control, option, painter, widget);
+ }
+}
diff --git a/WebCore/platform/qt/Maemo5Webstyle.h b/WebCore/platform/qt/Maemo5Webstyle.h
new file mode 100644
index 0000000..ce717b6
--- /dev/null
+++ b/WebCore/platform/qt/Maemo5Webstyle.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 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 Maemo5Webstyle_h
+#define Maemo5Webstyle_h
+
+#include <QWindowsStyle>
+
+class Maemo5WebStyle : public QWindowsStyle {
+public:
+ Maemo5WebStyle();
+
+ void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget = 0) const;
+ void drawComplexControl(ComplexControl cc, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget = 0) const;
+
+private:
+ void drawChecker(QPainter* painter, int size, QColor color) const;
+ QPixmap findChecker(const QRect& rect, bool disabled) const;
+
+ void drawRadio(QPainter* painter, const QSize& size, bool checked, QColor color) const;
+ QPixmap findRadio(const QSize& size, bool checked, bool disabled) const;
+
+ QSize getButtonImageSize(const QSize& buttonSize) const;
+ void drawSimpleComboButton(QPainter* painter, const QSize& size, QColor color) const;
+ void drawMultipleComboButton(QPainter* painter, const QSize& size, QColor color) const;
+ QPixmap findComboButton(const QSize& size, bool multiple, bool disabled) const;
+
+};
+
+#endif // Maemo5WebStyle_h
diff --git a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
index 12200f4..56fec70 100644
--- a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
+++ b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
@@ -28,8 +28,8 @@
#include "config.h"
#include "PlatformKeyboardEvent.h"
-#include "KeyboardCodes.h"
#include "NotImplemented.h"
+#include "WindowsKeyboardCodes.h"
#include <ctype.h>
@@ -127,6 +127,8 @@ static String keyIdentifierForQtKeyCode(int keyCode)
// Standard says that DEL becomes U+007F.
case Qt::Key_Delete:
return "U+007F";
+ case Qt::Key_Backspace:
+ return "U+0008";
case Qt::Key_Tab:
return "U+0009";
case Qt::Key_Backtab:
@@ -549,6 +551,15 @@ bool PlatformKeyboardEvent::currentCapsLockState()
return false;
}
+void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
+{
+ notImplemented();
+ shiftKey = false;
+ ctrlKey = false;
+ altKey = false;
+ metaKey = false;
+}
+
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/QWebPageClient.h b/WebCore/platform/qt/QWebPageClient.h
index 6d47c29..467941f 100644
--- a/WebCore/platform/qt/QWebPageClient.h
+++ b/WebCore/platform/qt/QWebPageClient.h
@@ -40,7 +40,9 @@ QT_END_NAMESPACE
class QWebPageClient {
public:
virtual ~QWebPageClient() { }
-
+
+ virtual bool isQWidgetClient() const { return false; }
+
virtual void scroll(int dx, int dy, const QRect&) = 0;
virtual void update(const QRect&) = 0;
virtual void setInputMethodEnabled(bool enable) = 0;
@@ -53,6 +55,7 @@ public:
// if scheduleSync is true, we schedule a sync ourselves. otherwise,
// we wait for the next update and sync the layers then.
virtual void markForSync(bool scheduleSync = false) {}
+ virtual bool allowsAcceleratedCompositing() const { return false; }
#endif
#if QT_VERSION >= 0x040600
@@ -80,6 +83,7 @@ public:
virtual QPalette palette() const = 0;
virtual int screenNumber() const = 0;
virtual QWidget* ownerWidget() const = 0;
+ virtual QRect geometryRelativeToOwnerWidget() const = 0;
virtual QObject* pluginParent() const = 0;
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.cpp b/WebCore/platform/qt/QtAbstractWebPopup.cpp
index f64287d..31ab28d 100644
--- a/WebCore/platform/qt/QtAbstractWebPopup.cpp
+++ b/WebCore/platform/qt/QtAbstractWebPopup.cpp
@@ -48,6 +48,28 @@ void QtAbstractWebPopup::valueChanged(int index)
m_popupClient->valueChanged(index);
}
+void QtAbstractWebPopup::selectItem(int index, bool allowMultiplySelections, bool shift)
+{
+#if ENABLE(NO_LISTBOX_RENDERING)
+ ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
+ if (client) {
+ client->listBoxSelectItem(index, allowMultiplySelections, shift);
+ return;
+ }
+#endif
+ valueChanged(index);
+}
+
+bool QtAbstractWebPopup::multiple()
+{
+#if ENABLE(NO_LISTBOX_RENDERING)
+ ListPopupMenuClient* client = static_cast<ListPopupMenuClient*>(m_popupClient);
+ return client && client->multiple();
+#else
+ return false;
+#endif
+}
+
QtAbstractWebPopup::ItemType QtAbstractWebPopup::itemType(int idx) const
{
if (m_popupClient->itemIsSeparator(idx))
diff --git a/WebCore/platform/qt/QtAbstractWebPopup.h b/WebCore/platform/qt/QtAbstractWebPopup.h
index 93b4122..dad4997 100644
--- a/WebCore/platform/qt/QtAbstractWebPopup.h
+++ b/WebCore/platform/qt/QtAbstractWebPopup.h
@@ -40,6 +40,8 @@ public:
QString itemToolTip(int idx) const { return m_popupClient->itemToolTip(idx); }
bool itemIsEnabled(int idx) const { return m_popupClient->itemIsEnabled(idx); }
int itemCount() const { return m_popupClient->listSize(); }
+ bool itemIsSelected(int idx) const { return m_popupClient->itemIsSelected(idx); }
+
QWebPageClient* pageClient() const { return m_pageClient; }
QRect geometry() const { return m_geometry; }
@@ -54,6 +56,10 @@ public:
void popupDidHide();
void valueChanged(int index);
+ void selectItem(int index, bool allowMultiplySelections, bool shift);
+ bool multiple();
+
+
QFont font() { return m_popupClient->menuStyle().font().font(); }
private:
diff --git a/WebCore/platform/qt/QtStyleOptionWebComboBox.h b/WebCore/platform/qt/QtStyleOptionWebComboBox.h
new file mode 100644
index 0000000..29c8220
--- /dev/null
+++ b/WebCore/platform/qt/QtStyleOptionWebComboBox.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 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 QtStyleOptionWebComboBox_h
+#define QtStyleOptionWebComboBox_h
+
+#include "HTMLSelectElement.h"
+#include "RenderObject.h"
+
+#include <QStyleOption>
+
+namespace WebCore {
+
+class RenderObject;
+
+class QtStyleOptionWebComboBox : public QStyleOptionComboBox {
+public:
+ QtStyleOptionWebComboBox(RenderObject* o)
+ : QStyleOptionComboBox()
+ #if ENABLE(NO_LISTBOX_RENDERING)
+ , m_multiple(checkMultiple(o))
+ #else
+ , m_multiple(false)
+ #endif
+ {
+ }
+
+ bool multiple() const { return m_multiple; }
+
+private:
+ bool m_multiple;
+
+ bool checkMultiple(RenderObject* o)
+ {
+ HTMLSelectElement* select = o ? static_cast<HTMLSelectElement*>(o->node()) : 0;
+ return select ? select->multiple() : false;
+ }
+};
+
+}
+
+#endif // QtStyleOptionWebComboBox_h
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
index 271c11a..9cc32ad 100644
--- a/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -39,18 +39,28 @@
#include "Font.h"
#include "FontSelector.h"
#include "GraphicsContext.h"
+#include "HTMLInputElement.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
+#ifdef Q_WS_MAEMO_5
+#include "Maemo5Webstyle.h"
+#endif
#include "NotImplemented.h"
#include "Page.h"
+#include "QtStyleOptionWebComboBox.h"
#include "QWebPageClient.h"
#include "RenderBox.h"
+#if ENABLE(PROGRESS_TAG)
+#include "RenderProgress.h"
+#endif
#include "RenderSlider.h"
#include "RenderTheme.h"
+#include "TimeRanges.h"
#include "ScrollbarThemeQt.h"
#include "UserAgentStyleSheets.h"
#include "qwebpage.h"
+
#include <QApplication>
#include <QColor>
#include <QDebug>
@@ -61,6 +71,9 @@
#include <QStyleFactory>
#include <QStyleOptionButton>
#include <QStyleOptionFrameV2>
+#if ENABLE(PROGRESS_TAG)
+#include <QStyleOptionProgressBarV2>
+#endif
#include <QStyleOptionSlider>
#include <QWidget>
@@ -129,6 +142,7 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
RenderThemeQt::RenderThemeQt(Page* page)
: RenderTheme()
, m_page(page)
+ , m_lineEdit(0)
{
QPushButton button;
button.setAttribute(Qt::WA_MacSmallSize);
@@ -139,14 +153,43 @@ RenderThemeQt::RenderThemeQt(Page* page)
m_buttonFontPixelSize = fontInfo.pixelSize();
#endif
+#ifdef Q_WS_MAEMO_5
+ m_fallbackStyle = new Maemo5WebStyle;
+#else
m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
+#endif
}
RenderThemeQt::~RenderThemeQt()
{
delete m_fallbackStyle;
+ delete m_lineEdit;
}
+#ifdef Q_WS_MAEMO_5
+bool RenderThemeQt::isControlStyled(const RenderStyle* style, const BorderData& border, const FillLayer& fill, const Color& backgroundColor) const
+{
+ switch (style->appearance()) {
+ case PushButtonPart:
+ case ButtonPart:
+ case MenulistPart:
+ case TextFieldPart:
+ case TextAreaPart:
+ return true;
+ case CheckboxPart:
+ case RadioPart:
+ return false;
+ default:
+ return RenderTheme::isControlStyled(style, border, fill, backgroundColor);
+ }
+}
+
+int RenderThemeQt::popupInternalPaddingBottom(RenderStyle* style) const
+{
+ return 1;
+}
+#endif
+
// for some widget painting, we need to fallback to Windows style
QStyle* RenderThemeQt::fallbackStyle() const
{
@@ -169,6 +212,18 @@ QStyle* RenderThemeQt::qStyle() const
return QApplication::style();
}
+String RenderThemeQt::extraDefaultStyleSheet()
+{
+ String result = RenderTheme::extraDefaultStyleSheet();
+#if ENABLE(NO_LISTBOX_RENDERING)
+ result += String(themeQtNoListboxesUserAgentStyleSheet, sizeof(themeQtNoListboxesUserAgentStyleSheet));
+#endif
+#ifdef Q_WS_MAEMO_5
+ result += String(themeQtMaemo5UserAgentStyleSheet, sizeof(themeQtMaemo5UserAgentStyleSheet));
+#endif
+ return result;
+}
+
bool RenderThemeQt::supportsHover(const RenderStyle*) const
{
return true;
@@ -207,11 +262,13 @@ bool RenderThemeQt::supportsControlTints() const
return true;
}
-static int findFrameLineWidth(QStyle* style)
+int RenderThemeQt::findFrameLineWidth(QStyle* style) const
{
- QLineEdit lineEdit;
+ if (!m_lineEdit)
+ m_lineEdit = new QLineEdit();
+
QStyleOptionFrameV2 opt;
- return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, &lineEdit);
+ return style->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, m_lineEdit);
}
static QRect inflateButtonRect(const QRect& originalRect, QStyle* style)
@@ -289,15 +346,30 @@ int RenderThemeQt::minimumMenuListSize(RenderStyle*) const
void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const
{
- // If the width and height are both specified, then we have nothing to do.
- if (!renderStyle->width().isIntrinsicOrAuto() && !renderStyle->height().isAuto())
- return;
-
QSize size(0, 0);
const QFontMetrics fm(renderStyle->font().font());
QStyle* style = qStyle();
switch (renderStyle->appearance()) {
+ case TextAreaPart:
+ 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;
@@ -341,23 +413,6 @@ void RenderThemeQt::computeSizeBasedOnStyle(RenderStyle* renderStyle) const
size.setHeight(menuListSize.height());
break;
}
- case TextFieldPart: {
- const int verticalMargin = 1;
- const int horizontalMargin = 2;
- int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin;
- int w = fm.width(QLatin1Char('x')) * 17 + 2*horizontalMargin;
- QStyleOptionFrameV2 opt;
- opt.lineWidth = findFrameLineWidth(style);
- QSize sz = style->sizeFromContents(QStyle::CT_LineEdit,
- &opt,
- QSize(w, h).expandedTo(QApplication::globalStrut()),
- 0);
- size.setHeight(sz.height());
-
- renderStyle->setPaddingLeft(Length(opt.lineWidth, Fixed));
- renderStyle->setPaddingRight(Length(opt.lineWidth, Fixed));
- break;
- }
default:
break;
}
@@ -576,7 +631,7 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo
if (!p.isValid())
return true;
- QStyleOptionComboBox opt;
+ QtStyleOptionWebComboBox opt(o);
if (p.widget)
opt.initFrom(p.widget);
initializeCommonQStyleOptions(opt, o);
@@ -593,9 +648,11 @@ bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo
void RenderThemeQt::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
{
+#ifndef Q_WS_MAEMO_5
// 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();
+#endif
// Height is locked to auto.
style->setHeight(Length(Auto));
@@ -616,7 +673,7 @@ bool RenderThemeQt::paintMenuListButton(RenderObject* o, const RenderObject::Pai
if (!p.isValid())
return true;
- QStyleOptionComboBox option;
+ QtStyleOptionWebComboBox option(o);
if (p.widget)
option.initFrom(p.widget);
initializeCommonQStyleOptions(option, o);
@@ -630,6 +687,75 @@ bool RenderThemeQt::paintMenuListButton(RenderObject* o, const RenderObject::Pai
return false;
}
+#if ENABLE(PROGRESS_TAG)
+double RenderThemeQt::animationRepeatIntervalForProgressBar(RenderProgress* renderProgress) const
+{
+ if (renderProgress->position() >= 0)
+ return 0;
+
+ // FIXME: Use hard-coded value until http://bugreports.qt.nokia.com/browse/QTBUG-9171 is fixed.
+ // Use the value from windows style which is 10 fps.
+ return 0.1;
+}
+
+double RenderThemeQt::animationDurationForProgressBar(RenderProgress* renderProgress) const
+{
+ if (renderProgress->position() >= 0)
+ return 0;
+
+ QStyleOptionProgressBarV2 option;
+ option.rect.setSize(renderProgress->size());
+ // 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);
+}
+
+void RenderThemeQt::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+ style->setBoxShadow(0);
+}
+
+bool RenderThemeQt::paintProgressBar(RenderObject* o, const RenderObject::PaintInfo& pi, const IntRect& r)
+{
+ StylePainter p(this, pi);
+ if (!p.isValid())
+ return true;
+
+ QStyleOptionProgressBarV2 option;
+ if (p.widget)
+ option.initFrom(p.widget);
+ 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.topLeft();
+ 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 RenderThemeQt::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& pi,
const IntRect& r)
{
@@ -882,10 +1008,15 @@ HTMLMediaElement* RenderThemeQt::getMediaElementFromRenderObject(RenderObject* o
return static_cast<HTMLMediaElement*>(mediaNode);
}
+double RenderThemeQt::mediaControlsBaselineOpacity() const
+{
+ return 0.4;
+}
+
void RenderThemeQt::paintMediaBackground(QPainter* painter, const IntRect& r) const
{
painter->setPen(Qt::NoPen);
- static QColor transparentBlack(0, 0, 0, 100);
+ static QColor transparentBlack(0, 0, 0, mediaControlsBaselineOpacity() * 255);
painter->setBrush(transparentBlack);
painter->drawRoundedRect(r.x(), r.y(), r.width(), r.height(), 5.0, 5.0);
}
@@ -921,14 +1052,9 @@ bool RenderThemeQt::paintMediaMuteButton(RenderObject* o, const RenderObject::Pa
const QPointF speakerPolygon[6] = { QPointF(20, 30), QPointF(50, 30), QPointF(80, 0),
QPointF(80, 100), QPointF(50, 70), QPointF(20, 70)};
- p.painter->setBrush(getMediaControlForegroundColor(o));
+ p.painter->setBrush(mediaElement->muted() ? Qt::darkRed : getMediaControlForegroundColor(o));
p.painter->drawPolygon(speakerPolygon, 6);
- if (mediaElement->muted()) {
- p.painter->setPen(Qt::red);
- p.painter->drawLine(0, 100, 100, 0);
- }
-
return false;
}
@@ -971,6 +1097,86 @@ bool RenderThemeQt::paintMediaSeekForwardButton(RenderObject*, const RenderObjec
return false;
}
+bool RenderThemeQt::paintMediaCurrentTime(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ StylePainter p(this, paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+ paintMediaBackground(p.painter, r);
+
+ return false;
+}
+
+String RenderThemeQt::formatMediaControlsCurrentTime(float currentTime, float duration) const
+{
+ return formatMediaControlsTime(currentTime) + " / " + formatMediaControlsTime(duration);
+}
+
+String RenderThemeQt::formatMediaControlsRemainingTime(float currentTime, float duration) const
+{
+ return String();
+}
+
+bool RenderThemeQt::paintMediaVolumeSliderTrack(RenderObject *o, const RenderObject::PaintInfo &paintInfo, const IntRect &r)
+{
+ StylePainter p(this, paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+
+ paintMediaBackground(p.painter, r);
+
+ if (!o->isSlider())
+ return false;
+
+ IntRect b = toRenderBox(o)->contentBoxRect();
+
+ // Position the outer rectangle
+ int top = r.y() + b.y();
+ int left = r.x() + b.x();
+ int width = b.width();
+ int height = b.height();
+
+ // Get the scale color from the page client
+ QPalette pal = QApplication::palette();
+ setPaletteFromPageClientIfExists(pal);
+ const QColor highlightText = pal.brush(QPalette::Active, QPalette::HighlightedText).color();
+ const QColor scaleColor(highlightText.red(), highlightText.green(), highlightText.blue(), mediaControlsBaselineOpacity() * 255);
+
+ // Draw the outer rectangle
+ p.painter->setBrush(scaleColor);
+ p.painter->drawRect(left, top, width, height);
+
+ if (!o->node() || !o->node()->hasTagName(inputTag))
+ return false;
+
+ HTMLInputElement* slider = static_cast<HTMLInputElement*>(o->node());
+
+ // Position the inner rectangle
+ height = height * slider->valueAsNumber();
+ top += b.height() - height;
+
+ // Draw the inner rectangle
+ p.painter->setPen(Qt::NoPen);
+ p.painter->setBrush(getMediaControlForegroundColor(o));
+ p.painter->drawRect(left, top, width, height);
+
+ return false;
+}
+
+bool RenderThemeQt::paintMediaVolumeSliderThumb(RenderObject *o, const RenderObject::PaintInfo &paintInfo, const IntRect &r)
+{
+ StylePainter p(this, paintInfo);
+ if (!p.isValid())
+ return true;
+
+ // Nothing to draw here, this is all done in the track
+ return false;
+}
+
bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o);
@@ -985,15 +1191,31 @@ bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::P
paintMediaBackground(p.painter, r);
+#if QT_VERSION >= 0x040700
+ if (MediaPlayer* player = mediaElement->player()) {
+ // Get the buffered parts of the media
+ PassRefPtr<TimeRanges> buffered = player->buffered();
+ if (buffered->length() > 0 && player->duration() < std::numeric_limits<float>::infinity()) {
+ // Set the transform and brush
+ WorldMatrixTransformer transformer(p.painter, o, r);
+ p.painter->setBrush(getMediaControlForegroundColor());
+
+ // Paint each buffered section
+ ExceptionCode ex;
+ for (int i = 0; i < buffered->length(); i++) {
+ float startX = (buffered->start(i, ex) / player->duration()) * 100;
+ float width = ((buffered->end(i, ex) / player->duration()) * 100) - startX;
+ p.painter->drawRect(startX, 37, width, 26);
+ }
+ }
+ }
+#endif
+
return false;
}
bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
{
- HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o->parent());
- if (!mediaElement)
- return false;
-
StylePainter p(this, paintInfo);
if (!p.isValid())
return true;
@@ -1019,6 +1241,13 @@ void RenderThemeQt::adjustSliderThumbSize(RenderObject* o) const
int parentHeight = parentStyle->height().value();
o->style()->setWidth(Length(parentHeight / 3, Fixed));
o->style()->setHeight(Length(parentHeight, Fixed));
+ } else if (part == MediaVolumeSliderThumbPart) {
+ RenderStyle* parentStyle = o->parent()->style();
+ Q_ASSERT(parentStyle);
+
+ int parentWidth = parentStyle->width().value();
+ o->style()->setHeight(Length(parentWidth / 3, Fixed));
+ o->style()->setWidth(Length(parentWidth, Fixed));
} else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalPart) {
QStyleOptionSlider option;
if (part == SliderThumbVerticalPart)
diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h
index 5385881..c10659a 100644
--- a/WebCore/platform/qt/RenderThemeQt.h
+++ b/WebCore/platform/qt/RenderThemeQt.h
@@ -27,12 +27,16 @@
#include <QStyle>
QT_BEGIN_NAMESPACE
+class QLineEdit;
class QPainter;
class QWidget;
QT_END_NAMESPACE
namespace WebCore {
+#if ENABLE(PROGRESS_TAG)
+class RenderProgress;
+#endif
class RenderStyle;
class HTMLMediaElement;
class ScrollbarThemeQt;
@@ -45,6 +49,8 @@ private:
public:
static PassRefPtr<RenderTheme> create(Page*);
+ String extraDefaultStyleSheet();
+
virtual bool supportsHover(const RenderStyle*) const;
virtual bool supportsFocusRing(const RenderStyle* style) const;
@@ -72,6 +78,11 @@ public:
virtual double caretBlinkInterval() const;
+#ifdef Q_WS_MAEMO_5
+ virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const;
+ virtual int popupInternalPaddingBottom(RenderStyle*) const;
+#endif
+
#if ENABLE(VIDEO)
virtual String extraMediaControlsStyleSheet();
#endif
@@ -101,6 +112,11 @@ protected:
virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+#if ENABLE(PROGRESS_TAG)
+ virtual void adjustProgressBarStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintProgressBar(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+#endif
+
virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual void adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
@@ -119,6 +135,13 @@ protected:
virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+#if ENABLE(PROGRESS_TAG)
+ // Returns the repeat interval of the animation for the progress bar.
+ virtual double animationRepeatIntervalForProgressBar(RenderProgress* renderProgress) const;
+ // Returns the duration of the animation for the progress bar.
+ virtual double animationDurationForProgressBar(RenderProgress* renderProgress) const;
+#endif
+
#if ENABLE(VIDEO)
virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
@@ -127,10 +150,15 @@ protected:
virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
+ virtual bool paintMediaCurrentTime(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const;
+ virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
private:
HTMLMediaElement* getMediaElementFromRenderObject(RenderObject* o) const;
void paintMediaBackground(QPainter* painter, const IntRect& r) const;
+ double mediaControlsBaselineOpacity() const;
QColor getMediaControlForegroundColor(RenderObject* o = 0) const;
#endif
void computeSizeBasedOnStyle(RenderStyle* renderStyle) const;
@@ -145,6 +173,8 @@ private:
void setPaletteFromPageClientIfExists(QPalette&) const;
+ int findFrameLineWidth(QStyle* style) const;
+
QStyle* fallbackStyle() const;
Page* m_page;
@@ -155,6 +185,7 @@ private:
QString m_buttonFontFamily;
QStyle* m_fallbackStyle;
+ mutable QLineEdit* m_lineEdit;
};
class StylePainter {
diff --git a/WebCore/platform/qt/ScrollbarThemeQt.cpp b/WebCore/platform/qt/ScrollbarThemeQt.cpp
index c0c80ba..04a2b1b 100644
--- a/WebCore/platform/qt/ScrollbarThemeQt.cpp
+++ b/WebCore/platform/qt/ScrollbarThemeQt.cpp
@@ -233,9 +233,6 @@ void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext
return;
}
-#if QT_VERSION < 0x040500
- context->fillRect(rect, QApplication::palette().color(QPalette::Normal, QPalette::Window), DeviceColorSpace);
-#else
StylePainter p(this, context);
if (!p.isValid())
return;
@@ -243,7 +240,6 @@ void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext
QStyleOption option;
option.rect = rect;
p.drawPrimitive(QStyle::PE_PanelScrollAreaCorner, option);
-#endif
}
QStyle* ScrollbarThemeQt::style() const
diff --git a/WebCore/platform/qt/SharedTimerQt.cpp b/WebCore/platform/qt/SharedTimerQt.cpp
index e9bcaee..7c0fd05 100644
--- a/WebCore/platform/qt/SharedTimerQt.cpp
+++ b/WebCore/platform/qt/SharedTimerQt.cpp
@@ -40,6 +40,8 @@
namespace WebCore {
class SharedTimerQt : public QObject {
+ Q_OBJECT
+
friend void setSharedTimerFiredFunction(void (*f)());
public:
static SharedTimerQt* inst();
@@ -50,15 +52,18 @@ public:
protected:
void timerEvent(QTimerEvent* ev);
+private slots:
+ void destroy();
+
private:
- SharedTimerQt(QObject* parent);
+ SharedTimerQt();
~SharedTimerQt();
QBasicTimer m_timer;
void (*m_timerFunction)();
};
-SharedTimerQt::SharedTimerQt(QObject* parent)
- : QObject(parent)
+SharedTimerQt::SharedTimerQt()
+ : QObject()
, m_timerFunction(0)
{}
@@ -68,11 +73,18 @@ SharedTimerQt::~SharedTimerQt()
(m_timerFunction)();
}
+void SharedTimerQt::destroy()
+{
+ delete this;
+}
+
SharedTimerQt* SharedTimerQt::inst()
{
static QPointer<SharedTimerQt> timer;
- if (!timer)
- timer = new SharedTimerQt(QCoreApplication::instance());
+ if (!timer) {
+ timer = new SharedTimerQt();
+ timer->connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(destroy()));
+ }
return timer;
}
@@ -129,6 +141,8 @@ void stopSharedTimer()
SharedTimerQt::inst()->stop();
}
+#include "SharedTimerQt.moc"
+
}
// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/TemporaryLinkStubs.cpp b/WebCore/platform/qt/TemporaryLinkStubs.cpp
index 814f961..432bd2b 100644
--- a/WebCore/platform/qt/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/qt/TemporaryLinkStubs.cpp
@@ -34,7 +34,6 @@
#include "AXObjectCache.h"
#include "DNS.h"
-#include "CString.h"
#include "CachedResource.h"
#include "CookieJar.h"
#include "Cursor.h"
@@ -71,6 +70,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
+#include <wtf/text/CString.h>
using namespace WebCore;