Bug 1679319 [wpt PR 26648] - [LargestContentfulPaint] Fix invisible image tracking, a=testonly

Automatic update from web-platform-tests
[LargestContentfulPaint] Fix invisible image tracking

In this CL we change |invisible_images_| to track not just LayoutObject
but also the ImageResourceContent, which is in line with how it is
tracked in |visible_images_| and is necessary to correctly track
background images as well as image source changes that do not impact
the LayoutObject used.

Bug: 1152846
Change-Id: I2bfa02ef0a6795b7036abecf8f1e342f39e6ea3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2561270
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831333}

--

wpt-commits: 35e691574b44ae6ff6251af68e619f5ddebfb07e
wpt-pr: 26648
This commit is contained in:
Nicolás Peña Moreno 2020-11-26 21:33:01 +00:00 коммит произвёл moz-wptsync-bot
Родитель d5c39f3769
Коммит 55980da468
1 изменённых файлов: 31 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Largest Contentful Paint: src change triggers new entry.</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/largest-contentful-paint-helpers.js"></script>
<img src='/images/green-1x1.png' id='image_id' width="133" height="106"/>
<script>
async_test(function (t) {
assert_implements(window.LargestContentfulPaint, "LargestContentfulPaint is not implemented");
let beforeLoad = performance.now();
document.getElementById('image_id').src = '/images/blue.png';
const url = window.location.origin + '/images/blue.png';
const observer = new PerformanceObserver(
t.step_func(function(entryList) {
let entries = entryList.getEntries().filter(e => e.url === url);
if (entries.length === 0)
return;
assert_equals(entries.length, 1);
const entry = entries[0];
// blue.png is 133 by 106.
const size = 133 * 106;
checkImage(entry, url, 'image_id', size, beforeLoad);
t.done();
})
);
observer.observe({type: 'largest-contentful-paint', buffered: true});
}, 'Largest Contentful Paint: changing src causes a new entry to be dispatched.');
</script>
</body>