Bug 87236 - [Qt][WK2] Fix failing qmltests::FitToView::test_basic()
Summary: [Qt][WK2] Fix failing qmltests::FitToView::test_basic()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: zalan
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 70236 86857
  Show dependency treegraph
 
Reported: 2012-05-23 02:20 PDT by Csaba Osztrogonác
Modified: 2012-05-29 05:10 PDT (History)
8 users (show)

See Also:


Attachments
Patch (9.55 KB, patch)
2012-05-24 05:16 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (8.42 KB, patch)
2012-05-24 05:42 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (9.22 KB, patch)
2012-05-24 12:26 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (9.59 KB, patch)
2012-05-25 00:13 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (14.09 KB, patch)
2012-05-29 02:33 PDT, Kenneth Rohde Christiansen
no flags Details | Formatted Diff | Diff
Patch (14.72 KB, patch)
2012-05-29 03:44 PDT, Kenneth Rohde Christiansen
hausmann: review+
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-05-23 02:20:15 PDT
This test introduced in http://trac.webkit.org/changeset/117942
and fails from the beginning:

FAIL!  : qmltests::FitToView::test_basic() Compared values are not the same
   Actual   (): 0.5
   Expected (): 1
   Loc: [/home/webkitbuildbot/slaves/release64bitWebKit2_EC2/buildslave/qt-linux-64-release-webkit2/build/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml(96)]
Comment 1 Kenneth Rohde Christiansen 2012-05-23 03:47:18 PDT
I'm already looking into this.
Comment 2 Kenneth Rohde Christiansen 2012-05-23 03:47:39 PDT
I'm already looking into this.
Comment 3 Kenneth Rohde Christiansen 2012-05-24 03:46:32 PDT
https://gist.github.com/2780751 fixes this but contains many separate changes. Work is ongoing to upstream this ASAP with help of Zalan and Alex.
Comment 4 zalan 2012-05-24 05:16:20 PDT
Created attachment 143792 [details]
Patch
Comment 5 Kenneth Rohde Christiansen 2012-05-24 05:18:06 PDT
Comment on attachment 143792 [details]
Patch

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

r=me with the changes

> Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp:127
> -    emit d->viewportItem->experimental()->test()->contentsScaleCommitted();
> +    emit d->viewportItem->experimental()->test()->contentsScaleChanged();

unrelated, should be part of another patch

> Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp:930
> -            // Emits contentsScaleCommitted();
> +            // Emits contentsScaleChanged();

Other patch?
Comment 6 Caio Marcelo de Oliveira Filho 2012-05-24 05:33:15 PDT
Comment on attachment 143792 [details]
Patch

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

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:297
> +    m_hadUserInteraction = true;

Question: do we still need to set it to true in the gesture specific functions: panGestureStarted(), pinchGestureStarted()?

Suggestion: this seems to be the important fix in the patch, maybe deserve some mention in the ChangeLog why had user interaction was missing here.

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:360
> +    ASSERT(m_hadUserInteraction);

8 lines after the code sets m_hadUserInteraction to true again, maybe that's not needed anymore.
Comment 7 Caio Marcelo de Oliveira Filho 2012-05-24 05:33:38 PDT
Comment on attachment 143792 [details]
Patch

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

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:297
> +    m_hadUserInteraction = true;

Question: do we still need to set it to true in the gesture specific functions: panGestureStarted(), pinchGestureStarted()?

Suggestion: this seems to be the important fix in the patch, maybe deserve some mention in the ChangeLog why had user interaction was missing here.

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:360
> +    ASSERT(m_hadUserInteraction);

8 lines after the code sets m_hadUserInteraction to true again, maybe that's not needed anymore.
Comment 8 Caio Marcelo de Oliveira Filho 2012-05-24 05:33:38 PDT
Comment on attachment 143792 [details]
Patch

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

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:297
> +    m_hadUserInteraction = true;

Question: do we still need to set it to true in the gesture specific functions: panGestureStarted(), pinchGestureStarted()?

Suggestion: this seems to be the important fix in the patch, maybe deserve some mention in the ChangeLog why had user interaction was missing here.

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:360
> +    ASSERT(m_hadUserInteraction);

8 lines after the code sets m_hadUserInteraction to true again, maybe that's not needed anymore.
Comment 9 Caio Marcelo de Oliveira Filho 2012-05-24 05:34:55 PDT
Sorry for the repeated messages.
Comment 10 Kenneth Rohde Christiansen 2012-05-24 05:36:25 PDT
(In reply to comment #8)
> (From update of attachment 143792 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=143792&action=review
> 
> > Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:297
> > +    m_hadUserInteraction = true;
> 
> Question: do we still need to set it to true in the gesture specific functions: panGestureStarted(), pinchGestureStarted()?

They should not be needed anymore, but I am not sure how correct our current code is, so we could replace them with asserts.

> Suggestion: this seems to be the important fix in the patch, maybe deserve some mention in the ChangeLog why had user interaction was missing here.

the touchBegin was added by Jocelyn to fix a bug, but he forgot to add the = true, which breaks one of our tests.
Comment 11 zalan 2012-05-24 05:42:37 PDT
Created attachment 143799 [details]
Patch
Comment 12 Caio Marcelo de Oliveira Filho 2012-05-24 06:00:43 PDT
Comment on attachment 143799 [details]
Patch

Sorry. I think at least assigning true after the ASSERT true should be fixed, otherwise people reading this code in the future will get confused.
Comment 13 Caio Marcelo de Oliveira Filho 2012-05-24 06:05:36 PDT
(In reply to comment #10)
> (In reply to comment #8)
> > (From update of attachment 143792 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=143792&action=review
> > 
> > > Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:297
> > > +    m_hadUserInteraction = true;
> > 
> > Question: do we still need to set it to true in the gesture specific functions: panGestureStarted(), pinchGestureStarted()?
> 
> They should not be needed anymore, but I am not sure how correct our current code is, so we could replace them with asserts.

If the assignments are redundant I think they should be removed before landing the patch with assertions.
Comment 14 Caio Marcelo de Oliveira Filho 2012-05-24 06:09:02 PDT
(In reply to comment #13)
> If the assignments are redundant I think they should be removed before landing the patch with assertions.

the patch, with assertions added in their places.
Comment 15 Kenneth Rohde Christiansen 2012-05-24 07:42:57 PDT
(In reply to comment #14)
> (In reply to comment #13)
> > If the assignments are redundant I think they should be removed before landing the patch with assertions.
> 
> the patch, with assertions added in their places.

He means from pinch and panGesture...
Comment 16 zalan 2012-05-24 12:26:15 PDT
Created attachment 143870 [details]
Patch
Comment 17 Kenneth Rohde Christiansen 2012-05-24 14:37:10 PDT
Comment on attachment 143870 [details]
Patch

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

r=me with that change

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:-503
> -    m_hadUserInteraction = true;

Please make these asserts instead. The idea is that touchBegin gets called before panGestureStarted, so lets make sure that never change by making this into an assert

ASSERT(m_hadUserInteraction); // Set by perceding touchBegin call.

> Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp:-567
> -    m_hadUserInteraction = true;

Same here.
Comment 18 zalan 2012-05-25 00:13:32 PDT
Created attachment 143989 [details]
Patch
Comment 19 WebKit Review Bot 2012-05-25 01:29:48 PDT
Comment on attachment 143989 [details]
Patch

Clearing flags on attachment: 143989

Committed r118493: <http://trac.webkit.org/changeset/118493>
Comment 20 WebKit Review Bot 2012-05-25 01:29:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Kenneth Rohde Christiansen 2012-05-26 01:47:09 PDT
Reopen as the test doesn't pass yet and I have local code to make it do so. Unfortunately this will first be fixed tuesday.
Comment 22 Kenneth Rohde Christiansen 2012-05-29 02:33:20 PDT
Created attachment 144490 [details]
Patch
Comment 23 WebKit Review Bot 2012-05-29 02:38:47 PDT
Attachment 144490 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1
Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h:26:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 24 Caio Marcelo de Oliveira Filho 2012-05-29 03:01:49 PDT
Comment on attachment 144490 [details]
Patch

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

> Source/WebKit2/ChangeLog:7
> +

I'm missing a big picture comment about the fix you are making here. What was wrong to make the test fail?

> Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp:887
> +    static float lastCommittedScale = -1;

If we have two WebViews in the application, won't this static cause trouble?
Comment 25 Simon Hausmann 2012-05-29 03:01:59 PDT
Comment on attachment 144490 [details]
Patch

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

> Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp:890
> +    static float lastCommittedScale = -1;
> +    if (scale != lastCommittedScale)
> +        emit q->experimental()->test()->contentsScaleCommitted();
> +    lastCommittedScale = scale;

Urgh, any chance of making this a member variable instead? ;(

Maybe it belongs as a member into the test object?

> Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp:57
> +bool QWebKitTest::sendTouchEvent(QQuickWebView* window, QEvent::Type type, QList<QTouchEvent::TouchPoint>& points, ulong timestamp)

I don't like APIs that have mutable parameters where you can't see them on the caller side. I would prefer if points was a _pointer_ to a QList, so
that it's easier to imagine on the caller side that the list will be modified in this function.

Although it doesn't look like that this functionality (removing released touch points) is used anywhere?
Comment 26 Kenneth Rohde Christiansen 2012-05-29 03:44:17 PDT
Created attachment 144504 [details]
Patch
Comment 27 WebKit Review Bot 2012-05-29 03:48:11 PDT
Attachment 144504 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1
Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h:25:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 28 Kenneth Rohde Christiansen 2012-05-29 05:10:31 PDT
Committed in 118758