Diff
Modified: trunk/LayoutTests/ChangeLog (207999 => 208000)
--- trunk/LayoutTests/ChangeLog 2016-10-27 20:00:38 UTC (rev 207999)
+++ trunk/LayoutTests/ChangeLog 2016-10-27 20:08:51 UTC (rev 208000)
@@ -1,5 +1,17 @@
2016-10-27 Chris Dumez <[email protected]>
+ Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable
+ https://bugs.webkit.org/show_bug.cgi?id=164062
+
+ Reviewed by Darin Adler.
+
+ Add layout test coverage.
+
+ * fast/canvas/draw-focus-if-needed-null-element-expected.txt: Added.
+ * fast/canvas/draw-focus-if-needed-null-element.html: Added.
+
+2016-10-27 Chris Dumez <[email protected]>
+
testharnessreport.js should sanitize the results before printing them
https://bugs.webkit.org/show_bug.cgi?id=164064
Added: trunk/LayoutTests/fast/canvas/draw-focus-if-needed-null-element-expected.txt (0 => 208000)
--- trunk/LayoutTests/fast/canvas/draw-focus-if-needed-null-element-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/draw-focus-if-needed-null-element-expected.txt 2016-10-27 20:08:51 UTC (rev 208000)
@@ -0,0 +1,11 @@
+Tests that the element parameter to drawFocusIfNeeded() is non-nullable.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS canvas.drawFocusIfNeeded(null) threw exception TypeError: Argument 1 ('element') to CanvasRenderingContext2D.drawFocusIfNeeded must be an instance of Element.
+PASS canvas.drawFocusIfNeeded(path, null) threw exception TypeError: Argument 2 ('element') to CanvasRenderingContext2D.drawFocusIfNeeded must be an instance of Element.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/draw-focus-if-needed-null-element.html (0 => 208000)
--- trunk/LayoutTests/fast/canvas/draw-focus-if-needed-null-element.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/draw-focus-if-needed-null-element.html 2016-10-27 20:08:51 UTC (rev 208000)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+<canvas id="canvas" width="30" height="30"></canvas>
+<script src=""
+<script>
+description("Tests that the element parameter to drawFocusIfNeeded() is non-nullable.");
+
+var canvas = document.getElementById("canvas").getContext("2d");
+shouldThrowErrorName("canvas.drawFocusIfNeeded(null)", "TypeError");
+
+var path = new Path2D();
+path.rect(10, 10, 10, 10);
+shouldThrowErrorName("canvas.drawFocusIfNeeded(path, null)", "TypeError");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (207999 => 208000)
--- trunk/Source/WebCore/ChangeLog 2016-10-27 20:00:38 UTC (rev 207999)
+++ trunk/Source/WebCore/ChangeLog 2016-10-27 20:08:51 UTC (rev 208000)
@@ -1,3 +1,23 @@
+2016-10-27 Chris Dumez <[email protected]>
+
+ Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable
+ https://bugs.webkit.org/show_bug.cgi?id=164062
+
+ Reviewed by Darin Adler.
+
+ Element parameter to CanvasRenderingContext2D.drawFocusIfNeeded() should not be nullable:
+ - https://html.spec.whatwg.org/#canvasuserinterface
+
+ Firefox and Chrome agree with the specification.
+
+ Test: fast/canvas/draw-focus-if-needed-null-element.html
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawFocusIfNeeded):
+ (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/CanvasRenderingContext2D.idl:
+
2016-10-27 Yusuke Suzuki <[email protected]>
[DOMJIT][CSSJIT] Share code with DOMJIT
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (207999 => 208000)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-10-27 20:00:38 UTC (rev 207999)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2016-10-27 20:08:51 UTC (rev 208000)
@@ -2041,21 +2041,21 @@
putImageData(data, ImageBuffer::BackingStoreCoordinateSystem, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight);
}
-void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element)
+void CanvasRenderingContext2D::drawFocusIfNeeded(Element& element)
{
drawFocusIfNeededInternal(m_path, element);
}
-void CanvasRenderingContext2D::drawFocusIfNeeded(DOMPath& path, Element* element)
+void CanvasRenderingContext2D::drawFocusIfNeeded(DOMPath& path, Element& element)
{
drawFocusIfNeededInternal(path.path(), element);
}
-void CanvasRenderingContext2D::drawFocusIfNeededInternal(const Path& path, Element* element)
+void CanvasRenderingContext2D::drawFocusIfNeededInternal(const Path& path, Element& element)
{
GraphicsContext* context = drawingContext();
- if (!element || !element->focused() || !state().hasInvertibleTransform || path.isEmpty() || !element->isDescendantOf(canvas()) || !context)
+ if (!element.focused() || !state().hasInvertibleTransform || path.isEmpty() || !element.isDescendantOf(canvas()) || !context)
return;
context->drawFocusRing(path, 1, 1, RenderTheme::focusRingColor());
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (207999 => 208000)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-10-27 20:00:38 UTC (rev 207999)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-10-27 20:08:51 UTC (rev 208000)
@@ -197,8 +197,8 @@
void webkitPutImageDataHD(ImageData&, float dx, float dy);
void webkitPutImageDataHD(ImageData&, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
- void drawFocusIfNeeded(Element*);
- void drawFocusIfNeeded(DOMPath&, Element*);
+ void drawFocusIfNeeded(Element&);
+ void drawFocusIfNeeded(DOMPath&, Element&);
float webkitBackingStorePixelRatio() const { return 1; }
@@ -353,7 +353,7 @@
bool isPointInPathInternal(const Path&, float x, float y, WindingRule);
bool isPointInStrokeInternal(const Path&, float x, float y);
- void drawFocusIfNeededInternal(const Path&, Element*);
+ void drawFocusIfNeededInternal(const Path&, Element&);
void clearCanvas();
Path transformAreaToDevice(const Path&) const;
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (207999 => 208000)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2016-10-27 20:00:38 UTC (rev 207999)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2016-10-27 20:08:51 UTC (rev 208000)
@@ -176,8 +176,8 @@
[MayThrowException] ImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh);
// Focus rings
- void drawFocusIfNeeded(Element? element); // FIXME: The element parameter should not be nullable.
- void drawFocusIfNeeded(DOMPath path, Element? element); // FIXME: The element parameter should not be nullable.
+ void drawFocusIfNeeded(Element element);
+ void drawFocusIfNeeded(DOMPath path, Element element);
readonly attribute float webkitBackingStorePixelRatio;