From 8545436476497cf8aa9e7af46000f283cbbfb3d9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 12 Sep 2010 23:22:20 +0200 Subject: Updated WebKit to 715b53069911a31a559aa0b3d94ffc6a5ac20988 Sync with qtwebkit-2.0 branch * Includes Thiago's intel compiler fixes * Girish' Maemo5 local rendering fixes --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 57 +++++++++++ .../webkit/JavaScriptCore/bytecode/Opcode.h | 2 +- .../webkit/JavaScriptCore/jit/JITStubs.cpp | 97 +++++++++--------- src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h | 5 +- src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h | 2 +- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 102 +++++++++++++++++++ src/3rdparty/webkit/WebCore/WebCore.pro | 11 ++- src/3rdparty/webkit/WebCore/bridge/npapi.h | 31 ++++++ .../webkit/WebCore/plugins/PluginPackage.cpp | 2 +- src/3rdparty/webkit/WebCore/plugins/PluginView.cpp | 10 ++ src/3rdparty/webkit/WebCore/plugins/PluginView.h | 10 ++ .../webkit/WebCore/plugins/qt/PluginViewQt.cpp | 109 +++++++++++++++++++-- src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h | 4 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 77 +++++++++++++++ .../qt/WebCoreSupport/FrameLoaderClientQt.cpp | 17 +++- .../webkit/WebKit/qt/qt_webkit_version.pri | 4 +- 18 files changed, 473 insertions(+), 71 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 1148320..ae33228 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -460b651cbe4f6994b492ff08614e57b0e31a24c8 +715b53069911a31a559aa0b3d94ffc6a5ac20988 diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index 2be6f5a..9922da6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,60 @@ +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Reindent the asm code I've moved to inside the function + (previous commit) + + * jit/JITStubs.cpp: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Fix the JIT compilation with the Intel 32-bit C++ compiler. + + ICC doesn't understand the use of "asm" statements outside of + function bodies, so move the assembly code inside a dummy + function (and mark it so that the compiler doesn't remove it + altogether). + + Also removed the ".text" entry that I had added because now + the assembly code is properly inside a code section (fixes + compilation with -ffunction-sections). + + * jit/JITStubs.cpp: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Don't use __attribute__((may_alias)) with the Intel compiler, + as it doesn't understand it. + + * wtf/Vector.h: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Fix compilation with the Intel C++ compiler (11.1.072). + + Like RVCT, label pointers must be void*, not const void*. + + * bytecode/Opcode.h: + +2010-06-16 Thiago Macieira + + Reviewed by NOBODY (OOPS!). + + Add the WTF_COMPILER_INTEL for when the Intel compiler is used + for building. Usually, the Intel compiler masquerades as + another compiler in the system and gets away with it, but some + times specific fixes are required (such as when using language + extensions). + + * wtf/Platform.h: + 2010-07-08 Andreas Kling Reviewed by Oliver Hunt. diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 509daeb..f7f53fd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -206,7 +206,7 @@ namespace JSC { #undef VERIFY_OPCODE_ID #if HAVE(COMPUTED_GOTO) -#if COMPILER(RVCT) +#if COMPILER(RVCT) || COMPILER(INTEL) typedef void* Opcode; #else typedef const void* Opcode; diff --git a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp index e5fcdc4..23fcb96 100644 --- a/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/jit/JITStubs.cpp @@ -113,56 +113,59 @@ COMPILE_ASSERT(offsetof(struct JITStackFrame, savedEBX) == 0x3c, JITStackFrame_s COMPILE_ASSERT(offsetof(struct JITStackFrame, callFrame) == 0x58, JITStackFrame_callFrame_offset_matches_ctiTrampoline); COMPILE_ASSERT(offsetof(struct JITStackFrame, code) == 0x50, JITStackFrame_code_offset_matches_ctiTrampoline); -asm volatile ( -".text\n" -".globl " SYMBOL_STRING(ctiTrampoline) "\n" -HIDE_SYMBOL(ctiTrampoline) "\n" -SYMBOL_STRING(ctiTrampoline) ":" "\n" - "pushl %ebp" "\n" - "movl %esp, %ebp" "\n" - "pushl %esi" "\n" - "pushl %edi" "\n" - "pushl %ebx" "\n" - "subl $0x3c, %esp" "\n" - "movl $512, %esi" "\n" - "movl 0x58(%esp), %edi" "\n" - "call *0x50(%esp)" "\n" - "addl $0x3c, %esp" "\n" - "popl %ebx" "\n" - "popl %edi" "\n" - "popl %esi" "\n" - "popl %ebp" "\n" - "ret" "\n" -); - -asm volatile ( -".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" -HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" -SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" +static void __attribute__((used)) asm_wrapper() +{ + asm volatile ( + ".text\n" + ".globl " SYMBOL_STRING(ctiTrampoline) "\n" + HIDE_SYMBOL(ctiTrampoline) "\n" + SYMBOL_STRING(ctiTrampoline) ":" "\n" + "pushl %ebp" "\n" + "movl %esp, %ebp" "\n" + "pushl %esi" "\n" + "pushl %edi" "\n" + "pushl %ebx" "\n" + "subl $0x3c, %esp" "\n" + "movl $512, %esi" "\n" + "movl 0x58(%esp), %edi" "\n" + "call *0x50(%esp)" "\n" + "addl $0x3c, %esp" "\n" + "popl %ebx" "\n" + "popl %edi" "\n" + "popl %esi" "\n" + "popl %ebp" "\n" + "ret" "\n" + ); + + asm volatile ( + ".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n" + HIDE_SYMBOL(ctiVMThrowTrampoline) "\n" + SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n" #if !USE(JIT_STUB_ARGUMENT_VA_LIST) - "movl %esp, %ecx" "\n" + "movl %esp, %ecx" "\n" #endif - "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" - "addl $0x3c, %esp" "\n" - "popl %ebx" "\n" - "popl %edi" "\n" - "popl %esi" "\n" - "popl %ebp" "\n" - "ret" "\n" -); - -asm volatile ( -".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" -HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" -SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" - "addl $0x3c, %esp" "\n" - "popl %ebx" "\n" - "popl %edi" "\n" - "popl %esi" "\n" - "popl %ebp" "\n" - "ret" "\n" -); + "call " SYMBOL_STRING_RELOCATION(cti_vm_throw) "\n" + "addl $0x3c, %esp" "\n" + "popl %ebx" "\n" + "popl %edi" "\n" + "popl %esi" "\n" + "popl %ebp" "\n" + "ret" "\n" + ); + asm volatile ( + ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n" + HIDE_SYMBOL(ctiOpThrowNotCaught) "\n" + SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n" + "addl $0x3c, %esp" "\n" + "popl %ebx" "\n" + "popl %edi" "\n" + "popl %esi" "\n" + "popl %ebp" "\n" + "ret" "\n" + ); +} + #elif COMPILER(GCC) && CPU(X86_64) #if USE(JIT_STUB_ARGUMENT_VA_LIST) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index 84b6153..15f0ffc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -99,7 +99,10 @@ #undef _WIN32 #endif - +/* COMPILER(INTEL) - Intel C++ Compiler */ +#if defined(__INTEL_COMPILER) +#define WTF_COMPILER_INTEL 1 +#endif /* ==== CPU() - the target CPU architecture ==== */ diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index 4d9ea61..c267050 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -49,7 +49,7 @@ namespace WTF { #error WTF_ALIGN macros need alignment control. #endif - #if COMPILER(GCC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) + #if COMPILER(GCC) && !COMPILER(INTEL) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) typedef char __attribute__((__may_alias__)) AlignedBufferChar; #else typedef char AlignedBufferChar; diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index aff3f2a..f919bdf 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 460b651cbe4f6994b492ff08614e57b0e31a24c8 + 715b53069911a31a559aa0b3d94ffc6a5ac20988 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 98d4d51..2d20cbd 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,105 @@ +2010-09-09 Kristian Amlie + + Reviewed by Andreas Kling. + + [Qt] Fixed incorrect Symbian scoping. + + The missing install functionality is only true for mmp based systems. + + https://bugs.webkit.org/show_bug.cgi?id=45268 + + * WebCore.pro: + +2010-09-12 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + [Qt] fix qt_webkit_version.pri install for in-Qt builds + + Always add the target, even if building inside Qt - as opposed to the + headers and libraries, there are no rules for that coming from + qbase.pri. + + Task-number: QTBUG-13306 + + * WebCore.pro: + +2010-09-12 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + [Qt] Let QtWebKit inject itself into the qt configuration + + i.e., don't explicitly deal with qt_webkit_version.pri outside of the + webkit source directory. + + Task-number: QTBUG-12379 + + * WebCore.pro: + +2010-08-20 Girish Ramakrishnan + + Reviewed by Ariya Hidayat. + + [Qt] When using the raster graphics system on Maemo5, allow + Flash to render directly into the raster window surface. + wmode=transparent is now supported as a result of this change. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::paintUsingImageSurfaceExtension): + +2010-08-18 Girish Ramakrishnan + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Implement Maemo5 local rendering NPAPI extension. See + https://wiki.mozilla.org/Plugins:NokiaMaemoImageSurface for details. + + With the local rendering extension, Flash will paint into a 16-bit surface. + For wmode=transparent, Flash expects the surface to contain the contents + beneath it. As it is tricky to implement the content propagation across all + graphics systems, transparent Flash is not supported. We just fill the surface + with white and wmode=transparent behaves the same as wmode=opaque with a white + background. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCore.pro: + * plugins/PluginView.cpp: + (WebCore::PluginView::setValue): + (WebCore::PluginView::PluginView): + * plugins/PluginView.h: + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::paintUsingImageSurfaceExtension): + (WebCore::PluginView::paint): + (WebCore::PluginView::platformGetValueStatic): + +2010-08-17 Girish Ramakrishnan + + Reviewed by Antonio Gomes. + + [Qt] On Maemo5, there is no libgdk-x11-2.0.so symlink. Look for + libgdk-x11-2.0.so.0 instead on X11 and Maemo5. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/qt/PluginViewQt.cpp: + (WebCore::getPluginDisplay): + +2010-08-17 Girish Ramakrishnan + + Reviewed by Kenneth Rohde Christiansen. + Set PluginQuirkRequiresDefaultScreenDepth for all Flash versions and not + just Flash 10. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * plugins/PluginPackage.cpp: + (WebCore::PluginPackage::determineQuirks): + 2010-08-10 Tor Arne Vestbø Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 5ea1e77..87638a0 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -2192,6 +2192,9 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) { CONFIG += x11 LIBS += -lXrender } + maemo5 { + DEFINES += MOZ_PLATFORM_MAEMO=5 + } SOURCES += \ plugins/qt/PluginContainerQt.cpp \ plugins/qt/PluginPackageQt.cpp \ @@ -2857,13 +2860,13 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { } } -!symbian-abld:!symbian-sbsv2 { +!symbian { modfile.files = $$moduleFile modfile.path = $$[QMAKE_MKSPECS]/modules INSTALLS += modfile } else { - # INSTALLS is not implemented in qmake's mmp generators, copy headers manually + # INSTALLS is not implemented in qmake's s60 generators, copy headers manually inst_modfile.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} inst_modfile.input = moduleFile @@ -2883,7 +2886,7 @@ HEADERS += $$WEBKIT_API_HEADERS exists($$OUTPUT_DIR/include/QtWebKit/classheaders.pri): include($$OUTPUT_DIR/include/QtWebKit/classheaders.pri) WEBKIT_INSTALL_HEADERS = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS - !symbian { + !symbian-abld:!symbian-sbsv2 { headers.files = $$WEBKIT_INSTALL_HEADERS !isEmpty(INSTALL_HEADERS): headers.path = $$INSTALL_HEADERS/QtWebKit @@ -2894,7 +2897,7 @@ HEADERS += $$WEBKIT_API_HEADERS INSTALLS += target headers } else { - # INSTALLS is not implemented in qmake's s60 generators, copy headers manually + # INSTALLS is not implemented in qmake's mmp generators, copy headers manually inst_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} inst_headers.input = WEBKIT_INSTALL_HEADERS inst_headers.CONFIG = no_clean diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index 533fcba..daa3a36 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -247,6 +247,12 @@ typedef struct _NPRect } NPRect; +typedef struct _NPSize +{ + int32 width; + int32 height; +} NPSize; + #ifdef XP_UNIX /* * Unix specific structures and definitions @@ -373,6 +379,11 @@ typedef enum { /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ NPPVpluginCoreAnimationLayer = 1003 #endif + + +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + NPPVpluginWindowlessLocalBool = 2002 +#endif } NPPVariable; /* @@ -419,6 +430,9 @@ typedef enum { , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ #endif /* XP_MACOSX */ +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , NPNVSupportsWindowlessLocal = 2002 +#endif } NPNVariable; typedef enum { @@ -539,6 +553,23 @@ typedef struct _NPWindow } NPWindow; +typedef struct _NPImageExpose +{ + char* data; /* image pointer */ + int32 stride; /* Stride of data image pointer */ + int32 depth; /* Depth of image pointer */ + int32 x; /* Expose x */ + int32 y; /* Expose y */ + uint32 width; /* Expose width */ + uint32 height; /* Expose height */ + NPSize dataSize; /* Data buffer size */ + float translateX; /* translate X matrix value */ + float translateY; /* translate Y matrix value */ + float scaleX; /* scale X matrix value */ + float scaleY; /* scale Y matrix value */ +} NPImageExpose; + + typedef struct _NPFullPrint { NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */ diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp index ad03ecd..3881f54 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginPackage.cpp @@ -185,12 +185,12 @@ void PluginPackage::determineQuirks(const String& mimeType) #if PLATFORM(QT) m_quirks.add(PluginQuirkRequiresGtkToolKit); #endif - m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); } else { // Flash 9 and older requests windowless plugins if we return a mozilla user agent m_quirks.add(PluginQuirkWantsMozillaUserAgent); } + m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); m_quirks.add(PluginQuirkThrottleInvalidate); m_quirks.add(PluginQuirkThrottleWMUserPlusOneMessages); m_quirks.add(PluginQuirkFlashURLNotifyBug); diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp index df9a29b..b8b2f2f 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2010 Girish Ramakrishnan * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -679,6 +680,12 @@ NPError PluginView::setValue(NPPVariable variable, void* value) } #endif // defined(XP_MACOSX) +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + case NPPVpluginWindowlessLocalBool: + m_renderToImage = true; + return NPERR_NO_ERROR; +#endif + default: notImplemented(); return NPERR_GENERIC_ERROR; @@ -852,6 +859,9 @@ PluginView::PluginView(Frame* parentFrame, const IntSize& size, PluginPackage* p , m_colormap(0) , m_pluginDisplay(0) #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + , m_renderToImage(false) +#endif , m_loadManually(loadManually) , m_manualStream(0) , m_isJavaScriptPaused(false) diff --git a/src/3rdparty/webkit/WebCore/plugins/PluginView.h b/src/3rdparty/webkit/WebCore/plugins/PluginView.h index 51b2127..f346134 100644 --- a/src/3rdparty/webkit/WebCore/plugins/PluginView.h +++ b/src/3rdparty/webkit/WebCore/plugins/PluginView.h @@ -54,6 +54,10 @@ typedef PlatformWidget PlatformPluginWidget; #include #endif #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +#include +class QPainter; +#endif namespace JSC { namespace Bindings { @@ -371,6 +375,12 @@ private: void initXEvent(XEvent* event); #endif +#if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + QImage m_image; + bool m_renderToImage; + void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect); +#endif + IntRect m_clipRect; // The clip rect to apply to a windowed plug-in IntRect m_windowRect; // Our window rect. diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index fb88b87..8dadc11 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -110,12 +110,20 @@ void PluginView::updatePluginWidget() return; if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) { - if (m_drawable) - XFreePixmap(QX11Info::display(), m_drawable); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + // On Maemo5, Flash always renders to 16-bit buffer + if (m_renderToImage) + m_image = QImage(m_windowRect.width(), m_windowRect.height(), QImage::Format_RGB16); + else +#endif + { + if (m_drawable) + XFreePixmap(QX11Info::display(), m_drawable); - m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), - ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); - QApplication::syncX(); // make sure that the server knows about the Drawable + m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), + ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); + QApplication::syncX(); // make sure that the server knows about the Drawable + } } // do not call setNPWindowIfNeeded immediately, will be called on paint() @@ -154,6 +162,71 @@ void PluginView::hide() Widget::hide(); } +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) +void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect) +{ + NPImageExpose imageExpose; + QPoint offset; + QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); + const bool surfaceHasUntransformedContents = client && qobject_cast(client->pluginParent()); + + QPaintDevice* surface = QPainter::redirected(painter->device(), &offset); + + // If the surface is a QImage, we can render directly into it + if (surfaceHasUntransformedContents && surface && surface->devType() == QInternal::Image) { + QImage* image = static_cast(surface); + offset = -offset; // negating the offset gives us the offset of the view within the surface + imageExpose.data = reinterpret_cast(image->bits()); + imageExpose.dataSize.width = image->width(); + imageExpose.dataSize.height = image->height(); + imageExpose.stride = image->bytesPerLine(); + imageExpose.depth = image->depth(); // this is guaranteed to be 16 on Maemo5 + imageExpose.translateX = offset.x() + m_windowRect.x(); + imageExpose.translateY = offset.y() + m_windowRect.y(); + imageExpose.scaleX = 1; + imageExpose.scaleY = 1; + } else { + if (m_isTransparent) { + // On Maemo5, Flash expects the buffer to contain the contents that are below it. + // We don't support transparency for non-raster graphicssystem, so clean the image + // before giving to Flash. + QPainter imagePainter(&m_image); + imagePainter.fillRect(exposedRect, Qt::white); + } + + imageExpose.data = reinterpret_cast(m_image.bits()); + imageExpose.dataSize.width = m_image.width(); + imageExpose.dataSize.height = m_image.height(); + imageExpose.stride = m_image.bytesPerLine(); + imageExpose.depth = m_image.depth(); + imageExpose.translateX = 0; + imageExpose.translateY = 0; + imageExpose.scaleX = 1; + imageExpose.scaleY = 1; + } + imageExpose.x = exposedRect.x(); + imageExpose.y = exposedRect.y(); + imageExpose.width = exposedRect.width(); + imageExpose.height = exposedRect.height(); + + XEvent xevent; + memset(&xevent, 0, sizeof(XEvent)); + XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; + exposeEvent.type = GraphicsExpose; + exposeEvent.display = 0; + exposeEvent.drawable = reinterpret_cast(&imageExpose); + exposeEvent.x = exposedRect.x(); + exposeEvent.y = exposedRect.y(); + exposeEvent.width = exposedRect.width(); + exposeEvent.height = exposedRect.height(); + + dispatchNPEvent(xevent); + + if (!surfaceHasUntransformedContents || !surface || surface->devType() != QInternal::Image) + painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect); +} +#endif + void PluginView::paint(GraphicsContext* context, const IntRect& rect) { if (!m_isStarted) { @@ -166,19 +239,32 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect) setNPWindowIfNeeded(); - if (m_isWindowed || !m_drawable) + if (m_isWindowed) return; - const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); + if (!m_drawable +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + && m_image.isNull() +#endif + ) + return; QPainter* painter = context->platformContext(); IntRect exposedRect(rect); exposedRect.intersect(frameRect()); exposedRect.move(-frameRect().x(), -frameRect().y()); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + if (!m_image.isNull()) { + paintUsingImageSurfaceExtension(painter, exposedRect); + return; + } +#endif + QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; ASSERT(drawableDepth == qtDrawable.depth()); + const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); // When printing, Qt uses a QPicture to capture the output in preview mode. The // QPicture holds a reference to the X Pixmap. As a result, the print preview would @@ -576,6 +662,13 @@ bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPErr *result = NPERR_NO_ERROR; return true; +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + case NPNVSupportsWindowlessLocal: + *static_cast(value) = true; + *result = NPERR_NO_ERROR; + return true; +#endif + default: return false; } @@ -651,7 +744,7 @@ static Display *getPluginDisplay() // support gdk based plugins (like flash) that use a different X connection. // The code below has the same effect as this one: // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default()); - QLibrary library("libgdk-x11-2.0"); + QLibrary library("libgdk-x11-2.0.so.0"); if (!library.load()) return 0; diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h index 665bf1b..63d9e55 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h @@ -22,9 +22,9 @@ #include -#define QTWEBKIT_VERSION_STR "2.0.0" +#define QTWEBKIT_VERSION_STR "2.0.1" // QTWEBKIT_VERSION is (major << 16) + (minor << 8) + patch. Similar to Qt. -#define QTWEBKIT_VERSION 0x020000 +#define QTWEBKIT_VERSION 0x020001 // Use: #if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 0, 0)). Similar to Qt. #define QTWEBKIT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 5083ba5..c6c3d72 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,80 @@ +2010-09-12 Martin Smith + + Reviewed by Simon Hausmann. + + doc: Changed the title so lists of contents sort better. + + * docs/qtwebkit.qdoc: + +2010-09-12 David Boddie + + Reviewed by Simon Hausmann. + + Doc: More work on the QML documentation. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Martin Jones + + Reviewed by Simon Hausmann. + + [Qml] Ensure WebView gets focus when an editable node is clicked on. + + Task-number: QTBUG-13342 + + * declarative/qdeclarativewebview.cpp: + (GraphicsWebView::mousePressEvent): + +2010-09-12 David Boddie + + Reviewed by Simon Hausmann. + + Doc: qdoc fixes. + + * declarative/qdeclarativewebview.cpp: + +2010-09-12 Oswald Buddenhagen + + Reviewed by Simon Hausmann. + + [Qt] let WebKit inject itself into the qt configuration + + Task-number: QTBUG-12379 + + * qt_webkit_version.pri: Use the faster + instead of * + operator to add webkit to the config. + +2010-09-12 Martin Smith + + Reviewed by Simon Hausmann. + + [Qt] Fix group of declarative web view in QML docs. + + * declarative/qdeclarativewebview.cpp: + +2010-08-20 Girish Ramakrishnan + + Reviewed by Ariya Hidayat. + + [Qt] Allow wmode=transparent in QWebView on Maemo5 after r65775. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + +2010-08-19 Girish Ramakrishnan + + Reviewed by Kenneth Christiansen. + + [Qt] Inject wmode=opaque for both QWebView and QGraphicsWebView on Maemo5 + as Flash XEmbed support is flaky. + + https://bugs.webkit.org/show_bug.cgi?id=44043 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::createPlugin): + 2010-08-05 David Leong Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 713fa39..dcbf614 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) * Copyright (C) 2008 Collabora Ltd. All rights reserved. * Coypright (C) 2008 Holger Hans Peter Freyther - * Coypright (C) 2009 Girish Ramakrishnan + * Coypright (C) 2009, 2010 Girish Ramakrishnan * * All rights reserved. * @@ -1349,7 +1349,19 @@ PassRefPtr FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Vector values = paramValues; if (mimeType == "application/x-shockwave-flash") { QWebPageClient* client = m_webFrame->page()->d->client; - if (!client || !qobject_cast(client->pluginParent())) { + const bool isQWebView = client && qobject_cast(client->pluginParent()); +#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) + size_t wmodeIndex = params.find("wmode"); + if (wmodeIndex == -1) { + // Disable XEmbed mode and force it to opaque mode + params.append("wmode"); + values.append("opaque"); + } else if (!isQWebView) { + // Disable transparency if client is not a QWebView + values[wmodeIndex] = "opaque"; + } +#else + if (!isQWebView) { // inject wmode=opaque when there is no client or the client is not a QWebView size_t wmodeIndex = params.find("wmode"); if (wmodeIndex == -1) { @@ -1358,6 +1370,7 @@ PassRefPtr FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, } else values[wmodeIndex] = "opaque"; } +#endif } RefPtr pluginView = PluginView::create(m_frame, pluginSize, element, url, diff --git a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri index 4594d1e..f2282f8 100644 --- a/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri +++ b/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri @@ -1,5 +1,5 @@ -QT_WEBKIT_VERSION = 4.7.0 +QT_WEBKIT_VERSION = 4.7.1 QT_WEBKIT_MAJOR_VERSION = 4 QT_WEBKIT_MINOR_VERSION = 7 -QT_WEBKIT_PATCH_VERSION = 0 +QT_WEBKIT_PATCH_VERSION = 1 QT_CONFIG += webkit -- cgit v0.12 From b04672e479ae245063e641c77d43e311c0851dc0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 09:32:42 +1000 Subject: Fix slot naming clash Reviewed-by: David Boddie --- src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp | 4 ++-- src/imports/folderlistmodel/qdeclarativefolderlistmodel.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp index 4983840..abab33c 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp @@ -167,7 +167,7 @@ QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) connect(&d->model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)) , this, SLOT(removed(const QModelIndex&,int,int))); connect(&d->model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)) - , this, SLOT(dataChanged(const QModelIndex&,const QModelIndex&))); + , this, SLOT(handleDataChanged(const QModelIndex&,const QModelIndex&))); connect(&d->model, SIGNAL(modelReset()), this, SLOT(refresh())); connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); } @@ -363,7 +363,7 @@ void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, i } } -void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end) +void QDeclarativeFolderListModel::handleDataChanged(const QModelIndex &start, const QModelIndex &end) { if (start.parent() == d->folderIndex) emit dataChanged(index(start.row(),0), index(end.row(),0)); diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h index 1bab5f84..24edecd 100644 --- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h +++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h @@ -138,7 +138,7 @@ private Q_SLOTS: void refresh(); void inserted(const QModelIndex &index, int start, int end); void removed(const QModelIndex &index, int start, int end); - void dataChanged(const QModelIndex &start, const QModelIndex &end); + void handleDataChanged(const QModelIndex &start, const QModelIndex &end); private: Q_DISABLE_COPY(QDeclarativeFolderListModel) -- cgit v0.12 From a39285f6f5c3355d48810851a7215b951f1aaa4c Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 13 Sep 2010 09:44:06 +1000 Subject: Fix compilation of QEgl with EGL 1.1 and older. Reviewed-by: Sarah Smith --- src/gui/egl/qegl.cpp | 2 +- src/gui/egl/qegl_p.h | 4 ++++ src/gui/egl/qeglproperties.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 605b1e6..af3b79a 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -259,7 +259,7 @@ EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options) // Add paint engine requirements if (api == OpenVG) { -#ifndef QVG_SCISSOR_CLIP +#if !defined(QVG_SCISSOR_CLIP) && defined(EGL_ALPHA_MASK_SIZE) configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1); #endif } else { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index c214e88..aa08934 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -65,6 +65,10 @@ QT_BEGIN_INCLUDE_NAMESPACE #else # include #endif +#if !defined(EGL_VERSION_1_2) +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#endif #else //types from egltypes.h for compiling stub without EGL headers diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 3638de5..eeae06d 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -241,8 +241,10 @@ void QEglProperties::setRenderableType(QEgl::API api) // reductions in complexity are possible. bool QEglProperties::reduceConfiguration() { +#ifdef EGL_SWAP_BEHAVIOR if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE) removeValue(EGL_SWAP_BEHAVIOR); +#endif #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't -- cgit v0.12 From 90c8a68eef4a87209279f4c528c540efe6525384 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 10:54:25 +1000 Subject: Ensure flickable velocity is updated when view is moved by setCurrentIndex Task-number: QTBUG-13543 --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 6 +++--- src/declarative/graphicsitems/qdeclarativeflickable_p_p.h | 1 + src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 ++ src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 062bbfb..c0b664f 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -128,8 +128,8 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate() , flickingHorizontally(false), flickingVertically(false) , hMoved(false), vMoved(false) , movingHorizontally(false), movingVertically(false) - , stealMouse(false), pressed(false) - , interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) + , stealMouse(false), pressed(false), interactive(true), calcVelocity(false) + , deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600) , vTime(0), visibleArea(0) , flickableDirection(QDeclarativeFlickable::AutoFlickDirection) @@ -981,7 +981,7 @@ void QDeclarativeFlickable::viewportMoved() qreal prevY = d->lastFlickablePosition.x(); qreal prevX = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); - if (d->pressed) { + if (d->pressed || d->calcVelocity) { int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); if (elapsed > 0) { qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / elapsed; diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index c398faa..2da034c 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -141,6 +141,7 @@ public: bool stealMouse : 1; bool pressed : 1; bool interactive : 1; + bool calcVelocity : 1; QElapsedTimer lastPosTime; QPointF lastPos; QPointF pressPos; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index a0faf14..6a99733 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2241,7 +2241,9 @@ void QDeclarativeGridView::trackedPositionChanged() } if (viewPos != pos) { cancelFlick(); + d->calcVelocity = true; d->setPosition(pos); + d->calcVelocity = false; } } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 177c5b3..ae504aa 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -2732,7 +2732,9 @@ void QDeclarativeListView::trackedPositionChanged() } if (viewPos != pos) { cancelFlick(); + d->calcVelocity = true; d->setPosition(pos); + d->calcVelocity = false; } } } -- cgit v0.12 From 491f5f9cc6da171155c613295018b9d54bb683c9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 11:02:24 +1000 Subject: Add test for view velocity update on setCurrentIndex() Task-number: QTBUG-13543 --- .../auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 2 ++ .../auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index d4d8bf6..5fd373c 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -604,6 +604,8 @@ void tst_QDeclarativeGridView::currentIndex() // no wrap gridview->setCurrentIndex(0); QCOMPARE(gridview->currentIndex(), 0); + // confirm that the velocity is updated + QTRY_VERIFY(gridview->verticalVelocity() != 0.0); gridview->moveCurrentIndexUp(); QCOMPARE(gridview->currentIndex(), 0); diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index e4b59a7..cd17fad 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1016,6 +1016,8 @@ void tst_QDeclarativeListView::currentIndex() // no wrap listview->setCurrentIndex(0); QCOMPARE(listview->currentIndex(), 0); + // confirm that the velocity is updated + QTRY_VERIFY(listview->verticalVelocity() != 0.0); listview->incrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 1); -- cgit v0.12 From ca36badc8925788e06910fab5200633d40e0f328 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Sep 2010 15:16:57 +1000 Subject: When onDoubleClicked: is handled don't emit a second onPressed/onClicked Task-number: QTBUG-12250 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativemousearea.cpp | 17 +++++++----- .../graphicsitems/qdeclarativemousearea_p_p.h | 6 ++++ .../qdeclarativemousearea/data/doubleclick.qml | 14 ++++++++++ .../tst_qdeclarativemousearea.cpp | 32 ++++++++++++++++++++++ 4 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 5516611..4685e65 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -303,7 +303,9 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() The \l {MouseEvent}{mouse} parameter provides information about the click, including the x and y position of the release of the click, and whether the click was held. - The \e accepted property of the MouseEvent parameter is ignored in this handler. + If the \e accepted property of the \l {MouseEvent}{mouse} parameter is set to false + in the handler, the onPressed/onReleased/onClicked handlers will be called for the second + click; otherwise they are supressed. The accepted property defaults to true. */ /*! @@ -525,12 +527,13 @@ void QDeclarativeMouseArea::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even if (!d->absorb) { QDeclarativeItem::mouseDoubleClickEvent(event); } else { - QDeclarativeItem::mouseDoubleClickEvent(event); - if (event->isAccepted()) { - // Only deliver the event if we have accepted the press. - d->saveEvent(event); - QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); - emit this->doubleClicked(&me); + d->saveEvent(event); + QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, true, false); + me.setAccepted(d->isDoubleClickConnected()); + emit this->doubleClicked(&me); + if (!me.isAccepted()) { + // Only deliver the press event if we haven't accepted the double click. + QDeclarativeItem::mouseDoubleClickEvent(event); } } } diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index cf9dc18..48a56d9 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -95,6 +95,12 @@ public: return QObjectPrivate::get(q)->isSignalConnected(idx); } + bool isDoubleClickConnected() { + Q_Q(QDeclarativeMouseArea); + static int idx = QObjectPrivate::get(q)->signalIndex("doubleClicked(QDeclarativeMouseEvent*)"); + return QObjectPrivate::get(q)->isSignalConnected(idx); + } + bool absorb : 1; bool hovered : 1; bool pressed : 1; diff --git a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml new file mode 100644 index 0000000..9cddf1b --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Item { + id: root + property int clicked: 0 + property int doubleClicked: 0 + + MouseArea { + width: 200; height: 200 + onClicked: { root.clicked++ } + onDoubleClicked: { root.doubleClicked++ } + } +} + diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index c9bb467..e4ec01f 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -62,6 +62,7 @@ private slots: void updateMouseAreaPosOnResize(); void noOnClickedWithPressAndHold(); void onMousePressRejected(); + void doubleClick(); private: QDeclarativeView *createView(); @@ -390,6 +391,37 @@ void tst_QDeclarativeMouseArea::onMousePressRejected() QVERIFY(!canvas->rootObject()->property("mr2_released").toBool()); } +void tst_QDeclarativeMouseArea::doubleClick() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/doubleclick.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QGraphicsScene *scene = canvas->scene(); + QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); + pressEvent.setScenePos(QPointF(100, 100)); + pressEvent.setButton(Qt::LeftButton); + pressEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &pressEvent); + + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); + releaseEvent.setScenePos(QPointF(100, 100)); + releaseEvent.setButton(Qt::LeftButton); + releaseEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &releaseEvent); + + QGraphicsSceneMouseEvent dblClickEvent(QEvent::GraphicsSceneMouseDoubleClick); + dblClickEvent.setScenePos(QPointF(100, 100)); + dblClickEvent.setButton(Qt::LeftButton); + dblClickEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &dblClickEvent); + + QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); + QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1); +} + QTEST_MAIN(tst_QDeclarativeMouseArea) #include "tst_qdeclarativemousearea.moc" -- cgit v0.12