Rename drawSystemFocusRing() to drawFocusIfNeeded()

RESOLUTION: to change draw SystemFocusRing to drawFocusIfNeeded.

public discussion:
  http://www.w3.org/Bugs/Public/show_bug.cgi?id=23980
  http://www.w3.org/WAI/PF/HTML/wiki/Summary_of_2014-01-13_Meeting
  http://www.w3.org/2014/01/13-html-a11y-minutes.html#item02

other browsers:
  It has already been agreed or changed.
  http://bugzilla.mozilla.org/show_bug.cgi?id=959820 (Firefox)

BUG=354960

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169925 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e4d956a5
PASS canvas.drawSystemFocusRing(null); did not throw exception. PASS canvas.drawFocusIfNeeded(null); did not throw exception.
PASS canvas.drawSystemFocusRing(); threw exception TypeError: Failed to execute 'drawSystemFocusRing' on 'CanvasRenderingContext2D': 1 argument required, but only 0 present.. PASS canvas.drawFocusIfNeeded(); threw exception TypeError: Failed to execute 'drawFocusIfNeeded' on 'CanvasRenderingContext2D': 1 argument required, but only 0 present..
PASS canvas.drawSystemFocusRing(null); did not throw exception. PASS canvas.drawFocusIfNeeded(null); did not throw exception.
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 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 PASS successfullyParsed is true
......
<!DOCTYPE HTML> <!DOCTYPE HTML>
<head> <head>
<title>Canvas test: drawSystemFocusRing</title> <title>Canvas test: drawFocusIfNeeded</title>
<script src="../../resources/js-test.js"></script> <script src="../../resources/js-test.js"></script>
</head> </head>
<body style="padding: 0; margin: 0"> <body style="padding: 0; margin: 0">
...@@ -19,13 +19,13 @@ document.getElementById("button1").addEventListener('focus', function() { ...@@ -19,13 +19,13 @@ document.getElementById("button1").addEventListener('focus', function() {
canvas.rect(50, 50, 200, 100); canvas.rect(50, 50, 200, 100);
canvas.fillStyle = "#ccf"; canvas.fillStyle = "#ccf";
canvas.fill(); canvas.fill();
canvas.drawSystemFocusRing(document.getElementById("button1")); canvas.drawFocusIfNeeded(document.getElementById("button1"));
canvas.beginPath(); canvas.beginPath();
canvas.rect(50, 200, 200, 100); canvas.rect(50, 200, 200, 100);
canvas.fillStyle = "#cfc"; canvas.fillStyle = "#cfc";
canvas.fill(); canvas.fill();
canvas.drawSystemFocusRing(document.getElementById("button2")); canvas.drawFocusIfNeeded(document.getElementById("button2"));
}); });
document.getElementById("button1").focus(); document.getElementById("button1").focus();
......
<!DOCTYPE HTML> <!DOCTYPE HTML>
<head> <head>
<title>Canvas test: drawSystemFocusRing</title> <title>Canvas test: drawFocusIfNeeded</title>
<script src="../../resources/js-test.js"></script> <script src="../../resources/js-test.js"></script>
</head> </head>
<body style="padding: 0; margin: 0"> <body style="padding: 0; margin: 0">
...@@ -16,22 +16,22 @@ document.getElementById("button1").focus(); ...@@ -16,22 +16,22 @@ document.getElementById("button1").focus();
var canvas = document.getElementById("canvas").getContext("2d"); var canvas = document.getElementById("canvas").getContext("2d");
shouldNotThrow('canvas.drawSystemFocusRing(null);'); shouldNotThrow('canvas.drawFocusIfNeeded(null);');
shouldThrow('canvas.drawSystemFocusRing();'); shouldThrow('canvas.drawFocusIfNeeded();');
canvas.beginPath(); canvas.beginPath();
canvas.rect(50, 50, 200, 100); canvas.rect(50, 50, 200, 100);
canvas.fillStyle = "#ccf"; canvas.fillStyle = "#ccf";
canvas.fill(); canvas.fill();
// re-test null case after having defined a path (regression test for crbug.com/353248) // re-test null case after having defined a path (regression test for crbug.com/353248)
shouldNotThrow('canvas.drawSystemFocusRing(null);'); shouldNotThrow('canvas.drawFocusIfNeeded(null);');
canvas.drawSystemFocusRing(document.getElementById("button1")); canvas.drawFocusIfNeeded(document.getElementById("button1"));
canvas.beginPath(); canvas.beginPath();
canvas.rect(50, 200, 200, 100); canvas.rect(50, 200, 200, 100);
canvas.fillStyle = "#cfc"; canvas.fillStyle = "#cfc";
canvas.fill(); canvas.fill();
canvas.drawSystemFocusRing(document.getElementById("button2")); canvas.drawFocusIfNeeded(document.getElementById("button2"));
// The top rect"s focus ring is tied to button1, which is focused. // The top rect"s focus ring is tied to button1, which is focused.
// It should have an outline in some color other than the background color. // It should have an outline in some color other than the background color.
......
...@@ -3,7 +3,7 @@ Test to catch Canvas 2D API changes. If this test should ever fail, we should re ...@@ -3,7 +3,7 @@ Test to catch Canvas 2D API changes. If this test should ever fail, we should re
New properties and functions that should be manually examined (should be empty to pass the test): New properties and functions that should be manually examined (should be empty to pass the test):
currentTransform currentTransform
drawCustomFocusRing drawCustomFocusRing
drawSystemFocusRing drawFocusIfNeeded
ellipse ellipse
resetTransform resetTransform
New properties and functions of CanvasGradient object that should be manually examined (should be empty to pass the test): New properties and functions of CanvasGradient object that should be manually examined (should be empty to pass the test):
......
...@@ -2207,7 +2207,7 @@ PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib ...@@ -2207,7 +2207,7 @@ PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib
return attributes.release(); return attributes.release();
} }
void CanvasRenderingContext2D::drawSystemFocusRing(Element* element) void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element)
{ {
if (!focusRingCallIsValid(m_path, element)) if (!focusRingCallIsValid(m_path, element))
return; return;
......
...@@ -230,7 +230,7 @@ public: ...@@ -230,7 +230,7 @@ public:
PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const;
void drawSystemFocusRing(Element*); void drawFocusIfNeeded(Element*);
bool drawCustomFocusRing(Element*); bool drawCustomFocusRing(Element*);
private: private:
......
...@@ -168,7 +168,7 @@ interface CanvasRenderingContext2D { ...@@ -168,7 +168,7 @@ interface CanvasRenderingContext2D {
[RaisesException, DeprecateAs=PrefixedGetImageDataHD] ImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh); [RaisesException, DeprecateAs=PrefixedGetImageDataHD] ImageData webkitGetImageDataHD(float sx, float sy, float sw, float sh);
// Focus rings // Focus rings
[RuntimeEnabled=ExperimentalCanvasFeatures] void drawSystemFocusRing(Element element); [RuntimeEnabled=ExperimentalCanvasFeatures] void drawFocusIfNeeded(Element element);
[RuntimeEnabled=ExperimentalCanvasFeatures] boolean drawCustomFocusRing(Element element); [RuntimeEnabled=ExperimentalCanvasFeatures] boolean drawCustomFocusRing(Element element);
readonly attribute float webkitBackingStorePixelRatio; readonly attribute float webkitBackingStorePixelRatio;
......
...@@ -3169,7 +3169,7 @@ CanvasRenderingContext2DResource.DrawingMethods = TypeUtils.createPrefixedProper ...@@ -3169,7 +3169,7 @@ CanvasRenderingContext2DResource.DrawingMethods = TypeUtils.createPrefixedProper
"drawImage", "drawImage",
"drawImageFromRect", "drawImageFromRect",
"drawCustomFocusRing", "drawCustomFocusRing",
"drawSystemFocusRing", "drawFocusIfNeeded",
"fill", "fill",
"fillRect", "fillRect",
"fillText", "fillText",
......
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