haikuwebkit/Source/WebCore/page/PerformancePaintTiming.h

53 lines
2.0 KiB
C
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
/*
* Copyright (C) 2020 WikiMedia Foundation. All Rights Reserve.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "PerformanceEntry.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
class PerformancePaintTiming final : public PerformanceEntry {
public:
static Ref<PerformancePaintTiming> createFirstContentfulPaint(DOMHighResTimeStamp timeStamp)
{
return adoptRef(*new PerformancePaintTiming("first-contentful-paint"_s, timeStamp));
}
private:
PerformancePaintTiming(const String& name, DOMHighResTimeStamp timeStamp)
: PerformanceEntry(name, timeStamp, timeStamp)
{
}
ASCIILiteral entryType() const final { return "paint"_s; }
Add support for Navigation Timing Level 2 https://bugs.webkit.org/show_bug.cgi?id=184363 Reviewed by Ryosuke Niwa. LayoutTests/imported/w3c: * web-platform-tests/navigation-timing/META.yml: Added. * web-platform-tests/navigation-timing/dom_interactive_image_document-expected.txt: Added. * web-platform-tests/navigation-timing/dom_interactive_image_document.html: Added. * web-platform-tests/navigation-timing/dom_interactive_media_document-expected.txt: Added. * web-platform-tests/navigation-timing/dom_interactive_media_document.html: Added. * web-platform-tests/navigation-timing/idlharness.window.js: * web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt: Added. * web-platform-tests/navigation-timing/nav2_test_attributes_exist.html: Added. This test fails because we have not implemented transferSize, encodedBodySize, and decodedBodySize as noted in PerformanceResourceTiming.idl * web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt: Added. * web-platform-tests/navigation-timing/nav2_test_attributes_values.html: Added. This test fails because we have not implemented transferSize, encodedBodySize, and decodedBodySize as noted in PerformanceResourceTiming.idl * web-platform-tests/navigation-timing/nav2_test_document_open-expected.txt: * web-platform-tests/navigation-timing/nav2_test_document_open.html: * web-platform-tests/navigation-timing/nav2_test_document_replaced-expected.txt: * web-platform-tests/navigation-timing/nav2_test_document_replaced.html: * web-platform-tests/navigation-timing/nav2_test_frame_removed-expected.txt: * web-platform-tests/navigation-timing/nav2_test_instance_accessible_from_the_start-expected.txt: * web-platform-tests/navigation-timing/nav2_test_instance_accessible_from_the_start.html: * web-platform-tests/navigation-timing/nav2_test_instance_accessors-expected.txt: Added. * web-platform-tests/navigation-timing/nav2_test_instance_accessors.html: Added. * web-platform-tests/navigation-timing/nav2_test_navigate_iframe-expected.txt: Added. * web-platform-tests/navigation-timing/nav2_test_navigate_iframe.html: Added. * web-platform-tests/navigation-timing/nav2_test_navigate_within_document-expected.txt: * web-platform-tests/navigation-timing/nav2_test_navigate_within_document.html: * web-platform-tests/navigation-timing/nav2_test_navigation_type_backforward-expected.txt: * web-platform-tests/navigation-timing/nav2_test_navigation_type_backforward.html: * web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate-expected.txt: Added. * web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate.html: Added. * web-platform-tests/navigation-timing/nav2_test_navigation_type_reload-expected.txt: * web-platform-tests/navigation-timing/nav2_test_navigation_type_reload.html: * web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin-expected.txt: Added. This test fails because our test infrastructure doesn't support loading from www.localhost. * web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin.html: Copied from LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html. * web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in-expected.txt: This test fails because our test infrastructure doesn't support loading from www.localhost. * web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html: * web-platform-tests/navigation-timing/nav2_test_redirect_none-expected.txt: Added. * web-platform-tests/navigation-timing/nav2_test_redirect_none.html: Added. * web-platform-tests/navigation-timing/nav2_test_redirect_server-expected.txt: This test failure needs further investigation. * web-platform-tests/navigation-timing/nav2_test_redirect_server.html: * web-platform-tests/navigation-timing/nav2_test_redirect_xserver-expected.txt: This test fails because our test infrastructure doesn't support loading from www.localhost. * web-platform-tests/navigation-timing/nav2_test_redirect_xserver.html: * web-platform-tests/navigation-timing/nav2_test_unique_nav_instances-expected.txt: Added. This test failure needs further investigation. * web-platform-tests/navigation-timing/nav2_test_unique_nav_instances.html: Added. * web-platform-tests/navigation-timing/po-navigation-expected.txt: Added. * web-platform-tests/navigation-timing/po-navigation.html: Added. * web-platform-tests/navigation-timing/resources/webperftestharness.js: (test_namespace): (test_attribute_exists): (test_enum): * web-platform-tests/navigation-timing/secure-connection-start-reuse.https-expected.txt: Added. * web-platform-tests/navigation-timing/secure-connection-start-reuse.https.html: Added. * web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt: This test has been marked as flaky. It needs to be fixed to not rely on no initial connection reuse. * web-platform-tests/navigation-timing/supported_navigation_type.any-expected.txt: * web-platform-tests/navigation-timing/supported_navigation_type.any.worker-expected.txt: * web-platform-tests/navigation-timing/test_document_onload-expected.txt: Added. * web-platform-tests/navigation-timing/test_document_onload.html: Added. This test failure needs further investigation. * web-platform-tests/navigation-timing/unload-event-same-origin-check-expected.txt: * web-platform-tests/navigation-timing/unload-event-same-origin-check.html: * web-platform-tests/performance-timeline/META.yml: Added. * web-platform-tests/performance-timeline/buffered-flag-after-timeout.any.js: Added. (async_test.t.t.step_timeout): * web-platform-tests/performance-timeline/buffered-flag-observer.any.js: Added. * web-platform-tests/performance-timeline/get-invalid-entries-expected.txt: Added. * web-platform-tests/performance-timeline/get-invalid-entries.html: Added. * web-platform-tests/performance-timeline/idlharness.any.js: Added. (async idl_array): * web-platform-tests/performance-timeline/multiple-buffered-flag-observers.any.js: Added. (promise_test): * web-platform-tests/performance-timeline/not-clonable-expected.txt: Added. * web-platform-tests/performance-timeline/not-clonable.html: Added. * web-platform-tests/performance-timeline/observer-buffered-false.any.js: Added. (async_test.t.t.step_timeout): * web-platform-tests/performance-timeline/performanceentry-tojson.any.js: Added. (test): * web-platform-tests/performance-timeline/po-callback-mutate.any.js: Added. (async_test): * web-platform-tests/performance-timeline/po-disconnect-removes-observed-types.any.js: Added. (async_test): * web-platform-tests/performance-timeline/po-disconnect.any.js: Added. (async_test): (test): * web-platform-tests/performance-timeline/po-entries-sort.any.js: Added. (async_test): * web-platform-tests/performance-timeline/po-getentries.any.js: Added. (async_test): * web-platform-tests/performance-timeline/po-mark-measure.any.js: Added. (async_test): * web-platform-tests/performance-timeline/po-observe-expected.txt: Added. * web-platform-tests/performance-timeline/po-observe-repeated-type.any.js: Added. (async_test): * web-platform-tests/performance-timeline/po-observe.html: Added. * web-platform-tests/performance-timeline/po-resource-expected.txt: Added. * web-platform-tests/performance-timeline/po-resource.html: Added. * web-platform-tests/performance-timeline/po-takeRecords.any.js: Added. (async_test): * web-platform-tests/performance-timeline/resources/postmessage-entry.html: Added. * web-platform-tests/performance-timeline/resources/worker-invalid-entries.js: Added. * web-platform-tests/performance-timeline/resources/worker-with-performance-observer.js: Added. (catch): * web-platform-tests/performance-timeline/supportedEntryTypes.any-expected.txt: This test failure needs further investigation. It's a bindings generation problem I've unsuccessfully looked into before. * web-platform-tests/performance-timeline/supportedEntryTypes.any.js: (test): * web-platform-tests/performance-timeline/supportedEntryTypes.any.worker-expected.txt: * web-platform-tests/performance-timeline/webtiming-resolution.any.js: Added. (testTimeResolution): (timeByUserTiming): * web-platform-tests/performance-timeline/worker-with-performance-observer-expected.txt: Added. * web-platform-tests/performance-timeline/worker-with-performance-observer.html: Added. * web-platform-tests/service-workers/service-worker/navigation-timing.https-expected.txt: This existing test failure needs more investigation. We are probably close to a fix after this patch. Source/WebCore: This is basically just a new shape for exposing the same data as window.performance.navigation, but with a shape that fits better into the rest of the performance timeline measurements that have been added to the web platform since performance.navigation. I noted that exposing transfer size is problematic, and some of the tests for reading transfer size still fail. There are still a few relatively minor test failures to fix in future patches. Each one is annotated in the LayoutTests ChangeLogs. Tests: imported/w3c/web-platform-tests/navigation-timing/dom_interactive_image_document.html imported/w3c/web-platform-tests/navigation-timing/dom_interactive_media_document.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_instance_accessors.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_navigate_iframe.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_navigation_type_navigate.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_chain_xserver_final_original_origin.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_redirect_none.html imported/w3c/web-platform-tests/navigation-timing/nav2_test_unique_nav_instances.html imported/w3c/web-platform-tests/navigation-timing/po-navigation.html imported/w3c/web-platform-tests/navigation-timing/secure-connection-start-reuse.https.html imported/w3c/web-platform-tests/navigation-timing/test_document_onload.html imported/w3c/web-platform-tests/performance-timeline/get-invalid-entries.html imported/w3c/web-platform-tests/performance-timeline/not-clonable.html imported/w3c/web-platform-tests/performance-timeline/po-observe.html imported/w3c/web-platform-tests/performance-timeline/po-resource.html imported/w3c/web-platform-tests/performance-timeline/worker-with-performance-observer.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSPerformanceEntryCustom.cpp: (WebCore::toJSNewlyCreated): * dom/Document.cpp: (WebCore::Document::setReadyState): Sometimes the ready state jumps right to Complete without hitting Interactive along the way. When this happens, we want to mark both m_documentTiming.domComplete and m_documentTiming.domInteractive. * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::notifyFinished): Call addNavigationTiming in notifyFinished to create the navigation timing object when we are done navigating * loader/ResourceLoader.cpp: (WebCore::ResourceLoader::didFinishLoading): * loader/ResourceLoader.h: * loader/ResourceTiming.cpp: (WebCore::ResourceTiming::fromLoad): Add a URL parameter. Sometimes we need to use the request's URL and sometimes the response's. Different specs written at different times. (WebCore::ResourceTiming::populateServerTiming const): (WebCore::ResourceTiming::populateServerTiming): Deleted. * loader/ResourceTiming.h: (WebCore::ResourceTiming::url const): (WebCore::ResourceTiming::initiator const): (WebCore::ResourceTiming::loadTiming const): (WebCore::ResourceTiming::networkLoadMetrics const): * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::reportResourceTiming): * page/Performance.cpp: (WebCore::Performance::getEntries const): (WebCore::Performance::getEntriesByType const): (WebCore::Performance::getEntriesByName const): (WebCore::Performance::appendBufferedEntriesByType const): (WebCore::Performance::addNavigationTiming): (WebCore::Performance::registerPerformanceObserver): (WebCore::Performance::queueEntry): (WebCore::Performance::scheduleTaskIfNeeded): * page/Performance.h: * page/PerformanceEntry.h: (WebCore::PerformanceEntry::startTime const): (WebCore::PerformanceEntry::duration const): (WebCore::PerformanceEntry::isResource const): Deleted. (WebCore::PerformanceEntry::isMark const): Deleted. (WebCore::PerformanceEntry::isMeasure const): Deleted. (WebCore::PerformanceEntry::isPaint const): Deleted. * page/PerformanceMark.h: (isType): Deleted. SPECIALIZE_TYPE_TRAITS_BEGIN/END doesn't work well with PerformanceNavigationTiming which inherits from PerformanceResourceTiming which both have distinct types. is<PerformanceResourceTiming> doesn't give us the info we need. I replaced that with "switch (entry->performanceEntryType())" in the one place it's used, and it works like a charm. Also renamed type to performanceEntryType so it doesn't conflict with PerformanceNavigationTiming::type, which is specified in the idl. * page/PerformanceMeasure.h: (isType): Deleted. * page/PerformanceNavigationTiming.cpp: Added. (WebCore::toPerformanceNavigationTimingNavigationType): (WebCore::PerformanceNavigationTiming::PerformanceNavigationTiming): (WebCore::PerformanceNavigationTiming::millisecondsSinceOrigin const): (WebCore::PerformanceNavigationTiming::sameOriginCheckFails const): (WebCore::PerformanceNavigationTiming::unloadEventStart const): (WebCore::PerformanceNavigationTiming::unloadEventEnd const): (WebCore::PerformanceNavigationTiming::domInteractive const): (WebCore::PerformanceNavigationTiming::domContentLoadedEventStart const): (WebCore::PerformanceNavigationTiming::domContentLoadedEventEnd const): (WebCore::PerformanceNavigationTiming::domComplete const): (WebCore::PerformanceNavigationTiming::loadEventStart const): (WebCore::PerformanceNavigationTiming::loadEventEnd const): (WebCore::PerformanceNavigationTiming::type const): (WebCore::PerformanceNavigationTiming::redirectCount const): (WebCore::PerformanceNavigationTiming::startTime const): (WebCore::PerformanceNavigationTiming::duration const): * page/PerformanceNavigationTiming.h: Added. * page/PerformanceNavigationTiming.idl: Copied from Source/WebCore/page/PerformanceObserver.idl. * page/PerformanceObserver.cpp: (WebCore::PerformanceObserver::takeRecords): (WebCore::PerformanceObserver::disconnect): (WebCore::PerformanceObserver::deliver): (WebCore::PerformanceObserver::supportedEntryTypes): * page/PerformanceObserver.h: * page/PerformanceObserver.idl: * page/PerformanceObserverEntryList.cpp: (WebCore::PerformanceObserverEntryList::getEntriesByName const): * page/PerformancePaintTiming.h: (isType): Deleted. * page/PerformanceResourceTiming.cpp: (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): (WebCore::PerformanceResourceTiming::nextHopProtocol const): (WebCore::PerformanceResourceTiming::redirectStart const): (WebCore::PerformanceResourceTiming::redirectEnd const): (WebCore::PerformanceResourceTiming::fetchStart const): (WebCore::PerformanceResourceTiming::domainLookupStart const): (WebCore::PerformanceResourceTiming::domainLookupEnd const): (WebCore::PerformanceResourceTiming::connectStart const): (WebCore::PerformanceResourceTiming::connectEnd const): (WebCore::PerformanceResourceTiming::secureConnectionStart const): (WebCore::PerformanceResourceTiming::requestStart const): (WebCore::PerformanceResourceTiming::responseStart const): (WebCore::PerformanceResourceTiming::responseEnd const): (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp const): * page/PerformanceResourceTiming.h: (WebCore::PerformanceResourceTiming::initiatorType const): (isType): Deleted. * page/PerformanceResourceTiming.idl: * platform/network/BlobResourceHandle.cpp: (WebCore::doNotifyFinish): * platform/network/NetworkLoadMetrics.h: * platform/network/ResourceHandleClient.h: (WebCore::ResourceHandleClient::didFinishLoading): * platform/network/SynchronousLoaderClient.cpp: (WebCore::SynchronousLoaderClient::didFinishLoading): * platform/network/SynchronousLoaderClient.h: * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading): Pass metrics including the response end time from NSURLConnection so we don't assert in WebKitLegacy. * platform/network/cocoa/NetworkLoadMetrics.mm: (WebCore::copyTimingData): Use currentRequest instead of passing in the response so we can call it from didFinishLoading, where we don't have a response stored anywhere. We're just looking for whether it's http or https, so the currentRequest (which is the request after all the redirects) fits our purpose. * platform/network/curl/ResourceHandleCurl.cpp: (WebCore::ResourceHandle::handleDataURL): * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]): (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]): Source/WebKit: * NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]): Mark reused TLS connections in complete metrics like I did in incomplete metrics in r277493. Source/WebKitLegacy: * WebCoreSupport/PingHandle.h: Source/WTF: * Scripts/Preferences/WebPreferencesExperimental.yaml: LayoutTests: * TestExpectations: Annoyingly secure_connection_start_non_zero.https.html becomes flaky with a correct implementation because it assumes that no connection is reused. However, when running this test after other tests, another connection is often reused. * performance-api/paint-timing/performance-observer-first-contentful-paint-expected.txt: * performance-api/paint-timing/performance-observer-first-contentful-paint.html: * performance-api/performance-observer-api-expected.txt: * performance-api/performance-timeline-api-expected.txt: * performance-api/resources/timeline-api.js: * platform/mac-wk1/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt: Next hop protocol isn't implemented in ResourceHandle. That's probably no big deal because WebKitLegacy is deprecated and not used by Safari. Canonical link: https://commits.webkit.org/237930@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-20 00:33:02 +00:00
Type performanceEntryType() const final { return Type::Paint; }
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
~PerformancePaintTiming() = default;
};
} // namespace WebCore