Title: [99533] trunk/Source/WebCore
- Revision
- 99533
- Author
- [email protected]
- Date
- 2011-11-08 00:55:51 -0800 (Tue, 08 Nov 2011)
Log Message
Web Inspector: refactor shortcuts and settings screens
https://bugs.webkit.org/show_bug.cgi?id=71773
Keep pointer to the visible screen and hide it automatically when new one is going
to be displayed.
Reviewed by Pavel Feldman.
* inspector/front-end/HelpScreen.js:
(WebInspector.HelpScreen.prototype.show):
(WebInspector.HelpScreen.prototype.hide):
* inspector/front-end/ShortcutsScreen.js:
(WebInspector.ShortcutsScreen): ShortcutsScreen is now a descendant of HelpScreen.
(WebInspector.ShortcutsScreen.prototype.show):
* inspector/front-end/inspector.js:
(WebInspector._hideSettingsScreen):
(WebInspector.documentKeyDown):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (99532 => 99533)
--- trunk/Source/WebCore/ChangeLog 2011-11-08 08:52:25 UTC (rev 99532)
+++ trunk/Source/WebCore/ChangeLog 2011-11-08 08:55:51 UTC (rev 99533)
@@ -1,3 +1,23 @@
+2011-11-07 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: refactor shortcuts and settings screens
+ https://bugs.webkit.org/show_bug.cgi?id=71773
+
+ Keep pointer to the visible screen and hide it automatically when new one is going
+ to be displayed.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/front-end/HelpScreen.js:
+ (WebInspector.HelpScreen.prototype.show):
+ (WebInspector.HelpScreen.prototype.hide):
+ * inspector/front-end/ShortcutsScreen.js:
+ (WebInspector.ShortcutsScreen): ShortcutsScreen is now a descendant of HelpScreen.
+ (WebInspector.ShortcutsScreen.prototype.show):
+ * inspector/front-end/inspector.js:
+ (WebInspector._hideSettingsScreen):
+ (WebInspector.documentKeyDown):
+
2011-11-08 Nikolas Zimmermann <[email protected]>
Not reviewed. Fix Snow Leopard 32bit builds.
Modified: trunk/Source/WebCore/inspector/front-end/HelpScreen.js (99532 => 99533)
--- trunk/Source/WebCore/inspector/front-end/HelpScreen.js 2011-11-08 08:52:25 UTC (rev 99532)
+++ trunk/Source/WebCore/inspector/front-end/HelpScreen.js 2011-11-08 08:55:51 UTC (rev 99533)
@@ -54,12 +54,18 @@
];
}
+WebInspector.HelpScreen.visibleScreen_ = null;
+
WebInspector.HelpScreen.prototype = {
show: function(onHide)
{
if (this._isShown)
return;
+ if (WebInspector.HelpScreen.visibleScreen_)
+ WebInspector.HelpScreen.visibleScreen_.hide();
+ WebInspector.HelpScreen.visibleScreen_ = this;
+
document.body.appendChild(this._element);
this._isShown = true;
this._onHide = onHide;
@@ -75,6 +81,7 @@
this._isShown = false;
document.body.removeChild(this._element);
WebInspector.setCurrentFocusElement(this._previousFocusElement);
+ WebInspector.HelpScreen.visibleScreen_ = null;
if (this._onHide) {
this._onHide();
delete this._onHide;
Modified: trunk/Source/WebCore/inspector/front-end/ShortcutsScreen.js (99532 => 99533)
--- trunk/Source/WebCore/inspector/front-end/ShortcutsScreen.js 2011-11-08 08:52:25 UTC (rev 99532)
+++ trunk/Source/WebCore/inspector/front-end/ShortcutsScreen.js 2011-11-08 08:55:51 UTC (rev 99533)
@@ -33,7 +33,9 @@
*/
WebInspector.ShortcutsScreen = function()
{
+ WebInspector.HelpScreen.call(this, WebInspector.UIString("Keyboard Shortcuts"));
this._sections = {};
+ this._tableReady = false;
}
WebInspector.ShortcutsScreen.prototype = {
@@ -45,23 +47,18 @@
return section;
},
- show: function()
+ show: function(onHide)
{
- if (!this._helpScreen) {
- this._helpScreen = new WebInspector.HelpScreen(WebInspector.UIString("Keyboard Shortcuts"));
- this._buildTable(this._helpScreen.contentElement, 2);
- }
- this._helpScreen.show();
+ this._buildTable(this.contentElement, 2);
+ WebInspector.HelpScreen.prototype.show.call(this, onHide);
},
- hide: function()
+ _buildTable: function(parent, nColumns)
{
- if (this._helpScreen)
- this._helpScreen.hide();
- },
+ if (this._tableReady)
+ return;
+ this._tableReady = true;
- _buildTable: function(parent, nColumns)
- {
var height = 0;
var orderedSections = [];
for (var section in this._sections) {
@@ -95,9 +92,15 @@
}
}
-WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
+WebInspector.ShortcutsScreen.prototype.__proto__ = WebInspector.HelpScreen.prototype;
/**
+ * We cannot initialize it here as localized strings are not loaded yet.
+ * @type {?WebInspector.ShortcutsScreen}
+ */
+WebInspector.shortcutsScreen = null;
+
+/**
* @constructor
*/
WebInspector.ShortcutsSection = function(name)
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (99532 => 99533)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2011-11-08 08:52:25 UTC (rev 99532)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2011-11-08 08:55:51 UTC (rev 99533)
@@ -150,20 +150,8 @@
this._hideSettingsScreen();
},
- _showShortcutsScreen: function()
- {
- this._hideSettingsScreen();
- WebInspector.shortcutsScreen.show();
- },
-
- _hideShortcutsScreen: function()
- {
- WebInspector.shortcutsScreen.hide();
- },
-
_showSettingsScreen: function()
{
- this._hideShortcutsScreen();
function onhide()
{
this._settingsButton.toggled = false;
@@ -178,11 +166,8 @@
_hideSettingsScreen: function()
{
- if (this._settingsScreen) {
+ if (this._settingsScreen)
this._settingsScreen.hide();
- this._settingsButton.toggled = false;
- delete this._settingsScreen;
- }
},
get attached()
@@ -335,6 +320,7 @@
if (WebInspector.socket)
document.body.addStyleClass("remote");
+ WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
this._registerShortcuts();
// set order of some sections explicitly
@@ -577,7 +563,7 @@
if (event.keyIdentifier === "F1" ||
(event.keyIdentifier === helpKey && event.shiftKey && (!isInEditMode && !isInputElement || event.metaKey))) {
- this._showShortcutsScreen();
+ WebInspector.shortcutsScreen.show();
event.stopPropagation();
event.preventDefault();
return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes