Bug 64595

Summary: [Qt] Make DeviceMotion and DeviceOrientation work with WebKit2
Product: WebKit Reporter: Kenneth Rohde Christiansen <kenneth>
Component: WebKit2Assignee: Lars Knudsen <larsgk>
Status: RESOLVED FIXED    
Severity: Normal CC: ahf, allan.jensen, benjamin, eric, hausmann, larsgk, laszlo.gombos, luiz, menard, ossy, webkit.review.bot, yael, zoltan
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
kenneth: review-
Patch
webkit.review.bot: commit-queue-
Patch 3
webkit-ews: commit-queue-
Patch 4
webkit-ews: commit-queue-
Patch
webkit-ews: commit-queue-
Patch
webkit-ews: commit-queue-
Patch
ossy: review-, webkit-ews: commit-queue-
patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Kenneth Rohde Christiansen 2011-07-15 06:08:08 PDT
SSIA
Comment 1 Kenneth Rohde Christiansen 2011-07-15 06:39:47 PDT
Created attachment 100967 [details]
Patch
Comment 2 WebKit Review Bot 2011-07-15 06:42:40 PDT
Attachment 100967 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebKit2/WebProcess/WebPage/WebPage.cpp:97:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/WebProcess/WebPage/WebPage.cpp:98:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/WebProcess/WebPage/WebPage.cpp:160:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h:27:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 4 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Kenneth Rohde Christiansen 2011-07-15 06:46:21 PDT
Comment on attachment 100967 [details]
Patch

something went wrong with my tools :-(
Comment 4 Kenneth Rohde Christiansen 2011-07-15 06:49:09 PDT
This needs to be enabled when compiling
Comment 5 Kenneth Rohde Christiansen 2011-07-15 06:49:43 PDT
Created attachment 100969 [details]
Patch
Comment 6 WebKit Review Bot 2011-07-15 06:53:04 PDT
Attachment 100969 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebKit2/WebProcess/WebPage/WebPage.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 WebKit Review Bot 2011-07-15 06:56:11 PDT
Comment on attachment 100969 [details]
Patch

Attachment 100969 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/9096243
Comment 8 Kenneth Rohde Christiansen 2011-07-15 07:02:07 PDT
Created attachment 100972 [details]
Patch 3
Comment 9 Early Warning System Bot 2011-07-15 07:16:22 PDT
Comment on attachment 100972 [details]
Patch 3

Attachment 100972 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9093247
Comment 10 Kenneth Rohde Christiansen 2011-07-15 07:50:09 PDT
Created attachment 100975 [details]
Patch 4

Another try...
Comment 11 Early Warning System Bot 2011-07-15 07:59:08 PDT
Comment on attachment 100975 [details]
Patch 4

Attachment 100975 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9095245
Comment 12 Kenneth Rohde Christiansen 2011-07-15 09:15:47 PDT
Created attachment 100990 [details]
Patch

Trying to include PassOwnPtr
Comment 13 Early Warning System Bot 2011-07-15 09:24:11 PDT
Comment on attachment 100990 [details]
Patch

Attachment 100990 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9093288
Comment 14 Kenneth Rohde Christiansen 2011-07-15 09:50:01 PDT
Created attachment 100996 [details]
Patch
Comment 15 Early Warning System Bot 2011-07-15 09:58:17 PDT
Comment on attachment 100996 [details]
Patch

Attachment 100996 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9094333
Comment 16 Kenneth Rohde Christiansen 2011-07-15 10:01:12 PDT
Created attachment 100999 [details]
Patch
Comment 17 Early Warning System Bot 2011-07-15 10:11:11 PDT
Comment on attachment 100999 [details]
Patch

Attachment 100999 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/9095285
Comment 18 Kenneth Rohde Christiansen 2011-07-15 10:26:36 PDT
I'm guess this is because of a non-clean build... it must be using the old file.

Ossy can you verify this somehow?
Comment 19 Benjamin Poulain 2011-07-18 05:17:31 PDT
Comment on attachment 100999 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=100999&action=review

Quick review.

I don't understand why you make this a Qt specific subclass of DeviceMotionClient and DeviceOrientationClient while all they do is forward call to a provider.
It looks like instead DeviceMotionClient should not be abstract, and DeviceMotionProvider should be a typedef per platform. Same for orientation.

I am not familiar with this code, is there a reason for all those indirections?

> Source/WebCore/platform/qt/DeviceMotionProviderQt.cpp:2
> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)

2011 :)

> Source/WebCore/platform/qt/DeviceMotionProviderQt.h:2
> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)

2011

> Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp:24
> +#if ENABLE(DEVICE_ORIENTATION)

You should not put this check, the file is simply not compiled if DEVICE_ORIENTATION is not set.

> Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h:23
> +#if ENABLE(DEVICE_ORIENTATION)

The file is not added if ENABLE_DEVICE_ORIENTATION is not defined. I think is it more explicit to have the check on the include side than on the header side.

> Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h:30
> +#include <wtf/PassOwnPtr.h>

I am unsure why you need PassOwnPtr in this header, looks like it should be only needed in the implementation for intializing the OwnPtr(?).

> Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h:36
> +    DeviceOrientationClientQt() { }

Maybe just remove the constructor and let the compiler declare the empty constructor for you? :)

> Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h:37
>      virtual ~DeviceOrientationClientQt();

Look like this one is not needed anymore after this patch.

> Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h:47
> +    virtual void deviceOrientationControllerDestroyed();
> +
>      virtual void startUpdating();
>      virtual void stopUpdating();
> +
>      virtual DeviceOrientation* lastOrientation() const;
> -    virtual void deviceOrientationControllerDestroyed();
>  
> -public Q_SLOTS:
> -    void changeDeviceOrientation(DeviceOrientation*);
> +    virtual void setController(DeviceOrientationController*);

I would put them in the same order as DeviceOrientationClient but it does not matter much...

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:127
> +#include "DeviceMotionClientQt.h"
> +#include "DeviceOrientationClientQt.h"

If you follow my comment about checking the feature in the hader, you need #if ENABLE(DEVICE_ORIENTATION) here.
Comment 20 Csaba Osztrogonác 2011-07-25 04:52:26 PDT
(In reply to comment #18)
> I'm guess this is because of a non-clean build... it must be using the old file.
> 
> Ossy can you verify this somehow?

No, it isn't a non-clean build problem.

Now there are two header files:
 - WebCore/platform/qt/DeviceOrientationProviderQt.h
 - WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h

And I guess that the cpp file includes the wrong one.
Comment 21 Csaba Osztrogonác 2011-07-25 04:52:52 PDT
Comment on attachment 100999 [details]
Patch

r- now, because it doesn't build
Comment 22 Luiz Agostini 2011-07-27 18:22:38 PDT
Created attachment 102211 [details]
patch
Comment 23 Luiz Agostini 2011-07-28 05:18:55 PDT
(In reply to comment #19)
> (From update of attachment 100999 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=100999&action=review
> 
> Quick review.
> 
> I don't understand why you make this a Qt specific subclass of DeviceMotionClient and DeviceOrientationClient while all they do is forward call to a provider.
> It looks like instead DeviceMotionClient should not be abstract, and DeviceMotionProvider should be a typedef per platform. Same for orientation.
> 
> I am not familiar with this code, is there a reason for all those indirections?

I think that what we could do to avoid all those indirections is to have no provider.
Comment 24 Alexis Menard (darktears) 2011-08-01 11:21:37 PDT
Comment on attachment 102211 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102211&action=review

> Source/WebCore/platform/qt/DeviceOrientationProviderQt.cpp:2
> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)

2011

> Source/WebCore/platform/qt/DeviceOrientationProviderQt.h:2
> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)

Still 2011
Comment 25 Kenneth Rohde Christiansen 2011-08-08 01:46:11 PDT
> > I am not familiar with this code, is there a reason for all those indirections?
> 
> I think that what we could do to avoid all those indirections is to have no provider.

There were possible a reason for this at some point, but not anymore. I wouldn't mind that being another patch though.
Comment 26 Kenneth Rohde Christiansen 2011-08-08 03:01:30 PDT
(In reply to comment #25)
> > > I am not familiar with this code, is there a reason for all those indirections?
> > 
> > I think that what we could do to avoid all those indirections is to have no provider.
> 
> There were possible a reason for this at some point, but not anymore. I wouldn't mind that being another patch though.

One of the reasons that there is a provider is that one is used by both DeviceMotion and DeviceOrientation.
Comment 27 Eric Seidel (no email) 2012-03-01 16:29:38 PST
This looks abandoned.  Should this be r-'d?  Closed?
Comment 28 Kenneth Rohde Christiansen 2012-03-02 02:28:27 PST
No, this will be done at some point. I can probably review the patch on monday.
Comment 29 Allan Sandfeld Jensen 2012-04-23 01:46:28 PDT
The patch is pretty old, maybe it needs to be rebased first?
Comment 30 Lars Knudsen 2012-04-25 11:16:18 PDT
(In reply to comment #29)
> The patch is pretty old, maybe it needs to be rebased first?

I'll take a shot at it now
Comment 31 Lars Knudsen 2012-05-01 05:43:12 PDT
Created attachment 139614 [details]
Patch
Comment 32 WebKit Review Bot 2012-05-01 05:45:40 PDT
Attachment 139614 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'ChangeLog', u'Source/WebCore/ChangeLog', u..." exit_code: 1
Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 33 Lars Knudsen 2012-05-01 05:47:45 PDT
Created attachment 139616 [details]
Patch
Comment 34 Kenneth Rohde Christiansen 2012-05-01 06:00:47 PDT
Comment on attachment 139616 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=139616&action=review

> Source/WebCore/platform/qt/DeviceMotionClientQt.cpp:2
> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)

If you change any of these files, please update copyright date

> Source/WebCore/platform/qt/DeviceMotionProviderQt.cpp:76
> +            false, 0 /* The interval is treated internally by Qt mobility */);

Nothing is called Qt Mobility in Qt5. QtSensors I believe
Comment 35 Early Warning System Bot 2012-05-01 06:22:48 PDT
Comment on attachment 139616 [details]
Patch

Attachment 139616 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12586608
Comment 36 Early Warning System Bot 2012-05-01 06:26:25 PDT
Comment on attachment 139616 [details]
Patch

Attachment 139616 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12584619
Comment 37 Lars Knudsen 2012-05-01 07:06:36 PDT
Created attachment 139622 [details]
Patch
Comment 38 Early Warning System Bot 2012-05-01 07:15:29 PDT
Comment on attachment 139622 [details]
Patch

Attachment 139622 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12587557
Comment 39 Lars Knudsen 2012-05-01 07:44:35 PDT
Created attachment 139626 [details]
Patch
Comment 40 Early Warning System Bot 2012-05-01 08:04:42 PDT
Comment on attachment 139626 [details]
Patch

Attachment 139626 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12589559
Comment 41 Lars Knudsen 2012-05-01 15:56:33 PDT
Created attachment 139696 [details]
Patch
Comment 42 Simon Hausmann 2012-05-02 01:15:16 PDT
Comment on attachment 139696 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=139696&action=review

> Source/WebCore/Target.pri:3439
> +    haveQt(5) {
> +        QT += sensors
> +    } else {
> +        CONFIG *= mobility
> +        MOBILITY *= sensors
> +    }

I don't think this block is needed given that it's also in WebCore.pri.

> Source/WebKit2/Target.pri:794
> +contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
> +    haveQt(5): QT += sensors
> +}

