Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 40b19269f440dbfe44035f50d2b0ccbe6e3fe58d
      
https://github.com/WebKit/WebKit/commit/40b19269f440dbfe44035f50d2b0ccbe6e3fe58d
  Author: Said Abou-Hallawa <s...@apple.com>
  Date:   2024-08-30 (Fri, 30 Aug 2024)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha.html
    M Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp
    M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

  Log Message:
  -----------
  CanvasRenderingContext2D globalAlpha property is ignored for some values of 
globalCompositeOperation
https://bugs.webkit.org/show_bug.cgi?id=278454
rdar://134840885

Reviewed by Simon Fraser.

beginTransparencyLayer(opacity) sets the global alpha to `opacity`. Then it
calls CGContextBeginTransparencyLayer() which sets the global alpha to 1.
Calling CGContextEndTransparencyLayer() restores the global alpha back to
`opacity` before compositing the transparency layer back to the destination
context.

beginTransparencyLayer(CompositeOperator, BlendMode) is called only from canvas.
It passes `opacity` = 1 to beginTransparencyLayer(opacity). This will set the
alpha of both the transparency layer and the destination context to 1. This will
display everything opaque.

The fix is to make beginTransparencyLayer(CompositeOperator, BlendMode) pass
state().alpha() to beginTransparencyLayer(opacity) so the current global alpha
is preserved.

* 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha.html:
 Added.
* Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp:
(WebCore::BifurcatedGraphicsContext::beginTransparencyLayer):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::beginTransparencyLayer):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to