Bug 24002

Summary: [Qt] Flash contents will not resize when the browser is resized
Product: WebKit Reporter: Luca Viggiani <lviggiani>
Component: Plug-insAssignee: QtWebKit Unassigned <webkit-qt-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: girish, jacob.skolnik, jesus, jturcotte, kenneth, kling, lviggiani, mrowe, plasm, tonikitoo, vestbo
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 35962    
Attachments:
Description Flags
Test page none

Description Luca Viggiani 2009-02-18 06:09:52 PST
1) Publish a flash 10 file (comprising the html) with those settings:
   Size: 100%, 100%
   Scale: no scale
2) Display the generated html
3) Initially the flash contents will fit the browser window (OK)
4) Resize the browser
5) Flash window will not resize (WRONG)
Comment 1 Mark Rowe (bdash) 2009-02-18 11:58:33 PST
Can you please provide a web page on which we can see the problem?  I doubt many WebKit developers have a copy of the Flash authoring tool.
Comment 2 Luca Viggiani 2009-02-18 23:50:09 PST
Created attachment 27778 [details]
Test page
Comment 3 Luca Viggiani 2009-02-18 23:54:24 PST
Attached is a test page.
The expected behavior is that the two circles are always displayed at the top-left and bottom-right corner of the browser window respectively, plus a red frame around (body background). You can test with FireFox or IE to see how it should work.

Run the html page with any webkit based brwoser and you'll see something like the screenshot within the zip file provided. I tried with Midori, the test browser created while compiling webkit, and Safari on Leopard. All of those show the same bug.
Comment 4 Luca Viggiani 2009-02-18 23:56:21 PST
...sorry I forgot to tell that when the page is first shown, it looks quite ok.
The problem occurs when you then resize the browser.
You'll see that flash window will not resize.
Comment 5 Luca Viggiani 2009-03-27 09:09:08 PDT
Any update on this?
Comment 6 Luca Viggiani 2009-03-28 10:40:46 PDT
I run some further testing.
I made a QT4.5 program which uses QWebView component based on webkit and loading the test page/flash provided.
Compiled and run on Linux, the resize problem is there
Compiled and run on Windows, the problem does not occur and when resizing the window, flash contents resizes too.

Going deeper in the investigation, I noticed that on Linux, when resizing the window, the plugin seems to be actually resized, however the resize event is not notified to the loaded movie.
Infact, if you run the sample page provided, you'll see that when resizing (expanding) the browser, even if the swf contents looks not resizing, if you right click on the new area (the area that should be supposed to be filled by the swf movie), the flash plugin context menu appears.
So, this to me seems that the plugin is actually resized, whilst the loaded swf movie is not notified.
As a futher test, i tried to trace within the swf movie, what it think its area (called "stage") is. Flash properties are stge.stageWidth and stage.stageHeight. And as a confirmation, those values stay the same when the browser (thus the plugin area) is resized.
I came to the conclusion that the issue could be the way webkit notifies the flash plugin.
Please also consider that the flash plugin used by webkit is THE SAME used by gecko in firefox and epiphany where the resizing issue does not occur.
I hope this will help.
Finally I have a question:
Does QT 4.5 WebView wraps WebKit or is WebKit embedded into that component?
In other words, by updating webkit, is qt 4.5 WebView components updated too?
Yhanks.
Comment 7 Girish Ramakrishnan 2009-10-16 06:33:43 PDT
This is a known problem on X11 (not sure if there is an existing task for this, though). The Flash plugin crashes with multiple calls to setNPWindow (see the comment in PluginViewQt.cpp setNPWindowIfNeeded()).
Comment 8 Girish Ramakrishnan 2009-10-16 06:50:48 PDT
Kenneth probably knows the exact problem, you can read his comment here https://bugs.webkit.org/show_bug.cgi?id=20081#c14.

This bug is only with windowed mode. Windowless mode (i.e passing wmode as transparent/opaque), which will be supported in 4.6, resizes fine (Tested with @49634).
Comment 9 Kenneth Rohde Christiansen 2009-10-18 09:38:24 PDT
This is due to us disabling resizing due to Flash crashing when embedded in a non-Gtk app.

I am trying to get hold of some of the Adobe developers to fix the issue.
Comment 10 Tor Arne Vestbø 2009-10-22 07:38:47 PDT
*** Bug 29588 has been marked as a duplicate of this bug. ***
Comment 11 Tim Yamin 2009-11-17 13:34:44 PST
*** Bug 31519 has been marked as a duplicate of this bug. ***
Comment 12 Simon Hausmann 2009-11-24 06:50:53 PST
*** Bug 28053 has been marked as a duplicate of this bug. ***
Comment 13 Girish Ramakrishnan 2009-12-14 19:55:37 PST
https://bugs.webkit.org/show_bug.cgi?id=32059 adds a fix that can be used as a workaround for this problem. After you have applied the patch in 32059, you have to patch Qt yourself with the following patch.

DO NOT INCLUDE THIS PATCH IN Qt/WebKit!

diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 3c30ab5..a1b54ec 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -1305,7 +1305,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
         Vector<String> values = paramValues;
         if (mimeType == "application/x-shockwave-flash") {
             QWebPageClient* client = m_webFrame->page()->d->client;
-            if (!client || !qobject_cast<QWidget*>(client->pluginParent())) {
+//            if (!client || !qobject_cast<QWidget*>(client->pluginParent())) {
                 // inject wmode=opaque when there is no client or the client is not a QWebView
                 size_t wmodeIndex = params.find("wmode");
                 if (wmodeIndex == -1) {
@@ -1314,7 +1314,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
                 } else
                     values[wmodeIndex] = "opaque";
             }
-        }
+//        }
 
         RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url,
             params, values, mimeType, loadManually);
Comment 14 Jesus Sanchez-Palencia 2010-05-13 11:19:14 PDT
Is this still a valid bug report?

We have a workaround patch that shouldn't go into QtWebKit and now we know that this only happens on windowed mode plugins.
Comment 15 Kenneth Rohde Christiansen 2010-05-13 11:25:12 PDT
(In reply to comment #14)
> Is this still a valid bug report?
> 
> We have a workaround patch that shouldn't go into QtWebKit and now we know that this only happens on windowed mode plugins.

We dont resize windowed plugins and Flash crashes... we could make that test specific to Flash and thus resize other windowed plugins.
Comment 16 Andreas Kling 2010-07-17 11:44:23 PDT
This was fixed with bug 41407
Comment 17 Jake 2010-09-17 15:44:03 PDT
We are having trouble getting this to work. We downloaded latest software and the associated test page above. Recompiled everything but no dice. We are building our WEBKit through pyside using QWebView.

Any guidance would be helpful.

Thanks, jake
Comment 18 Girish Ramakrishnan 2010-09-22 23:01:23 PDT
(In reply to comment #17)
> We are having trouble getting this to work. We downloaded latest software and the associated test page above. Recompiled everything but no dice. We are building our WEBKit through pyside using QWebView.
> 

Qt/X11 right? This is not a problem in any other platform. Also, this is a problem only on Windowed mode. If you add wmode=opaque in the html or apply the patch in comment 13. then you should not see this problem.

For X11/Windowed mode, this problem cannot be fixed in WebKit, it's a bug in flash.
Comment 19 Girish Ramakrishnan 2010-09-23 10:34:45 PDT
This problem is seen only on 32-bit.
Comment 20 Kenneth Rohde Christiansen 2010-09-23 10:41:36 PDT
(In reply to comment #19)
> This problem is seen only on 32-bit.

Does out work arounds account for that?
Comment 21 Jake 2010-09-26 08:52:08 PDT
(In reply to comment #18)
> (In reply to comment #17)
> > We are having trouble getting this to work. We downloaded latest software and the associated test page above. Recompiled everything but no dice. We are building our WEBKit through pyside using QWebView.
> > 
> 
> Qt/X11 right? This is not a problem in any other platform. Also, this is a problem only on Windowed mode. If you add wmode=opaque in the html or apply the patch in comment 13. then you should not see this problem.
> 
> For X11/Windowed mode, this problem cannot be fixed in WebKit, it's a bug in flash.

Thank you guys so much for the reply. The 'wmode=opaque' fixed the resize issue.

I have a related question about ExternalInterface capability. Has anyone tried this interface between flash and Qt?
Comment 22 Girish Ramakrishnan 2010-09-27 05:56:46 PDT
(In reply to comment #21)
> I have a related question about ExternalInterface capability. Has anyone tried this interface between flash and Qt?

AFAIK, this should just work since it just uses NPN_Invoke/Evaluate which is supported. If it doesn't work, please open a bug. Please keep further questions to the webkit-qt mailing list :)