Bug 1600652 - Update Scroll frame metrics for android so text select popup is in correct location. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D58165

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Taeleman 2019-12-31 22:30:13 +00:00
Родитель e98ae699f5
Коммит e673d8a673
4 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -731,6 +731,16 @@ void APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
wr::ToLayoutPoint(asyncScrollDelta));
apzc->ReportCheckerboard(aSampleTime);
#if defined(MOZ_WIDGET_ANDROID)
// Send the root frame metrics to java through the UIController
RefPtr<UiCompositorControllerParent> uiController =
UiCompositorControllerParent::GetFromRootLayerTreeId(mRootLayersId);
if (uiController &&
apzc->UpdateRootFrameMetricsIfChanged(mLastRootMetrics)) {
uiController->NotifyUpdateScreenMetrics(mLastRootMetrics);
}
#endif
}
// Now collect all the async transforms needed for the scrollthumbs.

Просмотреть файл

@ -954,6 +954,9 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
private:
RefPtr<AndroidDynamicToolbarAnimator> mToolbarAnimator;
// Last Frame metrics sent to java through UIController.
FrameMetrics mLastRootMetrics;
#endif // defined(MOZ_WIDGET_ANDROID)
};

Просмотреть файл

@ -4800,6 +4800,24 @@ const FrameMetrics& AsyncPanZoomController::Metrics() const {
;
}
bool AsyncPanZoomController::UpdateRootFrameMetricsIfChanged(
FrameMetrics& metrics) {
RecursiveMutexAutoLock lock(mRecursiveMutex);
const FrameMetrics& aMetrics = Metrics();
if (!aMetrics.IsRootContent()) return false;
bool hasChanged = RoundedToInt(metrics.GetScrollOffset()) !=
RoundedToInt(aMetrics.GetScrollOffset()) ||
metrics.GetZoom() != aMetrics.GetZoom();
if (hasChanged) {
metrics = aMetrics;
}
return hasChanged;
}
const FrameMetrics& AsyncPanZoomController::GetFrameMetrics() const {
return Metrics();
}

Просмотреть файл

@ -554,6 +554,10 @@ class AsyncPanZoomController {
const FrameMetrics& Metrics() const;
FrameMetrics& Metrics();
// Helper function to compare root frame metrics and update them
// Returns true when the metrics have changed and were updated.
bool UpdateRootFrameMetricsIfChanged(FrameMetrics& metrics);
private:
// Get whether the horizontal content of the honoured target of auto-dir
// scrolling starts from right to left. If you don't know of auto-dir