Bug 1250024 - Fix touch-tap event coordinate transformations when a fullzoom is applied. r=botond

There were a couple of problems when delivering tap gestures to content with
full zoom applied. One was that the ConverToGecko function converted the coords
into "CSS pixel" space by using the web content's CSS-to-LD scale, but also
applied that on the translation from the chrome area. Moving that conversion
to later in the process (after the coords got passed through TabParent::
AdjustTapToChildWidget) corrected that issue.

The other problem was that bits of code in APZEventState and APZCCallbackHelper
were using the widget->GetDefaultScale() value as the CSS-to-LD scale, but that
omitted the full zoom value. Getting the CSS-to-LD scale from the presShell and
propagating that through corrected that issue.

MozReview-Commit-ID: KdrkdEZslHo
This commit is contained in:
Kartikaya Gupta
2016-07-29 14:44:29 -04:00
parent e8161dcbef
commit 52a4a4348a
25 changed files with 135 additions and 80 deletions

View File

@@ -44,7 +44,7 @@ AndroidContentController::NotifyDefaultPrevented(IAPZCTreeManager* aManager,
}
void
AndroidContentController::HandleTap(TapType aType, const CSSPoint& aPoint,
AndroidContentController::HandleTap(TapType aType, const LayoutDevicePoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId)
@@ -55,14 +55,19 @@ AndroidContentController::HandleTap(TapType aType, const CSSPoint& aPoint,
// done from either thread but we need access to the callback transform
// so we do it from the main thread.
if (NS_IsMainThread() && aType == TapType::eSingleTap) {
CSSPoint point = mozilla::layers::APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
nsIContent* content = nsLayoutUtils::FindContentFor(aGuid.mScrollId);
nsIPresShell* shell = content
? mozilla::layers::APZCCallbackHelper::GetRootContentDocumentPresShellForContent(content)
: nullptr;
if (shell && shell->ScaleToResolution()) {
if (!shell || !shell->GetPresContext()) {
return;
}
CSSPoint point = mozilla::layers::APZCCallbackHelper::ApplyCallbackTransform(
aPoint / shell->GetPresContext()->CSSToDevPixelScale(), aGuid);
if (shell->ScaleToResolution()) {
// We need to convert from the root document to the root content document,
// by unapplying the resolution that's on the content document.
const float resolution = shell->GetResolution();