[HIC] Create composited layers for canvas descendants [chromium/src : main]

0 views
Skip to first unread message

Philip Rogers (Gerrit)

unread,
Jan 16, 2026, 1:16:50 PM (23 hours ago) Jan 16
to Stefan Zager, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org
Attention needed from Stefan Zager

Philip Rogers added 2 comments

File third_party/blink/renderer/core/paint/cull_rect_updater.cc
Line 106, Patchset 1 (Latest): if (element && element->IsInCanvasSubtree()) {
Philip Rogers . unresolved
`IsInCanvasSubtree` is general and is set even without the feature enabled. Can you wrap this logic in:
```
if (RuntimeEnabledFeatures::CanvasDrawElementEnabled()) {
auto* element = DynamicTo<Element>(object.GetNode());
if (element && element->IsInCanvasSubtree()) {
return true;
}
```
File third_party/blink/renderer/core/paint/paint_layer_painter.cc
Line 396, Patchset 1 (Latest): auto* element = DynamicTo<Element>(object.GetNode());
Philip Rogers . unresolved

Nit: maybe just wrap all of this logic in the feature check, rather than only checking the feature flag on line 400?

Open in Gerrit

Related details

Attention is currently required from:
  • Stefan Zager
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id4aafd0ea0924c51e16e5a5fb4db8925ca418542
Gerrit-Change-Number: 7487907
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Zager <sza...@chromium.org>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Philip Rogers <p...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Comment-Date: Fri, 16 Jan 2026 18:16:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Jan 16, 2026, 1:39:44 PM (23 hours ago) Jan 16
to Stefan Zager, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org
Attention needed from Stefan Zager

Philip Rogers added 1 comment

File third_party/blink/renderer/core/paint/compositing/compositing_test.cc
Line 3881, Patchset 2 (Latest): // EXPECT_FALSE(CcLayerByDOMElementId("grandchild_a"));
Philip Rogers . unresolved

nit: remove (the uncommented version is below)

Open in Gerrit

Related details

Attention is currently required from:
  • Stefan Zager
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id4aafd0ea0924c51e16e5a5fb4db8925ca418542
Gerrit-Change-Number: 7487907
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Zager <sza...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Comment-Date: Fri, 16 Jan 2026 18:39:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Jan 16, 2026, 4:32:15 PM (20 hours ago) Jan 16
to Stefan Zager, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org
Attention needed from Stefan Zager

Philip Rogers added 1 comment

File third_party/blink/renderer/core/paint/paint_layer_painter.cc
Line 407, Patchset 2 (Latest): if (is_drawn_canvas_child || PaintedOutputInvisible(object.StyleRef())) {
Philip Rogers . unresolved

I think some of the test failures (e.g., svg_rect.html) are due to using effectively invisible. It causes us to not render this content when we call drawElementImage, which uses PaintChunksToCCLayer, which calls ConversionContext<Result>::Convert, which skips effectively invisible chunks.

WDYT of making cc::Layer SetDrawsContent false as an alternative? We can do this by modifying Layer::PushDirtyPropertiesTo to check if the layer is in the layer tree host's list of draw element layer ids, and if so, set draws_content to false.

Gerrit-Comment-Date: Fri, 16 Jan 2026 21:32:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Stefan Zager (Gerrit)

unread,
Jan 16, 2026, 4:59:53 PM (20 hours ago) Jan 16
to Philip Rogers, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org
Attention needed from Philip Rogers

Stefan Zager added 4 comments

File third_party/blink/renderer/core/paint/compositing/compositing_test.cc
Line 3881, Patchset 2: // EXPECT_FALSE(CcLayerByDOMElementId("grandchild_a"));
Philip Rogers . resolved

nit: remove (the uncommented version is below)

Stefan Zager

Done

File third_party/blink/renderer/core/paint/cull_rect_updater.cc
Line 106, Patchset 1: if (element && element->IsInCanvasSubtree()) {
Philip Rogers . resolved
`IsInCanvasSubtree` is general and is set even without the feature enabled. Can you wrap this logic in:
```
if (RuntimeEnabledFeatures::CanvasDrawElementEnabled()) {
auto* element = DynamicTo<Element>(object.GetNode());
if (element && element->IsInCanvasSubtree()) {
return true;
}
```
Stefan Zager

Done

File third_party/blink/renderer/core/paint/paint_layer_painter.cc
Line 396, Patchset 1: auto* element = DynamicTo<Element>(object.GetNode());
Philip Rogers . resolved

Nit: maybe just wrap all of this logic in the feature check, rather than only checking the feature flag on line 400?

Stefan Zager

Done

Line 407, Patchset 2: if (is_drawn_canvas_child || PaintedOutputInvisible(object.StyleRef())) {
Philip Rogers . unresolved

I think some of the test failures (e.g., svg_rect.html) are due to using effectively invisible. It causes us to not render this content when we call drawElementImage, which uses PaintChunksToCCLayer, which calls ConversionContext<Result>::Convert, which skips effectively invisible chunks.

WDYT of making cc::Layer SetDrawsContent false as an alternative? We can do this by modifying Layer::PushDirtyPropertiesTo to check if the layer is in the layer tree host's list of draw element layer ids, and if so, set draws_content to false.

Stefan Zager

The problem is that we shouldn't emplace `effectively_invisible` for the `PaintLayerPainter::Paint` call from `CanvasRenderingContext`. I fixed this by checking for `PaintFlag::kPrivacyPreserving`, which is only set from that call site. That's pretty hacky, I'm open to other ideas.

Open in Gerrit

Related details

Attention is currently required from:
  • Philip Rogers
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id4aafd0ea0924c51e16e5a5fb4db8925ca418542
Gerrit-Change-Number: 7487907
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Zager <sza...@chromium.org>
Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Philip Rogers <p...@chromium.org>
Gerrit-Comment-Date: Fri, 16 Jan 2026 21:59:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Philip Rogers (Gerrit)

unread,
Jan 16, 2026, 5:43:18 PM (19 hours ago) Jan 16
to Stefan Zager, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org
Attention needed from Stefan Zager

Philip Rogers voted and added 2 comments

Votes added by Philip Rogers

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Philip Rogers . resolved

LGTM

File third_party/blink/renderer/core/paint/paint_layer_painter.cc
Line 407, Patchset 2: if (is_drawn_canvas_child || PaintedOutputInvisible(object.StyleRef())) {
Philip Rogers . resolved

I think some of the test failures (e.g., svg_rect.html) are due to using effectively invisible. It causes us to not render this content when we call drawElementImage, which uses PaintChunksToCCLayer, which calls ConversionContext<Result>::Convert, which skips effectively invisible chunks.

WDYT of making cc::Layer SetDrawsContent false as an alternative? We can do this by modifying Layer::PushDirtyPropertiesTo to check if the layer is in the layer tree host's list of draw element layer ids, and if so, set draws_content to false.

Stefan Zager

The problem is that we shouldn't emplace `effectively_invisible` for the `PaintLayerPainter::Paint` call from `CanvasRenderingContext`. I fixed this by checking for `PaintFlag::kPrivacyPreserving`, which is only set from that call site. That's pretty hacky, I'm open to other ideas.

Philip Rogers

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Stefan Zager
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Id4aafd0ea0924c51e16e5a5fb4db8925ca418542
    Gerrit-Change-Number: 7487907
    Gerrit-PatchSet: 4
    Gerrit-Owner: Stefan Zager <sza...@chromium.org>
    Gerrit-Reviewer: Philip Rogers <p...@chromium.org>
    Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Stefan Zager <sza...@chromium.org>
    Gerrit-Comment-Date: Fri, 16 Jan 2026 22:43:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Stefan Zager <sza...@chromium.org>
    Comment-In-Reply-To: Philip Rogers <p...@chromium.org>
    satisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages