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

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/page/LargestContentfulPaintData.cpp
    M Source/WebCore/page/LargestContentfulPaintData.h
    M Source/WebCore/rendering/TextBoxPainter.cpp

  Log Message:
  -----------
  [LCP] Optimize LCP for text paints when we know there's only one text box per 
element
https://bugs.webkit.org/show_bug.cgi?id=301135
rdar://163067611

Reviewed by Alan Baradlay.

When we know there's only one text box associated with an element, we can do an 
early
check of the painted rect area with the current largest area (when there are no 
transforms in
the ancestor chain). When there's more than one text, we have to take the 
union, and won't
know the result until painting is complete.

We can check for a single box by counting the number of lines, and boxes; there 
are 2 boxes,
the root inline box, and the single child box.

Tested by WPT.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::didPaintText const):
* Source/WebCore/dom/Document.h:
* Source/WebCore/page/LargestContentfulPaintData.cpp:
(WebCore::LargestContentfulPaintData::didPaintText):
* Source/WebCore/page/LargestContentfulPaintData.h:
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paint):

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