Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 56565b0ae7fda4b9fd71d1e6268962b7b7b89282
      
https://github.com/WebKit/WebKit/commit/56565b0ae7fda4b9fd71d1e6268962b7b7b89282
  Author: Simon Fraser <[email protected]>
  Date:   2025-09-26 (Fri, 26 Sep 2025)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/animated/observe-cross-origin-animated-image.tentative-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/animated/observe-cross-origin-tao-animated-image.tentative-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/background-image-set-image-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/broken-image-icon-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/idlharness-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/iframe-content-not-observed-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/image-sw-same-origin.https-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/image-upscaling-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/invisible-images-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/larger-image-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/supported-lcp-type-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/video-play-after-poster-expected.txt
    M LayoutTests/platform/mac-wk1/TestExpectations
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/page/LargestContentfulPaintData.cpp
    M Source/WebCore/page/LargestContentfulPaintData.h

  Log Message:
  -----------
  [LCP] Implement LCP for images
https://bugs.webkit.org/show_bug.cgi?id=299562
rdar://161362865

Reviewed by Tim Nguyen.

Implement `LargestContentfulPaintData::didPaintImage()`, which checks if the 
image has been seen before
(via `m_imageContentSet`), triggers a rendering update if needed so that the 
next frame enqueues the paint
timing entry. We store a localRect per image, to avoid having to compute this 
layer (since these might
be CSS background images, each with different geometry). If a given image on an 
element exists more than
once, we only need to track the larger rect.

In the next event loop, `takePendingEntry()` will be called, which iterates the 
image records, calling
`potentiallyAddLargestContentfulPaintEntry()` for each. This follows the logic 
at [1]. Despite the spec
talking about "trusted scroll events", what Chrome actually does is track user 
scrolls [2]; this
is tested by WPT.

The current largest contentful size is tracked in `m_largestPaintArea`; we only 
issue an entry
if the new one is larger.

Enable a subset of the LCP tests that mostly pass now that we are emitting LCP 
entries.

[1] https://w3c.github.io/largest-contentful-paint/#sec-add-lcp-entry
[2] https://github.com/w3c/largest-contentful-paint/issues/105

* LayoutTests/TestExpectations:
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/animated/observe-cross-origin-animated-image.tentative-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/animated/observe-cross-origin-tao-animated-image.tentative-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/background-image-set-image-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/broken-image-icon-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/idlharness-expected.txt:
 Added.
    Fail is because we don't support navigationId: 
https://bugs.webkit.org/show_bug.cgi?id=299564
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/iframe-content-not-observed-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/image-sw-same-origin.https-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/image-upscaling-expected.txt:
 Added.
    Fail is tracked by https://github.com/web-platform-tests/interop/issues/1189
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/invisible-images-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/larger-image-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/supported-lcp-type-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/video-play-after-poster-expected.txt:
 Added.
* LayoutTests/platform/mac-wk1/TestExpectations: Skip LCP tests in WK1. DRT's 
window does not autodisplay, which
means that paints don't happen until the end of the test. Maybe we'll fix this 
one day: webkit.org/b/244756.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/page/LargestContentfulPaintData.cpp:
(WebCore::LargestContentfulPaintData::isEligibleForLargestContentfulPaint):
(WebCore::LargestContentfulPaintData::potentiallyAddLargestContentfulPaintEntry):
(WebCore::LargestContentfulPaintData::takePendingEntry):
(WebCore::LargestContentfulPaintData::didPaintImage):
* Source/WebCore/page/LargestContentfulPaintData.h:

Canonical link: https://commits.webkit.org/300622@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to