Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e9cb09c7dcced3bcc75c2057d1de73facc34d320
https://github.com/WebKit/WebKit/commit/e9cb09c7dcced3bcc75c2057d1de73facc34d320
Author: Simon Fraser <[email protected]>
Date: 2025-09-30 (Tue, 30 Sep 2025)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/element-only-when-fully-active-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/first-letter-background-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/first-paint-equals-lcp-text-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/image-full-viewport-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/larger-text-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-css-generated-text-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-mathml-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-random-namespace-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-text-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/text-with-display-style-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/toJSON-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/transparent-text-with-shadow-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/transparent-text-with-text-stroke-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/update-on-style-change-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/web-font-styled-text-resize-block-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/web-font-styled-text-resize-swap-smaller-expected.txt
M LayoutTests/platform/ios/TestExpectations
M
LayoutTests/requestidlecallback/requestidlecallback-deadline-shortened-by-rendering-update.html
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/page/LargestContentfulPaint.cpp
M Source/WebCore/page/LargestContentfulPaint.h
M Source/WebCore/page/LargestContentfulPaintData.cpp
M Source/WebCore/page/LargestContentfulPaintData.h
M Source/WebCore/rendering/TextBoxPainter.cpp
M Source/WebCore/rendering/svg/SVGRenderSupport.cpp
Log Message:
-----------
[LCP] Implement LargestContentfulPaint for text
https://bugs.webkit.org/show_bug.cgi?id=299832
rdar://161609007
Reviewed by Tim Nguyen.
Start calling `Document::didPaintText()` from `TextBoxPainter::paint()` to
track text paints
for LCP. Pass the `formattingContextRoot` since we have a rect in its
coordinate system already.
In `LargestContentfulPaintData::didPaintText()` we have to find the containing
block
per spec[1], after which we can get to the element to check if it's in the set
of
textful elements that we've already seen. If no, we add to
`m_paintedTextRecords`, unioning
the rect with any existing rect for this element (which is effectively
computing a bounds
for all the painted text nodes, per spec).
`LargestContentfulPaintData::takePendingEntry()` then needs to consider
`m_paintedTextRecords`
when generating the potential LCP entry.
Add test results for the newly passing tests.
[1] https://w3c.github.io/paint-timing/#sec-modifications-dom
* LayoutTests/TestExpectations:
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/element-only-when-fully-active-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/first-letter-background-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/first-paint-equals-lcp-text-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/image-full-viewport-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/larger-text-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-css-generated-text-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-mathml-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-random-namespace-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/observe-text-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/text-with-display-style-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/toJSON-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/transparent-text-with-shadow-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/transparent-text-with-text-stroke-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/update-on-style-change-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/web-font-styled-text-resize-block-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/largest-contentful-paint/web-font-styled-text-resize-swap-smaller-expected.txt:
Added.
* LayoutTests/platform/ios/TestExpectations:
*
LayoutTests/requestidlecallback/requestidlecallback-deadline-shortened-by-rendering-update.html:
The test needs to wait another
event loop turn for the LCP-related update triggered by the `description()`
rendering.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::didPaintText const):
* Source/WebCore/dom/Document.h:
* Source/WebCore/page/LargestContentfulPaint.cpp:
(WebCore::LargestContentfulPaint::element const):
* Source/WebCore/page/LargestContentfulPaint.h: Use a WeakPtr for the element
to avoid document leaks.
This is OK, since if the element is not connected, this function returns null
per spec.
* Source/WebCore/page/LargestContentfulPaintData.cpp:
(WebCore::LargestContentfulPaintData::potentiallyAddLargestContentfulPaintEntry):
(WebCore::LargestContentfulPaintData::takePendingEntry):
(WebCore::LargestContentfulPaintData::didPaintText):
* Source/WebCore/page/LargestContentfulPaintData.h:
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paint):
* Source/WebCore/rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::mapLocalToContainer): Early return, just like
`RenderBox::mapLocalToContainer()` does.
Canonical link: https://commits.webkit.org/300790@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