Bug 31975

Summary: [Qt] Mac Plugins: Printing or drawing to QImage does not paint plugins
Product: WebKit Reporter: Girish Ramakrishnan <girish>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: kent.hansen
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on: 31979    
Bug Blocks: 35962    

Description Girish Ramakrishnan 2009-11-29 21:30:38 PST
Currently, if you print a web page with flash, the flash does not appear.

The problem is that when painting, we paint using the contextref of the platformPluginWidget. When printing you have to print using the printer's contextref (same goes for drawing to QImage except that a QImage does not have a contextref, afaik).

Problem can be solved in two ways in Qt:
1. Disable direct painting and always paint to offscreen drawable (in essence this means removing the call to setPlatformPluginWidget for Qt). Since, we draw to an offscreen drawable, QPainter takes care of painting to the QPixmap to the target paint device. The two main things to fix are:
    * context menu positioning (since platformPluginWidget is not set, topLevelOffset will return 0 and the context menu ends up in the wrong place)
    * check if there are performance regressions. Obviously, it will slower with this change, we just need to know how much.

2. Probe the paint device and set the appropriate context ref. This is the fastest approach but we will end up with some ugly code. Considerations for this approach are
   * qt_mac_cg_context does not work for all paint devices - it does not work for printers and qimage. I don't know if we can even return a cgcontext for a QImage. This requires a fix in Qt.
   * I am not a big fan of device probing. As seen from the X11 code, it gets really ugly and is based on Qt's implementation/internal behavior.
Comment 1 Girish Ramakrishnan 2009-11-30 03:15:45 PST
Context menu should work with 31979. However, I cannot get Flash to process mouse events for the settings dialog it popups up, ATM.
Comment 2 Jocelyn Turcotte 2014-02-03 03:13:12 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.