WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
64541
[Qt] Consider the scale of the page view when scrolling QTouchWebView.
https://bugs.webkit.org/show_bug.cgi?id=64541
Summary
[Qt] Consider the scale of the page view when scrolling QTouchWebView.
Jocelyn Turcotte
Reported
2011-07-14 10:39:06 PDT
[Qt] Consider the scale of the page view when scrolling QTouchWebView.
Attachments
Patch
(1.46 KB, patch)
2011-07-14 10:42 PDT
,
Jocelyn Turcotte
no flags
Details
Formatted Diff
Diff
Patch
(1.49 KB, patch)
2011-07-15 09:25 PDT
,
Jocelyn Turcotte
no flags
Details
Formatted Diff
Diff
Patch
(1.97 KB, patch)
2011-07-15 10:19 PDT
,
Jocelyn Turcotte
no flags
Details
Formatted Diff
Diff
Patch
(1.95 KB, patch)
2011-07-18 05:21 PDT
,
Jocelyn Turcotte
benjamin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Jocelyn Turcotte
Comment 1
2011-07-14 10:42:18 PDT
Created
attachment 100829
[details]
Patch
Benjamin Poulain
Comment 2
2011-07-15 08:42:52 PDT
Comment on
attachment 100829
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=100829&action=review
> Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp:42 > + pageView->moveBy(deltaX * pageView->scale(), deltaY * pageView->scale());
I think TouchViewInterface::panGestureRequestScroll() should use m_viewportView->mapFromItem() and send the coordinate in the right space to the viewport. QTouchWebViewPrivate::scroll(qreal deltaX, qreal deltaY) should be in viewport coordinate.
Jocelyn Turcotte
Comment 3
2011-07-15 09:25:52 PDT
Created
attachment 100993
[details]
Patch Use item mapping functions instead.
Jocelyn Turcotte
Comment 4
2011-07-15 09:31:49 PDT
(In reply to
comment #2
)
> I think TouchViewInterface::panGestureRequestScroll() should use m_viewportView->mapFromItem() and send the coordinate in the right space to the viewport. > > QTouchWebViewPrivate::scroll(qreal deltaX, qreal deltaY) should be in viewport coordinate.
Humm didn't see your comment, since the method is on the viewport it would make sense to give it viewport coordinates. Cooking a new patch.
Jocelyn Turcotte
Comment 5
2011-07-15 10:19:03 PDT
Created
attachment 101001
[details]
Patch Move the mapping to TouchViewInterface
Benjamin Poulain
Comment 6
2011-07-15 10:35:13 PDT
Comment on
attachment 101001
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=101001&action=review
> Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:51 > + // This assumes that m_viewportView's and m_pageView parent's coordinate systems match. > + QPointF destInViewportCoords = m_pageView->mapToParent(m_pageView->mapFromParent(m_pageView->pos()) + QPointF(deltaX, deltaY)); > + QPointF offsetInViewportCoords = destInViewportCoords - m_pageView->pos();
I don't understand why you do all this. Isn't it QPointF destInViewportCoords = m_viewportView->mapFromItem(m_pageView, QPointF(deltaX, deltaY)); ? The 2 delta is like a vector, you can just multiply it by the combined transformation matrix of a subtree to get the transformed vector. Or am I missing something?
Jocelyn Turcotte
Comment 7
2011-07-15 11:10:17 PDT
(In reply to
comment #6
)
> I don't understand why you do all this. > Isn't it > QPointF destInViewportCoords = m_viewportView->mapFromItem(m_pageView, QPointF(deltaX, deltaY)); ? > > The 2 delta is like a vector, you can just multiply it by the combined transformation matrix of a subtree to get the transformed vector. Or am I missing something?
I tried but it's not enough when there is also a translation transform. i.e. a (1,2) delta is mapped to (11,12) if there is a (10,10) translation on top.
Benjamin Poulain
Comment 8
2011-07-15 11:19:21 PDT
Comment on
attachment 101001
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=101001&action=review
Isn't m_pageView->mapFromParent(m_pageView->pos()) always gonna be zero though? In page view coordinate, its own position would be the top left corner.
> Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:49 > + // This assumes that m_viewportView's and m_pageView parent's coordinate systems match.
Personnally I would remove that comment and remove the assumption by using mapFromItem instead of mapFromParent :)
Jocelyn Turcotte
Comment 9
2011-07-15 14:49:57 PDT
(In reply to
comment #8
)
> (From update of
attachment 101001
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=101001&action=review
> > Isn't m_pageView->mapFromParent(m_pageView->pos()) always gonna be zero though? > In page view coordinate, its own position would be the top left corner. >
That's a good point, and along that your code seems right in
comment 6
, but what you get is a vector from the viewport's origin toward the applied vector on the page view's origin. I didn't realize that this is the final destination in viewport coordinate and was trying to apply it as a vector again by sending it as the delta values.
> > Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:49 > > + // This assumes that m_viewportView's and m_pageView parent's coordinate systems match. > > Personnally I would remove that comment and remove the assumption by using mapFromItem instead of mapFromParent :)
That sounds like a good idea too, would also help fixing my assumptions instead of spreading them around :)
Jocelyn Turcotte
Comment 10
2011-07-18 05:21:28 PDT
Created
attachment 101149
[details]
Patch New patch using mapFromItem instead of mapToParent. I tried assuming that mapFromParent(pos()) and remove the call, but the assumption wouldn't hold when scaling the item, event though the documentation says it should (it might not help that we set a different transform origin on that item.).
Benjamin Poulain
Comment 11
2011-07-18 05:24:46 PDT
Comment on
attachment 101149
[details]
Patch Great.
Jocelyn Turcotte
Comment 12
2011-07-18 06:48:56 PDT
Committed
r91183
: <
http://trac.webkit.org/changeset/91183
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug