summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-highlight-api/painting/resources
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-highlight-api/painting/resources')
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/painting/resources/iframe-code.html13
-rw-r--r--testing/web-platform/tests/css/css-highlight-api/painting/resources/run-after-layout-and-paint.js11
2 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/resources/iframe-code.html b/testing/web-platform/tests/css/css-highlight-api/painting/resources/iframe-code.html
new file mode 100644
index 0000000000..a4a1829be2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/painting/resources/iframe-code.html
@@ -0,0 +1,13 @@
+<style>
+ ::highlight(foo) {
+ color: blue;
+ background-color: cyan;
+ }
+</style>
+<span id='span-iframe'>abc</span>
+<script>
+ let r = new Range();
+ r.setStart(document.querySelector('#span-iframe'), 0);
+ r.setEnd(document.querySelector('#span-iframe'), 1);
+ CSS.highlights.set('foo', new Highlight(r));
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/css/css-highlight-api/painting/resources/run-after-layout-and-paint.js b/testing/web-platform/tests/css/css-highlight-api/painting/resources/run-after-layout-and-paint.js
new file mode 100644
index 0000000000..75d3e279a4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-highlight-api/painting/resources/run-after-layout-and-paint.js
@@ -0,0 +1,11 @@
+// This is inspired in runAfterLayoutAndPaint() from
+// third_party/blink/web_tests/resources/run-after-layout-and-paint.js.
+function runAfterLayoutAndPaint(callback) {
+ // See http://crrev.com/c/1395193/10/third_party/blink/web_tests/http/tests/resources/run-after-layout-and-paint.js
+ // for more discussions.
+ requestAnimationFrame(function() {
+ requestAnimationFrame(function() {
+ callback();
+ });
+ });
+} \ No newline at end of file