fix: support hiding caret in case of matching style rule (#12172)
This commit is contained in:
parent
6ec00a9ae5
commit
c98d595bea
|
|
@ -133,11 +133,9 @@ export class Screenshotter {
|
||||||
await frame.nonStallingEvaluateInExistingContext('(' + (function(disableAnimations: boolean) {
|
await frame.nonStallingEvaluateInExistingContext('(' + (function(disableAnimations: boolean) {
|
||||||
const styleTag = document.createElement('style');
|
const styleTag = document.createElement('style');
|
||||||
styleTag.textContent = `
|
styleTag.textContent = `
|
||||||
*,
|
*:not(#playwright-aaaaaaaaaa.playwright-bbbbbbbbbbb.playwright-cccccccccc.playwright-dddddddddd.playwright-eeeeeeeee) {
|
||||||
* > *,
|
caret-color: transparent !important;
|
||||||
* > * > *,
|
}
|
||||||
* > * > * > *,
|
|
||||||
* > * > * > * > * { caret-color: transparent !important; }
|
|
||||||
`;
|
`;
|
||||||
document.documentElement.append(styleTag);
|
document.documentElement.append(styleTag);
|
||||||
const infiniteAnimationsToResume: Set<Animation> = new Set();
|
const infiniteAnimationsToResume: Set<Animation> = new Set();
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,16 @@ it.describe('page screenshot', () => {
|
||||||
|
|
||||||
it('should not capture blinking caret', async ({ page, server }) => {
|
it('should not capture blinking caret', async ({ page, server }) => {
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
|
<!-- Refer to stylesheet from other origin. Accessing this
|
||||||
|
stylesheet rules will throw.
|
||||||
|
-->
|
||||||
|
<link rel=stylesheet href="${server.CROSS_PROCESS_PREFIX + '/injectedstyle.css'}">
|
||||||
|
<!-- make life harder: define caret color in stylesheet -->
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
caret-color: #000 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<div contenteditable="true"></div>
|
<div contenteditable="true"></div>
|
||||||
`);
|
`);
|
||||||
const div = page.locator('div');
|
const div = page.locator('div');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue