Commit 2c9b7c62 authored by fs@opera.com's avatar fs@opera.com

Add StrictTypeChecking to CRC2D.{drawFocusIfNeeded,drawCustomFocusRing}

'null' should not be allowed per current spec. so modify tests accordingly.

BUG=363148

Review URL: https://codereview.chromium.org/237063002

git-svn-id: svn://svn.chromium.org/blink/trunk@171474 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2994b9c8
PASS canvas.drawFocusIfNeeded(null); did not throw exception.
PASS canvas.drawFocusIfNeeded(null); threw exception TypeError: Failed to execute 'drawFocusIfNeeded' on 'CanvasRenderingContext2D': parameter 1 is not of type 'Element'..
PASS canvas.drawFocusIfNeeded(); threw exception TypeError: Failed to execute 'drawFocusIfNeeded' on 'CanvasRenderingContext2D': 1 argument required, but only 0 present..
PASS canvas.drawFocusIfNeeded(null); did not throw exception.
PASS canvas.drawFocusIfNeeded(null); threw exception TypeError: Failed to execute 'drawFocusIfNeeded' on 'CanvasRenderingContext2D': parameter 1 is not of type 'Element'..
PASS data[0] != 0 || data[1] != 0 || data[2] != 0 is true
PASS data[0] == 0 && data[1] == 0 && data[2] == 0 is true
PASS successfullyParsed is true
......
......@@ -16,7 +16,7 @@ document.getElementById("button1").focus();
var canvas = document.getElementById("canvas").getContext("2d");
shouldNotThrow('canvas.drawFocusIfNeeded(null);');
shouldThrow('canvas.drawFocusIfNeeded(null);');
shouldThrow('canvas.drawFocusIfNeeded();');
canvas.beginPath();
......@@ -24,7 +24,7 @@ canvas.rect(50, 50, 200, 100);
canvas.fillStyle = "#ccf";
canvas.fill();
// re-test null case after having defined a path (regression test for crbug.com/353248)
shouldNotThrow('canvas.drawFocusIfNeeded(null);');
shouldThrow('canvas.drawFocusIfNeeded(null);');
canvas.drawFocusIfNeeded(document.getElementById("button1"));
canvas.beginPath();
......
......@@ -2372,11 +2372,12 @@ bool CanvasRenderingContext2D::drawCustomFocusRing(Element* element)
bool CanvasRenderingContext2D::focusRingCallIsValid(const Path& path, Element* element)
{
ASSERT(element);
if (!state().m_invertibleCTM)
return false;
if (path.isEmpty())
return false;
if (!element || !element->isDescendantOf(canvas()))
if (!element->isDescendantOf(canvas()))
return false;
return true;
......
......@@ -168,8 +168,8 @@ interface CanvasRenderingContext2D {
[RaisesException] ImageData getImageData(float sx, float sy, float sw, float sh);
// Focus rings
[RuntimeEnabled=ExperimentalCanvasFeatures] void drawFocusIfNeeded(Element element);
[RuntimeEnabled=ExperimentalCanvasFeatures] boolean drawCustomFocusRing(Element element);
[RuntimeEnabled=ExperimentalCanvasFeatures, StrictTypeChecking] void drawFocusIfNeeded(Element element);
[RuntimeEnabled=ExperimentalCanvasFeatures, StrictTypeChecking] boolean drawCustomFocusRing(Element element);
[ImplementedAs=imageSmoothingEnabled, MeasureAs=PrefixedImageSmoothingEnabled] attribute boolean webkitImageSmoothingEnabled;
[MeasureAs=UnprefixedImageSmoothingEnabled] attribute boolean imageSmoothingEnabled;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment