mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 07:07:30 +09:00
Map intersectionRect to the coordinate space of the target document.
Spec says: "Map intersectionRect to the coordinate space of the viewport of the Document containing the target." Tag #249
This commit is contained in:
parent
52f04699c0
commit
475d865c14
1 changed files with 8 additions and 7 deletions
|
|
@ -319,6 +319,7 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
||||||
nsIFrame* targetFrame = target->GetPrimaryFrame();
|
nsIFrame* targetFrame = target->GetPrimaryFrame();
|
||||||
nsRect targetRect;
|
nsRect targetRect;
|
||||||
Maybe<nsRect> intersectionRect;
|
Maybe<nsRect> intersectionRect;
|
||||||
|
bool isSameDoc = root && root->GetComposedDoc() == target->GetComposedDoc();
|
||||||
|
|
||||||
if (rootFrame && targetFrame) {
|
if (rootFrame && targetFrame) {
|
||||||
// If mRoot is set we are testing intersection with a container element
|
// If mRoot is set we are testing intersection with a container element
|
||||||
|
|
@ -327,7 +328,7 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
||||||
// Skip further processing of this target if it is not in the same
|
// Skip further processing of this target if it is not in the same
|
||||||
// Document as the intersection root, e.g. if root is an element of
|
// Document as the intersection root, e.g. if root is an element of
|
||||||
// the main document and target an element from an embedded iframe.
|
// the main document and target an element from an embedded iframe.
|
||||||
if (target->GetComposedDoc() != root->GetComposedDoc()) {
|
if (!isSameDoc) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Skip further processing of this target if is not a descendant of the
|
// Skip further processing of this target if is not a descendant of the
|
||||||
|
|
@ -399,12 +400,12 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
|
||||||
intersectionRectRelativeToRoot,
|
intersectionRectRelativeToRoot,
|
||||||
rootIntersectionRect
|
rootIntersectionRect
|
||||||
);
|
);
|
||||||
if (intersectionRect.isSome()) {
|
if (intersectionRect.isSome() && !isSameDoc) {
|
||||||
intersectionRect = Some(nsLayoutUtils::TransformFrameRectToAncestor(
|
nsRect rect = intersectionRect.value();
|
||||||
nsLayoutUtils::GetContainingBlockForClientRect(rootFrame),
|
nsPresContext* presContext = targetFrame->PresContext();
|
||||||
intersectionRect.value(),
|
nsLayoutUtils::TransformRect(rootFrame,
|
||||||
targetFrame->PresContext()->PresShell()->GetRootScrollFrame()
|
presContext->PresShell()->GetRootScrollFrame(), rect);
|
||||||
));
|
intersectionRect = Some(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue