Skip to content

ResizeObserver content rect calculation must not work on non-replaced inline elements #40259

@jdm

Description

@jdm

This is described at https://drafts.csswg.org/resize-observer/#content-rect-h and tested by

function test6() {
let helper = new ResizeTestHelper(
"test6: inline element notifies once with 0x0.",
[
{
setup: observer => {
observer.observe(inline);
},
notify: (entries, observer) => {
assert_equals(entries.length, 1, "observing inline element triggers notification");
assert_equals(entries[0].target, inline, "observing inline element triggers notification");
assert_equals(entries[0].contentRect.width, 0);
assert_equals(entries[0].contentRect.height, 0);
return true; // Delay next step
}
},
{
setup: observer => {
inline.style.width = "66px";
},
notify: (entries, observer) => {
assert_unreached("resizing inline element should not cause resize notifications");
},
timeout: () => {
// expected
}
},
{ // "inline element that becomes block should notify",
setup: observer => {
inline.style.display = "block";
},
notify: (entries, observer) => {
assert_equals(entries.length, 1, "inline element becoming a non-zero sized block triggers a notification");
assert_equals(entries[0].target, inline, "inline element becoming a non-zero sized block triggers a notification");
}
}
]);
return helper.start();
}
. Like #40258 this is caused by the box_area layout query being too broad for what this particular code needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions