Skip to content

Commit

Permalink
[ElementTiming] Do not expose elements in Shadow Trees
Browse files Browse the repository at this point in the history
We initially exposed these elements but this seems to break design
invariants. It is still unclear what we can do with elements in shadow
trees, but for now it is safest to not expose them at all.

Relevant threads:
WICG/element-timing#3
WICG/webcomponents#816

Bug: 879270
Change-Id: Id4c0d65e0f0e086c6c6dfa29cc019a4c1ef6ab1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1622470
Reviewed-by: Chris Harrelson <[email protected]>
Commit-Queue: Nicolás Peña Moreno <[email protected]>
Cr-Commit-Position: refs/heads/master@{#662391}
  • Loading branch information
npm1 authored and chromium-wpt-export-bot committed May 22, 2019
1 parent 0f00529 commit d5ebd1f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions element-timing/observe-shadow-image.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Element Timing: observe image in shadow tree</title>
<title>Element Timing: do not observe image in shadow tree</title>
<style>
body {
margin: 0;
Expand All @@ -19,13 +19,7 @@
}
const observer = new PerformanceObserver(
t.step_func_done(function(entryList) {
assert_equals(entryList.getEntries().length, 1);
const entry = entryList.getEntries()[0];
const pathname = window.location.origin + '/element-timing/resources/square100.png';
checkElement(entry, pathname, 'my_image', 'my_id', beforeRender, img);
// Assume viewport has size at least 100, so the element is fully visible.
checkRect(entry, [0, 100, 0, 100]);
checkNaturalSize(entry, 100, 100);
assert_unreached('Should not observe elements in shadow trees!');
})
);
observer.observe({entryTypes: ['element']});
Expand All @@ -40,6 +34,10 @@
const shadowRoot = document.getElementById('target').attachShadow({mode: 'closed'});
shadowRoot.appendChild(img);
beforeRender = performance.now();
t.step_timeout(() => {
// Assume entry was not dispatched, so test passes.
t.done();
}, 500);
};
}, 'Image in shadow tree with elementtiming attribute is observable.');
}, 'Image in shadow tree with elementtiming attribute is not observable.');
</script>

0 comments on commit d5ebd1f

Please sign in to comment.