From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/paint-timing/META.yml | 3 + .../paint-timing/fcp-only/buffered-flag.window.js | 24 +++++++ .../paint-timing/fcp-only/fcp-background-size.html | 38 +++++++++++ .../paint-timing/fcp-only/fcp-bg-image-set.html | 36 ++++++++++ .../fcp-only/fcp-bg-image-two-steps.html | 44 ++++++++++++ .../paint-timing/fcp-only/fcp-canvas-context.html | 24 +++++++ .../fcp-only/fcp-document-opacity-image.html | 49 +++++++++++++ .../fcp-only/fcp-document-opacity-text.html | 39 +++++++++++ .../fcp-ensure-update-the-rendering-step.html | 55 +++++++++++++++ .../tests/paint-timing/fcp-only/fcp-gradient.html | 27 ++++++++ .../tests/paint-timing/fcp-only/fcp-iframe.html | 27 ++++++++ .../fcp-only/fcp-ignore-from-subframe.html | 27 ++++++++ .../fcp-invisible-3d-rotate-descendant.html | 39 +++++++++++ .../fcp-only/fcp-invisible-3d-rotate.html | 29 ++++++++ .../fcp-only/fcp-invisible-scale-transition.html | 30 ++++++++ .../paint-timing/fcp-only/fcp-invisible-scale.html | 40 +++++++++++ .../paint-timing/fcp-only/fcp-invisible-text.html | 30 ++++++++ .../fcp-only/fcp-opacity-descendant.html | 46 +++++++++++++ .../tests/paint-timing/fcp-only/fcp-opacity.html | 40 +++++++++++ .../fcp-only/fcp-out-of-bounds-translate.html | 30 ++++++++ .../paint-timing/fcp-only/fcp-out-of-bounds.html | 39 +++++++++++ .../fcp-only/fcp-pseudo-element-display.html | 32 +++++++++ .../fcp-only/fcp-pseudo-element-image.html | 38 +++++++++++ .../fcp-only/fcp-pseudo-element-opacity.html | 32 +++++++++ .../fcp-only/fcp-pseudo-element-text.html | 28 ++++++++ .../fcp-only/fcp-pseudo-element-visibility.html | 32 +++++++++ .../tests/paint-timing/fcp-only/fcp-svg.html | 40 +++++++++++ .../paint-timing/fcp-only/fcp-text-input.html | 24 +++++++ .../fcp-only/fcp-typographic-pseudo.html | 32 +++++++++ .../paint-timing/fcp-only/fcp-video-frame.html | 27 ++++++++ .../paint-timing/fcp-only/fcp-video-poster.html | 28 ++++++++ .../paint-timing/fcp-only/fcp-whitespace.html | 45 ++++++++++++ .../tests/paint-timing/fcp-only/fcp-with-rtl.html | 31 +++++++++ .../tests/paint-timing/fcp-only/svg-in-iframe.html | 14 ++++ .../paint-timing/first-contentful-canvas-none.html | 23 +++++++ .../tests/paint-timing/idlharness.window.js | 31 +++++++++ .../tests/paint-timing/input-text.html | 20 ++++++ .../tests/paint-timing/replaced-content-image.html | 20 ++++++ .../tests/paint-timing/resources/circle.svg | 3 + .../tests/paint-timing/resources/circles.png | Bin 0 -> 2479 bytes .../paint-timing/resources/subframe-painting.html | 24 +++++++ .../resources/subframe-sending-paint.html | 13 ++++ .../tests/paint-timing/resources/svg.html | 20 ++++++ .../tests/paint-timing/resources/utils.js | 52 ++++++++++++++ .../paint-timing/supported-paint-type.window.js | 22 ++++++ .../paint-timing/with-first-paint/basetest.html | 48 +++++++++++++ .../with-first-paint/border-image.html | 28 ++++++++ .../with-first-paint/buffered-flag.window.js | 36 ++++++++++ .../child-painting-first-image.html | 46 +++++++++++++ .../first-contentful-bg-image.html | 43 ++++++++++++ .../first-contentful-canvas-webgl2.html | 47 +++++++++++++ .../with-first-paint/first-contentful-canvas.html | 43 ++++++++++++ .../with-first-paint/first-contentful-image.html | 42 ++++++++++++ .../with-first-paint/first-contentful-paint.html | 76 +++++++++++++++++++++ .../with-first-paint/first-contentful-svg.html | 42 ++++++++++++ .../with-first-paint/first-image-child.html | 45 ++++++++++++ .../with-first-paint/first-paint-bg-color.html | 39 +++++++++++ .../with-first-paint/first-paint-only.html | 42 ++++++++++++ .../paint-timing/with-first-paint/mask-image.html | 27 ++++++++ .../with-first-paint/paint-visited.html | 48 +++++++++++++ .../sibling-painting-first-image.html | 54 +++++++++++++++ 61 files changed, 2053 insertions(+) create mode 100644 testing/web-platform/tests/paint-timing/META.yml create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/buffered-flag.window.js create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-background-size.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-set.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-canvas-context.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-image.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-text.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-ensure-update-the-rendering-step.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-gradient.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-iframe.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-text.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity-descendant.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-display.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-image.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-text.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-svg.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-text-input.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-typographic-pseudo.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-video-frame.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-video-poster.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-whitespace.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/fcp-with-rtl.html create mode 100644 testing/web-platform/tests/paint-timing/fcp-only/svg-in-iframe.html create mode 100644 testing/web-platform/tests/paint-timing/first-contentful-canvas-none.html create mode 100644 testing/web-platform/tests/paint-timing/idlharness.window.js create mode 100644 testing/web-platform/tests/paint-timing/input-text.html create mode 100644 testing/web-platform/tests/paint-timing/replaced-content-image.html create mode 100644 testing/web-platform/tests/paint-timing/resources/circle.svg create mode 100644 testing/web-platform/tests/paint-timing/resources/circles.png create mode 100644 testing/web-platform/tests/paint-timing/resources/subframe-painting.html create mode 100644 testing/web-platform/tests/paint-timing/resources/subframe-sending-paint.html create mode 100644 testing/web-platform/tests/paint-timing/resources/svg.html create mode 100644 testing/web-platform/tests/paint-timing/resources/utils.js create mode 100644 testing/web-platform/tests/paint-timing/supported-paint-type.window.js create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/basetest.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/border-image.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/buffered-flag.window.js create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-bg-image.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-canvas-webgl2.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-canvas.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-image.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-paint.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-svg.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-image-child.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-paint-bg-color.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/first-paint-only.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/mask-image.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/paint-visited.html create mode 100644 testing/web-platform/tests/paint-timing/with-first-paint/sibling-painting-first-image.html (limited to 'testing/web-platform/tests/paint-timing') diff --git a/testing/web-platform/tests/paint-timing/META.yml b/testing/web-platform/tests/paint-timing/META.yml new file mode 100644 index 0000000000..1892a41ed1 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/META.yml @@ -0,0 +1,3 @@ +spec: https://w3c.github.io/paint-timing/ +suggested_reviewers: + - spanicker diff --git a/testing/web-platform/tests/paint-timing/fcp-only/buffered-flag.window.js b/testing/web-platform/tests/paint-timing/fcp-only/buffered-flag.window.js new file mode 100644 index 0000000000..5910b6881f --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/buffered-flag.window.js @@ -0,0 +1,24 @@ +setup({"hide_test_state": true}); +async_test(t => { + assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); + // First observer creates a second one in the callback to ensure the entry has been dispatched + // by the time the second observer begins observing. + new PerformanceObserver(entries => { + const entry_seen = entries.getEntriesByName('first-contentful-paint').length > 0; + // Abort if we have not yet received the entry. + if (!entry_seen) + return; + + // Second observer requires 'buffered: true' to see the entry. + new PerformanceObserver(t.step_func_done(list => { + const fcp = list.getEntriesByName('first-contentful-paint'); + assert_equals(fcp.length, 1, 'Should have an fcp entry'); + const entry = fcp[0]; + assert_equals(entry.entryType, 'paint'); + })).observe({'type': 'paint', buffered: true}); + }).observe({'entryTypes': ['paint']}); + // Trigger the first contentful paint entry. + const img = document.createElement("img"); + img.src = "../resources/circles.png"; + document.body.appendChild(img); +}, "PerformanceObserver with buffered flag sees previous FCP entry."); diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-background-size.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-background-size.html new file mode 100644 index 0000000000..25fe986bde --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-background-size.html @@ -0,0 +1,38 @@ + + +Performance Paint Timing Test: FCP due to background size + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-set.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-set.html new file mode 100644 index 0000000000..443cef630b --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-set.html @@ -0,0 +1,36 @@ + + +Performance Paint Timing Test: FCP due to background image in image-set + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html new file mode 100644 index 0000000000..89b161f859 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-bg-image-two-steps.html @@ -0,0 +1,44 @@ + + +Performance Paint Timing Test: FCP should fire for background image only when visible + + + + + + +
+ + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-canvas-context.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-canvas-context.html new file mode 100644 index 0000000000..726e4516ee --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-canvas-context.html @@ -0,0 +1,24 @@ + + +Performance Paint Timing Test: FCP when canvas context is created + + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-image.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-image.html new file mode 100644 index 0000000000..e407f68708 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-image.html @@ -0,0 +1,49 @@ + + + +Performance Paint Timing Test: Image FCP due to the documentElement's opacity + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-text.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-text.html new file mode 100644 index 0000000000..12384d5585 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-document-opacity-text.html @@ -0,0 +1,39 @@ + + + +Performance Paint Timing Test: Text FCP due to the documentElement's opacity + + + + + + +
This is content that is extremely contentful.
+ + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-ensure-update-the-rendering-step.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-ensure-update-the-rendering-step.html new file mode 100644 index 0000000000..700707de33 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-ensure-update-the-rendering-step.html @@ -0,0 +1,55 @@ + + + + Ensure the timing is marked during the `update the rendering` step. + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-gradient.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-gradient.html new file mode 100644 index 0000000000..c1e147472f --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-gradient.html @@ -0,0 +1,27 @@ + + +Performance Paint Timing Test: FCP should not fire with gradient-only backgrounds + + + + + + +
+ + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-iframe.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-iframe.html new file mode 100644 index 0000000000..674bcd9121 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-iframe.html @@ -0,0 +1,27 @@ + + + + Performance Paint Timing Test: Not only the top level document, paints + in the iframe should also generate the entry + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html new file mode 100644 index 0000000000..7083a93db7 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html @@ -0,0 +1,27 @@ + + + + Performance Paint Timing Test: Paints in the iframe should be reported in the iframe + and not in the top document + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html new file mode 100644 index 0000000000..76d459d0f4 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate-descendant.html @@ -0,0 +1,39 @@ + + +Performance Paint Timing Test: FCP due to 3d revealing of descendants + + + + + + +
+
Text
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html new file mode 100644 index 0000000000..0b7fc325c5 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-3d-rotate.html @@ -0,0 +1,29 @@ + + +Performance Paint Timing Test: FCP due to 3d rotation into view + + + + + + +
Text
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html new file mode 100644 index 0000000000..c0c0af0cdb --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale-transition.html @@ -0,0 +1,30 @@ + + +Performance Paint Timing Test: FCP in transition + + + + + + +
TEXT
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale.html new file mode 100644 index 0000000000..4d3a060e85 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-scale.html @@ -0,0 +1,40 @@ + + +Performance Paint Timing Test: FCP due to scale change + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-text.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-text.html new file mode 100644 index 0000000000..e1b38712a6 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-invisible-text.html @@ -0,0 +1,30 @@ + + +Performance Paint Timing Test: FCP should still fire for invisible text + + + + + + +
+ INVISIBLE +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity-descendant.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity-descendant.html new file mode 100644 index 0000000000..8ada49b767 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity-descendant.html @@ -0,0 +1,46 @@ + + +Performance Paint Timing Test: FCP due to ancestor opacity + + + + + + +
+
Text
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity.html new file mode 100644 index 0000000000..3c6912c4e6 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-opacity.html @@ -0,0 +1,40 @@ + + +Performance Paint Timing Test: FCP due to opacity + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html new file mode 100644 index 0000000000..ee7975eec4 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds-translate.html @@ -0,0 +1,30 @@ + + +Performance Paint Timing Test: FCP due to transform-based intersection with document + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds.html new file mode 100644 index 0000000000..91556e50e0 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-out-of-bounds.html @@ -0,0 +1,39 @@ + + +Performance Paint Timing Test: FCP due to intersection with document + + + + + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-display.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-display.html new file mode 100644 index 0000000000..50fd626e89 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-display.html @@ -0,0 +1,32 @@ + + +Performance Paint Timing Test: FCP due to pseudo-element text + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-image.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-image.html new file mode 100644 index 0000000000..d67ae21cd9 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-image.html @@ -0,0 +1,38 @@ + + +Performance Paint Timing Test: FCP due to pseudo-element image + + + + + + +
+
+ + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html new file mode 100644 index 0000000000..b209864d5d --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-opacity.html @@ -0,0 +1,32 @@ + + +Performance Paint Timing Test: FCP due to pseudo-element getting positive opacity + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-text.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-text.html new file mode 100644 index 0000000000..ea2105e453 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-text.html @@ -0,0 +1,28 @@ + + +Performance Paint Timing Test: FCP due to pseudo-element text + + + + + + +
+
+ + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html new file mode 100644 index 0000000000..c903c47218 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-pseudo-element-visibility.html @@ -0,0 +1,32 @@ + + +Performance Paint Timing Test: FCP due to pseudo-element becoming visible + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-svg.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-svg.html new file mode 100644 index 0000000000..bcd2372cfc --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-svg.html @@ -0,0 +1,40 @@ + + +Performance Paint Timing Test: FCP with SVG + + + + + + +
+ + + + + + +
+ + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-text-input.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-text-input.html new file mode 100644 index 0000000000..e50449abbe --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-text-input.html @@ -0,0 +1,24 @@ + + +Performance Paint Timing Test: FCP due for non-empty text input + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-typographic-pseudo.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-typographic-pseudo.html new file mode 100644 index 0000000000..5ec62b7d59 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-typographic-pseudo.html @@ -0,0 +1,32 @@ + + +Performance Paint Timing Test: FCP should not fire when all text is hidden due to typographic pseudo-elements + + + + + + +
+
A
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-video-frame.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-video-frame.html new file mode 100644 index 0000000000..c54648f001 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-video-frame.html @@ -0,0 +1,27 @@ + + +Performance Paint Timing Test: FCP due to loaded video frame + + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-video-poster.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-video-poster.html new file mode 100644 index 0000000000..e7eeee3f12 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-video-poster.html @@ -0,0 +1,28 @@ + + +Performance Paint Timing Test: FCP due to loaded video poster + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-whitespace.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-whitespace.html new file mode 100644 index 0000000000..71c72b018a --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-whitespace.html @@ -0,0 +1,45 @@ + + +Performance Paint Timing Test: Whitespace should not count as contentful + + + + + + +
+
+
TEXT
+
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/fcp-with-rtl.html b/testing/web-platform/tests/paint-timing/fcp-only/fcp-with-rtl.html new file mode 100644 index 0000000000..5541fcbc72 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/fcp-with-rtl.html @@ -0,0 +1,31 @@ + + +Performance Paint Timing Test: FCP due to direction change + + + + + + +
TEXT
+ + + diff --git a/testing/web-platform/tests/paint-timing/fcp-only/svg-in-iframe.html b/testing/web-platform/tests/paint-timing/fcp-only/svg-in-iframe.html new file mode 100644 index 0000000000..230c166cb0 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/fcp-only/svg-in-iframe.html @@ -0,0 +1,14 @@ + +Performance Paint Timing Test: SVG in iframe does not trigger FCP + + + + + diff --git a/testing/web-platform/tests/paint-timing/first-contentful-canvas-none.html b/testing/web-platform/tests/paint-timing/first-contentful-canvas-none.html new file mode 100644 index 0000000000..33a4352126 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/first-contentful-canvas-none.html @@ -0,0 +1,23 @@ + + + + Performance Paint Timing Test: FCP due to canvas + + + + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/idlharness.window.js b/testing/web-platform/tests/paint-timing/idlharness.window.js new file mode 100644 index 0000000000..049f0f18f1 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/idlharness.window.js @@ -0,0 +1,31 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/paint-timing/ + +idl_test( + ['paint-timing'], + ['performance-timeline'], + (idl_array, t) => { + idl_array.add_objects({ + PerformancePaintTiming: ['paintTiming'], + }); + + const awaitPaint = new Promise(resolve => { + let observer = new PerformanceObserver(list => { + self.paintTiming = list.getEntries()[0]; + resolve(); + }); + observer.observe({ entryTypes: ['paint'] }); + const div = document.createElement('div'); + div.innerHTML = 'Hello World'; + document.body.appendChild(div); + }); + const timeout = new Promise((_, reject) => { + t.step_timeout(() => reject('Timed out waiting for paint event'), 3000); + }); + return Promise.race([awaitPaint, timeout]); + } +); diff --git a/testing/web-platform/tests/paint-timing/input-text.html b/testing/web-platform/tests/paint-timing/input-text.html new file mode 100644 index 0000000000..da1e0e8376 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/input-text.html @@ -0,0 +1,20 @@ + + + + + +
+ +
+ + diff --git a/testing/web-platform/tests/paint-timing/replaced-content-image.html b/testing/web-platform/tests/paint-timing/replaced-content-image.html new file mode 100644 index 0000000000..b3199aa0f6 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/replaced-content-image.html @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/resources/circle.svg b/testing/web-platform/tests/paint-timing/resources/circle.svg new file mode 100644 index 0000000000..6b5fdbe8e0 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/resources/circle.svg @@ -0,0 +1,3 @@ + + + diff --git a/testing/web-platform/tests/paint-timing/resources/circles.png b/testing/web-platform/tests/paint-timing/resources/circles.png new file mode 100644 index 0000000000..708682a207 Binary files /dev/null and b/testing/web-platform/tests/paint-timing/resources/circles.png differ diff --git a/testing/web-platform/tests/paint-timing/resources/subframe-painting.html b/testing/web-platform/tests/paint-timing/resources/subframe-painting.html new file mode 100644 index 0000000000..00fd39bcb8 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/resources/subframe-painting.html @@ -0,0 +1,24 @@ + + +
+ + + diff --git a/testing/web-platform/tests/paint-timing/resources/subframe-sending-paint.html b/testing/web-platform/tests/paint-timing/resources/subframe-sending-paint.html new file mode 100644 index 0000000000..f372bd6f4f --- /dev/null +++ b/testing/web-platform/tests/paint-timing/resources/subframe-sending-paint.html @@ -0,0 +1,13 @@ + + diff --git a/testing/web-platform/tests/paint-timing/resources/svg.html b/testing/web-platform/tests/paint-timing/resources/svg.html new file mode 100644 index 0000000000..94185eab34 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/resources/svg.html @@ -0,0 +1,20 @@ + +
+ + + + + + +
+ diff --git a/testing/web-platform/tests/paint-timing/resources/utils.js b/testing/web-platform/tests/paint-timing/resources/utils.js new file mode 100644 index 0000000000..5766971dd0 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/resources/utils.js @@ -0,0 +1,52 @@ +function waitForAnimationFrames(count) { + return new Promise(resolve => { + if (count-- <= 0) { + resolve(); + } else { + requestAnimationFrame(() => { + waitForAnimationFrames(count).then(resolve); + }); + } + }); +} + +// Asserts that there is currently no FCP reported. Pass t to add some wait, in case CSS is loaded +// and FCP is incorrectly fired afterwards. +async function assertNoFirstContentfulPaint(t) { + await waitForAnimationFrames(3); + assert_equals(performance.getEntriesByName('first-contentful-paint').length, 0, 'First contentful paint marked too early. '); +} + +// Function that is resolved once FCP is reported, using PerformanceObserver. It rejects after a long +// wait time so that failing tests don't timeout. +async function assertFirstContentfulPaint(t) { + return new Promise(resolve => { + function checkFCP() { + if (performance.getEntriesByName('first-contentful-paint').length === 1) { + resolve(); + } else { + t.step_timeout(checkFCP, 0); + } + } + t.step(checkFCP); + }); +} + +async function test_fcp(label, before_assert_fcp_func) { + setup({"hide_test_state": true}); + const style = document.createElement('style'); + document.head.appendChild(style); + await promise_test(async t => { + assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); + const main = document.getElementById('main'); + await new Promise(r => window.addEventListener('load', r)); + await assertNoFirstContentfulPaint(t); + main.className = 'preFCP'; + await assertNoFirstContentfulPaint(t); + if (before_assert_fcp_func) { + await before_assert_fcp_func(); + } + main.className = 'contentful'; + await assertFirstContentfulPaint(t); + }, label); +} diff --git a/testing/web-platform/tests/paint-timing/supported-paint-type.window.js b/testing/web-platform/tests/paint-timing/supported-paint-type.window.js new file mode 100644 index 0000000000..518faff5cf --- /dev/null +++ b/testing/web-platform/tests/paint-timing/supported-paint-type.window.js @@ -0,0 +1,22 @@ +test(() => { + assert_implements(typeof PerformanceObserver.supportedEntryTypes !== "undefined", 'supportedEntryTypes is not supported'); + assert_true(PerformanceObserver.supportedEntryTypes.includes("paint"), + "There should be an entry 'paint' in PerformanceObserver.supportedEntryTypes"); +}, "supportedEntryTypes contains 'paint'."); + +const entryType = 'paint'; +promise_test(async() => { + assert_implements(typeof PerformanceObserver.supportedEntryTypes !== "undefined", 'supportedEntryTypes is not supported'); + assert_implements(typeof PerformanceObserver.supportedEntryTypes.includes(entryType), `supportedEntryTypes does not include '${entryType}'`); + await new Promise((resolve) => { + new PerformanceObserver(function (list, observer) { + observer.disconnect(); + resolve(); + }).observe({entryTypes: [entryType]}); + + // Force the PerformanceEntry. + // Use `self` for Workers. + if (self.document) + document.head.parentNode.appendChild(document.createTextNode('foo')); + }) +}, `'${entryType}' entries should be observable.`) diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/basetest.html b/testing/web-platform/tests/paint-timing/with-first-paint/basetest.html new file mode 100644 index 0000000000..759dfaa97a --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/basetest.html @@ -0,0 +1,48 @@ + + +Performance Paint Timing Test + + + + +
+ + + + diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/border-image.html b/testing/web-platform/tests/paint-timing/with-first-paint/border-image.html new file mode 100644 index 0000000000..4abccfe8e8 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/border-image.html @@ -0,0 +1,28 @@ + + + + + + +
+ + diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/buffered-flag.window.js b/testing/web-platform/tests/paint-timing/with-first-paint/buffered-flag.window.js new file mode 100644 index 0000000000..0b7c8bea2e --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/buffered-flag.window.js @@ -0,0 +1,36 @@ +setup({"hide_test_state": true}); +async_test(t => { + assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported."); + // First observer creates second in callback to ensure the entry has been dispatched by the time + // the second observer begins observing. + let entries_seen = 0; + new PerformanceObserver(firstList => { + entries_seen += firstList.getEntries().length; + // Abort if we have not yet received both paint entries. + if (entries_seen < 2) + return; + + // Second observer requires 'buffered: true' to see the entries. + let firstPaintSeen = false; + let firstContentfulPaintSeen = false; + new PerformanceObserver(list => { + list.getEntries().forEach(t.step_func(entry => { + assert_equals(entry.entryType, 'paint'); + if (entry.name === 'first-paint') + firstPaintSeen = true; + else if (entry.name === 'first-contentful-paint') + firstContentfulPaintSeen = true; + else + assert_unreached('The observer should only see first paint or first contentful paint!'); + + if (firstPaintSeen && firstContentfulPaintSeen) + t.done(); + })); + }).observe({'type': 'paint', buffered: true}); + }).observe({'entryTypes': ['paint']}); + + // Trigger the first paint entries + const img = document.createElement("IMG"); + img.src = "resources/circles.png"; + document.body.appendChild(img); +}, "PerformanceObserver with buffered flag sees previous paint entries."); diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html b/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html new file mode 100644 index 0000000000..92a926a2b9 --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-bg-image.html b/testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-bg-image.html new file mode 100644 index 0000000000..40eaa635bb --- /dev/null +++ b/testing/web-platform/tests/paint-timing/with-first-paint/first-contentful-bg-image.html @@ -0,0 +1,43 @@ + + +Performance Paint Timing Test: FCP due to background image + + + + +
+ + +