Bug 198009 - Intersection Observer: bounding client rect is wrong for an inline element
Summary: Intersection Observer: bounding client rect is wrong for an inline element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Ali Juma
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-05-17 16:49 PDT by IvanX
Modified: 2019-05-22 13:22 PDT (History)
14 users (show)

See Also:


Attachments
test page to reproduce the issue (1.00 KB, text/html)
2019-05-17 16:49 PDT, IvanX
no flags Details
Patch (5.39 KB, patch)
2019-05-21 13:29 PDT, Ali Juma
no flags Details | Formatted Diff | Diff
Patch (7.01 KB, patch)
2019-05-22 08:01 PDT, Ali Juma
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-highsierra (2.67 MB, application/zip)
2019-05-22 09:05 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.85 MB, application/zip)
2019-05-22 09:18 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews113 for mac-highsierra (1.71 MB, application/zip)
2019-05-22 09:30 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews124 for ios-simulator-wk2 (2.36 MB, application/zip)
2019-05-22 09:53 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews215 for win-future (13.82 MB, application/zip)
2019-05-22 10:01 PDT, EWS Watchlist
no flags Details
Patch for landing (7.38 KB, patch)
2019-05-22 10:50 PDT, Ali Juma
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description IvanX 2019-05-17 16:49:34 PDT
Created attachment 370170 [details]
test page to reproduce the issue

Open the attached .html file and go to console, the discrepancy is logged.

When using intersection observe on an inline element, the bounding client rect reported by intersection observer is different from calling element.getBoundingClientRect().

Open the same file using FireFox can confirm the bug.
Comment 1 Radar WebKit Bug Importer 2019-05-17 16:54:17 PDT
<rdar://problem/50910959>
Comment 2 Ali Juma 2019-05-21 13:29:43 PDT
Created attachment 370337 [details]
Patch
Comment 3 Simon Fraser (smfr) 2019-05-21 14:30:58 PDT
Comment on attachment 370337 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=370337&action=review

> Source/WebCore/ChangeLog:9
> +        Make target rect computation for inline elements equivalent to the logic used
> +        when computing bounding client rects.

Can the code be shared?
Comment 4 Ali Juma 2019-05-22 08:01:00 PDT
Created attachment 370396 [details]
Patch
Comment 5 Ali Juma 2019-05-22 08:01:19 PDT
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 370337 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=370337&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        Make target rect computation for inline elements equivalent to the logic used
> > +        when computing bounding client rects.
> 
> Can the code be shared?

Done.
Comment 6 EWS Watchlist 2019-05-22 09:05:35 PDT
Comment on attachment 370396 [details]
Patch

Attachment 370396 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/12257543

Number of test failures exceeded the failure limit.
Comment 7 EWS Watchlist 2019-05-22 09:05:38 PDT
Created attachment 370402 [details]
Archive of layout-test-results from ews103 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 8 EWS Watchlist 2019-05-22 09:18:40 PDT
Comment on attachment 370396 [details]
Patch

Attachment 370396 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/12257641

Number of test failures exceeded the failure limit.
Comment 9 EWS Watchlist 2019-05-22 09:18:42 PDT
Created attachment 370403 [details]
Archive of layout-test-results from ews107 for mac-highsierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-highsierra-wk2  Platform: Mac OS X 10.13.6
Comment 10 EWS Watchlist 2019-05-22 09:30:00 PDT
Comment on attachment 370396 [details]
Patch

Attachment 370396 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/12257608

Number of test failures exceeded the failure limit.
Comment 11 EWS Watchlist 2019-05-22 09:30:02 PDT
Created attachment 370405 [details]
Archive of layout-test-results from ews113 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 12 EWS Watchlist 2019-05-22 09:53:55 PDT
Comment on attachment 370396 [details]
Patch

Attachment 370396 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12257703

Number of test failures exceeded the failure limit.
Comment 13 EWS Watchlist 2019-05-22 09:53:56 PDT
Created attachment 370411 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 14 EWS Watchlist 2019-05-22 10:01:47 PDT
Comment on attachment 370396 [details]
Patch

Attachment 370396 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/12257735

New failing tests:
fast/events/constructors/track-event-constructor.html
fast/multicol/fix-inherit-when-container-is-replaced.html
jquery/offset.html
accessibility/aria-hidden-hides-all-elements.html
http/tests/security/contentSecurityPolicy/track-redirect-allowed.html
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-track.html
fast/forms/input-user-modify.html
fast/css/display-contents-to-none.html
fast/css/empty-display-none-invalidation.html
fast/forms/access-key.html
fast/dom/HTMLSelectElement/listbox-items-client-rects.html
imported/blink/fast/css/first-letter-associated-text-node-crash.html
http/tests/security/contentSecurityPolicy/track-redirect-allowed2.html
http/tests/security/contentSecurityPolicy/media-src-track-block.html
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/default-src-object-data-url-blocked.html
http/tests/security/contentSecurityPolicy/track-redirect-blocked.html
Comment 15 EWS Watchlist 2019-05-22 10:01:54 PDT
Created attachment 370413 [details]
Archive of layout-test-results from ews215 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews215  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 16 Ali Juma 2019-05-22 10:50:05 PDT
Created attachment 370420 [details]
Patch for landing
Comment 17 Ali Juma 2019-05-22 10:52:40 PDT
(In reply to Ali Juma from comment #16)
> Created attachment 370420 [details]
> Patch for landing

To maintain the existing behavior of getBoundingClientRect (and fix the crashes from the last patch), made the new boundingAbsoluteRectWithoutLayout method return an optional pair of RenderObject* and FloatRect, so that getBoundingClientRect can still early-return when the set of absolute quads is empty, and can use the right renderer's style when converting from absolute space to client space.
Comment 18 WebKit Commit Bot 2019-05-22 13:22:51 PDT
Comment on attachment 370420 [details]
Patch for landing

Clearing flags on attachment: 370420

Committed r245642: <https://trac.webkit.org/changeset/245642>
Comment 19 WebKit Commit Bot 2019-05-22 13:22:53 PDT
All reviewed patches have been landed.  Closing bug.