Diff
Modified: trunk/LayoutTests/ChangeLog (201663 => 201664)
--- trunk/LayoutTests/ChangeLog 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/LayoutTests/ChangeLog 2016-06-03 22:26:50 UTC (rev 201664)
@@ -1,3 +1,16 @@
+2016-06-03 Chris Dumez <[email protected]>
+
+ CanvasRenderingContext2D.createPattern() / putImageData() throw wrong exception type
+ https://bugs.webkit.org/show_bug.cgi?id=158322
+
+ Reviewed by Ryosuke Niwa.
+
+ Update several outdated layout tests.
+
+ * canvas/philip/tests/2d.imageData.put.null.html:
+ * canvas/philip/tests/2d.pattern.image.null.html:
+ * canvas/philip/tests/2d.pattern.image.undefined.html:
+
2016-06-03 Ryan Haddad <[email protected]>
Marking fast/scrolling/scroll-container-horizontally.html as flaky on mac-wk2 and ios-simulator-wk1
Modified: trunk/LayoutTests/canvas/philip/tests/2d.imageData.put.null.html (201663 => 201664)
--- trunk/LayoutTests/canvas/philip/tests/2d.imageData.put.null.html 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/LayoutTests/canvas/philip/tests/2d.imageData.put.null.html 2016-06-03 22:26:50 UTC (rev 201664)
@@ -14,7 +14,7 @@
try { var _thrown = false;
ctx.putImageData(null, 0, 0);
-} catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH_ERR: ctx.putImageData(null, 0, 0)"); }
+} catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected exception of type TypeError, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.putImageData(null, 0, 0)"); }
});
Modified: trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.null.html (201663 => 201664)
--- trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.null.html 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.null.html 2016-06-03 22:26:50 UTC (rev 201664)
@@ -14,7 +14,7 @@
try { var _thrown = false;
ctx.createPattern(null, 'repeat');
-} catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH_ERR: ctx.createPattern(null, 'repeat')"); }
+} catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected exception of type TypeError, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.createPattern(null, 'repeat')"); }
});
Modified: trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined.html (201663 => 201664)
--- trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined.html 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/LayoutTests/canvas/philip/tests/2d.pattern.image.undefined.html 2016-06-03 22:26:50 UTC (rev 201664)
@@ -14,7 +14,7 @@
try { var _thrown = false;
ctx.createPattern(undefined, 'repeat');
-} catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH_ERR: ctx.createPattern(undefined, 'repeat')"); }
+} catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected exception of type TypeError, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.createPattern(undefined, 'repeat')"); }
});
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (201663 => 201664)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-06-03 22:26:50 UTC (rev 201664)
@@ -1,3 +1,14 @@
+2016-06-03 Chris Dumez <[email protected]>
+
+ CanvasRenderingContext2D.createPattern() / putImageData() throw wrong exception type
+ https://bugs.webkit.org/show_bug.cgi?id=158322
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline test now that it is passing.
+
+ * canvas/2d.pattern.image.undefined-expected.txt:
+
2016-06-02 Chris Dumez <[email protected]>
[WebIDL] 'undefined' should be an acceptable value for nullable parameters
Modified: trunk/LayoutTests/imported/w3c/canvas/2d.pattern.image.undefined-expected.txt (201663 => 201664)
--- trunk/LayoutTests/imported/w3c/canvas/2d.pattern.image.undefined-expected.txt 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/LayoutTests/imported/w3c/canvas/2d.pattern.image.undefined-expected.txt 2016-06-03 22:26:50 UTC (rev 201664)
@@ -2,4 +2,4 @@
Spec references: 2d.pattern.IDL
Defined in "Web IDL" (draft)
Actual output:
-Failed assertion: expected exception of type TypeError, got: Error: TypeMismatchError: DOM Exception 17
+Passed
Modified: trunk/Source/WebCore/ChangeLog (201663 => 201664)
--- trunk/Source/WebCore/ChangeLog 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/Source/WebCore/ChangeLog 2016-06-03 22:26:50 UTC (rev 201664)
@@ -1,3 +1,31 @@
+2016-06-03 Chris Dumez <[email protected]>
+
+ CanvasRenderingContext2D.createPattern() / putImageData() throw wrong exception type
+ https://bugs.webkit.org/show_bug.cgi?id=158322
+
+ Reviewed by Ryosuke Niwa.
+
+ CanvasRenderingContext2D.createPattern() / putImageData() were throwing the wrong
+ exception type when the first parameter was null. It should throw a TypeError
+ but it was throwing a legacy TYPE_MISMATCH_ERR:
+ - http://www.w3.org/TR/2dcontext/#canvasrenderingcontext2d
+ - http://www.w3.org/TR/2dcontext/#canvasimagesource
+
+ This patch aligns our behavior with the specification.
+
+ No new tests, covered by existing tests.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::createPattern):
+ (WebCore::CanvasRenderingContext2D::putImageData):
+ (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD):
+ (WebCore::CanvasRenderingContext2D::didDraw): Deleted.
+ (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded): Deleted.
+ (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Deleted.
+ (WebCore::CanvasRenderingContext2D::font): Deleted.
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/CanvasRenderingContext2D.idl:
+
2016-06-03 Anders Carlsson <[email protected]>
Rename NoncopyableFunction to Function
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (201663 => 201664)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-06-03 22:26:50 UTC (rev 201664)
@@ -1744,22 +1744,18 @@
return WTFMove(gradient);
}
-RefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageElement* imageElement,
+RefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageElement& imageElement,
const String& repetitionType, ExceptionCode& ec)
{
- if (!imageElement) {
- ec = TYPE_MISMATCH_ERR;
- return nullptr;
- }
bool repeatX, repeatY;
ec = 0;
CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, ec);
if (ec)
return nullptr;
- CachedImage* cachedImage = imageElement->cachedImage();
+ CachedImage* cachedImage = imageElement.cachedImage();
// If the image loading hasn't started or the image is not complete, it is not fully decodable.
- if (!cachedImage || !imageElement->complete())
+ if (!cachedImage || !imageElement.complete())
return nullptr;
if (cachedImage->status() == CachedResource::LoadError) {
@@ -1767,7 +1763,7 @@
return nullptr;
}
- if (!imageElement->cachedImage()->imageForRenderer(imageElement->renderer()))
+ if (!imageElement.cachedImage()->imageForRenderer(imageElement.renderer()))
return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true);
bool originClean = cachedImage->isOriginClean(canvas()->securityOrigin());
@@ -1781,17 +1777,13 @@
if (cachedImage->image()->isSVGImage())
originClean = false;
- return CanvasPattern::create(cachedImage->imageForRenderer(imageElement->renderer()), repeatX, repeatY, originClean);
+ return CanvasPattern::create(cachedImage->imageForRenderer(imageElement.renderer()), repeatX, repeatY, originClean);
}
-RefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElement* canvas,
+RefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElement& canvas,
const String& repetitionType, ExceptionCode& ec)
{
- if (!canvas) {
- ec = TYPE_MISMATCH_ERR;
- return nullptr;
- }
- if (!canvas->width() || !canvas->height() || !canvas->buffer()) {
+ if (!canvas.width() || !canvas.height() || !canvas.buffer()) {
ec = INVALID_STATE_ERR;
return nullptr;
}
@@ -1801,7 +1793,7 @@
CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, ec);
if (ec)
return nullptr;
- return CanvasPattern::create(canvas->copiedImage(), repeatX, repeatY, canvas->originClean());
+ return CanvasPattern::create(canvas.copiedImage(), repeatX, repeatY, canvas.originClean());
}
void CanvasRenderingContext2D::didDrawEntireCanvas()
@@ -2016,31 +2008,23 @@
return ImageData::create(imageDataRect.size(), byteArray.releaseNonNull());
}
-void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionCode& ec)
+void CanvasRenderingContext2D::putImageData(ImageData& data, float dx, float dy, ExceptionCode& ec)
{
- if (!data) {
- ec = TYPE_MISMATCH_ERR;
- return;
- }
- putImageData(data, dx, dy, 0, 0, data->width(), data->height(), ec);
+ putImageData(data, dx, dy, 0, 0, data.width(), data.height(), ec);
}
-void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, ExceptionCode& ec)
+void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData& data, float dx, float dy, ExceptionCode& ec)
{
- if (!data) {
- ec = TYPE_MISMATCH_ERR;
- return;
- }
- webkitPutImageDataHD(data, dx, dy, 0, 0, data->width(), data->height(), ec);
+ webkitPutImageDataHD(data, dx, dy, 0, 0, data.width(), data.height(), ec);
}
-void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, float dirtyX, float dirtyY,
+void CanvasRenderingContext2D::putImageData(ImageData& data, float dx, float dy, float dirtyX, float dirtyY,
float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
{
putImageData(data, ImageBuffer::LogicalCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, ec);
}
-void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
+void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData& data, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
{
putImageData(data, ImageBuffer::BackingStoreCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, ec);
}
@@ -2066,13 +2050,9 @@
context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor());
}
-void CanvasRenderingContext2D::putImageData(ImageData* data, ImageBuffer::CoordinateSystem coordinateSystem, float dx, float dy, float dirtyX, float dirtyY,
+void CanvasRenderingContext2D::putImageData(ImageData& data, ImageBuffer::CoordinateSystem coordinateSystem, float dx, float dy, float dirtyX, float dirtyY,
float dirtyWidth, float dirtyHeight, ExceptionCode& ec)
{
- if (!data) {
- ec = TYPE_MISMATCH_ERR;
- return;
- }
if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dirtyX) || !std::isfinite(dirtyY) || !std::isfinite(dirtyWidth) || !std::isfinite(dirtyHeight)) {
ec = NOT_SUPPORTED_ERR;
return;
@@ -2093,7 +2073,7 @@
}
FloatRect clipRect(dirtyX, dirtyY, dirtyWidth, dirtyHeight);
- clipRect.intersect(IntRect(0, 0, data->width(), data->height()));
+ clipRect.intersect(IntRect(0, 0, data.width(), data.height()));
IntSize destOffset(static_cast<int>(dx), static_cast<int>(dy));
IntRect destRect = enclosingIntRect(clipRect);
destRect.move(destOffset);
@@ -2103,7 +2083,7 @@
IntRect sourceRect(destRect);
sourceRect.move(-destOffset);
- buffer->putByteArray(Unmultiplied, data->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset), coordinateSystem);
+ buffer->putByteArray(Unmultiplied, data.data(), IntSize(data.width(), data.height()), sourceRect, IntPoint(destOffset), coordinateSystem);
didDraw(destRect, CanvasDidDrawApplyNone); // ignore transform, shadow and clip
}
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (201663 => 201664)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-06-03 22:26:50 UTC (rev 201664)
@@ -180,17 +180,17 @@
RefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1, float y1, ExceptionCode&);
RefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionCode&);
- RefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&);
- RefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&);
+ RefPtr<CanvasPattern> createPattern(HTMLImageElement&, const String& repetitionType, ExceptionCode&);
+ RefPtr<CanvasPattern> createPattern(HTMLCanvasElement&, const String& repetitionType, ExceptionCode&);
RefPtr<ImageData> createImageData(RefPtr<ImageData>&&, ExceptionCode&) const;
RefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const;
RefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const;
RefPtr<ImageData> webkitGetImageDataHD(float sx, float sy, float sw, float sh, ExceptionCode&) const;
- void putImageData(ImageData*, float dx, float dy, ExceptionCode&);
- void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
- void webkitPutImageDataHD(ImageData*, float dx, float dy, ExceptionCode&);
- void webkitPutImageDataHD(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+ void putImageData(ImageData&, float dx, float dy, ExceptionCode&);
+ void putImageData(ImageData&, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+ void webkitPutImageDataHD(ImageData&, float dx, float dy, ExceptionCode&);
+ void webkitPutImageDataHD(ImageData&, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
void drawFocusIfNeeded(Element*);
void drawFocusIfNeeded(DOMPath&, Element*);
@@ -370,7 +370,7 @@
void prepareGradientForDashboard(CanvasGradient& gradient) const;
RefPtr<ImageData> getImageData(ImageBuffer::CoordinateSystem, float sx, float sy, float sw, float sh, ExceptionCode&) const;
- void putImageData(ImageData*, ImageBuffer::CoordinateSystem, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
+ void putImageData(ImageData&, ImageBuffer::CoordinateSystem, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&);
bool is2d() const override { return true; }
bool isAccelerated() const override;
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (201663 => 201664)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2016-06-03 22:24:06 UTC (rev 201663)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2016-06-03 22:26:50 UTC (rev 201664)
@@ -169,14 +169,14 @@
void setShadow(float width, unrestricted float height, unrestricted float blur, unrestricted float c, unrestricted float m,
unrestricted float y, unrestricted float k, unrestricted float a);
- [RaisesException] void putImageData(ImageData? imagedata, float dx, float dy);
- [RaisesException] void putImageData(ImageData? imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
+ [RaisesException] void putImageData(ImageData imagedata, float dx, float dy);
+ [RaisesException] void putImageData(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
- [RaisesException] void webkitPutImageDataHD(ImageData? imagedata, float dx, float dy);
- [RaisesException] void webkitPutImageDataHD(ImageData? imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
+ [RaisesException] void webkitPutImageDataHD(ImageData imagedata, float dx, float dy);
+ [RaisesException] void webkitPutImageDataHD(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
- [RaisesException] CanvasPattern createPattern(HTMLCanvasElement? canvas, [TreatNullAs=EmptyString] DOMString repetitionType);
- [RaisesException] CanvasPattern createPattern(HTMLImageElement? image, [TreatNullAs=EmptyString] DOMString repetitionType);
+ [RaisesException] CanvasPattern createPattern(HTMLCanvasElement canvas, [TreatNullAs=EmptyString] DOMString repetitionType);
+ [RaisesException] CanvasPattern createPattern(HTMLImageElement image, [TreatNullAs=EmptyString] DOMString repetitionType);
[RaisesException] ImageData createImageData(ImageData? imagedata);
[RaisesException] ImageData createImageData(float sw, float sh);