diff --git a/resize-observer/observe.html b/resize-observer/observe.html
index d41799332720a1..3b336837b3bbea 100644
--- a/resize-observer/observe.html
+++ b/resize-observer/observe.html
@@ -644,6 +644,77 @@
return helper.start(() => t.remove());
}
+function test15() {
+ let t = createAndAppendElement("div");
+ t.style.height = "100px";
+ t.style.width = "50px";
+
+ let helper = new ResizeTestHelper(
+ "test15: an observation is fired with box dimensions 0 when element's " +
+ "display property is set to inline",
+ [
+ {
+ setup: observer => {
+ observer.observe(t);
+ },
+ notify: entries => {
+ assert_equals(entries.length, 1, "1 pending notification");
+ assert_equals(entries[0].target, t, "target is t");
+ assert_equals(entries[0].contentRect.width, 50, "target width");
+ assert_equals(entries[0].contentRect.height, 100, "target height");
+ assert_equals(entries[0].contentBoxSize.inlineSize, 50,
+ "target content-box inline size");
+ assert_equals(entries[0].contentBoxSize.blockSize, 100,
+ "target content-box block size");
+ assert_equals(entries[0].borderBoxSize.inlineSize, 50,
+ "target content-box inline size");
+ assert_equals(entries[0].borderBoxSize.blockSize, 100,
+ "target content-box block size");
+ }
+ },
+ {
+ setup: observer => {
+ t.style.display = "inline";
+ },
+ notify: entries => {
+ assert_equals(entries[0].contentRect.width, 0, "target width");
+ assert_equals(entries[0].contentRect.height, 0, "target height");
+ assert_equals(entries[0].contentBoxSize.inlineSize, 0,
+ "target content-box inline size");
+ assert_equals(entries[0].contentBoxSize.blockSize, 0,
+ "target content-box block size");
+ assert_equals(entries[0].borderBoxSize.inlineSize, 0,
+ "target border-box inline size");
+ assert_equals(entries[0].borderBoxSize.blockSize, 0,
+ "target border-box block size");
+ }
+ }
+ ]);
+
+ return helper.start(() => t.remove());
+}
+
+function test16() {
+ let t = createAndAppendElement("span");
+
+ let helper = new ResizeTestHelper(
+ // See: https://drafts.csswg.org/resize-observer/#intro.
+ "test16: observations do not fire for non-replaced inline elements",
+ [
+ {
+ setup: observer => {
+ observer.observe(t);
+ },
+ notify: entries => {
+ assert_unreached("No observation should fire for non box element")
+ },
+ timeout: () => {}
+ }
+ ]);
+
+ return helper.start(() => t.remove());
+}
+
let guard;
test(_ => {
assert_own_property(window, "ResizeObserver");
@@ -665,6 +736,8 @@
.then(() => test12())
.then(() => test13())
.then(() => test14())
+ .then(() => test15())
+ .then(() => test16())
.then(() => guard.done());
diff --git a/resize-observer/svg.html b/resize-observer/svg.html
index f43fff18d98b8d..648a4995702f95 100644
--- a/resize-observer/svg.html
+++ b/resize-observer/svg.html
@@ -18,7 +18,7 @@
- svg text tag
+ svg text tag
@@ -465,6 +465,37 @@
return helper.start();
}
+function test15() {
+ let target = document.querySelector('text');
+ let helper = new ResizeTestHelper(
+ "test15: observe svg:text content and border box",
+ [
+ {
+ setup: observer => {
+ observer.observe(target);
+ },
+ notify: (entries, observer) => {
+ return true; // Delay next step
+ }
+ },
+ {
+ setup: observer => {
+ target.setAttribute('font-size', "30");
+ },
+ notify: (entries, observer) => {
+ assert_equals(entries.length, 1);
+ assert_equals(entries[0].contentRect.width, 360);
+ assert_equals(entries[0].contentRect.height, 30);
+ assert_equals(entries[0].contentBoxSize.inlineSize, 360);
+ assert_equals(entries[0].contentBoxSize.blockSize, 30);
+ assert_equals(entries[0].borderBoxSize.inlineSize, 360);
+ assert_equals(entries[0].borderBoxSize.blockSize, 30);
+ }
+ }
+ ]);
+ return helper.start();
+}
+
let guard;
test(_ => {
assert_own_property(window, "ResizeObserver");
@@ -486,6 +517,7 @@
.then(() => { return test12(); })
.then(() => { return test13(); })
.then(() => { return test14(); })
+ .then(() => { return test15(); })
.then(() => { guard.done(); });