This commit is contained in:
Vlad Tukhtarov 2022-03-31 08:40:37 +00:00 committed by GitHub
commit 908819cd1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -231,6 +231,10 @@ export class CSSParsedDeclaration {
return this.display > 0 && this.opacity > 0 && this.visibility === VISIBILITY.VISIBLE;
}
isChildVisible(): boolean {
return this.display > 0 && this.opacity > 0;
}
isTransparent(): boolean {
return isTransparent(this.backgroundColor);
}

View File

@ -25,7 +25,7 @@ const parseNodeTree = (context: Context, node: Node, parent: ElementContainer, r
childNode.assignedNodes().forEach((childNode) => parseNodeTree(context, childNode, parent, root));
} else {
const container = createContainer(context, childNode);
if (container.styles.isVisible()) {
if (container.styles.isChildVisible()) {
if (createsRealStackingContext(childNode, container, root)) {
container.flags |= FLAGS.CREATES_REAL_STACKING_CONTEXT;
} else if (createsStackingContext(container.styles)) {

View File

@ -128,7 +128,7 @@ export class CanvasRenderer extends Renderer {
async renderStack(stack: StackingContext): Promise<void> {
const styles = stack.element.container.styles;
if (styles.isVisible()) {
if (styles.isChildVisible()) {
await this.renderStackContent(stack);
}
}
@ -476,7 +476,10 @@ export class CanvasRenderer extends Renderer {
}
// https://www.w3.org/TR/css-position-3/#painting-order
// 1. the background and borders of the element forming the stacking context.
await this.renderNodeBackgroundAndBorders(stack.element);
const styles = stack.element.container.styles;
if (styles.isVisible()) {
await this.renderNodeBackgroundAndBorders(stack.element);
}
// 2. the child stacking contexts with negative stack levels (most negative first).
for (const child of stack.negativeZIndex) {
await this.renderStack(child);