summaryrefslogtreecommitdiffstats
path: root/dom/canvas
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:02:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:02:55 +0000
commit22e2874bf6412144ab4b51b95327306ef9609b2c (patch)
tree977413f3f953a8838b52b432554e53707cf27777 /dom/canvas
parentReleasing progress-linux version 126.0-1~progress7.99u1. (diff)
downloadfirefox-22e2874bf6412144ab4b51b95327306ef9609b2c.tar.xz
firefox-22e2874bf6412144ab4b51b95327306ef9609b2c.zip
Merging upstream version 126.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas')
-rw-r--r--dom/canvas/CanvasRenderingContext2D.cpp12
-rw-r--r--dom/canvas/test/test_accelerated_canvas_context_loss.html12
2 files changed, 19 insertions, 5 deletions
diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp
index 1a79a9f734..54711aa981 100644
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -2216,14 +2216,16 @@ void CanvasRenderingContext2D::Transform(double aM11, double aM12, double aM21,
already_AddRefed<DOMMatrix> CanvasRenderingContext2D::GetTransform(
ErrorResult& aError) {
- if (!EnsureTarget(aError)) {
+ // If we are silently failing, then we still need to return a transform while
+ // we are in the process of recovering.
+ Matrix transform;
+ if (EnsureTarget(aError)) {
+ transform = mTarget->GetTransform();
+ } else if (aError.Failed()) {
return nullptr;
}
- MOZ_ASSERT(IsTargetValid());
-
- RefPtr<DOMMatrix> matrix =
- new DOMMatrix(GetParentObject(), mTarget->GetTransform());
+ RefPtr<DOMMatrix> matrix = new DOMMatrix(GetParentObject(), transform);
return matrix.forget();
}
diff --git a/dom/canvas/test/test_accelerated_canvas_context_loss.html b/dom/canvas/test/test_accelerated_canvas_context_loss.html
index 6172420bcb..610c8d8fc3 100644
--- a/dom/canvas/test/test_accelerated_canvas_context_loss.html
+++ b/dom/canvas/test/test_accelerated_canvas_context_loss.html
@@ -58,6 +58,12 @@ let countRestoredEvents = 0;
function onContextLost() {
ok(context.isContextLost(), "Canvas context should be lost during contextlost event");
+
+ try {
+ let transform = context.getTransform();
+ ok(transform.isIdentity, "Canvas context should return identity transform while context lost");
+ } catch (e) {}
+
countLostEvents += 1;
}
@@ -88,6 +94,12 @@ async function start() {
ok(!context.isContextLost(), "Canvas context should not be lost after initial fill");
+ let transform = context.getTransform();
+ ok(transform.isIdentity, "Canvas context should default to identity transform");
+ context.setTransform(2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
+ transform = context.getTransform();
+ ok(!transform.isIdentity, "Canvas context should have non-identity transform");
+
const restarted = await restartGPUProcess();
const expectedEvents = restarted ? 1 : 0;