Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Unified Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp

Issue 2330553002: Disallow resizing on OffscreenCanvas that has been transferred control from canvas (Closed)
Patch Set: test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
index 200d0ba317fc6a5655325e01f63532bc247c3607..66bdaf2d16ea1d48b05b9b7981c9ff01e514ed9c 100644
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -27,20 +27,24 @@ OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height)
return new OffscreenCanvas(IntSize(clampTo<int>(width), clampTo<int>(height)));
}
-void OffscreenCanvas::setWidth(unsigned width)
+void OffscreenCanvas::setWidth(unsigned width, ExceptionState& exceptionState)
{
// If this OffscreenCanvas is transferred control by an html canvas,
// its size is determined by html canvas's size and cannot be resized.
- if (m_canvasId >= 0)
+ if (m_canvasId >= 0) {
+ exceptionState.throwDOMException(InvalidStateError, "Resizing is not allowed on an OffscreenCanvas that has been transferred control from a canvas.");
return;
+ }
m_size.setWidth(clampTo<int>(width));
}
-void OffscreenCanvas::setHeight(unsigned height)
+void OffscreenCanvas::setHeight(unsigned height, ExceptionState& exceptionState)
{
// Same comment as above.
- if (m_canvasId >= 0)
+ if (m_canvasId >= 0) {
+ exceptionState.throwDOMException(InvalidStateError, "Resizing is not allowed on an OffscreenCanvas that has been transferred control from a canvas.");
return;
+ }
m_size.setHeight(clampTo<int>(height));
}

Powered by Google App Engine
This is Rietveld 408576698