Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d94089ba244c3b91fa6855b4e49abbb5b300146a
      
https://github.com/WebKit/WebKit/commit/d94089ba244c3b91fa6855b4e49abbb5b300146a
  Author: Simon Fraser <[email protected]>
  Date:   2025-10-16 (Thu, 16 Oct 2025)

  Changed paths:
    M Source/WebCore/page/LargestContentfulPaintData.cpp
    M Source/WebCore/page/LargestContentfulPaintData.h

  Log Message:
  -----------
  [LCP] Early return from LCP functions when we know the rect is smaller than 
the current LCP
https://bugs.webkit.org/show_bug.cgi?id=300915
rdar://162796001

Reviewed by Tim Nguyen.

In `LargestContentfulPaintData::didPaintImage()`, we can return early if we 
know that the localRect area
is less than the current LCP, but only after checking that there are no 
transforms in the ancestor chain
(since transforms can scale up the rect).

We can do the same thing in `potentiallyAddLargestContentfulPaintEntry`, which 
catches accumulated
text rectangles; we can't do this in didPaintText, because individual text 
paints have to get
coalesced based on their originating element.

Also remove the `isNewCandidate` checks from 
`LargestContentfulPaintData::potentiallyAddLargestContentfulPaintEntry()`,
because we can only ever get here for new candidates, so `isNewCandidate` was 
always true; instead we move
this check to `LargestContentfulPaintData::didPaintImage()`. (Text maintains 
this state via an element bit.)

Tested by existing WPT.

* Source/WebCore/page/LargestContentfulPaintData.cpp:
(WebCore::LargestContentfulPaintData::canCompareWithLargestPaintArea):
(WebCore::LargestContentfulPaintData::potentiallyAddLargestContentfulPaintEntry):
(WebCore::LargestContentfulPaintData::didPaintImage):
(WebCore::LargestContentfulPaintData::didPaintText):
* Source/WebCore/page/LargestContentfulPaintData.h:

Canonical link: https://commits.webkit.org/301669@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