summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-05-15 12:45:10 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-05-15 12:45:10 +0200
commit34d5483ac3959a21c3cae2efa6f5ab1b64915a81 (patch)
tree5ff6efb7d64c7f95ccc22b1bf097ee88365242b8
parent1595ee7da4559e4619127e2893cce04aad976ac8 (diff)
downloadUXP-34d5483ac3959a21c3cae2efa6f5ab1b64915a81.tar
UXP-34d5483ac3959a21c3cae2efa6f5ab1b64915a81.tar.gz
UXP-34d5483ac3959a21c3cae2efa6f5ab1b64915a81.tar.lz
UXP-34d5483ac3959a21c3cae2efa6f5ab1b64915a81.tar.xz
UXP-34d5483ac3959a21c3cae2efa6f5ab1b64915a81.zip
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.
-rw-r--r--dom/base/DOMIntersectionObserver.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp
index 389b93071..70b5534ba 100644
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -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);