Title: [269050] trunk
Revision
269050
Author
[email protected]
Date
2020-10-27 10:32:32 -0700 (Tue, 27 Oct 2020)

Log Message

compositing/iframes/layout-on-compositing-change.html can assert under ContentfulPaintChecker
https://bugs.webkit.org/show_bug.cgi?id=218204
<rdar://problem/70694218>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/paint-timing/resources/subframe-painting.html:
* web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html:
* web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe-expected.txt:
        Added a new test to assert that painting inside iframes is not automatically considered by the parent.
        Upstreamed: https://github.com/web-platform-tests/wpt/pull/26303

Source/WebCore:

Paints from child iframes should not be considered when checking for first-contentful-paint.
The previous w3c test allegedly checking for it was actualy testing something else.

Tests: LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html.

* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
        Avoid iframe painting if we're in contentfulness detection fake-paint.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269049 => 269050)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-27 17:30:14 UTC (rev 269049)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-10-27 17:32:32 UTC (rev 269050)
@@ -1,3 +1,17 @@
+2020-10-27  Noam Rosenthal  <[email protected]>
+
+        compositing/iframes/layout-on-compositing-change.html can assert under ContentfulPaintChecker
+        https://bugs.webkit.org/show_bug.cgi?id=218204
+        <rdar://problem/70694218>
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/paint-timing/resources/subframe-painting.html:
+        * web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html:
+        * web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe-expected.txt:
+                Added a new test to assert that painting inside iframes is not automatically considered by the parent.
+                Upstreamed: https://github.com/web-platform-tests/wpt/pull/26303
+
 2020-10-26  Emilio Cobos Álvarez  <[email protected]>
 
         Drop sorting and deduplication of media queries.

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe-expected.txt (0 => 269050)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe-expected.txt	2020-10-27 17:32:32 UTC (rev 269050)
@@ -0,0 +1,4 @@
+
+
+PASS Parent frame should not fire own paint-timing events for subframes.
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html (0 => 269050)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html	2020-10-27 17:32:32 UTC (rev 269050)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<head>
+    <title>
+        Performance Paint Timing Test: Paints in the iframe should be reported in the iframe
+        and not in the top document
+    </title>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+setup({"hide_test_state": true});
+promise_test(async t => {
+    const iframe = document.createElement('iframe');
+    iframe.src = '';
+    document.body.appendChild(iframe);
+    await new Promise(resolve => window.addEventListener('message', e => {
+        if (e.data.entryType == "paint" && e.data.name == "first-contentful-paint")
+            resolve()
+    }));
+    await assertNoFirstContentfulPaint(t);
+}, 'Parent frame should not fire own paint-timing events for subframes.');
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/resources/subframe-painting.html (269049 => 269050)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/resources/subframe-painting.html	2020-10-27 17:30:14 UTC (rev 269049)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/paint-timing/resources/subframe-painting.html	2020-10-27 17:32:32 UTC (rev 269050)
@@ -4,22 +4,20 @@
 <script>
   const img = document.createElement('IMG');
   img.src = '';
-  img._onload_ = function() {
-    function sendPaintEntries() {
-      const paintEntries = performance.getEntriesByType('paint');
-      if (paintEntries.length < 2) {
-        setTimeout(sendPaintEntries, 20);
-        return;
-      }
-      let entryContents = paintEntries.length + '';
+
+  var observer = new PerformanceObserver(function(list, obj) {
+    var paintEntries = list.getEntries();
       for (let i = 0; i < paintEntries.length; i++) {
-        const entry = paintEntries[i];
-        entryContents += ' ' + entry.entryType + ' '  + entry.name;
+          // postMessage doesn't allow sending the entry object over directly
+          var dataToSend = {
+              "entryType": paintEntries[i]["entryType"],
+              "name": paintEntries[i]["name"]
+          };
+          parent.postMessage(dataToSend, '*');
       }
-      parent.postMessage(entryContents, '*');
-    };
-    sendPaintEntries();
-  };
+  });
+
+  observer.observe({"type": "paint"});
   document.getElementById('image').appendChild(img);
 </script>
 </body>

Modified: trunk/Source/WebCore/ChangeLog (269049 => 269050)


--- trunk/Source/WebCore/ChangeLog	2020-10-27 17:30:14 UTC (rev 269049)
+++ trunk/Source/WebCore/ChangeLog	2020-10-27 17:32:32 UTC (rev 269050)
@@ -1,3 +1,20 @@
+2020-10-27  Noam Rosenthal  <[email protected]>
+
+        compositing/iframes/layout-on-compositing-change.html can assert under ContentfulPaintChecker
+        https://bugs.webkit.org/show_bug.cgi?id=218204
+        <rdar://problem/70694218>
+
+        Reviewed by Simon Fraser.
+
+        Paints from child iframes should not be considered when checking for first-contentful-paint.
+        The previous w3c test allegedly checking for it was actualy testing something else.
+
+        Tests: LayoutTests/imported/w3c/web-platform-tests/paint-timing/fcp-only/fcp-ignore-from-subframe.html.
+
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::paint):
+                Avoid iframe painting if we're in contentfulness detection fake-paint.
+
 2020-10-27  Chris Dumez  <[email protected]>
 
         Calling AudioContext.suspend() / resume() while already suspended / running should resolve the promise right away

Modified: trunk/Source/WebCore/rendering/RenderWidget.cpp (269049 => 269050)


--- trunk/Source/WebCore/rendering/RenderWidget.cpp	2020-10-27 17:30:14 UTC (rev 269049)
+++ trunk/Source/WebCore/rendering/RenderWidget.cpp	2020-10-27 17:32:32 UTC (rev 269050)
@@ -281,6 +281,9 @@
     if (!shouldPaint(paintInfo, paintOffset))
         return;
 
+    if (paintInfo.context().detectingContentfulPaint())
+        return;
+
     LayoutPoint adjustedPaintOffset = paintOffset + location();
 
     if (hasVisibleBoxDecorations() && (paintInfo.phase == PaintPhase::Foreground || paintInfo.phase == PaintPhase::Selection))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to