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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2515623003: Stop OffscreenCanvas resize from changing placeholder attributes (Closed)
Patch Set: report correct intrinsic size Created 4 years, 1 month 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/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 655442579b0afbc4d611446376ec62f42f9455c4..9fd7e8d3d938529fff7db558d1ea3227f7c1d8e2 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -177,27 +177,10 @@ Node::InsertionNotificationRequest HTMLCanvasElement::insertedInto(
}
void HTMLCanvasElement::setHeight(int value, ExceptionState& exceptionState) {
- if (surfaceLayerBridge()) {
- // The existence of surfaceLayerBridge indicates that
- // canvas.transferControlToOffscreen has been called.
- exceptionState.throwDOMException(InvalidStateError,
- "Resizing is not allowed for a canvas "
- "that has transferred its control to "
- "offscreen.");
- return;
- }
setIntegralAttribute(heightAttr, value);
}
void HTMLCanvasElement::setWidth(int value, ExceptionState& exceptionState) {
- if (surfaceLayerBridge()) {
- // Same comment as above.
- exceptionState.throwDOMException(InvalidStateError,
- "Resizing is not allowed for a canvas "
- "that has transferred its control to "
- "offscreen.");
- return;
- }
setIntegralAttribute(widthAttr, value);
}
@@ -1266,6 +1249,8 @@ FloatSize HTMLCanvasElement::elementSize(const FloatSize&) const {
return FloatSize(image->width(), image->height());
return FloatSize(0, 0);
}
+ if (placeholderFrame())
+ return FloatSize(placeholderFrame()->size());
return FloatSize(width(), height());
}

Powered by Google App Engine
This is Rietveld 408576698