Changeset 116403 in webkit
- Timestamp:
- May 8, 2012 1:42:37 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r116396 r116403 1 2012-05-08 Balazs Kelemen <kbalazs@webkit.org> 2 3 [Qt] X11 plugins need to be reworked for Qt5+WK1 4 https://bugs.webkit.org/show_bug.cgi?id=80691 5 6 Reviewed by Simon Hausmann. 7 8 Implement basic windowless plugin support with Qt5. 9 10 * Source/api.pri: Need private API's to be able 11 to use QApplicationPrivate::windowForWidget. 12 1 13 2012-05-07 Dave Tu <dtu@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r116402 r116403 1 2012-05-08 Balazs Kelemen <kbalazs@webkit.org> 2 3 [Qt] X11 plugins need to be reworked for Qt5+WK1 4 https://bugs.webkit.org/show_bug.cgi?id=80691 5 6 Reviewed by Simon Hausmann. 7 8 Implement basic windowless plugin support with Qt5. 9 The solution is the same that has been chosen for 10 WebKit2. We get the content drawed by the plugin 11 from the X server as an image, create a QImage 12 from it and paint it to the window surface with QPainter. 13 Performance is sufficient for basic video playback. 14 15 No new tests, covered by existing plugin tests. 16 17 * Target.pri: 18 * WebCore.pri: 19 * platform/qt/QWebPageClient.h: 20 (QWebPageClient): 21 * plugins/PluginView.h: 22 (PluginView): 23 * plugins/qt/PluginPackageQt.cpp: 24 (WebCore::PluginPackage::isPluginBlacklisted): 25 Blacklist plugins that are incompatible with Qt5. 26 The only one I know about currently is skypebuttons 27 but the list can be extended in the future. 28 (WebCore): 29 (WebCore::PluginPackage::load): 30 * plugins/qt/PluginViewQt.cpp: 31 (X11Environment): 32 (WebCore): 33 (WebCore::x11Display): 34 (WebCore::x11Screen): 35 (WebCore::rootWindowID): 36 (WebCore::displayDepth): 37 (WebCore::syncX): 38 (WebCore::PluginView::platformPageClient): Added a safe 39 convenience getter for the QWebpageClient. 40 (WebCore::PluginView::updatePluginWidget): 41 (WebCore::PluginView::setFocus): 42 (WebCore::setupGraphicsExposeEvent): 43 (WebCore::PluginView::paintUsingXPixmap): 44 (WebCore::setSharedXEventFields): 45 (WebCore::PluginView::initXEvent): 46 (WebCore::PluginView::setXKeyEventSpecificFields): 47 (WebCore::setXButtonEventSpecificFields): 48 (WebCore::setXMotionEventSpecificFields): 49 (WebCore::setXCrossingEventSpecificFields): 50 (WebCore::PluginView::setNPWindowIfNeeded): 51 (WebCore::PluginView::setParentVisible): 52 (WebCore::PluginView::platformGetValue): 53 (WebCore::PluginView::invalidateRect): 54 (WebCore::getVisualAndColormap): 55 Refactored this function to make it more clear 56 what does it actually do. 57 (WebCore::PluginView::platformStart): 58 (WebCore::PluginView::platformDestroy): 59 1 60 2012-05-07 Antti Koivisto <antti@apple.com> 2 61 -
trunk/Source/WebCore/Target.pri
r116277 r116403 2971 2971 } else { 2972 2972 SOURCES += \ 2973 plugins/qt/PluginContainerQt.cpp \2974 2973 plugins/qt/PluginPackageQt.cpp \ 2975 2974 plugins/qt/PluginViewQt.cpp 2976 HEADERS += \ 2977 plugins/qt/PluginContainerQt.h 2975 2976 haveQt(4) { 2977 SOURCES += plugins/qt/PluginContainerQt.cpp 2978 HEADERS += plugins/qt/PluginContainerQt.h 2979 } 2978 2980 } 2979 2981 } -
trunk/Source/WebCore/WebCore.pri
r116105 r116403 135 135 # Note: XP_MACOSX is defined in npapi.h 136 136 } else { 137 !embedded{137 xlibAvailable() { 138 138 CONFIG += x11 139 139 LIBS += -lXrender -
trunk/Source/WebCore/platform/qt/QWebPageClient.h
r107815 r116403 44 44 QT_BEGIN_NAMESPACE 45 45 class QStyle; 46 class QWindow; 46 47 QT_END_NAMESPACE 47 48 … … 110 111 PlatformGraphicsSurface3D*) = 0; 111 112 #endif 113 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 114 virtual QWindow* ownerWindow() const; 115 #endif 112 116 113 117 protected: -
trunk/Source/WebCore/plugins/PluginView.h
r116371 r116403 427 427 static void setXKeyEventSpecificFields(XEvent*, KeyboardEvent*); 428 428 void paintUsingXPixmap(QPainter* painter, const QRect &exposedRect); 429 QWebPageClient* platformPageClient() const; 429 430 #endif 430 431 #if USE(ACCELERATED_COMPOSITING_PLUGIN_LAYER) -
trunk/Source/WebCore/plugins/qt/PluginPackageQt.cpp
r108281 r116403 32 32 #include "PluginDatabase.h" 33 33 #include "PluginDebug.h" 34 #include <QFileInfo> 34 35 #include <wtf/text/CString.h> 35 36 … … 130 131 } 131 132 133 bool PluginPackage::isPluginBlacklisted() 134 { 135 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 136 // TODO: enumerate all plugins that are incompatible with Qt5. 137 const QLatin1String pluginBlacklist[] = { 138 QLatin1String("skypebuttons") 139 }; 140 141 QString baseName = QFileInfo(static_cast<QString>(m_path)).baseName(); 142 for (unsigned i = 0; i < sizeof(pluginBlacklist) / sizeof(QLatin1String); ++i) { 143 if (baseName == pluginBlacklist[i]) 144 return true; 145 } 146 #endif 147 return false; 148 } 149 132 150 bool PluginPackage::load() 133 151 { … … 136 154 return true; 137 155 } 156 157 if (isPluginBlacklisted()) 158 return false; 138 159 139 160 m_module = new QLibrary((QString)m_path); -
trunk/Source/WebCore/plugins/qt/PluginViewQt.cpp
r113990 r116403 59 59 #include "PlatformMouseEvent.h" 60 60 #include "PlatformKeyboardEvent.h" 61 #include "PluginContainerQt.h"62 61 #include "PluginDebug.h" 63 62 #include "PluginPackage.h" … … 70 69 #include "runtime_root.h" 71 70 #endif 72 73 #include <QApplication>74 #include <QDesktopWidget>75 #include <QGraphicsWidget>76 71 #include <QKeyEvent> 77 72 #include <QPainter> 78 #include <QStyleOptionGraphicsItem>79 #include <QWidget>80 #include <QX11Info>81 73 #include <X11/X.h> 82 74 #ifndef QT_NO_XRENDER … … 88 80 #include <runtime/JSValue.h> 89 81 82 #define HAVE_QT5 (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 83 84 #if HAVE(QT5) 85 #include "QtX11ImageConversion.h" 86 #include <QGuiApplication> 87 #include <QPlatformNativeInterface> 88 #include <QWindow> 89 #else 90 #include "PluginContainerQt.h" 91 #include <QApplication> 92 #include <QDesktopWidget> 93 #include <QGraphicsWidget> 94 #include <QStyleOptionGraphicsItem> 95 #include <QWidget> 96 #include <QX11Info> 97 #endif 98 90 99 using JSC::ExecState; 91 100 #if USE(JSC) … … 106 115 using namespace HTMLNames; 107 116 108 #if USE(ACCELERATED_COMPOSITING) 117 struct X11Environment { 118 Display* display; 119 int screenID; 120 unsigned long rootWindowID; 121 int displayDepth; 122 }; 123 124 static X11Environment x11Environment = { 0, 0, 0, 0 }; 125 126 static inline Display* x11Display() { return x11Environment.display; } 127 static inline int x11Screen() { return x11Environment.screenID; } 128 static inline unsigned long rootWindowID() { return x11Environment.rootWindowID; } 129 static inline int displayDepth() { return x11Environment.displayDepth; } 130 131 static inline void syncX() 132 { 133 XSync(x11Display(), false); 134 } 135 136 QWebPageClient* PluginView::platformPageClient() const 137 { 138 FrameView* view = m_parentFrame->view(); 139 if (!view) 140 return 0; 141 HostWindow* hostWindow = view->hostWindow(); 142 if (!hostWindow) 143 return 0; 144 return hostWindow->platformPageClient(); 145 } 146 147 #if !HAVE(QT5) && USE(ACCELERATED_COMPOSITING) 109 148 // Qt's GraphicsLayer (GraphicsLayerQt) requires layers to be QGraphicsWidgets 110 149 class PluginGraphicsLayerQt : public QGraphicsWidget { … … 155 194 if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) { 156 195 if (m_drawable) 157 XFreePixmap( QX11Info::display(), m_drawable);158 159 m_drawable = XCreatePixmap( QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(),196 XFreePixmap(x11Display(), m_drawable); 197 198 m_drawable = XCreatePixmap(x11Display(), rootWindowID(), m_windowRect.width(), m_windowRect.height(), 160 199 ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); 161 QApplication::syncX(); // make sure that the server knows about the Drawable200 syncX(); // make sure that the server knows about the Drawable 162 201 } 163 202 … … 188 227 void PluginView::setFocus(bool focused) 189 228 { 229 #if !HAVE(QT5) // Windowed mode is not supported with Qt5 yet (so platformPluginWidget() is always null). 190 230 if (platformPluginWidget()) { 191 231 if (focused) 192 232 static_cast<QWidget*>(platformPluginWidget())->setFocus(Qt::OtherFocusReason); 193 } else { 233 } else 234 #endif 194 235 Widget::setFocus(focused); 195 }196 236 } 197 237 … … 208 248 } 209 249 250 static void setupGraphicsExposeEvent(Pixmap drawable, const QRect& exposedRect, XEvent& xevent) 251 { 252 memset(&xevent, 0, sizeof(XEvent)); 253 XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; 254 exposeEvent.type = GraphicsExpose; 255 exposeEvent.display = x11Display(); 256 exposeEvent.drawable = drawable; 257 exposeEvent.x = exposedRect.x(); 258 exposeEvent.y = exposedRect.y(); 259 exposeEvent.width = exposedRect.x() + exposedRect.width(); // flash bug? it thinks width is the right in transparent mode 260 exposeEvent.height = exposedRect.y() + exposedRect.height(); // flash bug? it thinks height is the bottom in transparent mode 261 } 262 210 263 void PluginView::paintUsingXPixmap(QPainter* painter, const QRect &exposedRect) 211 264 { 265 bool shouldSyncX = m_pluginDisplay && m_pluginDisplay != x11Display(); 266 XEvent xevent; 267 268 #if HAVE(QT5) 269 setupGraphicsExposeEvent(m_drawable, exposedRect, xevent); 270 #else 212 271 QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); 213 272 const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; 214 273 ASSERT(drawableDepth == qtDrawable.depth()); 215 const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display();216 274 217 275 // When printing, Qt uses a QPicture to capture the output in preview mode. The … … 233 291 // (because backing store contents are already transformed). What we really mean to do 234 292 // here is to check if we are painting on QWebView, but let's be a little permissive :) 235 QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();293 QWebPageClient* client = platformPageClient(); 236 294 const bool backingStoreHasUntransformedContents = client && qobject_cast<QWidget*>(client->pluginParent()); 237 295 … … 247 305 } 248 306 249 if (syncX) 250 QApplication::syncX(); 251 } 252 253 XEvent xevent; 254 memset(&xevent, 0, sizeof(XEvent)); 255 XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; 256 exposeEvent.type = GraphicsExpose; 257 exposeEvent.display = QX11Info::display(); 258 exposeEvent.drawable = qtDrawable.handle(); 259 exposeEvent.x = exposedRect.x(); 260 exposeEvent.y = exposedRect.y(); 261 exposeEvent.width = exposedRect.x() + exposedRect.width(); // flash bug? it thinks width is the right in transparent mode 262 exposeEvent.height = exposedRect.y() + exposedRect.height(); // flash bug? it thinks height is the bottom in transparent mode 307 if (shouldSyncX) 308 syncX(); 309 } 310 311 setupGraphicsExposeEvent(qtDrawable.handle(), exposedRect, xevent); 312 #endif 263 313 264 314 dispatchNPEvent(xevent); 265 315 266 if (s yncX)316 if (shouldSyncX) 267 317 XSync(m_pluginDisplay, false); // sync changes by plugin 268 318 319 #if HAVE(QT5) 320 XImage* xImage = XGetImage(x11Display(), m_drawable, exposedRect.x(), exposedRect.y(), 321 exposedRect.width(), exposedRect.height(), ULONG_MAX, ZPixmap); 322 painter->drawImage(QPoint(exposedRect.x(), exposedRect.y()), qimageFromXImage(xImage), exposedRect); 323 XDestroyImage(xImage); 324 #else 269 325 painter->drawPixmap(QPoint(exposedRect.x(), exposedRect.y()), qtDrawable, exposedRect); 326 #endif 270 327 } 271 328 … … 332 389 } 333 390 334 void setSharedXEventFields(XEvent* xEvent, QW idget* ownerWidget)391 void setSharedXEventFields(XEvent* xEvent, QWebPageClient* pageClient) 335 392 { 336 393 xEvent->xany.serial = 0; // we are unaware of the last request processed by X Server 337 394 xEvent->xany.send_event = false; 338 xEvent->xany.display = QX11Info::display();395 xEvent->xany.display = x11Display(); 339 396 // NOTE: event->xany.window doesn't always respond to the .window property of other XEvent's 340 397 // but does in the case of KeyPress, KeyRelease, ButtonPress, ButtonRelease, and MotionNotify 341 398 // events; thus, this is right: 342 xEvent->xany.window = ownerWidget ? ownerWidget->window()->handle() : 0; 399 #if HAVE(QT5) 400 QWindow* window = pageClient ? pageClient->ownerWindow() : 0; 401 xEvent->xany.window = window ? window->winId() : 0; 402 #else 403 QWidget* ownerWidget = pageClient ? pageClient->ownerWidget() : 0; 404 xEvent->xany.window = ownerWidget ? ownerWidget->window()->winId() : 0; 405 #endif 343 406 } 344 407 … … 347 410 memset(xEvent, 0, sizeof(XEvent)); 348 411 349 QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); 350 QWidget* ownerWidget = client ? client->ownerWidget() : 0; 351 setSharedXEventFields(xEvent, ownerWidget); 412 QWebPageClient* client = platformPageClient(); 413 setSharedXEventFields(xEvent, client); 352 414 } 353 415 … … 357 419 358 420 xEvent->type = (event->type() == eventNames().keydownEvent) ? 2 : 3; // ints as Qt unsets KeyPress and KeyRelease 359 xEvent->xkey.root = QX11Info::appRootWindow();421 xEvent->xkey.root = rootWindowID(); 360 422 xEvent->xkey.subwindow = 0; // we have no child window 361 423 xEvent->xkey.time = event->timeStamp(); … … 371 433 ASSERT(qKeyEvent); 372 434 QString keyText = qKeyEvent->text().left(1); 373 xEvent->xkey.keycode = XKeysymToKeycode( QX11Info::display(), XStringToKeysym(keyText.toUtf8().constData()));435 xEvent->xkey.keycode = XKeysymToKeycode(x11Display(), XStringToKeysym(keyText.toUtf8().constData())); 374 436 } 375 437 … … 420 482 XButtonEvent& xbutton = xEvent->xbutton; 421 483 xbutton.type = event->type() == eventNames().mousedownEvent ? ButtonPress : ButtonRelease; 422 xbutton.root = QX11Info::appRootWindow();484 xbutton.root = rootWindowID(); 423 485 xbutton.subwindow = 0; 424 486 xbutton.time = event->timeStamp(); … … 447 509 XMotionEvent& xmotion = xEvent->xmotion; 448 510 xmotion.type = MotionNotify; 449 xmotion.root = QX11Info::appRootWindow();511 xmotion.root = rootWindowID(); 450 512 xmotion.subwindow = 0; 451 513 xmotion.time = event->timeStamp(); … … 463 525 XCrossingEvent& xcrossing = xEvent->xcrossing; 464 526 xcrossing.type = event->type() == eventNames().mouseoverEvent ? EnterNotify : LeaveNotify; 465 xcrossing.root = QX11Info::appRootWindow();527 xcrossing.root = rootWindowID(); 466 528 xcrossing.subwindow = 0; 467 529 xcrossing.time = event->timeStamp(); … … 572 634 m_hasPendingGeometryChange = false; 573 635 636 #if !HAVE(QT5) // Windowed mode is not supported with Qt5 yet 574 637 if (m_isWindowed) { 575 638 QWidget* widget = static_cast<QWidget*>(platformPluginWidget()); … … 591 654 m_npWindow.x = m_windowRect.x(); 592 655 m_npWindow.y = m_windowRect.y(); 593 } else { 656 } else 657 #endif 658 { 594 659 m_npWindow.x = 0; 595 660 m_npWindow.y = 0; … … 640 705 Widget::setParentVisible(visible); 641 706 707 #if !HAVE(QT5) // Windowed mode is not supported with Qt5 yet. 642 708 if (isSelfVisible() && platformPluginWidget()) 643 709 static_cast<QWidget*>(platformPluginWidget())->setVisible(visible); 710 #endif 644 711 } 645 712 … … 702 769 switch (variable) { 703 770 case NPNVxDisplay: 704 * (void **)value = QX11Info::display();771 *reinterpret_cast<void**>(value) = x11Display(); 705 772 *result = NPERR_NO_ERROR; 706 773 return true; … … 711 778 712 779 case NPNVnetscapeWindow: { 713 void* w = reinterpret_cast<void*>(value); 714 QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient(); 715 *((XID *)w) = client ? client->ownerWidget()->window()->winId() : 0; 780 QWebPageClient* client = platformPageClient(); 781 #if HAVE(QT5) 782 QWindow* window = client ? client->ownerWindow() : 0; 783 *reinterpret_cast<XID*>(value) = window ? window->winId() : 0; 784 #else 785 *reinterpret_cast<XID*>(value) = client ? client->ownerWidget()->window()->winId() : 0; 786 #endif 716 787 *result = NPERR_NO_ERROR; 717 788 return true; … … 740 811 #endif 741 812 813 #if !HAVE(QT5) // Windowed mode is not supported with Qt5 yet. 742 814 if (m_isWindowed) { 743 815 if (platformWidget()) { … … 750 822 return; 751 823 } 824 #endif 752 825 753 826 invalidateWindowlessPluginRect(rect); … … 804 877 } 805 878 806 static void getVisualAndColormap(int depth, Visual **visual, Colormap *colormap) 807 { 808 *visual = 0; 809 *colormap = 0; 810 811 #ifndef QT_NO_XRENDER 879 static bool getVisualAndColormap(int depth, Visual*& visual, Colormap& colormap, bool forceARGB32) 880 { 881 ASSERT(depth == 32 || !forceARGB32); 882 883 visual = 0; 884 colormap = 0; 885 886 #if !HAVE(QT5) && !defined(QT_NO_XRENDER) 812 887 static const bool useXRender = qgetenv("QT_X11_NO_XRENDER").isNull(); // Should also check for XRender >= 0.5 813 888 #else 814 889 static const bool useXRender = false; 815 890 #endif 816 817 if (!useXRender && depth == 32) 818 return; 891 if (!useXRender && forceARGB32) 892 return false; 819 893 820 894 int nvi; 821 895 XVisualInfo templ; 822 templ.screen = QX11Info::appScreen();896 templ.screen = x11Screen(); 823 897 templ.depth = depth; 824 898 templ.c_class = TrueColor; 825 XVisualInfo* xvi = XGetVisualInfo( QX11Info::display(), VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi);826 899 XVisualInfo* xvi = XGetVisualInfo(x11Display(), VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi); 900 ASSERT(xvi || forceARGB32); 827 901 if (!xvi) 828 return ;829 830 #if ndef QT_NO_XRENDER831 if ( depth ==32) {902 return false; 903 904 #if !HAVE(QT5) && !defined(QT_NO_XRENDER) 905 if (forceARGB32) { 832 906 for (int idx = 0; idx < nvi; ++idx) { 833 XRenderPictFormat* format = XRenderFindVisualFormat( QX11Info::display(), xvi[idx].visual);907 XRenderPictFormat* format = XRenderFindVisualFormat(x11Display(), xvi[idx].visual); 834 908 if (format->type == PictTypeDirect && format->direct.alphaMask) { 835 *visual = xvi[idx].visual;909 visual = xvi[idx].visual; 836 910 break; 837 911 } 838 } 912 } 913 if (!visual) 914 return false; 839 915 } else 840 #endif // QT_NO_XRENDER 841 *visual = xvi[0].visual; 916 #endif 917 { 918 visual = xvi[0].visual; 919 } 920 ASSERT(visual); 842 921 843 922 XFree(xvi); 844 923 845 if (*visual)846 *colormap = XCreateColormap(QX11Info::display(), QX11Info::appRootWindow(), *visual, AllocNone);924 colormap = XCreateColormap(x11Display(), rootWindowID(), visual, AllocNone); 925 return true; 847 926 } 848 927 … … 852 931 ASSERT(m_status == PluginStatusLoadedSuccessfully); 853 932 933 if (!x11Environment.display) { 934 Display* display; 935 #if HAVE(QT5) 936 display = static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow("display", 0)); 937 #else 938 display = QX11Info::display(); 939 #endif 940 x11Environment.display = display; 941 x11Environment.screenID = XDefaultScreen(display); 942 x11Environment.displayDepth = XDefaultDepth(display, x11Environment.screenID); 943 x11Environment.rootWindowID = XDefaultRootWindow(display); 944 } 945 946 #if HAVE(QT5) 947 // Windowed mode is not supported with Qt5 yet. 948 if (m_isWindowed) 949 return false; 950 #else 854 951 if (m_plugin->pluginFuncs()->getvalue) { 855 952 PluginView::setCurrentPluginView(this); … … 864 961 865 962 if (m_isWindowed) { 866 QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();963 QWebPageClient* client = platformPageClient(); 867 964 if (m_needsXEmbed && client) { 868 965 setPlatformWidget(new PluginContainerQt(this, client->ownerWidget())); … … 874 971 return false; 875 972 } 876 } else { 973 } else 974 #endif // HAVE(QT5) 975 { 877 976 setPlatformWidget(0); 878 977 m_pluginDisplay = getPluginDisplay(); … … 894 993 wsi->type = 0; 895 994 995 #if !HAVE(QT5) 896 996 if (m_isWindowed) { 897 997 const QX11Info* x11Info = &static_cast<QWidget*>(platformPluginWidget())->x11Info(); … … 906 1006 m_npWindow.width = -1; 907 1007 m_npWindow.height = -1; 908 } else { 1008 } else 1009 #endif 1010 { 1011 #if !HAVE(QT5) 909 1012 const QX11Info* x11Info = &QApplication::desktop()->x11Info(); 910 911 if (x11Info->depth() == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) { 912 getVisualAndColormap(32, &m_visual, &m_colormap); 1013 if ((x11Info->depth() == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) 1014 && getVisualAndColormap(32, m_visual, m_colormap, /* forceARGB32 = */ true)) 913 1015 wsi->depth = 32; 1016 else 1017 #endif 1018 { 1019 int depth = displayDepth(); 1020 bool found = getVisualAndColormap(depth, m_visual, m_colormap, /* forceARGB32 = */ false); 1021 ASSERT_UNUSED(found, found); 1022 wsi->depth = depth; 914 1023 } 915 1024 916 if (!m_visual) { 917 getVisualAndColormap(x11Info->depth(), &m_visual, &m_colormap); 918 wsi->depth = x11Info->depth(); 919 } 920 921 wsi->display = x11Info->display(); 1025 wsi->display = x11Display(); 922 1026 wsi->visual = m_visual; 923 1027 wsi->colormap = m_colormap; … … 947 1051 948 1052 if (m_drawable) 949 XFreePixmap( QX11Info::display(), m_drawable);1053 XFreePixmap(x11Display(), m_drawable); 950 1054 951 1055 if (m_colormap) 952 XFreeColormap( QX11Info::display(), m_colormap);1056 XFreeColormap(x11Display(), m_colormap); 953 1057 } 954 1058 -
trunk/Source/WebKit/qt/Api/qwebsettings.cpp
r111002 r116403 1175 1175 // All applications can share the common QtWebkit cache file(s). 1176 1176 // Path is not configurable and uses QDesktopServices::CacheLocation by default. 1177 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 1178 QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); 1179 #else 1177 1180 QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); 1181 #endif 1178 1182 WebCore::makeAllDirectories(cachePath); 1179 1183 -
trunk/Source/WebKit/qt/ChangeLog
r116246 r116403 1 2012-05-08 Balazs Kelemen <kbalazs@webkit.org> 2 3 [Qt] X11 plugins need to be reworked for Qt5+WK1 4 https://bugs.webkit.org/show_bug.cgi?id=80691 5 6 Reviewed by Simon Hausmann. 7 8 * Api/qwebsettings.cpp: 9 (QWebSettings::enablePersistentStorage): 10 Build fix for Qt5. 11 * WebCoreSupport/FrameLoaderClientQt.cpp: 12 (WebCore::FrameLoaderClientQt::createPlugin): 13 Inject the wmode parameter for flash so it will 14 work in windowless, non-transparent mode which 15 is the only one we support currently. 16 * WebCoreSupport/PageClientQt.cpp: 17 (WebCore): 18 (WebCore::QWebPageClient::ownerWindow): 19 Added a getter for the top level window so the PluginView 20 can get it without calling into QtWidgets code. 21 1 22 2012-05-06 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 23 -
trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
r116121 r116403 1604 1604 Vector<String> values = paramValues; 1605 1605 if (mimeType == "application/x-shockwave-flash") { 1606 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 1607 const bool shouldInjectWmode = true; 1608 #else 1609 // Inject wmode=opaque when there is no client or the client is not a QWebView. 1606 1610 QWebPageClient* client = m_webFrame->page()->d->client.get(); 1607 const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent()); 1608 if (!isQWebView) { 1611 const bool shouldInjectWmode = !(client && qobject_cast<QWidget*>(client->pluginParent())); 1612 #endif 1613 if (shouldInjectWmode) { 1609 1614 // Inject wmode=opaque when there is no client or the client is not a QWebView. 1610 1615 size_t wmodeIndex = params.find("wmode"); -
trunk/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
r107819 r116403 70 70 #endif 71 71 72 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 73 QWindow* QWebPageClient::ownerWindow() const 74 { 75 QWidget* widget = ownerWidget(); 76 if (!widget) 77 return 0; 78 if (QWindow *window = widget->windowHandle()) 79 return window; 80 if (const QWidget *nativeParent = widget->nativeParentWidget()) 81 return nativeParent->windowHandle(); 82 return 0; 83 } 84 #endif 85 72 86 namespace WebCore { 73 87 -
trunk/Tools/ChangeLog
r116387 r116403 1 2012-05-08 Balazs Kelemen <kbalazs@webkit.org> 2 3 [Qt] X11 plugins need to be reworked for Qt5+WK1 4 https://bugs.webkit.org/show_bug.cgi?id=80691 5 6 Reviewed by Simon Hausmann. 7 8 Implement basic windowless plugin support with Qt5. 9 10 * qmake/mkspecs/features/features.prf: 11 Enable NPAPI plugins if X11 libraries are available. 12 * qmake/mkspecs/features/functions.prf: 13 Added a convenience function to determine availability 14 of X11 libraries. 15 1 16 2012-05-07 Raphael Kubo da Costa <rakuco@webkit.org> 2 17 -
trunk/Tools/qmake/mkspecs/features/features.prf
r116215 r116403 81 81 # Nescape plugins support (NPAPI) 82 82 !contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) { 83 unix:haveQt(4)|win32-*:!embedded:!wince*: { 83 haveQt(5):xlibAvailable() { 84 DEFINES += ENABLE_NETSCAPE_PLUGIN_API=1 85 CONFIG += plugin_backend_xlib 86 } else: unix|win32-*:!embedded:!wince* { 84 87 DEFINES += ENABLE_NETSCAPE_PLUGIN_API=1 85 88 } -
trunk/Tools/qmake/mkspecs/features/functions.prf
r115293 r116403 324 324 return(true) 325 325 } 326 327 defineTest(xlibAvailable) { 328 haveQt(5) { 329 contains(QT_CONFIG, xcb-xlib) { 330 return(true) 331 } else { 332 return(false) 333 } 334 } else { 335 unix:!mac:!embedded { 336 return(true) 337 } else { 338 return(false) 339 } 340 } 341 }
Note: See TracChangeset
for help on using the changeset viewer.