Diff
Modified: trunk/Source/WebCore/ChangeLog (144665 => 144666)
--- trunk/Source/WebCore/ChangeLog 2013-03-04 21:39:25 UTC (rev 144665)
+++ trunk/Source/WebCore/ChangeLog 2013-03-04 21:42:03 UTC (rev 144666)
@@ -1,3 +1,26 @@
+2013-03-04 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: Modal dialogs sometimes lose focus.
+ https://bugs.webkit.org/show_bug.cgi?id=111317
+
+ Reviewed by Pavel Feldman.
+
+ setCurrentFocusElement doesn't give focus to an element anymore
+ if modal glass pane is shown and element is not inside it.
+
+ * inspector/front-end/Dialog.js:
+ (WebInspector.Dialog):
+ (WebInspector.Dialog.prototype._hide):
+ * inspector/front-end/InspectorView.js:
+ (WebInspector.InspectorView.prototype.defaultFocusedElement):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype.defaultFocusedElement):
+ * inspector/front-end/UIUtils.js:
+ (WebInspector.GlassPane):
+ (WebInspector.GlassPane.prototype.dispose):
+ (WebInspector.setCurrentFocusElement):
+ * inspector/front-end/dialog.css:
+
2013-03-04 Roger Fong <[email protected]>
Unreviewed. AppleWin build fix.
Modified: trunk/Source/WebCore/inspector/front-end/Dialog.js (144665 => 144666)
--- trunk/Source/WebCore/inspector/front-end/Dialog.js 2013-03-04 21:39:25 UTC (rev 144665)
+++ trunk/Source/WebCore/inspector/front-end/Dialog.js 2013-03-04 21:42:03 UTC (rev 144666)
@@ -38,13 +38,12 @@
this._delegate = delegate;
this._relativeToElement = relativeToElement;
+ this._glassPane = new WebInspector.GlassPane();
// Install glass pane capturing events.
- this._glassPaneElement = document.body.createChild("div");
- this._glassPaneElement.className = "dialog-glass-pane";
- this._glassPaneElement.tabIndex = 0;
- this._glassPaneElement.addEventListener("focus", this._onGlassPaneFocus.bind(this), false);
+ this._glassPane.element.tabIndex = 0;
+ this._glassPane.element.addEventListener("focus", this._onGlassPaneFocus.bind(this), false);
- this._element = this._glassPaneElement.createChild("div");
+ this._element = this._glassPane.element.createChild("div");
this._element.tabIndex = 0;
this._element.addEventListener("focus", this._onFocus.bind(this), false);
this._element.addEventListener("keydown", this._onKeyDown.bind(this), false);
@@ -58,8 +57,6 @@
this._position();
this._windowResizeHandler = this._position.bind(this);
window.addEventListener("resize", this._windowResizeHandler, true);
-
- this._previousFocusElement = WebInspector.currentFocusElement();
this._delegate.focus();
}
@@ -98,10 +95,8 @@
this._delegate.willHide();
- if (this._element.isSelfOrAncestor(document.activeElement))
- WebInspector.setCurrentFocusElement(this._previousFocusElement);
delete WebInspector.Dialog._instance;
- document.body.removeChild(this._glassPaneElement);
+ this._glassPane.dispose();
window.removeEventListener("resize", this._windowResizeHandler, true);
},
Modified: trunk/Source/WebCore/inspector/front-end/InspectorView.js (144665 => 144666)
--- trunk/Source/WebCore/inspector/front-end/InspectorView.js 2013-03-04 21:39:25 UTC (rev 144665)
+++ trunk/Source/WebCore/inspector/front-end/InspectorView.js 2013-03-04 21:42:03 UTC (rev 144666)
@@ -124,6 +124,14 @@
}
},
+ /**
+ * @return {Element}
+ */
+ defaultFocusedElement: function()
+ {
+ return this._currentPanel ? this._currentPanel.defaultFocusedElement() : null;
+ },
+
_keyPress: function(event)
{
// BUG 104250: Windows 7 posts a WM_CHAR message upon the Ctrl+']' keypress.
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (144665 => 144666)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2013-03-04 21:39:25 UTC (rev 144665)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2013-03-04 21:42:03 UTC (rev 144666)
@@ -200,7 +200,7 @@
defaultFocusedElement: function()
{
- return this._navigator.view.defaultFocusedElement();
+ return this._editorContainer.view.defaultFocusedElement() || this._navigator.view.defaultFocusedElement();
},
get paused()
Modified: trunk/Source/WebCore/inspector/front-end/UIUtils.js (144665 => 144666)
--- trunk/Source/WebCore/inspector/front-end/UIUtils.js 2013-03-04 21:39:25 UTC (rev 144665)
+++ trunk/Source/WebCore/inspector/front-end/UIUtils.js 2013-03-04 21:42:03 UTC (rev 144666)
@@ -137,11 +137,14 @@
this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;";
this.element.id = "glass-pane-for-drag";
document.body.appendChild(this.element);
+ WebInspector._glassPane = this;
}
WebInspector.GlassPane.prototype = {
dispose: function()
{
+ delete WebInspector._glassPane;
+ WebInspector.inspectorView.focus();
if (this.element.parentElement)
this.element.parentElement.removeChild(this.element);
}
@@ -861,6 +864,8 @@
WebInspector.setCurrentFocusElement = function(x)
{
+ if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAncestor(x))
+ return;
if (WebInspector._currentFocusElement !== x)
WebInspector._previousFocusElement = WebInspector._currentFocusElement;
WebInspector._currentFocusElement = x;
Modified: trunk/Source/WebCore/inspector/front-end/dialog.css (144665 => 144666)
--- trunk/Source/WebCore/inspector/front-end/dialog.css 2013-03-04 21:39:25 UTC (rev 144665)
+++ trunk/Source/WebCore/inspector/front-end/dialog.css 2013-03-04 21:42:03 UTC (rev 144666)
@@ -1,12 +1,3 @@
-.dialog-glass-pane {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: 1900;
-}
-
.dialog {
position: absolute;