Why is this needed? WebCore.pri has it and this Target.pri has WEBKIT += webcore, which should pull in WebCore.pri through Tools/qmake/mkspecs/modules/webcore.prf
Comment 43 Lars Knudsen 2012-05-02 01:42:53 PDT
Created attachment 139767 [details]
Patch
Comment 44 Lars Knudsen 2012-05-02 01:43:46 PDT
(In reply to comment #42)
> (From update of attachment 139696 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=139696&action=review
> 
> > Source/WebCore/Target.pri:3439
> > +    haveQt(5) {
> > +        QT += sensors
> > +    } else {
> > +        CONFIG *= mobility
> > +        MOBILITY *= sensors
> > +    }
> 
> I don't think this block is needed given that it's also in WebCore.pri.
> 
> > Source/WebKit2/Target.pri:794
> > +contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
> > +    haveQt(5): QT += sensors
> > +}
> 
> Why is this needed? WebCore.pri has it and this Target.pri has WEBKIT += webcore, which should pull in WebCore.pri through Tools/qmake/mkspecs/modules/webcore.prf

True, done - thanks! :)
Comment 45 Kenneth Rohde Christiansen 2012-05-02 02:00:18 PDT
[10:38] <simon_> laknudse, kenneth: the pattern in if (!m_provider && controller) looks a bit dangerous to me :)
[10:38] <simon_> if !m_provider and !controller, then setController crashes
[10:39] * simon_ would remove the controller part of the if()
Comment 46 Lars Knudsen 2012-05-02 04:00:45 PDT
Created attachment 139785 [details]
Patch
Comment 47 WebKit Review Bot 2012-05-02 04:50:50 PDT
Comment on attachment 139785 [details]
Patch

Clearing flags on attachment: 139785

Committed r115812: <http://trac.webkit.org/changeset/115812>
Comment 48 WebKit Review Bot 2012-05-02 04:50:59 PDT
All reviewed patches have been landed.  Closing bug.
Comment 49 Csaba Osztrogonác 2012-05-02 06:51:41 PDT
Reopen, because it broke the builds with Qt Mobility:
(Qt Windows, Qt MIPS, Qt SH4 bots)

In file included from ../../../Source/WebCore/platform/qt/DeviceMotionClientQt.h:27:0,
                 from ../../../Source/WebKit/qt/Api/qwebpage.cpp:48:
../../../Source/WebCore/platform/qt/DeviceMotionProviderQt.h:25:32: fatal error: QAccelerometerFilter: No such file or directory
Comment 50 Csaba Osztrogonác 2012-05-02 07:06:44 PDT
Created attachment 139807 [details]
Patch
Comment 51 Csaba Osztrogonác 2012-05-02 07:18:05 PDT
Comment on attachment 139807 [details]
Patch

Clearing flags on attachment: 139807

Committed r115828: <http://trac.webkit.org/changeset/115828>
Comment 52 Csaba Osztrogonác 2012-05-02 07:18:25 PDT
All reviewed patches have been landed.  Closing bug.