summaryrefslogtreecommitdiffstats
path: root/dom/base/DOMIntersectionObserver.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-22 14:34:42 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-22 14:34:42 +0100
commitfa97cddb3910ce8c35992d3ad2ec0fda060e3041 (patch)
tree4fbab983513dc1b2670aab4f43ea2a8358ccdbcb /dom/base/DOMIntersectionObserver.cpp
parent6cfd7509c781c11a99edb4332bc7b0142eb57faf (diff)
downloadUXP-fa97cddb3910ce8c35992d3ad2ec0fda060e3041.tar
UXP-fa97cddb3910ce8c35992d3ad2ec0fda060e3041.tar.gz
UXP-fa97cddb3910ce8c35992d3ad2ec0fda060e3041.tar.lz
UXP-fa97cddb3910ce8c35992d3ad2ec0fda060e3041.tar.xz
UXP-fa97cddb3910ce8c35992d3ad2ec0fda060e3041.zip
Use content area as the intersection rectangle ...
... for custom root with overflow clip. Tag #249
Diffstat (limited to 'dom/base/DOMIntersectionObserver.cpp')
-rw-r--r--dom/base/DOMIntersectionObserver.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp
index 5798335b4..f5e59c2b9 100644
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -269,17 +269,21 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
root = mRoot;
rootFrame = root->GetPrimaryFrame();
if (rootFrame) {
+ nsRect rootRectRelativeToRootFrame;
if (rootFrame->GetType() == nsGkAtoms::scrollFrame) {
+ // rootRectRelativeToRootFrame should be the content rect of rootFrame, not including the scrollbars.
nsIScrollableFrame* scrollFrame = do_QueryFrame(rootFrame);
- rootRect = nsLayoutUtils::TransformFrameRectToAncestor(
- rootFrame,
- rootFrame->GetContentRectRelativeToSelf(),
- scrollFrame->GetScrolledFrame());
+ rootRectRelativeToRootFrame = scrollFrame->GetScrollPortRect();
} else {
- rootRect = nsLayoutUtils::GetAllInFlowRectsUnion(rootFrame,
- nsLayoutUtils::GetContainingBlockForClientRect(rootFrame),
- nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
+ // rootRectRelativeToRootFrame should be the border rect of rootFrame.
+ rootRectRelativeToRootFrame = rootFrame->GetRectRelativeToSelf();
}
+ nsIFrame* containingBlock =
+ nsLayoutUtils::GetContainingBlockForClientRect(rootFrame);
+ rootRect =
+ nsLayoutUtils::TransformFrameRectToAncestor(rootFrame,
+ rootRectRelativeToRootFrame,
+ containingBlock);
}
} else {
nsCOMPtr<nsIPresShell> presShell = aDocument->GetShell();