Changeset 249845 in webkit
- Timestamp:
- Sep 13, 2019 11:46:56 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249844 r249845 1 2019-09-13 Ali Juma <ajuma@chromium.org> 2 3 IntersectionObserverEntry#intersectionRatio can be larger than 1 4 https://bugs.webkit.org/show_bug.cgi?id=200776 5 6 Reviewed by Simon Fraser. 7 8 * intersection-observer/intersection-clipped-to-target-expected.txt: Added. 9 * intersection-observer/intersection-clipped-to-target.html: Added. 10 1 11 2019-09-13 Russell Epstein <repstein@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r249843 r249845 1 2019-09-13 Ali Juma <ajuma@chromium.org> 2 3 IntersectionObserverEntry#intersectionRatio can be larger than 1 4 https://bugs.webkit.org/show_bug.cgi?id=200776 5 6 Reviewed by Simon Fraser. 7 8 When computing the intersection between a target and an intersection observer's 9 root, RenderBox::computeVisibleRectInContainer is used to map the target rect 10 up the containing block chain, clipping along the way. When a RenderBox has 11 a transform, this method expands the given rect to the enclosing rect in device 12 pixels. This is fine for the use case of computing an invalidation rect, but for 13 the intersection observer use case it means that it is possible for the computed 14 intersection rect to be slightly larger than the original target rect, resulting 15 in an intersection ratio greater than 1. 16 17 Fix this by performing a final intersection between the intersection rect as 18 computed above and the target rect. 19 20 Test: intersection-observer/intersection-clipped-to-target.html 21 22 * dom/Document.cpp: 23 (WebCore::computeIntersectionState): 24 1 25 2019-09-13 Nikolas Zimmermann <zimmermann@kde.org> 2 26 -
trunk/Source/WebCore/dom/Document.cpp
r249779 r249845 7420 7420 IntersectionObservationState intersectionState; 7421 7421 intersectionState.isIntersecting = rootLocalTargetRect && rootLocalIntersectionRect.edgeInclusiveIntersect(*rootLocalTargetRect); 7422 intersectionState.absoluteTargetRect = targetRenderer->localToAbsoluteQuad(FloatRect(localTargetBounds)).boundingBox(); 7423 intersectionState.absoluteRootBounds = rootRenderer->localToAbsoluteQuad(localRootBounds).boundingBox(); 7422 7424 7423 7425 if (intersectionState.isIntersecting) { … … 7429 7431 intersectionState.absoluteIntersectionRect = targetRenderer->view().frameView().rootViewToContents(rootViewIntersectionRect); 7430 7432 } 7431 } 7432 7433 intersectionState.absoluteTargetRect = targetRenderer->localToAbsoluteQuad(FloatRect(localTargetBounds)).boundingBox(); 7434 intersectionState.absoluteRootBounds = rootRenderer->localToAbsoluteQuad(localRootBounds).boundingBox(); 7433 intersectionState.isIntersecting = intersectionState.absoluteIntersectionRect.edgeInclusiveIntersect(intersectionState.absoluteTargetRect); 7434 } 7435 7435 7436 return intersectionState; 7436 7437 }
Note: See TracChangeset
for help on using the changeset viewer.