Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7c7f7bd40fbd5ed427de4927cf67c12502d82458
      
https://github.com/WebKit/WebKit/commit/7c7f7bd40fbd5ed427de4927cf67c12502d82458
  Author: Taher Ali <[email protected]>
  Date:   2026-10-15 (Thu, 15 Oct 2026)

  Changed paths:
    M 
LayoutTests/compositing/canvas/html-in-canvas-drawable-canvas-is-composited-expected.txt
    M 
LayoutTests/compositing/canvas/html-in-canvas-drawable-canvas-is-composited.html
    M 
LayoutTests/fast/canvas/draw-element-image/2d-drawElementImage-rotated-text.html
    A 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/draw-element-image/canvas-content-drawable-stacking-context.tentative-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/draw-element-image/canvas-content-drawable-stacking-context.tentative-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/draw-element-image/canvas-content-drawable-stacking-context.tentative.html
    M Source/WebCore/rendering/RenderHTMLCanvas.cpp
    M Source/WebCore/rendering/RenderHTMLCanvas.h
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/style/StyleAdjuster.cpp

  Log Message:
  -----------
  [HTML-in-Canvas] Make a canvas with drawable content a stacking context
https://bugs.webkit.org/show_bug.cgi?id=327450
rdar://189945867

Reviewed by Said Abou-Hallawa and Simon Fraser.

Drawable elements are stacking contexts, but the canvas containing them was
not. Their layers were therefore ordered in the stacking context outside the
canvas, so their repaints did not reach the canvas and did not fire the paint
event.

In this PR we give a canvas with drawable content a stacking context.

* 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/draw-element-image/canvas-content-drawable-stacking-context.tentative-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/draw-element-image/canvas-content-drawable-stacking-context.tentative-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/draw-element-image/canvas-content-drawable-stacking-context.tentative.html:
 Added.

* Source/WebCore/rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::canvasDrawableRecorder const):
* Source/WebCore/rendering/RenderHTMLCanvas.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::canvasDrawableRecorder):
(WebCore::RenderLayer::paintLayer):

Drawable elements are now painted by the canvas's backing, so their painting 
root is the
canvas layer. Compute the recording rect from the layer's offset to the 
painting root,
which is the space the drawing commands are recorded in, instead of the 
element's absolute position.

* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::adjust const):

* 
LayoutTests/compositing/canvas/html-in-canvas-drawable-canvas-is-composited-expected.txt:
* 
LayoutTests/compositing/canvas/html-in-canvas-drawable-canvas-is-composited.html:

This test only checks which canvases get a composited layer. Now that the 
canvas is a
stacking context, its layer bounds include its drawable children, so the test 
would also
depend on how they are laid out. We change the children to small empty elements 
so the
test checks only the graphics layers.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to