mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 06:18:38 +09:00
Map IntersectionObserver rect to the correct viewport.
targetFrame is modified during the intersection computation loop, so it's not the viewport you want if there are scrollframes around. This bug triggers when IntersectionObservers are used on frames that wrap. Follow-up for #249.
This commit is contained in:
parent
0103cdc8a5
commit
78b6f639b2
1 changed files with 2 additions and 1 deletions
|
|
@ -339,6 +339,7 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
|||
for (size_t i = 0; i < mObservationTargets.Length(); ++i) {
|
||||
Element* target = mObservationTargets.ElementAt(i);
|
||||
nsIFrame* targetFrame = target->GetPrimaryFrame();
|
||||
nsIFrame* originalTargetFrame = targetFrame;
|
||||
nsRect targetRect;
|
||||
Maybe<nsRect> intersectionRect;
|
||||
bool isSameDoc = root && root->GetComposedDoc() == target->GetComposedDoc();
|
||||
|
|
@ -424,7 +425,7 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
|||
);
|
||||
if (intersectionRect.isSome() && !isSameDoc) {
|
||||
nsRect rect = intersectionRect.value();
|
||||
nsPresContext* presContext = targetFrame->PresContext();
|
||||
nsPresContext* presContext = originalTargetFrame->PresContext();
|
||||
nsLayoutUtils::TransformRect(rootFrame,
|
||||
presContext->PresShell()->GetRootScrollFrame(), rect);
|
||||
intersectionRect = Some(rect);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue