mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1127066 - Fold APZCCallbackHelper::UpdateCallbackTransform() into ScrollFrame(). r=kats
--HG-- extra : source : 5b78d9e9ba84408c898d9e0ab55ae30f437792c8
This commit is contained in:
parent
98957944f7
commit
eaf4eff1d2
@ -539,7 +539,6 @@ TabChildBase::UpdateFrameHandler(const FrameMetrics& aFrameMetrics)
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
|
||||
if (APZCCallbackHelper::HasValidPresShellId(utils, aFrameMetrics)) {
|
||||
mLastRootMetrics = ProcessUpdateFrame(aFrameMetrics);
|
||||
APZCCallbackHelper::UpdateCallbackTransform(aFrameMetrics, mLastRootMetrics);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@ -550,7 +549,6 @@ TabChildBase::UpdateFrameHandler(const FrameMetrics& aFrameMetrics)
|
||||
if (content) {
|
||||
FrameMetrics newSubFrameMetrics(aFrameMetrics);
|
||||
APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics);
|
||||
APZCCallbackHelper::UpdateCallbackTransform(aFrameMetrics, newSubFrameMetrics);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +111,9 @@ ScrollFrameTo(nsIScrollableFrame* aFrame, const CSSPoint& aPoint, bool& aSuccess
|
||||
* requested in |aMetrics|.
|
||||
* The scroll offset in |aMetrics| is updated to reflect the actual scroll
|
||||
* position.
|
||||
* The displayport stored in |aMetrics| is updated to reflect any difference
|
||||
* between the requested and actual scroll positions.
|
||||
* The displayport stored in |aMetrics| and the callback-transform stored on
|
||||
* the content are updated to reflect any difference between the requested
|
||||
* and actual scroll positions.
|
||||
*/
|
||||
static void
|
||||
ScrollFrame(nsIContent* aContent,
|
||||
@ -121,7 +122,8 @@ ScrollFrame(nsIContent* aContent,
|
||||
// Scroll the window to the desired spot
|
||||
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aMetrics.GetScrollId());
|
||||
bool scrollUpdated = false;
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, aMetrics.GetScrollOffset(), scrollUpdated);
|
||||
CSSPoint apzScrollOffset = aMetrics.GetScrollOffset();
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, apzScrollOffset, scrollUpdated);
|
||||
|
||||
if (scrollUpdated) {
|
||||
// Correct the display port due to the difference between mScrollOffset and the
|
||||
@ -138,6 +140,16 @@ ScrollFrame(nsIContent* aContent,
|
||||
}
|
||||
|
||||
aMetrics.SetScrollOffset(actualScrollOffset);
|
||||
|
||||
// APZ transforms inputs assuming we applied the exact scroll offset it
|
||||
// requested (|apzScrollOffset|). Since we may not have, record the difference
|
||||
// between what APZ asked for and what we actually applied, and apply it to
|
||||
// input events to compensate.
|
||||
if (aContent) {
|
||||
CSSPoint scrollDelta = apzScrollOffset - actualScrollOffset;
|
||||
aContent->SetProperty(nsGkAtoms::apzCallbackTransform, new CSSPoint(scrollDelta),
|
||||
nsINode::DeleteProperty<CSSPoint>);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -300,18 +312,6 @@ APZCCallbackHelper::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollI
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
APZCCallbackHelper::UpdateCallbackTransform(const FrameMetrics& aApzcMetrics, const FrameMetrics& aActualMetrics)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = nsLayoutUtils::FindContentFor(aApzcMetrics.GetScrollId());
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
CSSPoint scrollDelta = aApzcMetrics.GetScrollOffset() - aActualMetrics.GetScrollOffset();
|
||||
content->SetProperty(nsGkAtoms::apzCallbackTransform, new CSSPoint(scrollDelta),
|
||||
nsINode::DeleteProperty<CSSPoint>);
|
||||
}
|
||||
|
||||
CSSPoint
|
||||
APZCCallbackHelper::ApplyCallbackTransform(const CSSPoint& aInput,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
@ -75,19 +75,6 @@ public:
|
||||
static void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
|
||||
const uint32_t& aScrollGeneration);
|
||||
|
||||
/* Save an "input transform" property on the content element corresponding to
|
||||
the scrollable content. This is needed because in some cases when the APZ code
|
||||
sends a paint request via the GeckoContentController interface, we don't always
|
||||
apply the scroll offset that was requested. Since the APZ code doesn't know
|
||||
that we didn't apply it, it will transform inputs assuming that we had applied
|
||||
it, and so we need to apply a fixup to the input to account for the fact that
|
||||
we didn't.
|
||||
The |aApzcMetrics| argument are the metrics that the APZ sent us, and the
|
||||
|aActualMetrics| argument are the metrics representing the gecko state after we
|
||||
applied some or all of the APZ metrics. */
|
||||
static void UpdateCallbackTransform(const FrameMetrics& aApzcMetrics,
|
||||
const FrameMetrics& aActualMetrics);
|
||||
|
||||
/* Apply an "input transform" to the given |aInput| and return the transformed value.
|
||||
The input transform applied is the one for the content element corresponding to
|
||||
|aGuid|; this is populated in a previous call to UpdateCallbackTransform. See that
|
||||
|
@ -90,7 +90,6 @@ APZCCallbackHandler::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||
if (utils && APZCCallbackHelper::HasValidPresShellId(utils, aFrameMetrics)) {
|
||||
FrameMetrics metrics = aFrameMetrics;
|
||||
APZCCallbackHelper::UpdateRootFrame(utils, metrics);
|
||||
APZCCallbackHelper::UpdateCallbackTransform(aFrameMetrics, metrics);
|
||||
}
|
||||
} else {
|
||||
// aFrameMetrics.mIsRoot is false, so we are trying to update a subframe.
|
||||
@ -99,7 +98,6 @@ APZCCallbackHandler::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||
if (content) {
|
||||
FrameMetrics newSubFrameMetrics(aFrameMetrics);
|
||||
APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics);
|
||||
APZCCallbackHelper::UpdateCallbackTransform(aFrameMetrics, newSubFrameMetrics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user