Changeset 49169 in webkit
- Timestamp:
- Oct 6, 2009 4:52:42 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49165 r49169 1 2009-10-06 Girish Ramakrishnan <girish@forwardbias.in> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Windowless plugins: Add PluginQuirkRequiresDefaultScreenDepth quirk for Flash. 6 7 Flash does not use the visual provided by us to draw into the drawable. 8 It instead uses the system default visual (as returned by XDefaultVisual). 9 This means that if the screen default visual is 24-bit, Flash won't be 10 able to draw on 32-bit drawable created by us. This is a bug in Flash 11 and for the moment, the above quirk is only set for Flash. 12 13 Our strategy to create the drawable: 14 1. Create a 32-bit drawable if the default screen depth is 32 or the 15 quirk is not set (i.e not flash) 16 2. If we didn't create a 32-bit drawable (maybe the Display has no such 17 visual), we create a drawable with default screen depth. 18 19 As a result of the above changes, content propagation behavior changes as: 20 1. Content propagation is possible only if the drawable we create and 21 Qt's backing store are of the same depth. 22 2. If we created a 32-bit drawable, there is no need for content 23 propagation (Qt will take care of it). 24 25 https://bugs.webkit.org/show_bug.cgi?id=20081 26 27 * plugins/PluginPackage.cpp: 28 (WebCore::PluginPackage::determineQuirks): 29 * plugins/PluginQuirkSet.h: 30 (WebCore::): 31 * plugins/PluginView.cpp: 32 (WebCore::PluginView::PluginView): 33 * plugins/PluginView.h: 34 * plugins/qt/PluginViewQt.cpp: 35 (WebCore::PluginView::updatePluginWidget): 36 (WebCore::PluginView::paint): 37 (WebCore::getVisualAndColormap): 38 (WebCore::PluginView::platformStart): 39 (WebCore::PluginView::platformDestroy): 40 1 41 2009-10-06 Fumitoshi Ukai <ukai@chromium.org> 2 42 -
trunk/WebCore/plugins/PluginPackage.cpp
r46540 r49169 184 184 m_quirks.add(PluginQuirkRequiresGtkToolKit); 185 185 #endif 186 m_quirks.add(PluginQuirkRequiresDefaultScreenDepth); 186 187 } else { 187 188 // Flash 9 and older requests windowless plugins if we return a mozilla user agent -
trunk/WebCore/plugins/PluginQuirkSet.h
r38124 r49169 47 47 PluginQuirkDontAllowMultipleInstances = 1 << 11, 48 48 PluginQuirkRequiresGtkToolKit = 1 << 12, 49 PluginQuirkRequiresDefaultScreenDepth = 1 << 13 49 50 }; 50 51 -
trunk/WebCore/plugins/PluginView.cpp
r49159 r49169 822 822 , m_hasPendingGeometryChange(false) 823 823 , m_drawable(0) 824 , m_visual(0) 825 , m_colormap(0) 824 826 , m_pluginDisplay(0) 825 827 #endif -
trunk/WebCore/plugins/PluginView.h
r49159 r49169 328 328 bool m_hasPendingGeometryChange; 329 329 Pixmap m_drawable; 330 Visual* m_visual; 331 Colormap m_colormap; 330 332 Display* m_pluginDisplay; 331 333 -
trunk/WebCore/plugins/qt/PluginViewQt.cpp
r49159 r49169 69 69 #include <runtime/JSValue.h> 70 70 #include <X11/X.h> 71 #ifndef QT_NO_XRENDER 72 #define Bool int 73 #define Status int 74 #include <X11/extensions/Xrender.h> 75 #endif 71 76 72 77 using JSC::ExecState; … … 106 111 107 112 if (!m_isWindowed) 108 m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), QX11Info::appDepth()); 113 m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), 114 ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); 109 115 110 116 // do not call setNPWindowIfNeeded immediately, will be called on paint() … … 175 181 176 182 QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); 177 178 if (m_isTransparent) { 179 // Attempt content propagation by copying over from the backing store 183 const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; 184 ASSERT(drawableDepth == qtDrawable.depth()); 185 186 if (m_isTransparent && drawableDepth != 32) { 187 // Attempt content propagation for drawable with no alpha by copying over from the backing store 180 188 QPoint offset; 181 189 QPaintDevice* backingStoreDevice = QPainter::redirected(painter->device(), &offset); 190 offset = -offset; // negating the offset gives us the offset of the view within the backing store pixmap 191 182 192 const bool hasValidBackingStore = backingStoreDevice && backingStoreDevice->devType() == QInternal::Pixmap; 183 offset = -offset; // negating the offset gives us the offset of the view within the backing store pixmap 184 185 if (hasValidBackingStore) { 186 QPixmap* backingStorePixmap = static_cast<QPixmap*>(backingStoreDevice); 193 QPixmap* backingStorePixmap = static_cast<QPixmap*>(backingStoreDevice); 194 195 if (hasValidBackingStore && backingStorePixmap->depth() == drawableDepth) { 187 196 GC gc = XDefaultGC(QX11Info::display(), QX11Info::appScreen()); 188 197 XCopyArea(QX11Info::display(), backingStorePixmap->handle(), m_drawable, gc, 189 198 offset.x() + m_windowRect.x() + m_clipRect.x(), offset.y() + m_windowRect.y() + m_clipRect.y(), 190 199 m_clipRect.width(), m_clipRect.height(), m_clipRect.x(), m_clipRect.y()); 191 } else { // no backing store, clean the pixmap 200 } else { // no backing store, clean the pixmap because the plugin thinks its transparent 192 201 QPainter painter(&qtDrawable); 193 202 painter.fillRect(m_clipRect, Qt::white); … … 683 692 } 684 693 694 static void getVisualAndColormap(int depth, Visual **visual, Colormap *colormap) 695 { 696 *visual = 0; 697 *colormap = 0; 698 699 #ifndef QT_NO_XRENDER 700 static const bool useXRender = qgetenv("QT_X11_NO_XRENDER").isNull(); // Should also check for XRender >= 0.5 701 #else 702 static const bool useXRender = false; 703 #endif 704 705 if (!useXRender && depth == 32) 706 return; 707 708 int nvi; 709 XVisualInfo templ; 710 templ.screen = QX11Info::appScreen(); 711 templ.depth = depth; 712 templ.c_class = TrueColor; 713 XVisualInfo* xvi = XGetVisualInfo(QX11Info::display(), VisualScreenMask | VisualDepthMask | VisualClassMask, &templ, &nvi); 714 715 if (!xvi) 716 return; 717 718 #ifndef QT_NO_XRENDER 719 if (depth == 32) { 720 for (int idx = 0; idx < nvi; ++idx) { 721 XRenderPictFormat* format = XRenderFindVisualFormat(QX11Info::display(), xvi[idx].visual); 722 if (format->type == PictTypeDirect && format->direct.alphaMask) { 723 *visual = xvi[idx].visual; 724 break; 725 } 726 } 727 } else 728 #endif // QT_NO_XRENDER 729 *visual = xvi[0].visual; 730 731 XFree(xvi); 732 733 if (*visual) 734 *colormap = XCreateColormap(QX11Info::display(), QX11Info::appRootWindow(), *visual, AllocNone); 735 } 736 685 737 bool PluginView::platformStart() 686 738 { … … 716 768 wsi->type = 0; 717 769 718 const QX11Info* x11Info = 0;719 770 if (m_isWindowed) { 720 x11Info = &platformPluginWidget()->x11Info(); 771 const QX11Info* x11Info = &platformPluginWidget()->x11Info(); 772 773 wsi->display = x11Info->display(); 774 wsi->visual = (Visual*)x11Info->visual(); 775 wsi->depth = x11Info->depth(); 776 wsi->colormap = x11Info->colormap(); 721 777 722 778 m_npWindow.type = NPWindowTypeWindow; … … 725 781 m_npWindow.height = -1; 726 782 } else { 727 x11Info = &QApplication::desktop()->x11Info(); 783 const QX11Info* x11Info = &QApplication::desktop()->x11Info(); 784 785 if (x11Info->depth() == 32 || !m_plugin->quirks().contains(PluginQuirkRequiresDefaultScreenDepth)) { 786 getVisualAndColormap(32, &m_visual, &m_colormap); 787 wsi->depth = 32; 788 } 789 790 if (!m_visual) { 791 getVisualAndColormap(x11Info->depth(), &m_visual, &m_colormap); 792 wsi->depth = x11Info->depth(); 793 } 794 795 wsi->display = x11Info->display(); 796 wsi->visual = m_visual; 797 wsi->colormap = m_colormap; 728 798 729 799 m_npWindow.type = NPWindowTypeDrawable; … … 735 805 } 736 806 737 wsi->display = x11Info->display();738 wsi->visual = (Visual*)x11Info->visual();739 wsi->depth = x11Info->depth();740 wsi->colormap = x11Info->colormap();741 807 m_npWindow.ws_info = wsi; 742 808 … … 756 822 if (m_drawable) 757 823 XFreePixmap(QX11Info::display(), m_drawable); 824 825 if (m_colormap) 826 XFreeColormap(QX11Info::display(), m_colormap); 758 827 } 759 828
Note: See TracChangeset
for help on using the changeset viewer.