Commit 2484509c authored by rajendrant's avatar rajendrant Committed by Commit Bot

Add test for image in a sub-pixel layout

Image with 0 height in sub-pixel layout is a special case for
intersection observer that causes it not fire. This CL adds a test for
that.

Bug: 999019
Change-Id: I3b95a46eebcc534a22af42dc9c47f2d40a201606
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1780060Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarScott Little <sclittle@chromium.org>
Commit-Queue: rajendrant <rajendrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694790}
parent ccf37713
// Helper to access the element, its associated loading promise, and also to
// resolve the promise.
class ElementLoadPromise {
constructor(element_id) {
this.element_id = element_id;
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve
this.reject = reject
});
}
element() {
return document.getElementById(this.element_id);
}
}
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="common.js"></script>
<style>
.img {
display: block;
}
.img-container {
width: 200px;
border-radius: 50%;
overflow: hidden;
}
</style>
<script>
const subpixel_position_img = new ElementLoadPromise("subpixel_position_img");
async_test(function(t) {
subpixel_position_img.promise.then(t.step_func_done());
}, "Test that the in viewport image with sub-pixel starting position and overflow:hidden style is loaded");
</script>
<body>
<div style="height:0.5px;">
This div makes the img-container below to start at sub-pixel top position
</div>
<div class="img-container">
<img id="subpixel_position_img" class="img" loading="lazy"
src="../loading/resources/base-image1.png"
onload="subpixel_position_img.resolve();">
</div>
</body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment