forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
view-transition: Implement more opt-in CSSOM
This CL implements the @view-transitions rule's navigation trigger setter so that it may be used from JavaScript. Bug: 1463966 Change-Id: Ia506cb8ae9c997da91837df7c8515cc57bd036cf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4938961 Reviewed-by: Vladimir Levin <vmpstr@chromium.org> Commit-Queue: David Bokan <bokan@chromium.org> Reviewed-by: Khushal Sagar <khushalsagar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1211548}
- Loading branch information
Showing
8 changed files
with
154 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../blink/web_tests/wpt_internal/view-transition-on-navigation/at-rule-opt-in-via-cssom.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<title>View Transitions: @view-transitions opt-in programmatically.</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/"> | ||
<link rel="author" href="mailto:bokan@chromium.org"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@view-transitions { | ||
navigation-trigger: none; | ||
} | ||
</style> | ||
<script> | ||
function optIn() { | ||
document.styleSheets[0].cssRules[0].navigationTrigger = 'cross-document-same-origin'; | ||
} | ||
const params = new URLSearchParams(location.search); | ||
const is_new_page = params.has('new'); | ||
|
||
if (!is_new_page) { | ||
onload = () => requestAnimationFrame(() => requestAnimationFrame(() => { | ||
optIn(); | ||
location.replace(location.href + '?new'); | ||
})); | ||
} else { | ||
promise_test(() => { | ||
optIn(); | ||
return new Promise((resolve) => { | ||
addEventListener('pagereveal', resolve); | ||
}).then(event => { | ||
assert_not_equals(event.viewTransition, null, | ||
"ViewTransition must be triggered."); | ||
}); | ||
}); | ||
} | ||
</script> |
31 changes: 31 additions & 0 deletions
31
...blink/web_tests/wpt_internal/view-transition-on-navigation/at-rule-opt-out-via-cssom.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<title>View Transitions: @view-transitions opt-out programmatically.</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/"> | ||
<link rel="author" href="mailto:bokan@chromium.org"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@view-transitions { | ||
navigation-trigger: cross-document-same-origin; | ||
} | ||
</style> | ||
<script> | ||
const params = new URLSearchParams(location.search); | ||
const is_new_page = params.has('new'); | ||
|
||
if (!is_new_page) { | ||
onload = () => requestAnimationFrame(() => requestAnimationFrame(() => { | ||
document.styleSheets[0].rules[0].navigationTrigger = 'none'; | ||
location.replace(location.href + '?new'); | ||
})); | ||
} else { | ||
promise_test(() => { | ||
return new Promise((resolve) => { | ||
addEventListener('pagereveal', resolve); | ||
}).then(event => { | ||
assert_equals(event.viewTransition, null, | ||
"ViewTransition must not be triggered."); | ||
}); | ||
}); | ||
} | ||
</script> |