diff options
Diffstat (limited to 'Source/WebKit/qt')
32 files changed, 1770 insertions, 195 deletions
diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 40c69f4bf..3fc64c96f 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -33,6 +33,7 @@ #include "GraphicsContext.h" #include "HTMLElement.h" #include "StylePropertySet.h" +#include "StyleRule.h" #if USE(JSC) #include "Completion.h" #include "JSGlobalObject.h" @@ -843,7 +844,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str if (!propID) return QString(); - StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); + const StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyle(); if (strategy == InlineStyle) return style->getPropertyValue(propID); @@ -865,11 +866,11 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str for (int i = rules->length(); i > 0; --i) { CSSStyleRule* rule = static_cast<CSSStyleRule*>(rules->item(i - 1)); - if (rule->declaration()->propertyIsImportant(propID)) - return rule->declaration()->getPropertyValue(propID); + if (rule->styleRule()->properties()->propertyIsImportant(propID)) + return rule->styleRule()->properties()->getPropertyValue(propID); if (style->getPropertyValue(propID).isEmpty()) - style = rule->declaration(); + style = rule->styleRule()->properties(); } } @@ -908,11 +909,7 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value) return; int propID = cssPropertyID(name); - StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); - if (!propID || !style) - return; - - style->setProperty(propID, value); + static_cast<StyledElement*>(m_element)->setInlineStyleProperty(propID, value); } /*! diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index 211f0ef20..dcf23061d 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -783,12 +783,12 @@ QString QWebFrame::title() const Given the above HTML code the metaData() function will return a map with two entries: \table - \header \o Key - \o Value - \row \o "description" - \o "This document is a tutorial about Qt development" - \row \o "keywords" - \o "Qt, WebKit, Programming" + \header \li Key + \li Value + \row \li "description" + \li "This document is a tutorial about Qt development" + \row \li "keywords" + \li "Qt, WebKit, Programming" \endtable This function returns a multi map to support multiple meta tags with the same attribute name. @@ -1750,7 +1750,7 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult { if (!hitTest.innerNode()) return; - pos = hitTest.point(); + pos = hitTest.roundedPoint(); WebCore::TextDirection dir; title = hitTest.title(dir); linkText = hitTest.textContent(); diff --git a/Source/WebKit/qt/Api/qwebhistory.cpp b/Source/WebKit/qt/Api/qwebhistory.cpp index 33bad4174..fc5bdd5fc 100644 --- a/Source/WebKit/qt/Api/qwebhistory.cpp +++ b/Source/WebKit/qt/Api/qwebhistory.cpp @@ -53,13 +53,13 @@ enum { the functions used to access them. \table - \header \o Function \o Description - \row \o title() \o The page title. - \row \o url() \o The location of the page. - \row \o originalUrl() \o The URL used to access the page. - \row \o lastVisited() \o The date and time of the user's last visit to the page. - \row \o icon() \o The icon associated with the page that was provided by the server. - \row \o userData() \o The user specific data that was stored with the history item. + \header \li Function \li Description + \row \li title() \li The page title. + \row \li url() \li The location of the page. + \row \li originalUrl() \li The URL used to access the page. + \row \li lastVisited() \li The date and time of the user's last visit to the page. + \row \li icon() \li The icon associated with the page that was provided by the server. + \row \li userData() \li The user specific data that was stored with the history item. \endtable \note QWebHistoryItem objects are value based, but \e{explicitly shared}. Changing diff --git a/Source/WebKit/qt/Api/qwebinspector.cpp b/Source/WebKit/qt/Api/qwebinspector.cpp index 52feb8895..2fbbab249 100644 --- a/Source/WebKit/qt/Api/qwebinspector.cpp +++ b/Source/WebKit/qt/Api/qwebinspector.cpp @@ -50,8 +50,8 @@ \note A QWebInspector will display a blank widget if either: \list - \o page() is null - \o QWebSettings::DeveloperExtrasEnabled is false + \li page() is null + \li QWebSettings::DeveloperExtrasEnabled is false \endlist \section1 Resources @@ -60,8 +60,8 @@ Most of the resources needed by the inspector are owned by the associated QWebPage and are allocated the first time that: \list - \o an element is inspected - \o the QWebInspector is shown. + \li an element is inspected + \li the QWebInspector is shown. \endlist \section1 Inspector configuration persistence @@ -98,12 +98,12 @@ QWebInspector::~QWebInspector() /*! Bind this inspector to the QWebPage to be inspected. - \bold {Notes:} + \b {Notes:} \list - \o There can only be one QWebInspector associated with a QWebPage + \li There can only be one QWebInspector associated with a QWebPage and vice versa. - \o Calling this method with a null \a page will break the current association, if any. - \o If \a page is already associated to another QWebInspector, the association + \li Calling this method with a null \a page will break the current association, if any. + \li If \a page is already associated to another QWebInspector, the association will be replaced and the previous QWebInspector will become unbound \endlist diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 898899bf5..4928318d6 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -3290,15 +3290,11 @@ bool QWebPage::swallowContextMenuEvent(QContextMenuEvent *event) { d->page->contextMenuController()->clearContextMenu(); -#if HAVE(QSTYLE) - if (!RenderThemeQt::useMobileTheme()) { - if (QWebFrame* webFrame = frameAt(event->pos())) { - Frame* frame = QWebFramePrivate::core(webFrame); - if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position())) - return handleScrollbarContextMenuEvent(scrollbar, event); - } + if (QWebFrame* webFrame = frameAt(event->pos())) { + Frame* frame = QWebFramePrivate::core(webFrame); + if (Scrollbar* scrollbar = frame->view()->scrollbarAtPoint(convertMouseEvent(event, 1).position())) + return handleScrollbarContextMenuEvent(scrollbar, event); } -#endif WebCore::Frame* focusedFrame = d->page->focusController()->focusedOrMainFrame(); focusedFrame->eventHandler()->sendContextMenuEvent(convertMouseEvent(event, 1)); @@ -3744,11 +3740,11 @@ QWebPluginFactory *QWebPage::pluginFactory() const In this string the following values are replaced at run-time: \list - \o %Platform% expands to the windowing system followed by "; " if it is not Windows (e.g. "X11; "). - \o %Security% expands to "N; " if SSL is disabled. - \o %Subplatform% expands to the operating system version (e.g. "Windows NT 6.1" or "Intel Mac OS X 10.5"). - \o %WebKitVersion% is the version of WebKit the application was compiled against. - \o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. + \li %Platform% expands to the windowing system followed by "; " if it is not Windows (e.g. "X11; "). + \li %Security% expands to "N; " if SSL is disabled. + \li %Subplatform% expands to the operating system version (e.g. "Windows NT 6.1" or "Intel Mac OS X 10.5"). + \li %WebKitVersion% is the version of WebKit the application was compiled against. + \li %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version. \endlist */ QString QWebPage::userAgentForUrl(const QUrl&) const diff --git a/Source/WebKit/qt/Api/qwebpluginfactory.cpp b/Source/WebKit/qt/Api/qwebpluginfactory.cpp index b9180be94..34ea05265 100644 --- a/Source/WebKit/qt/Api/qwebpluginfactory.cpp +++ b/Source/WebKit/qt/Api/qwebpluginfactory.cpp @@ -181,16 +181,16 @@ void QWebPluginFactory::refreshPlugins() The above object element will result in a call to create() with the following arguments: \table - \header \o Parameter - \o Value - \row \o mimeType - \o "application/x-pdf" - \row \o url - \o "http://qt.nokia.com/document.pdf" - \row \o argumentNames - \o "showTableOfContents" "hideThumbnails" - \row \o argumentVaues - \o "true" "false" + \header \li Parameter + \li Value + \row \li mimeType + \li "application/x-pdf" + \row \li url + \li "http://qt.nokia.com/document.pdf" + \row \li argumentNames + \li "showTableOfContents" "hideThumbnails" + \row \li argumentVaues + \li "true" "false" \endtable \note Ownership of the returned object will be transferred to the caller. diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 2885f01ee..0f55b0b89 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -703,7 +703,7 @@ void QWebSettings::clearIconDatabase() /*! Returns the web site's icon for \a url. - If the web site does not specify an icon \bold OR if the icon is not in the + If the web site does not specify an icon \b OR if the icon is not in the database, a null QIcon is returned. \note The returned icon's size is arbitrary. @@ -850,10 +850,10 @@ int QWebSettings::maximumPagesInCache() dead objects should consume when the cache is under pressure. \a cacheMaxDead is the \e maximum number of bytes that dead objects should - consume when the cache is \bold not under pressure. + consume when the cache is \b not under pressure. \a totalCapacity specifies the \e maximum number of bytes that the cache - should consume \bold overall. + should consume \b overall. The cache is enabled by default. Calling setObjectCacheCapacities(0, 0, 0) will disable the cache. Calling it with one non-zero enables it again. diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 175b43df2..d9c4ee953 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,316 @@ +2012-03-09 Jon Lee <jonlee@apple.com> + + Rename NotificationPresenter to NotificationClient + https://bugs.webkit.org/show_bug.cgi?id=80488 + <rdar://problem/10965558> + + Reviewed by Kentaro Hara. + + Refactor to use renamed WebCore::NotificationClient. + * WebCoreSupport/NotificationPresenterClientQt.cpp: + (WebCore::NotificationPresenterClientQt::checkPermission): + (WebCore::NotificationPresenterClientQt::allowNotificationForFrame): + * WebCoreSupport/NotificationPresenterClientQt.h: + (NotificationPresenterClientQt): + +2012-03-09 Emil A Eklund <eae@chromium.org> + + Add roundedPoint to HitTestResult and change platform code to use it + https://bugs.webkit.org/show_bug.cgi?id=80715 + + Reviewed by James Robinson. + + Change ports to use roundedPoint to avoid exposing subpixel types to + platform code. + + * Api/qwebframe.cpp: + (QWebHitTestResultPrivate::QWebHitTestResultPrivate): + +2012-03-09 Jon Lee <jonlee@apple.com> + + Add support for ENABLE(LEGACY_NOTIFICATIONS) + https://bugs.webkit.org/show_bug.cgi?id=80497 + + Reviewed by Adam Barth. + + Prep for b80472: Update API for Web Notifications + * examples/platformplugin/platformplugin.pro: + +2012-03-09 Csaba Osztrogonác <ossy@webkit.org> + + [Qt] Fix compilation without QtQuick1 + https://bugs.webkit.org/show_bug.cgi?id=80503 + + Qt 4.8 API test fix after r110050. + + Reviewed by Zoltan Herczeg. + + * declarative/public.pri: Add load(features) to ensure HAVE_QQUICK1=1 is set. + +2012-03-08 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + [Qt] Use Qt's module system for install rules and depending on QtWebKit + + Instead of rolling our own install rules we now use the same approach as + every other Qt module, by loading qt_module.prf and qt_module_config.prf. + + This ensures that we follow the same semantics as the rest of Qt on + what sort of config options are enabled by default (create_cmake eg.). + It also allows us to use QT += webkit instead of the workaround we had + with CONFIG += qtwebkit. + + We do however force Qt to always treat our build as a non-developer build, + so the libraries will end up in the WebKit lib directory instead of the + qtbase directory (as with a normal developer-build). This allows us to + keep the webkit-build self-contained. If Qt is a developer build we still + copy the module file manually to Qt, so that you don't have to install + WebKit to make it available. + + For non-developer builds of Qt, it is still possible to use the built + WebKit libraries without having to install them, by having the variable + QMAKE_EXTRA_MODULE_FORWARDS set in the project's .qmake.cache file, + pointing to $WEBKITOUTUTDIR/$CONFIGURATION/modules. + + https://bugs.webkit.org/show_bug.cgi?id=80590 + + Reviewed by Simon Hausmann. + + * declarative/experimental/experimental.pri: + * declarative/experimental/plugin.cpp: + * declarative/plugin.cpp: + * declarative/public.pri: + * tests/tests.pri: + +2012-03-08 Antti Koivisto <antti@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=80370 + Enable matched declaration caching for elements with a style attribute + + Reviewed by Andreas Kling + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + (QWebElement::setStyleProperty): + +2012-03-07 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Fix compilation without QtQuick1 + https://bugs.webkit.org/show_bug.cgi?id=80503 + + Reviewed by Tor Arne Vestbø. + + Compile and enable the QtQuick1/QML1 plugin and webview + only if we're using Qt 4 at the moment. QQuick1 clashes + with QQuick2 right now because both declare QDeclarativeEngine + and friends as classes. + + * declarative/plugin.cpp: + (WebKitQmlPlugin::registerTypes): + * declarative/public.pri: + * tests/tests.pri: + +2012-03-07 Kangil Han <kangil.han@samsung.com> + + [DRT] Remove PlainTextController implementations. + https://bugs.webkit.org/show_bug.cgi?id=79959 + + Reviewed by Hajime Morita. + + PlainTextController usages in existing tests have been + replaced by internals API by bug 78570. + So this patch will remove PlainTextController implementations + to avoid further usage in new tests. + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + * WebCoreSupport/DumpRenderTreeSupportQt.h: + +2012-03-06 Philippe Normand <pnormand@igalia.com> + + [GStreamer] disable GStreamerGWorld when building against 0.11 + https://bugs.webkit.org/show_bug.cgi?id=77088 + + Reviewed by Martin Robinson. + + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::ChromeClientQt): + (WebCore::ChromeClientQt::~ChromeClientQt): + (WebCore): + * WebCoreSupport/FullScreenVideoQt.cpp: + (WebCore): + (WebCore::FullScreenVideoQt::FullScreenVideoQt): + (WebCore::FullScreenVideoQt::~FullScreenVideoQt): + (WebCore::FullScreenVideoQt::enterFullScreenForNode): + (WebCore::FullScreenVideoQt::exitFullScreenForNode): + (WebCore::FullScreenVideoQt::isValid): + * WebCoreSupport/FullScreenVideoQt.h: + (WebCore): + +2012-03-03 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Fix static_libs_as_shared build + https://bugs.webkit.org/show_bug.cgi?id=80214 + + Reviewed by Tor Arne Vestbø. + + Add helper function to be called by WebProcess main + to potentially initialize the QStyle theme. + + * WebCoreSupport/InitWebCoreQt.cpp: + (WebKit): + (WebKit::initializeWebKit2Theme): + +2012-03-02 Casper van Donderen <casper.vandonderen@nokia.com> + + [Qt] Documentation cleanup + https://bugs.webkit.org/show_bug.cgi?id=80131 + + Reviewed by Simon Hausmann. + + QDoc uses different commands to do bold, lists, and italics. + This change updates the documentation accordingly. + QTBUG-24578 + + * Api/qwebframe.cpp: + * Api/qwebhistory.cpp: + * Api/qwebinspector.cpp: + * Api/qwebpage.cpp: + * Api/qwebpluginfactory.cpp: + * Api/qwebsettings.cpp: + * declarative/qdeclarativewebview.cpp: + * docs/qtwebkit-bridge.qdoc: + * docs/qtwebkit.qdoc: + * docs/qtwebkit.qdocconf: + +2012-03-02 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Build system cleanup + + Rubber-stamped by Antti Koivisto. + + * tests/MIMESniffing/MIMESniffing.pro: Don't link in WTFAssertions.cpp for ASSERT, now + that the symbols are properly exported with export macros from the DLL. + +2012-03-02 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Move QStyle theming code out of WebCore into WebKit1 + https://bugs.webkit.org/show_bug.cgi?id=80128 + + Reviewed by Kenneth Rohde Christiansen. + + Moved the bulk of the QStyle dependant code here, where it's okay to depend on QtWidgets/QStyle. + Install the QStyle factory functions in initWebCoreQt.cpp. + + * Api/qwebpage.cpp: + (QWebPage::swallowContextMenuEvent): + * WebCoreSupport/InitWebCoreQt.cpp: + (WebCore::initializeWebCoreQt): + * 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::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::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: Copied from Source/WebCore/platform/qt/ScrollbarThemeQt.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/ScrollbarThemeQt.h. + (WebCore): + (ScrollbarThemeQStyle): + +2012-02-27 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + [Qt] Move registration of experimental types to the proper plugin + https://bugs.webkit.org/show_bug.cgi?id=79706 + + Reviewed by Tor Arne Vestbø. + + * declarative/experimental/plugin.cpp: + * declarative/plugin.cpp: + (WebKitQmlPlugin::registerTypes): + +2012-02-28 Antti Koivisto <antti@apple.com> + + Try to fix build. + + Not reviewed. + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + +2012-02-26 Hajime Morrita <morrita@chromium.org> + + Move ChromeClient::showContextMenu() to ContextMenuClient + https://bugs.webkit.org/show_bug.cgi?id=79427 + + Reviewed by Adam Barth. + + * WebCoreSupport/ChromeClientQt.h: + (ChromeClientQt): + +2012-02-24 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] API: Unify the loading properties and signals. + https://bugs.webkit.org/show_bug.cgi?id=79486 + + Reviewed by Simon Hausmann. + + * declarative/plugin.cpp: + (WebKitQmlPlugin::registerTypes): + 2012-02-24 Holger Hans Peter Freyther <holger@moiji-mobile.com> [Qt] Build fix. macro "QSKIP" now only takes 1 argument on Qt5 diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index f129b5871..aee2cf8fc 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -73,7 +73,7 @@ #include <wtf/OwnPtr.h> #include <wtf/qt/UtilsQt.h> -#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) +#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT)) #include "FullScreenVideoQt.h" #include "HTMLMediaElement.h" #include "HTMLNames.h" @@ -90,7 +90,7 @@ bool ChromeClientQt::dumpVisitedLinksCallbacks = false; ChromeClientQt::ChromeClientQt(QWebPage* webPage) : m_webPage(webPage) , m_eventLoop(0) -#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) +#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT)) , m_fullScreenVideo(0) #endif { @@ -102,7 +102,7 @@ ChromeClientQt::~ChromeClientQt() if (m_eventLoop) m_eventLoop->exit(); -#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) +#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT)) delete m_fullScreenVideo; #endif } @@ -650,7 +650,7 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const } #endif -#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT)) +#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT)) FullScreenVideoQt* ChromeClientQt::fullScreenVideo() { if (!m_fullScreenVideo) diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 3d45b7b51..386b986d4 100644 --- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -138,9 +138,6 @@ public: #endif virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded); -#if ENABLE(CONTEXT_MENUS) - virtual void showContextMenu() { } -#endif #if USE(ACCELERATED_COMPOSITING) // This is a hook for WebCore to tell us what we need to do with the GraphicsLayers. diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 92c98cd37..457b49e26 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -992,15 +992,6 @@ void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& ti #endif } -QString DumpRenderTreeSupportQt::plainText(const QVariant& range) -{ - QMap<QString, QVariant> map = range.toMap(); - QVariant startContainer = map.value(QLatin1String("startContainer")); - map = startContainer.toMap(); - - return map.value(QLatin1String("innerText")).toString(); -} - QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping) { QVariantList res; diff --git a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 4b0314350..d949e5154 100644 --- a/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -167,7 +167,6 @@ public: static QString markerTextForListItem(const QWebElement& listItem); static QVariantMap computedStyleIncludingVisitedInfo(const QWebElement& element); - static QString plainText(const QVariant& rng); static void dumpFrameLoader(bool b); static void dumpProgressFinishedCallback(bool); diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp index 81d2720b5..3b244c657 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp @@ -47,7 +47,7 @@ namespace WebCore { -#if USE(GSTREAMER) +#if USE(GSTREAMER) && !defined(GST_API_VERSION_1) GStreamerFullScreenVideoHandler::GStreamerFullScreenVideoHandler() : m_videoElement(0) , m_fullScreenWidget(0) @@ -148,7 +148,7 @@ FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient) connect(m_FullScreenVideoHandler, SIGNAL(fullScreenClosed()), this, SLOT(aboutToClose())); #endif -#if USE(GSTREAMER) +#if USE(GSTREAMER) && !defined(GST_API_VERSION_1) m_FullScreenVideoHandlerGStreamer = new GStreamerFullScreenVideoHandler; #endif @@ -162,7 +162,7 @@ FullScreenVideoQt::~FullScreenVideoQt() #if USE(QT_MULTIMEDIA) delete m_FullScreenVideoHandler; #endif -#if USE(GSTREAMER) +#if USE(GSTREAMER) && !defined(GST_API_VERSION_1) delete m_FullScreenVideoHandlerGStreamer; #endif #if USE(QTKIT) @@ -192,7 +192,7 @@ void FullScreenVideoQt::enterFullScreenForNode(Node* node) m_FullScreenVideoHandler->enterFullScreen(mediaPlayerQt->mediaPlayer()); #endif -#if USE(GSTREAMER) +#if USE(GSTREAMER) && !defined(GST_API_VERSION_1) m_FullScreenVideoHandlerGStreamer->setVideoElement(m_videoElement); m_FullScreenVideoHandlerGStreamer->enterFullScreen(); #endif @@ -223,7 +223,7 @@ void FullScreenVideoQt::exitFullScreenForNode(Node* node) MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayer(); mediaPlayerQt->restoreVideoItem(); #endif -#if USE(GSTREAMER) +#if USE(GSTREAMER) && !defined(GST_API_VERSION_1) m_FullScreenVideoHandlerGStreamer->exitFullScreen(); #endif @@ -262,7 +262,7 @@ bool FullScreenVideoQt::isValid() const #if USE(QT_MULTIMEDIA) return m_FullScreenVideoHandler; #endif -#if USE(GSTREAMER) +#if USE(GSTREAMER) && !defined(GST_API_VERSION_1) return m_FullScreenVideoHandlerGStreamer; #elif USE(QTKIT) return m_FullScreenVideoHandlerQTKit; diff --git a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h index 06438ea46..6c7c7e926 100644 --- a/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h @@ -43,7 +43,7 @@ class QTKitFullScreenVideoHandler; #endif // We do not use ENABLE or USE because moc does not expand these macros. -#if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER +#if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER && !defined(GST_API_VERSION_1) class FullScreenVideoWindow; class GStreamerFullScreenVideoHandler : public QObject { diff --git a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp index 5cbd82c58..b09413345 100644 --- a/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp @@ -33,7 +33,9 @@ #include "Image.h" #include "NotImplemented.h" #include "PlatformStrategiesQt.h" +#include "RenderThemeQStyle.h" #include "ScriptController.h" +#include "ScrollbarThemeQStyle.h" #include "SecurityPolicy.h" #if USE(QTKIT) #include "WebSystemInterface.h" @@ -46,6 +48,17 @@ #include <runtime/InitializeThreading.h> #include <wtf/MainThread.h> +namespace WebKit { + +// Called also from WebKit2's WebProcess. +Q_DECL_EXPORT void initializeWebKit2Theme() +{ + if (qgetenv("QT_WEBKIT_THEME_NAME") == "qstyle") + WebCore::RenderThemeQt::setCustomTheme(WebCore::RenderThemeQStyle::create, new WebCore::ScrollbarThemeQStyle); +} + +} + namespace WebCore { void initializeWebCoreQt() @@ -62,6 +75,8 @@ void initializeWebCoreQt() PlatformStrategiesQt::initialize(); QtWebElementRuntime::initialize(); + RenderThemeQt::setCustomTheme(RenderThemeQStyle::create, new ScrollbarThemeQStyle); + #if USE(QTKIT) InitWebCoreSystemInterface(); #endif diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp index 8200664ad..00052184a 100644 --- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp @@ -337,9 +337,9 @@ void NotificationPresenterClientQt::requestPermission(ScriptExecutionContext* co } } -NotificationPresenter::Permission NotificationPresenterClientQt::checkPermission(ScriptExecutionContext* context) +NotificationClient::Permission NotificationPresenterClientQt::checkPermission(ScriptExecutionContext* context) { - return m_cachedPermissions.value(context, NotificationPresenter::PermissionNotAllowed); + return m_cachedPermissions.value(context, NotificationClient::PermissionNotAllowed); } void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionContext* context) @@ -367,7 +367,7 @@ void NotificationPresenterClientQt::cancelRequestsForPermission(ScriptExecutionC void NotificationPresenterClientQt::allowNotificationForFrame(Frame* frame) { - m_cachedPermissions.insert(frame->document(), NotificationPresenter::PermissionAllowed); + m_cachedPermissions.insert(frame->document(), NotificationClient::PermissionAllowed); QHash<ScriptExecutionContext*, CallbacksInfo>::iterator iter = m_pendingPermissionRequests.begin(); while (iter != m_pendingPermissionRequests.end()) { diff --git a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h index 77dcd3bc8..12b06fe9b 100644 --- a/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h @@ -33,7 +33,7 @@ #define NotificationPresenterClientQt_h #include "Notification.h" -#include "NotificationPresenter.h" +#include "NotificationClient.h" #include "QtPlatformPlugin.h" #include "Timer.h" @@ -81,18 +81,18 @@ public: typedef QHash <Notification*, NotificationWrapper*> NotificationsQueue; -class NotificationPresenterClientQt : public NotificationPresenter { +class NotificationPresenterClientQt : public NotificationClient { public: NotificationPresenterClientQt(); ~NotificationPresenterClientQt(); - /* WebCore::NotificationPresenter interface */ + /* WebCore::NotificationClient interface */ virtual bool show(Notification*); virtual void cancel(Notification*); virtual void notificationObjectDestroyed(Notification*); virtual void notificationControllerDestroyed(); virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<VoidCallback>); - virtual NotificationPresenter::Permission checkPermission(ScriptExecutionContext*); + virtual NotificationClient::Permission checkPermission(ScriptExecutionContext*); virtual void cancelRequestsForPermission(ScriptExecutionContext*); void cancel(NotificationWrapper*); @@ -125,7 +125,7 @@ private: QList<RefPtr<VoidCallback> > m_callbacks; }; QHash<ScriptExecutionContext*, CallbacksInfo > m_pendingPermissionRequests; - QHash<ScriptExecutionContext*, NotificationPresenter::Permission> m_cachedPermissions; + QHash<ScriptExecutionContext*, NotificationClient::Permission> m_cachedPermissions; NotificationsQueue m_notifications; QtPlatformPlugin m_platformPlugin; diff --git a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp new file mode 100644 index 000000000..ac42fdd8b --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.cpp @@ -0,0 +1,809 @@ +/* + * 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 "CSSStyleSelector.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_TAG) +#include "RenderProgress.h" +#endif +#include "RenderSlider.h" +#include "ScrollbarThemeQStyle.h" +#include "SliderThumbElement.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_TAG) +#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(); +} + +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().font()); + 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(CSSStyleSelector* selector, 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(selector->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(CSSStyleSelector* selector, RenderStyle* style, Element* element) const +{ + adjustTextFieldStyle(selector, 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)); +} + + +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(CSSStyleSelector* selector, 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(selector, 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_TAG) +double RenderThemeQStyle::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); +} + +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(CSSStyleSelector*, 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(CSSStyleSelector* selector, RenderStyle* style, Element* element) const +{ + RenderTheme::adjustSliderThumbStyle(selector, style, element); + style->setBoxShadow(nullptr); +} + +bool RenderThemeQStyle::paintSearchField(RenderObject* o, const PaintInfo& pi, + const IntRect& r) +{ + return paintTextField(o, pi, r); +} + +void RenderThemeQStyle::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, + Element* e) const +{ + notImplemented(); + RenderTheme::adjustSearchFieldDecorationStyle(selector, style, e); +} + +bool RenderThemeQStyle::paintSearchFieldDecoration(RenderObject* o, const PaintInfo& pi, + const IntRect& r) +{ + notImplemented(); + return RenderTheme::paintSearchFieldDecoration(o, pi, r); +} + +void RenderThemeQStyle::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* selector, RenderStyle* style, + Element* e) const +{ + notImplemented(); + RenderTheme::adjustSearchFieldResultsDecorationStyle(selector, 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) 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); +} + +} + +// vim: ts=4 sw=4 et diff --git a/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h new file mode 100644 index 000000000..a83e02f5a --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/RenderThemeQStyle.h @@ -0,0 +1,144 @@ +/* + * 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*) const; + + QStyle* qStyle() const; + +protected: + virtual void adjustButtonStyle(CSSStyleSelector*, 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(CSSStyleSelector*, RenderStyle*, Element*) const; + + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); + + virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + +#if ENABLE(PROGRESS_TAG) + // 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(CSSStyleSelector*, RenderStyle*, Element*) const; + + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual void adjustSliderThumbStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + + virtual bool paintSearchField(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintSearchFieldDecoration(RenderObject*, const PaintInfo&, const IntRect&); + + virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, 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; + +private: + ControlPart initializeCommonQStyleOptions(QStyleOption&, RenderObject*) const; + + void setButtonPadding(RenderStyle*) const; + + int findFrameLineWidth(QStyle*) const; + + QStyle* fallbackStyle() 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 new file mode 100644 index 000000000..b0827fea4 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.cpp @@ -0,0 +1,253 @@ +/* + * 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 new file mode 100644 index 000000000..2537b9ae4 --- /dev/null +++ b/Source/WebKit/qt/WebCoreSupport/ScrollbarThemeQStyle.h @@ -0,0 +1,63 @@ +/* + * 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 bbecabb5c..583726f62 100644 --- a/Source/WebKit/qt/declarative/experimental/experimental.pri +++ b/Source/WebKit/qt/declarative/experimental/experimental.pri @@ -24,9 +24,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols wince*:LIBS += $$QMAKE_LIBS_GUI -CONFIG += qtwebkit qtwebkit-private - -QT += declarative widgets network quick +QT += declarative widgets network quick webkit webkit-private DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} @@ -37,8 +35,8 @@ SOURCES += plugin.cpp DEFINES += HAVE_WEBKIT2 +# FIXME: Why are these needed, and why can't we use WEBKIT += ... ? INCLUDEPATH += \ - ../../../../WebKit2/UIProcess/API/qt \ ../../../../WebKit2/Shared/qt \ ../../../../JavaScriptCore \ ../../../../JavaScriptCore/wtf \ diff --git a/Source/WebKit/qt/declarative/experimental/plugin.cpp b/Source/WebKit/qt/declarative/experimental/plugin.cpp index da228521f..7d380e66a 100644 --- a/Source/WebKit/qt/declarative/experimental/plugin.cpp +++ b/Source/WebKit/qt/declarative/experimental/plugin.cpp @@ -19,14 +19,16 @@ #include "config.h" -#include "qquicknetworkreply_p.h" -#include "qquicknetworkrequest_p.h" -#include "qquickwebpage_p.h" -#include "qquickwebview_p.h" -#include "qwebdownloaditem_p.h" -#include "qwebviewportinfo_p.h" - -#include "qwebnavigationhistory_p.h" +#include "private/qquicknetworkreply_p.h" +#include "private/qquicknetworkrequest_p.h" +#include "private/qquickwebpage_p.h" +#include "private/qquickwebview_p.h" +#include "private/qtwebsecurityorigin_p.h" +#include "private/qwebdownloaditem_p.h" +#include "private/qwebnavigationhistory_p.h" +#include "private/qwebpermissionrequest_p.h" +#include "private/qwebpreferences_p.h" +#include "private/qwebviewportinfo_p.h" #include <QtDeclarative/qdeclarative.h> #include <QtDeclarative/qdeclarativeextensionplugin.h> @@ -54,6 +56,10 @@ public: qmlRegisterUncreatableType<QWebDownloadItem>(uri, 1, 0, "DownloadItem", QObject::tr("Cannot create separate instance of DownloadItem")); qmlRegisterUncreatableType<QWebNavigationListModel>(uri, 1, 0, "NavigationListModel", QObject::tr("Cannot create separate instance of NavigationListModel")); qmlRegisterUncreatableType<QWebNavigationHistory>(uri, 1, 0, "NavigationHistory", QObject::tr("Cannot create separate instance of NavigationHistory")); + qmlRegisterUncreatableType<QWebPreferences>(uri, 1, 0, "WebPreferences", QObject::tr("Cannot create separate instance of WebPreferences")); + qmlRegisterUncreatableType<QWebPermissionRequest>(uri, 1, 0, "PermissionRequest", QObject::tr("Cannot create separate instance of PermissionRequest")); + qmlRegisterUncreatableType<QtWebSecurityOrigin>(uri, 1, 0, "SecurityOrigin", QObject::tr("Cannot create separate instance of SecurityOrigin")); + qmlRegisterExtendedType<QQuickWebView, QQuickWebViewExperimentalExtension>(uri, 1, 0, "WebView"); qmlRegisterUncreatableType<QQuickWebViewExperimental>(uri, 1, 0, "WebViewExperimental", QObject::tr("Cannot create separate instance of WebViewExperimental")); diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp index e2f0fb3ec..968b1fe18 100644 --- a/Source/WebKit/qt/declarative/plugin.cpp +++ b/Source/WebKit/qt/declarative/plugin.cpp @@ -17,19 +17,19 @@ Boston, MA 02110-1301, USA. */ +#if defined(HAVE_QQUICK1) #include "qdeclarativewebview_p.h" +#endif #include <QtDeclarative/qdeclarative.h> #include <QtDeclarative/qdeclarativeextensionplugin.h> #if defined(HAVE_WEBKIT2) -#include "qquickwebpage_p.h" -#include "qquickwebview_p.h" -#include "qtwebsecurityorigin_p.h" -#include "qwebiconimageprovider_p.h" -#include "qwebnavigationrequest_p.h" -#include "qwebpermissionrequest_p.h" -#include "qwebpreferences_p.h" +#include "private/qquickwebpage_p.h" +#include "private/qquickwebview_p.h" +#include "private/qwebiconimageprovider_p.h" +#include "private/qwebloadrequest_p.h" +#include "private/qwebnavigationrequest_p.h" #include <QtDeclarative/qdeclarativeengine.h> #include <QtNetwork/qnetworkreply.h> @@ -51,6 +51,7 @@ public: virtual void registerTypes(const char* uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit")); +#if defined(HAVE_QQUICK1) qmlRegisterType<QDeclarativeWebSettings>(); qmlRegisterType<QDeclarativeWebView>(uri, 1, 0, "WebView"); #ifdef Q_REVISION @@ -58,16 +59,14 @@ public: qmlRegisterRevision<QDeclarativeWebView, 0>("QtWebKit", 1, 0); qmlRegisterRevision<QDeclarativeWebView, 1>("QtWebKit", 1, 1); #endif +#endif #if defined(HAVE_WEBKIT2) qmlRegisterType<QQuickWebView>(uri, 3, 0, "WebView"); - qmlRegisterUncreatableType<QWebPreferences>(uri, 3, 0, "WebPreferences", QObject::tr("Cannot create separate instance of WebPreferences")); qmlRegisterUncreatableType<QQuickWebPage>(uri, 3, 0, "WebPage", QObject::tr("Cannot create separate instance of WebPage, use WebView")); qmlRegisterUncreatableType<QNetworkReply>(uri, 3, 0, "NetworkReply", QObject::tr("Cannot create separate instance of NetworkReply")); - qmlRegisterUncreatableType<QWebPermissionRequest>(uri, 3, 0, "PermissionRequest", QObject::tr("Cannot create separate instance of PermissionRequest")); qmlRegisterUncreatableType<QWebNavigationRequest>(uri, 3, 0, "NavigationRequest", QObject::tr("Cannot create separate instance of NavigationRequest")); - qmlRegisterUncreatableType<QtWebSecurityOrigin>(uri, 3, 0, "SecurityOrigin", QObject::tr("Cannot create separate instance of SecurityOrigin")); - + qmlRegisterUncreatableType<QWebLoadRequest>(uri, 3, 0, "WebLoadRequest", QObject::tr("Cannot create separate instance of WebLoadRequest")); #endif } }; @@ -77,4 +76,3 @@ QT_END_NAMESPACE #include "plugin.moc" Q_EXPORT_PLUGIN2(qmlwebkitplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); - diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index a6665eda6..e389e38eb 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -11,6 +11,8 @@ TARGET.module_name = QtWebKit CONFIG += qt plugin +load(features) + QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir copy2build.input = QMLDIRFILE copy2build.output = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}/qmldir @@ -24,24 +26,27 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols wince*:LIBS += $$QMAKE_LIBS_GUI -CONFIG += qtwebkit qtwebkit-private +QT += declarative webkit webkit-private +haveQt(5): QT += widgets quick -QT += declarative -haveQt(5): QT += widgets quick quick1 +contains(DEFINES, HAVE_QQUICK1=1) { + SOURCES += qdeclarativewebview.cpp + HEADERS += qdeclarativewebview_p.h +} DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} CONFIG += rpath RPATHDIR_RELATIVE_TO_DESTDIR = ../../lib +# FIXME: Why are these needed, and why can't we use WEBKIT += ... ? INCLUDEPATH += \ ../../../WebKit2/Shared/qt \ ../../../JavaScriptCore \ ../../../JavaScriptCore/runtime \ ../../../JavaScriptCore/wtf -SOURCES += qdeclarativewebview.cpp plugin.cpp -HEADERS += qdeclarativewebview_p.h +SOURCES += plugin.cpp !no_webkit2: { DEFINES += HAVE_WEBKIT2 diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp index abf9bb218..d184c087e 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp +++ b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp @@ -162,7 +162,7 @@ bool GraphicsWebView::sceneEvent(QEvent *event) This type is made available by importing the \c QtWebKit module: - \bold{import QtWebKit 1.0} + \b{import QtWebKit 1.0} The WebView item includes no scrolling, scaling, toolbars, or other common browser components. These must be implemented around WebView. See the \l{QML Web Browser} @@ -577,11 +577,11 @@ void QDeclarativeWebView::setRenderingEnabled(bool enabled) Finds a zoom that: \list - \i shows a whole item - \i includes (\a clickX, \a clickY) - \i fits into the preferredWidth and preferredHeight - \i zooms by no more than \a maxZoom - \i is more than 10% above the current zoom + \li shows a whole item + \li includes (\a clickX, \a clickY) + \li fits into the preferredWidth and preferredHeight + \li zooms by no more than \a maxZoom + \li is more than 10% above the current zoom \endlist If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, diff --git a/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc b/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc index 877eb4d33..807cdaec0 100644 --- a/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc +++ b/Source/WebKit/qt/docs/qtwebkit-bridge.qdoc @@ -79,20 +79,20 @@ with the QtWebKit bridge: \list - \i \bold{Hybrid C++/script}: C++ application code connects a + \li \b{Hybrid C++/script}: C++ application code connects a signal to a script function. This approach is useful if you have a QObject but don't want to expose the object itself to the scripting environment. You just want to define how the script responds to a signal and leave it up to the C++ side of your application to establish the connection between the C++ signal and the JavaScript slot. - \i \bold{Hybrid script/C++}: A script can connect signals and slots + \li \b{Hybrid script/C++}: A script can connect signals and slots to establish connections between pre-defined objects that the application exposes to the scripting environment. In this scenario, the slots themselves are still written in C++, but the definition of the connections is fully dynamic (script-defined). - \i \bold{Purely script-defined}: A script can both define signal + \li \b{Purely script-defined}: A script can both define signal handler functions (effectively "slots written in JavaScript"), \e{and} set up the connections that utilize those handlers. For example, a script can define a function that will handle the diff --git a/Source/WebKit/qt/docs/qtwebkit.qdoc b/Source/WebKit/qt/docs/qtwebkit.qdoc index 710d19478..f8cd8e702 100644 --- a/Source/WebKit/qt/docs/qtwebkit.qdoc +++ b/Source/WebKit/qt/docs/qtwebkit.qdoc @@ -106,54 +106,54 @@ The following locations are searched for plugins: \table - \header \o Linux/Unix (X11) - \row \o + \header \li Linux/Unix (X11) + \row \li \list - \o \c{.mozilla/plugins} in the user's home directory - \o \c{.netscape/plugins} in the user's home directory - \o System locations, such as + \li \c{.mozilla/plugins} in the user's home directory + \li \c{.netscape/plugins} in the user's home directory + \li System locations, such as \list - \o \c{/usr/lib/browser/plugins} - \o \c{/usr/local/lib/mozilla/plugins} - \o \c{/usr/lib/firefox/plugins} - \o \c{/usr/lib64/browser-plugins} - \o \c{/usr/lib/browser-plugins} - \o \c{/usr/lib/mozilla/plugins} - \o \c{/usr/local/netscape/plugins} - \o \c{/opt/mozilla/plugins} - \o \c{/opt/mozilla/lib/plugins} - \o \c{/opt/netscape/plugins} - \o \c{/opt/netscape/communicator/plugins} - \o \c{/usr/lib/netscape/plugins} - \o \c{/usr/lib/netscape/plugins-libc5} - \o \c{/usr/lib/netscape/plugins-libc6} - \o \c{/usr/lib64/netscape/plugins} - \o \c{/usr/lib64/mozilla/plugins} + \li \c{/usr/lib/browser/plugins} + \li \c{/usr/local/lib/mozilla/plugins} + \li \c{/usr/lib/firefox/plugins} + \li \c{/usr/lib64/browser-plugins} + \li \c{/usr/lib/browser-plugins} + \li \c{/usr/lib/mozilla/plugins} + \li \c{/usr/local/netscape/plugins} + \li \c{/opt/mozilla/plugins} + \li \c{/opt/mozilla/lib/plugins} + \li \c{/opt/netscape/plugins} + \li \c{/opt/netscape/communicator/plugins} + \li \c{/usr/lib/netscape/plugins} + \li \c{/usr/lib/netscape/plugins-libc5} + \li \c{/usr/lib/netscape/plugins-libc6} + \li \c{/usr/lib64/netscape/plugins} + \li \c{/usr/lib64/mozilla/plugins} \endlist - \o Locations specified by environment variables: + \li Locations specified by environment variables: \list - \o \c{$MOZILLA_HOME/plugins} - \o \c{$MOZ_PLUGIN_PATH} - \o \c{$QTWEBKIT_PLUGIN_PATH} + \li \c{$MOZILLA_HOME/plugins} + \li \c{$MOZ_PLUGIN_PATH} + \li \c{$QTWEBKIT_PLUGIN_PATH} \endlist \endlist \endtable \table - \header \o Windows - \row \o + \header \li Windows + \row \li \list - \o The user's \c{Application Data\Mozilla\plugins} directory - \o Standard system locations of plugins for Quicktime, Flash, etc. + \li The user's \c{Application Data\Mozilla\plugins} directory + \li Standard system locations of plugins for Quicktime, Flash, etc. \endlist \endtable \table - \header \o Mac OS X - \row \o + \header \li Mac OS X + \row \li \list - \o \c{Library/Internet Plug-Ins} in the user's home directory - \o The system \c{/Library/Internet Plug-Ins} directory + \li \c{Library/Internet Plug-Ins} in the user's home directory + \li The system \c{/Library/Internet Plug-Ins} directory \endlist \endtable diff --git a/Source/WebKit/qt/docs/qtwebkit.qdocconf b/Source/WebKit/qt/docs/qtwebkit.qdocconf index 4f11d18bb..278d77ba8 100644 --- a/Source/WebKit/qt/docs/qtwebkit.qdocconf +++ b/Source/WebKit/qt/docs/qtwebkit.qdocconf @@ -17,17 +17,17 @@ indexes = $QTDIR/doc/html/qt.index macro.aring.HTML = "å" macro.Auml.HTML = "Ä" -macro.author = "\\bold{Author:}" +macro.author = "\\b{Author:}" macro.br.HTML = "<br />" macro.BR.HTML = "<br />" macro.aacute.HTML = "á" macro.eacute.HTML = "é" macro.iacute.HTML = "í" -macro.gui = "\\bold" +macro.gui = "\\b" macro.hr.HTML = "<hr />" -macro.key = "\\bold" -macro.menu = "\\bold" -macro.note = "\\bold{Note:}" +macro.key = "\\b" +macro.menu = "\\b" +macro.note = "\\b{Note:}" macro.oslash.HTML = "ø" macro.ouml.HTML = "ö" macro.QA = "\\e{Qt Assistant}" @@ -50,24 +50,24 @@ macro.0 = "\\\\0" macro.b = "\\\\b" macro.n = "\\\\n" macro.r = "\\\\r" -macro.i = "\\o" -macro.i11 = "\\o{1,1}" -macro.i12 = "\\o{1,2}" -macro.i13 = "\\o{1,3}" -macro.i14 = "\\o{1,4}" -macro.i15 = "\\o{1,5}" -macro.i16 = "\\o{1,6}" -macro.i17 = "\\o{1,7}" -macro.i18 = "\\o{1,8}" -macro.i19 = "\\o{1,9}" -macro.i21 = "\\o{2,1}" -macro.i31 = "\\o{3,1}" -macro.i41 = "\\o{4,1}" -macro.i51 = "\\o{5,1}" -macro.i61 = "\\o{6,1}" -macro.i71 = "\\o{7,1}" -macro.i81 = "\\o{8,1}" -macro.i91 = "\\o{9,1}" +macro.i = "\\li" +macro.i11 = "\\li{1,1}" +macro.i12 = "\\li{1,2}" +macro.i13 = "\\li{1,3}" +macro.i14 = "\\li{1,4}" +macro.i15 = "\\li{1,5}" +macro.i16 = "\\li{1,6}" +macro.i17 = "\\li{1,7}" +macro.i18 = "\\li{1,8}" +macro.i19 = "\\li{1,9}" +macro.i21 = "\\li{2,1}" +macro.i31 = "\\li{3,1}" +macro.i41 = "\\li{4,1}" +macro.i51 = "\\li{5,1}" +macro.i61 = "\\li{6,1}" +macro.i71 = "\\li{7,1}" +macro.i81 = "\\li{8,1}" +macro.i91 = "\\li{9,1}" macro.img = "\\image" macro.endquote = "\\endquotation" diff --git a/Source/WebKit/qt/examples/platformplugin/platformplugin.pro b/Source/WebKit/qt/examples/platformplugin/platformplugin.pro index 896da8a3e..db3789958 100644 --- a/Source/WebKit/qt/examples/platformplugin/platformplugin.pro +++ b/Source/WebKit/qt/examples/platformplugin/platformplugin.pro @@ -31,4 +31,5 @@ HEADERS += \ qwebkitplatformplugin.h \ WebNotificationPresenter.h +!contains(DEFINES, ENABLE_LEGACY_NOTIFICATIONS=.): DEFINES += ENABLE_LEGACY_NOTIFICATIONS=1 !contains(DEFINES, ENABLE_NOTIFICATIONS=.): DEFINES += ENABLE_NOTIFICATIONS=1 diff --git a/Source/WebKit/qt/tests/MIMESniffing/MIMESniffing.pro b/Source/WebKit/qt/tests/MIMESniffing/MIMESniffing.pro index e960c0f6a..fe50f1b34 100644 --- a/Source/WebKit/qt/tests/MIMESniffing/MIMESniffing.pro +++ b/Source/WebKit/qt/tests/MIMESniffing/MIMESniffing.pro @@ -12,8 +12,4 @@ INCLUDEPATH += \ ../../../../JavaScriptCore \ ../../../../JavaScriptCore/runtime -debug { - SOURCES += ../../../../JavaScriptCore/wtf/Assertions.cpp -} - RESOURCES += resources.qrc diff --git a/Source/WebKit/qt/tests/tests.pri b/Source/WebKit/qt/tests/tests.pri index c4a5818f9..90c61f093 100644 --- a/Source/WebKit/qt/tests/tests.pri +++ b/Source/WebKit/qt/tests/tests.pri @@ -16,16 +16,10 @@ INCLUDEPATH += \ $$PWD \ $$PWD/../Api -QT += testlib network +QT += testlib network webkit haveQt(5): QT += widgets -CONFIG += qtwebkit - -haveQt(5) { - QT += declarative quick1 -} else { - contains(QT_CONFIG, declarative): QT += declarative -} +haveQt(4): haveQtModule(declarative): QT += declarative # This define is used by some tests to look up resources in the source tree DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\" |