haikuwebkit/LayoutTests/performance-api/paint-timing/paint-timing-with-worker-ex...

14 lines
454 B
Plaintext
Raw Permalink Normal View History

Implement FCP (first contentful paint) https://bugs.webkit.org/show_bug.cgi?id=208499 Reviewed by Simon Fraser. LayoutTests/imported/w3c: Imported paint timing tests that don't require first-paint. * resources/import-expectations.json: * web-platform-tests/paint-timing: Added. * web-platform-tests/paint-timing/fcp-only: Added. * web-platform-tests/paint-timing/fcp-only/fcp-background-size-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-background-size.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-bg-image-set-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-bg-image-set.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-bg-image-two-steps-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-canvas-context-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-canvas-context.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-gradient-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-gradient.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale-transition-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-text-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-invisible-text.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-opacity-descendant-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-opacity-descendant.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-opacity-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-opacity.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds-translate-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-display-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-display.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-image-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-image.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-opacity-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-text-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-text.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-visibility-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-svg-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-svg.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-text-input-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-text-input.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-typographic-pseudo-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-typographic-pseudo.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-video-frame-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-video-frame.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-video-poster-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-video-poster.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-whitespace-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-whitespace.html: Added. * web-platform-tests/paint-timing/fcp-only/fcp-with-rtl-expected.txt: Added. * web-platform-tests/paint-timing/fcp-only/fcp-with-rtl.html: Added. * web-platform-tests/paint-timing/resources: Added. * web-platform-tests/paint-timing/resources/circle.svg: Added. * web-platform-tests/paint-timing/resources/circles.png: Added. * web-platform-tests/paint-timing/resources/subframe-painting.html: Added. * web-platform-tests/paint-timing/resources/subframe-sending-paint.html: Added. * web-platform-tests/paint-timing/resources/utils.js: Added. (waitForAnimationFrames): (async assertNoFirstContentfulPaint): (async assertFirstContentfulPaint.return.new.Promise): (async assertFirstContentfulPaint): (async test_fcp): Source/WebCore: Added the necessary interface, extensions to the performance interface and observer, new runtime flag. Detecting contentfulness after layout and before actual paint, by running a "dummy" paint, similar to invalidateControlTints() / invalidateImagesWithAsyncDecodes(). Save the result to the GraphicsContext and then to the document. This would run for every paint until we detect a contentful one. Note that it paints the entire frame contents, as FCP is not viewport-dependent. Also, paint timing is currently disabled for LFC (layout formatting context), and will be dealt with later. Tests: http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-num-chars.html http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-style.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-background-size.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-bg-image-set.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-canvas-context.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-gradient.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-scale.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-invisible-text.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-opacity-descendant.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-opacity.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-out-of-bounds.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-display.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-image.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-text.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-svg.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-text-input.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-typographic-pseudo.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-video-frame.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-video-poster.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-whitespace.html imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-with-rtl.html performance-api/paint-timing/paint-timing-apis.html performance-api/paint-timing/paint-timing-frames.html performance-api/paint-timing/paint-timing-with-worker.html performance-api/paint-timing/performance-observer-first-contentful-paint.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSPerformanceEntryCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/WebCoreBuiltinNames.h: Add PerformancePaintTiming interface. https://w3c.github.io/paint-timing/#sec-PerformancePaintTiming * dom/Document.cpp: * dom/Document.h: (WebCore::Document::supportsPaintTiming const): We only report paint timing for document that can access the top level security origin, to avoid leakage of information to sandboxed iframes. (WebCore::Document::enqueuePaintTimingEntryIfNeeded): Enqueue a paint timing entry, according to https://w3c.github.io/paint-timing/#sec-reporting-paint-timing * page/FrameView.cpp: (WebCore::FrameView::paintContents): Disable FCP fake-paint in LFC mode. * page/Page.cpp: (WebCore::Page::doAfterUpdateRendering): * page/Performance.cpp: (WebCore::Performance::getEntries const): (WebCore::Performance::getEntriesByType const): (WebCore::Performance::getEntriesByName const): (WebCore::Performance::reportFirstContentfulPaint): * page/Performance.h: Support first-contentful-paint reporting. * page/PerformanceEntry.cpp: (WebCore::PerformanceEntry::parseEntryTypeString): * page/PerformanceEntry.h: (WebCore::PerformanceEntry::isPaint const): * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::supportedEntryTypes): * page/PerformanceObserver.h: * page/PerformanceObserver.idl: * page/PerformancePaintTiming.h: Added. (isType): * page/PerformancePaintTiming.idl: Added. Add paint performance entry type. * page/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setPaintTimingEnabled): (WebCore::RuntimeEnabledFeatures::paintTimingEnabled const): New runtime flag for paint timing. * platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::detectingContentfulPaint const): (WebCore::GraphicsContext::setContentfulPaintDetected): (WebCore::GraphicsContext::contenfulPaintDetected const): Add a flag in GraphicsContext where different render operations can report if they're contentful. * rendering/ContentfulPaintChecker.cpp: Added. (WebCore::ContentfulPaintChecker::qualifiesForContentfulPaint): * rendering/ContentfulPaintChecker.h: Added. Run a "dummy" paint of the FrameView, to detect contentful elements. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): * rendering/RenderHTMLCanvas.cpp: (WebCore::RenderHTMLCanvas::paintReplaced): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintReplaced): * rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintLayerContents): * rendering/RenderVideo.cpp: (WebCore::RenderVideo::paintReplaced): * rendering/TextPainter.cpp: (WebCore::TextPainter::paintTextOrEmphasisMarks): * rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::paintReplaced): Report contentfulness when we reach anything that qualifies as contentful, based on https://w3c.github.io/paint-timing/#contentful. Source/WebKit: Add an experimental runtime flag for paint-timing (paintTimingEnabled). * Shared/WebPreferences.yaml: * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesSetPaintTimingEnabled): (WKPreferencesGetPaintTimingEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: * WebProcess/Storage/WebSWContextManagerConnection.cpp: (WebKit::WebSWContextManagerConnection::updatePreferencesStore): LayoutTests: Added tests for some first-contentful-paint (FCP) use-cases. Ensure that FCP works well with VNE (first paint delay until contents are visually non-empty). * platform/win/TestExpectations: * platform/mac-wk1/TestExpectations: Disable paint timing for WebKit1. * TestExpectations: Disable of the WPT tests. * http/tests/performance/paint-timing: Added. * http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-num-chars-expected.txt: Added. * http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-num-chars.html: Added. If VNE due to number of characters blocks painting, make sure FCP is reported only after painting is unblocked. * http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-style-expected.txt: Added. * http/tests/performance/paint-timing/performance-paint-timing-fcp-after-visually-non-empty-for-style.html: Added. If a pending stylesheet blocks painting, make sure FCP is reported only after stylesheet has loaded. * http/tests/performance/paint-timing/resources: Added. * http/tests/performance/paint-timing/resources/slowscript.php: Added. * http/tests/performance/paint-timing/resources/slowstyle.php: Added. * http/tests/performance/paint-timing/resources/style.css: Added. (body): * performance-api/paint-timing: Added. * performance-api/paint-timing/paint-timing-apis-expected.txt: Added. * performance-api/paint-timing/paint-timing-apis.html: Added. * performance-api/paint-timing/paint-timing-frames-expected.txt: Added. * performance-api/paint-timing/paint-timing-frames.html: Added. * performance-api/paint-timing/paint-timing-with-worker-expected.txt: Added. * performance-api/paint-timing/paint-timing-with-worker.html: Added. Test that FCP is not available for cross-origin frames and workers. * performance-api/paint-timing/performance-observer-first-contentful-paint-expected.txt: Added. * performance-api/paint-timing/performance-observer-first-contentful-paint.html: Added. Test that performance observers are called for FCP. * performance-api/paint-timing/resources: Added. * performance-api/paint-timing/resources/fcp-subframe.html: Added. * performance-api/paint-timing/resources/paint-api-utils.js: Added. (async waitForFCP): * performance-api/paint-timing/resources/paint-timing-api.js: Added. * performance-api/paint-timing/resources/worker.html: Added. Canonical link: https://commits.webkit.org/224044@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-28 22:34:52 +00:00
Paint API should not be available in worker contexts.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS PerformanceObserver.supportedEntryTypes.includes("paint") is true
PASS workerSupportedEntryTypes.includes("paint") is false
PASS workerSupportedEntryTypes.includes("mark") is true
PASS PerformanceObserver.supportedEntryTypes did not include 'paint' for workers
PASS successfullyParsed is true
TEST COMPLETE