зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1473699 - Async-scroll the layout viewport even if it's smaller than the visual viewport. r=botond
When the layout viewport is smaller than the visual viewport and the user scrolls a web page, the layout viewport remains fixed to its position before the scroll event took place. However, the visual viewport moves according to the new scroll position. This patch addresses this issue by moving the layout viewport along with the visual viewport. MozReview-Commit-ID: 3Mk1o6AF2wr --HG-- extra : rebase_source : 8c6068059593038dc443cb9c96242483de97e9d9
This commit is contained in:
Родитель
51462b9733
Коммит
a468f78119
|
@ -26,14 +26,37 @@ FrameMetrics::RecalculateViewportOffset()
|
|||
// Additionally, if the composition bounds changes (due to an orientation
|
||||
// change, window resize, etc.), it may take a few frames for mViewport to
|
||||
// update and during that time, the visual viewport may be larger than the
|
||||
// layout viewport, so don't attempt to make any adjustments.
|
||||
if (mViewport.Contains(visualViewport) ||
|
||||
(mViewport.Width() < visualViewport.Width() &&
|
||||
// layout viewport. In such situations, we take an early exit if the visual
|
||||
// viewport contains the layout viewport.
|
||||
if (mViewport.Contains(visualViewport) || visualViewport.Contains(mViewport)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If visual viewport size is greater than the layout viewport, move the layout
|
||||
// viewport such that it remains inside the visual viewport. Otherwise,
|
||||
// move the layout viewport such that the visual viewport is contained
|
||||
// inside the layout viewport.
|
||||
if ((mViewport.Width() < visualViewport.Width() &&
|
||||
!FuzzyEqualsMultiplicative(mViewport.Width(), visualViewport.Width())) ||
|
||||
(mViewport.Height() < visualViewport.Height() &&
|
||||
!FuzzyEqualsMultiplicative(mViewport.Height(), visualViewport.Height()))) {
|
||||
return;
|
||||
|
||||
if (mViewport.X() < visualViewport.X()) {
|
||||
// layout viewport moves right
|
||||
mViewport.MoveToX(visualViewport.X());
|
||||
} else if (visualViewport.XMost() < mViewport.XMost()) {
|
||||
// layout viewport moves left
|
||||
mViewport.MoveByX(visualViewport.XMost() - mViewport.XMost());
|
||||
}
|
||||
if (mViewport.Y() < visualViewport.Y()) {
|
||||
// layout viewport moves down
|
||||
mViewport.MoveToY(visualViewport.Y());
|
||||
} else if (visualViewport.YMost() < mViewport.YMost()) {
|
||||
// layout viewport moves up
|
||||
mViewport.MoveByY(visualViewport.YMost() - mViewport.YMost());
|
||||
}
|
||||
} else {
|
||||
|
||||
if (visualViewport.X() < mViewport.X()) {
|
||||
mViewport.MoveToX(visualViewport.X());
|
||||
} else if (mViewport.XMost() < visualViewport.XMost()) {
|
||||
|
@ -45,6 +68,7 @@ FrameMetrics::RecalculateViewportOffset()
|
|||
mViewport.MoveByY(visualViewport.YMost() - mViewport.YMost());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ScrollMetadata::SetUsesContainerScrolling(bool aValue) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче