Bug 1685009. Update the visual offset too when doing a paint skip transaction to keep it in sync with layout offset. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D101149
This commit is contained in:
Timothy Nikkel 2021-01-10 01:52:24 +00:00
Родитель 941ac5d0fa
Коммит d70b8b4af4
4 изменённых файлов: 32 добавлений и 11 удалений

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

@ -152,6 +152,24 @@ CSSPoint FrameMetrics::ApplyPureRelativeScrollUpdateFrom(
return GetVisualScrollOffset() - origin;
}
void FrameMetrics::UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo) {
// We only get this "pending scroll info" for paint-skip transactions,
// but PureRelative position updates always trigger a full paint, so
// we should never enter this code with a PureRelative update type. For
// the other types, the destination field on the ScrollPositionUpdate will
// tell us the final layout scroll position on the main thread.
MOZ_ASSERT(aInfo.GetType() != ScrollUpdateType::PureRelative);
// In applying a main-thread scroll update, try to preserve the relative
// offset between the visual and layout viewports.
CSSPoint relativeOffset = GetVisualScrollOffset() - GetLayoutScrollOffset();
MOZ_ASSERT(IsRootContent() || relativeOffset == CSSPoint());
SetLayoutScrollOffset(aInfo.GetDestination());
ClampAndSetVisualScrollOffset(aInfo.GetDestination() + relativeOffset);
mScrollGeneration = aInfo.GetGeneration();
}
ScrollSnapInfo::ScrollSnapInfo()
: mScrollSnapStrictnessX(StyleScrollSnapStrictness::None),
mScrollSnapStrictnessY(StyleScrollSnapStrictness::None) {}

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

@ -266,16 +266,7 @@ struct FrameMetrics {
CSSPoint ApplyPureRelativeScrollUpdateFrom(
const ScrollPositionUpdate& aUpdate);
void UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo) {
// We only get this "pending scroll info" for paint-skip transactions,
// but PureRelative position updates always trigger a full paint, so
// we should never enter this code with a PureRelative update type. For
// the other types, the destination field on the ScrollPositionUpdate will
// tell us the final layout scroll position on the main thread.
MOZ_ASSERT(aInfo.GetType() != ScrollUpdateType::PureRelative);
SetLayoutScrollOffset(aInfo.GetDestination());
mScrollGeneration = aInfo.GetGeneration();
}
void UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo);
public:
void SetPresShellResolution(float aPresShellResolution) {

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

@ -0,0 +1,12 @@
<script>
window.requestIdleCallback(() => {
window.close();
})
window.onload = () => {
a.value = "J."
b.submit()
window.requestAnimationFrame(() => { a.setRangeText("foo") })
}
</script>
<textarea id="a" style="max-width: 0"></textarea>
<form id="b" target="a">

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

@ -200,4 +200,4 @@ skip-if(!webrender||AddressSanitizer) load 1652750-deep-scene-stack.html
load 1651882.html
skip-if(!webrender) load 1678938-1.html
load 1679477-1.html
skip-if(Android) pref(dom.disable_open_during_load,false) load 1685009-1.html