Bug 88308 - [Qt][Win] Fix building Source/WebCore/plugins/win/PluginViewWin.cpp
Summary: [Qt][Win] Fix building Source/WebCore/plugins/win/PluginViewWin.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 420+
Hardware: All All
: P1 Blocker
Assignee: Balazs Kelemen
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 88300
  Show dependency treegraph
 
Reported: 2012-06-05 01:21 PDT by Csaba Osztrogonác
Modified: 2012-06-10 06:44 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.13 KB, patch)
2012-06-05 09:10 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.48 KB, patch)
2012-06-07 09:43 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff
Patch (1.67 KB, patch)
2012-06-08 07:59 PDT, Balazs Kelemen
no flags Details | Formatted Diff | Diff
Patch (1.83 KB, patch)
2012-06-08 09:59 PDT, Balazs Kelemen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Csaba Osztrogonác 2012-06-05 01:21:57 PDT
- Use QtWidgets/QWidget include instead of obsolete QWidget
- QWidget->winId() doesn't work for some reason
Comment 1 Csaba Osztrogonác 2012-06-05 09:10:39 PDT
Created attachment 145814 [details]
Patch
Comment 2 Csaba Osztrogonác 2012-06-05 09:14:00 PDT
(In reply to comment #0)
> - Use QtWidgets/QWidget include instead of obsolete QWidget
> - QWidget->winId() doesn't work for some reason

The patch only fixes the first bug.

The second one is here, but I don't know how to fix it:
f:\WebKit\Source\WebCore\plugins\win\PluginViewWin.cpp(105) : error C2440: 'return' : cannot convert from 'WId' to 'HWND'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Comment 3 Caio Marcelo de Oliveira Filho 2012-06-05 11:19:33 PDT
(In reply to comment #2)
> (In reply to comment #0)
> > - Use QtWidgets/QWidget include instead of obsolete QWidget
> > - QWidget->winId() doesn't work for some reason
> 
> The patch only fixes the first bug.
> 
> The second one is here, but I don't know how to fix it:
> f:\WebKit\Source\WebCore\plugins\win\PluginViewWin.cpp(105) : error C2440: 'return' : cannot convert from 'WId' to 'HWND'
>         Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

WId used to be a typedef to HWND, but it isn't anymore. It seems to me we need to do more work to get the HWND.

By insepcting Qt code, it seems using QApplicationPrivate::getHWNDForWidget() instead of winId() would suffice.
Comment 4 Simon Hausmann 2012-06-05 14:08:54 PDT
Comment on attachment 145814 [details]
Patch

Hm no, if we were using QT += widgets in WebCore, then this would not be needed. But we shouldn't use QT += widgets in WebCore, so the question is: Why dos PluginViewWin.cpp need QWidget?

I have the feeling that for Qt 5 it's not actually QWidget that's needed but QWindow instead, to make the resolution from the WebView to a HWND.
Comment 5 Caio Marcelo de Oliveira Filho 2012-06-05 15:44:21 PDT
(In reply to comment #3)
> By insepcting Qt code, it seems using QApplicationPrivate::getHWNDForWidget() instead of winId() would suffice.

Note that getHWNDForWidget() is implemented using the QWidget's QWindow, so we possibly can do the same, getting rid of the QWidget dependency.
Comment 6 Caio Marcelo de Oliveira Filho 2012-06-05 15:44:45 PDT
(In reply to comment #5)
> Note that getHWNDForWidget() is implemented using the QWidget's QWindow, so we possibly can do the same, getting rid of the QWidget dependency.

(...in this particular case.)
Comment 7 Csaba Osztrogonác 2012-06-07 07:53:39 PDT
I don't understand what are you talking about. :)

Any volunteer to fix it?
Comment 8 Csaba Osztrogonác 2012-06-07 09:43:59 PDT
Created attachment 146311 [details]
Patch

Please don't review it, I don't want to land it. It is only a workaround until proper fix to be able test other build problems.
Comment 9 Csaba Osztrogonác 2012-06-07 09:44:30 PDT
No, I didn't want to assign it to myself, but webkit-patch did it again ...
Comment 10 Balazs Kelemen 2012-06-08 07:59:28 PDT
Created attachment 146573 [details]
Patch
Comment 11 Balazs Kelemen 2012-06-08 08:01:04 PDT
Ossy, could you test it? Maybe a cast is missing.
Comment 12 Csaba Osztrogonác 2012-06-08 09:11:20 PDT
(In reply to comment #11)
> Ossy, could you test it? Maybe a cast is missing.
Sure.

PluginViewWin.cpp

f:\WebKit\Source\WebCore\plugins\win\PluginViewWin.cpp(104) : error C2027: use of undefined type 'QWindow'
        f:\qt5\qtbase\include\qtgui\../../src/gui/kernel/qwindowdefs.h(57) : see
 declaration of 'QWindow'
f:\WebKit\Source\WebCore\plugins\win\PluginViewWin.cpp(104) : error C2227: left of '->winId' must point to class/struct/union/generic type
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\Bin\cl.EXE"' : return code '0x2'
Stop.

It seems we need different codepaths for Qt4 and Qt5:

#if HAVE(QT5)
#include <QWindow>
#else
#include <QWidget>
#endif

...

and similar when we use included things


and after this fix I got the following error:
f:\WebKit\Source\WebCore\plugins\win\PluginViewWin.cpp(109) : error C2440: return' : cannot convert from 'WId' to 'HWND'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Comment 13 Balazs Kelemen 2012-06-08 09:59:43 PDT
Created attachment 146590 [details]
Patch
Comment 14 Balazs Kelemen 2012-06-10 06:44:45 PDT
Comment on attachment 146590 [details]
Patch

Clearing flags on attachment: 146590

Committed r119927: <http://trac.webkit.org/changeset/119927>
Comment 15 Balazs Kelemen 2012-06-10 06:44:54 PDT
All reviewed patches have been landed.  Closing bug.