Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent, composited canvas is rendered black when layer is changed to render layer backing sharing #15599

Conversation

kkinnunen-apple
Copy link
Contributor

@kkinnunen-apple kkinnunen-apple commented Jul 6, 2023

dbef4cf

Transparent, composited canvas is rendered black when layer is changed to render layer backing sharing
https://bugs.webkit.org/show_bug.cgi?id=258927
rdar://110088034

Reviewed by Simon Fraser.

Explicitly composited canvas element might switch to being
composited to other RenderLayerBacking. This left the
RenderLayer::m_shouldPaintUsingCompositeCopy unreset.

Instead, store the flag to RenderLayerBacking.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
* Source/WebCore/rendering/RenderLayer.h:
(WebCore::RenderLayer::shouldPaintUsingCompositeCopy const): Deleted.
(WebCore::RenderLayer::setShouldPaintUsingCompositeCopy): Deleted.
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::paintIntoLayer):
* Source/WebCore/rendering/RenderLayerBacking.h:

Canonical link: https://commits.webkit.org/265837@main

e43669b

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@kkinnunen-apple kkinnunen-apple self-assigned this Jul 6, 2023
@kkinnunen-apple kkinnunen-apple added the Canvas Bugs related to the canvas element. label Jul 6, 2023
@kkinnunen-apple kkinnunen-apple requested review from smfr and removed request for rniwa and cdumez July 6, 2023 14:19
Source/WebCore/rendering/RenderLayerBacking.h Outdated Show resolved Hide resolved
Source/WebCore/rendering/RenderLayerBacking.h Outdated Show resolved Hide resolved
@@ -3443,6 +3443,9 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap
#endif
return;
}
GraphicsContextStateSaver saver(context, m_shouldPaintUsingCompositeCopy);
if (m_shouldPaintUsingCompositeCopy)
context.setCompositeOperation(CompositeOperator::Copy);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit weird to do this here. Sure, we know that the canvas is the only thing painted into this layer, but it looks weird to have this cover the scope of all the painting. Maybe it will do something odd for event regions, for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd feel OK if this was moved to before layer.paintLayerContents().

@kkinnunen-apple kkinnunen-apple force-pushed the canvas-composite-copy-remotelayerbacking-changes-1 branch from a34982c to e43669b Compare July 7, 2023 08:06
@kkinnunen-apple kkinnunen-apple added the merge-queue Applied to send a pull request to merge-queue label Jul 7, 2023
…d to render layer backing sharing

https://bugs.webkit.org/show_bug.cgi?id=258927
rdar://110088034

Reviewed by Simon Fraser.

Explicitly composited canvas element might switch to being
composited to other RenderLayerBacking. This left the
RenderLayer::m_shouldPaintUsingCompositeCopy unreset.

Instead, store the flag to RenderLayerBacking.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
* Source/WebCore/rendering/RenderLayer.h:
(WebCore::RenderLayer::shouldPaintUsingCompositeCopy const): Deleted.
(WebCore::RenderLayer::setShouldPaintUsingCompositeCopy): Deleted.
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::paintIntoLayer):
* Source/WebCore/rendering/RenderLayerBacking.h:

Canonical link: https://commits.webkit.org/265837@main
@webkit-commit-queue webkit-commit-queue force-pushed the canvas-composite-copy-remotelayerbacking-changes-1 branch from e43669b to dbef4cf Compare July 7, 2023 12:08
@webkit-commit-queue
Copy link
Collaborator

Committed 265837@main (dbef4cf): https://commits.webkit.org/265837@main

Reviewed commits have been landed. Closing PR #15599 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit dbef4cf into WebKit:main Jul 7, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canvas Bugs related to the canvas element.
Projects
None yet
4 participants