Bug 1335895 - Android GeckoView Dynamic Toolbar Version 3 r=botond,dvander,jchen,kats
This version of the Dynamic Toolbar moves the animation of the toolbar from the Android UI thread to the compositor thread. All animation for showing and hiding the toolbar are done with the compositor and a static snapshot of the real toolbar. MozReview-Commit-ID: BCe8zpbkWQt
This commit is contained in:
@@ -25,64 +25,6 @@ AndroidContentController::Destroy()
|
||||
ChromeProcessController::Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
AndroidContentController::DispatchSingleTapToObservers(const LayoutDevicePoint& aPoint,
|
||||
const ScrollableLayerGuid& aGuid) const
|
||||
{
|
||||
nsIContent* content = nsLayoutUtils::FindContentFor(aGuid.mScrollId);
|
||||
nsPresContext* context = content
|
||||
? mozilla::layers::APZCCallbackHelper::GetPresContextForContent(content)
|
||||
: nullptr;
|
||||
|
||||
if (!context) {
|
||||
return;
|
||||
}
|
||||
|
||||
CSSPoint point = mozilla::layers::APZCCallbackHelper::ApplyCallbackTransform(
|
||||
aPoint / context->CSSToDevPixelScale(), aGuid);
|
||||
|
||||
nsPresContext* rcdContext = context->GetToplevelContentDocumentPresContext();
|
||||
if (rcdContext && rcdContext->PresShell()->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 = rcdContext->PresShell()->GetResolution();
|
||||
point.x /= resolution;
|
||||
point.y /= resolution;
|
||||
}
|
||||
|
||||
CSSIntPoint rounded = RoundedToInt(point);
|
||||
nsAppShell::PostEvent([rounded] {
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
if (!obsServ) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsPrintfCString data("{\"x\":%d,\"y\":%d}", rounded.x, rounded.y);
|
||||
obsServ->NotifyObservers(nullptr, "Gesture:SingleTap",
|
||||
NS_ConvertASCIItoUTF16(data).get());
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
AndroidContentController::HandleTap(TapType aType, const LayoutDevicePoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId)
|
||||
{
|
||||
// This function will get invoked first on the Java UI thread, and then
|
||||
// again on the main thread (because of the code in ChromeProcessController::
|
||||
// HandleTap). We want to post the SingleTap message once; it can be
|
||||
// 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 || aType == TapType::eSecondTap)) {
|
||||
DispatchSingleTapToObservers(aPoint, aGuid);
|
||||
}
|
||||
|
||||
ChromeProcessController::HandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidContentController::UpdateOverscrollVelocity(const float aX, const float aY, const bool aIsRootContent)
|
||||
{
|
||||
@@ -99,14 +41,6 @@ AndroidContentController::UpdateOverscrollOffset(const float aX, const float aY,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidContentController::SetScrollingRootContent(const bool isRootContent)
|
||||
{
|
||||
if (mAndroidWindow) {
|
||||
mAndroidWindow->SetScrollingRootContent(isRootContent);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidContentController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
|
||||
Reference in New Issue
Block a user