From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- dom/canvas/CanvasRenderingContext2D.h | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'dom/canvas/CanvasRenderingContext2D.h') diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index 3376e1033c..75a57ab14f 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -570,6 +570,10 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, void OnShutdown(); + bool IsContextLost() const { return mIsContextLost; } + void OnRemoteCanvasLost(); + void OnRemoteCanvasRestored(); + /** * Update CurrentState().filter with the filter description for * CurrentState().filterChain. @@ -699,8 +703,16 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, * * Returns true on success. */ - bool EnsureTarget(const gfx::Rect* aCoveredRect = nullptr, + bool EnsureTarget(ErrorResult& aError, + const gfx::Rect* aCoveredRect = nullptr, bool aWillClear = false); + + bool EnsureTarget(const gfx::Rect* aCoveredRect = nullptr, + bool aWillClear = false) { + IgnoredErrorResult error; + return EnsureTarget(error, aCoveredRect, aWillClear); + } + // Attempt to borrow a new target from an existing buffer provider. bool BorrowTarget(const gfx::IntRect& aPersistedRect, bool aNeedsClear); @@ -714,7 +726,8 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, RefPtr& aOutProvider); bool TryBasicTarget(RefPtr& aOutDT, - RefPtr& aOutProvider); + RefPtr& aOutProvider, + ErrorResult& aError); void RegisterAllocation(); @@ -753,7 +766,7 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, * Check if the target is valid after calling EnsureTarget. */ bool IsTargetValid() const { - return !!mTarget && mTarget != sErrorTarget.get(); + return !!mTarget && mTarget != sErrorTarget.get() && !mIsContextLost; } /** @@ -836,8 +849,11 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, bool mWillReadFrequently = false; // Whether or not we have already shutdown. bool mHasShutdown = false; + // Whether or not remote canvas is currently unavailable. + bool mIsContextLost = false; + // Whether or not we can restore the context after restoration. + bool mAllowContextRestore = true; - RefPtr mShutdownObserver; bool AddShutdownObserver(); void RemoveShutdownObserver(); bool AlreadyShutDown() const { return mHasShutdown; } @@ -1008,9 +1024,11 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, RefPtr fontLanguage; nsFont fontFont; - EnumeratedArray> gradientStyles; - EnumeratedArray> patternStyles; - EnumeratedArray colorStyles; + EnumeratedArray, size_t(Style::MAX)> + gradientStyles; + EnumeratedArray, size_t(Style::MAX)> + patternStyles; + EnumeratedArray colorStyles; nsCString font; CanvasTextAlign textAlign = CanvasTextAlign::Start; -- cgit v1.2.3