Bug 1554795 - Expose the currently effective visual viewport rect. r=hiro

Similar to the other GetCurrentAsync*() functions,
GetCurrentAsyncVisualViewport() takes into account the async test
attributes as well as the frame delay.

It supersedes GetCurrentAsyncScrollOffsetInCSSPixels() which can
be obtained as the the TopLeft() of the visual viewport rect.

Differential Revision: https://phabricator.services.mozilla.com/D163148
This commit is contained in:
Botond Ballo 2023-02-06 23:16:58 +00:00
Родитель aef9e1e135
Коммит 3783cb10b6
4 изменённых файлов: 15 добавлений и 11 удалений

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

@ -760,8 +760,9 @@ void APZCTreeManager::SampleForWebRender(const Maybe<VsyncId>& aVsyncId,
auto it = mTestData.find(guid.mLayersId);
if (it != mTestData.end()) {
it->second->RecordSampledResult(
apzc->GetCurrentAsyncScrollOffsetInCssPixels(
AsyncPanZoomController::eForCompositing),
apzc->GetCurrentAsyncVisualViewport(
AsyncPanZoomController::eForCompositing)
.TopLeft(),
(aSampleTime.Time() - TimeStamp::ProcessCreation())
.ToMicroseconds(),
guid.mLayersId, guid.mScrollId);

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

@ -161,8 +161,9 @@ APZSampler::GetCurrentScrollOffsetAndRange(
// FIXME: Use the one-frame delayed offset now. This doesn't take
// scroll-linked effets into accounts, so we have to fix this in the
// future.
apzc->GetCurrentAsyncScrollOffsetInCssPixels(
AsyncPanZoomController::AsyncTransformConsumer::eForCompositing),
apzc->GetCurrentAsyncVisualViewport(
AsyncPanZoomController::AsyncTransformConsumer::eForCompositing)
.TopLeft(),
apzc->GetCurrentScrollRangeInCssPixels()});
}

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

@ -4767,12 +4767,15 @@ ParentLayerPoint AsyncPanZoomController::GetCurrentAsyncScrollOffset(
return GetEffectiveScrollOffset(aMode, lock) * GetEffectiveZoom(aMode, lock);
}
CSSPoint AsyncPanZoomController::GetCurrentAsyncScrollOffsetInCssPixels(
CSSRect AsyncPanZoomController::GetCurrentAsyncVisualViewport(
AsyncTransformConsumer aMode) const {
RecursiveMutexAutoLock lock(mRecursiveMutex);
AutoApplyAsyncTestAttributes testAttributeApplier(this, lock);
return GetEffectiveScrollOffset(aMode, lock);
return CSSRect(
GetEffectiveScrollOffset(aMode, lock),
FrameMetrics::CalculateCompositedSizeInCssPixels(
Metrics().GetCompositionBounds(), GetEffectiveZoom(aMode, lock)));
}
AsyncTransform AsyncPanZoomController::GetCurrentAsyncTransform(

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

@ -1184,12 +1184,11 @@ class AsyncPanZoomController {
AsyncTransformConsumer aMode) const;
/**
* Get the current scroll offset of the scrollable frame corresponding
* to this APZC, including the effects of any asynchronous panning, in
* CSS pixels.
* Get the current visual viewport of the scrollable frame corresponding
* to this APZC, including the effects of any asynchronous panning and
* zooming, in CSS pixels.
*/
CSSPoint GetCurrentAsyncScrollOffsetInCssPixels(
AsyncTransformConsumer aMode) const;
CSSRect GetCurrentAsyncVisualViewport(AsyncTransformConsumer aMode) const;
/**
* Return a visual effect that reflects this apzc's