зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1651332. Update scrollbar attrs to use visual viewport offset. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D82685
This commit is contained in:
Родитель
9665488d31
Коммит
8fd54dce2c
|
@ -5302,16 +5302,22 @@ void ScrollFrameHelper::UpdateScrollbarPosition() {
|
||||||
mFrameIsUpdatingScrollbar = true;
|
mFrameIsUpdatingScrollbar = true;
|
||||||
|
|
||||||
nsPoint pt = GetScrollPosition();
|
nsPoint pt = GetScrollPosition();
|
||||||
|
nsRect scrolledRect = GetScrolledRect();
|
||||||
|
|
||||||
|
if (gfxPlatform::UseDesktopZoomingScrollbars()) {
|
||||||
|
pt = GetVisualViewportOffset();
|
||||||
|
}
|
||||||
|
|
||||||
if (mVScrollbarBox) {
|
if (mVScrollbarBox) {
|
||||||
SetCoordAttribute(mVScrollbarBox->GetContent()->AsElement(),
|
SetCoordAttribute(mVScrollbarBox->GetContent()->AsElement(),
|
||||||
nsGkAtoms::curpos, pt.y - GetScrolledRect().y);
|
nsGkAtoms::curpos, pt.y - scrolledRect.y);
|
||||||
if (!weakFrame.IsAlive()) {
|
if (!weakFrame.IsAlive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mHScrollbarBox) {
|
if (mHScrollbarBox) {
|
||||||
SetCoordAttribute(mHScrollbarBox->GetContent()->AsElement(),
|
SetCoordAttribute(mHScrollbarBox->GetContent()->AsElement(),
|
||||||
nsGkAtoms::curpos, pt.x - GetScrolledRect().x);
|
nsGkAtoms::curpos, pt.x - scrolledRect.x);
|
||||||
if (!weakFrame.IsAlive()) {
|
if (!weakFrame.IsAlive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5342,6 +5348,11 @@ void ScrollFrameHelper::CurPosAttributeChanged(nsIContent* aContent,
|
||||||
nsRect scrolledRect = GetScrolledRect();
|
nsRect scrolledRect = GetScrolledRect();
|
||||||
|
|
||||||
nsPoint current = GetScrollPosition() - scrolledRect.TopLeft();
|
nsPoint current = GetScrollPosition() - scrolledRect.TopLeft();
|
||||||
|
|
||||||
|
if (gfxPlatform::UseDesktopZoomingScrollbars()) {
|
||||||
|
current = GetVisualViewportOffset() - scrolledRect.TopLeft();
|
||||||
|
}
|
||||||
|
|
||||||
nsPoint dest;
|
nsPoint dest;
|
||||||
nsRect allowedRange;
|
nsRect allowedRange;
|
||||||
dest.x = GetCoordAttribute(mHScrollbarBox, nsGkAtoms::curpos, current.x,
|
dest.x = GetCoordAttribute(mHScrollbarBox, nsGkAtoms::curpos, current.x,
|
||||||
|
@ -6175,10 +6186,15 @@ bool ScrollFrameHelper::ReflowFinished() {
|
||||||
if (vScroll || hScroll) {
|
if (vScroll || hScroll) {
|
||||||
nsSize visualViewportSize = GetVisualViewportSize();
|
nsSize visualViewportSize = GetVisualViewportSize();
|
||||||
nsRect scrollRange = GetVisualScrollRange();
|
nsRect scrollRange = GetVisualScrollRange();
|
||||||
|
|
||||||
AutoWeakFrame weakFrame(mOuter);
|
|
||||||
nsPoint scrollPos = GetScrollPosition();
|
nsPoint scrollPos = GetScrollPosition();
|
||||||
nsSize lineScrollAmount = GetLineScrollAmount();
|
nsSize lineScrollAmount = GetLineScrollAmount();
|
||||||
|
|
||||||
|
if (gfxPlatform::UseDesktopZoomingScrollbars()) {
|
||||||
|
scrollRange = GetScrollRangeForUserInputEvents();
|
||||||
|
scrollPos = GetVisualViewportOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
AutoWeakFrame weakFrame(mOuter);
|
||||||
if (vScroll) {
|
if (vScroll) {
|
||||||
const double kScrollMultiplier =
|
const double kScrollMultiplier =
|
||||||
Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance",
|
Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче