Title: [129094] trunk/Source/WebCore
- Revision
- 129094
- Author
- [email protected]
- Date
- 2012-09-19 23:02:30 -0700 (Wed, 19 Sep 2012)
Log Message
REGRESSION(r127727): Calendar picker focus ring should be hidden until key event
https://bugs.webkit.org/show_bug.cgi?id=97165
Reviewed by Kent Tamura.
The regression was caused because NoFocusRing class was being removed
from then main element inside resetMain().
No new tests. Covered by calendar-picker-appearance.html.
* Resources/pagepopups/calendarPicker.js:
(initialize):
(CalendarPicker):
(CalendarPicker.prototype._layout):
(DaysTable.prototype._handleKey):
(CalendarPicker.prototype._handleBodyKeyDown):
(CalendarPicker.prototype.maybeUpdateFocusStyle): Make this a method of CalendarPicker because we don't use it for other pickers.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (129093 => 129094)
--- trunk/Source/WebCore/ChangeLog 2012-09-20 05:52:12 UTC (rev 129093)
+++ trunk/Source/WebCore/ChangeLog 2012-09-20 06:02:30 UTC (rev 129094)
@@ -1,3 +1,23 @@
+2012-09-19 Keishi Hattori <[email protected]>
+
+ REGRESSION(r127727): Calendar picker focus ring should be hidden until key event
+ https://bugs.webkit.org/show_bug.cgi?id=97165
+
+ Reviewed by Kent Tamura.
+
+ The regression was caused because NoFocusRing class was being removed
+ from then main element inside resetMain().
+
+ No new tests. Covered by calendar-picker-appearance.html.
+
+ * Resources/pagepopups/calendarPicker.js:
+ (initialize):
+ (CalendarPicker):
+ (CalendarPicker.prototype._layout):
+ (DaysTable.prototype._handleKey):
+ (CalendarPicker.prototype._handleBodyKeyDown):
+ (CalendarPicker.prototype.maybeUpdateFocusStyle): Make this a method of CalendarPicker because we don't use it for other pickers.
+
2012-09-19 David Grogan <[email protected]>
IndexedDB: Print console warning about setVersion
Modified: trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js (129093 => 129094)
--- trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js 2012-09-20 05:52:12 UTC (rev 129093)
+++ trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js 2012-09-20 06:02:30 UTC (rev 129094)
@@ -72,7 +72,6 @@
*/
var global = {
argumentsReceived: false,
- hadKeyEvent: false,
params: null
};
@@ -267,11 +266,9 @@
* @param {!Object} args
*/
function initialize(args) {
- var main = $("main");
- main.classList.add(ClassNames.NoFocusRing);
-
var errorString = validateArguments(args);
if (errorString) {
+ var main = $("main");
main.textContent = "Internal error: " + errorString;
resizeWindow(main.offsetWidth, main.offsetHeight);
} else {
@@ -305,6 +302,7 @@
this.step = (typeof this._config.step !== undefined) ? this._config.step * CalendarPicker.BaseStep : CalendarPicker.BaseStep;
this.yearMonthController = new YearMonthController(this);
this.daysTable = new DaysTable(this);
+ this._hadKeyEvent = false;
this._layout();
var initialDate = parseDateString(this._config.currentValue);
if (initialDate < this.minimumDate)
@@ -328,6 +326,8 @@
this.yearMonthController.attachTo(this._element);
this.daysTable.attachTo(this._element);
this._layoutButtons();
+ // DaysTable will have focus but we don't want to show its focus ring until the first key event.
+ this._element.classList.add(ClassNames.NoFocusRing);
};
CalendarPicker.prototype.handleToday = function() {
@@ -1056,7 +1056,7 @@
* @param {Event} event
*/
DaysTable.prototype._handleKey = function(event) {
- maybeUpdateFocusStyle();
+ this.picker.maybeUpdateFocusStyle();
var x = this._x;
var y = this._y;
var key = event.keyIdentifier;
@@ -1156,7 +1156,7 @@
* @param {!Event} event
*/
CalendarPicker.prototype._handleBodyKeyDown = function(event) {
- maybeUpdateFocusStyle();
+ this.maybeUpdateFocusStyle();
var key = event.keyIdentifier;
if (key == "U+0009") {
if (!event.shiftKey && document.activeElement == global.lastFocusableControl) {
@@ -1178,11 +1178,11 @@
this.handleCancel();
}
-function maybeUpdateFocusStyle() {
- if (global.hadKeyEvent)
+CalendarPicker.prototype.maybeUpdateFocusStyle = function() {
+ if (this._hadKeyEvent)
return;
- global.hadKeyEvent = true;
- $("main").classList.remove(ClassNames.NoFocusRing);
+ this._hadKeyEvent = true;
+ this._element.classList.remove(ClassNames.NoFocusRing);
}
if (window.dialogArguments) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes