Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1714)

Unified Diff: Source/devtools/front_end/ui/UIUtils.js

Issue 659403006: DevTools: do not consider ? a shortcut while editing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/ui/ShortcutRegistry.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/UIUtils.js
diff --git a/Source/devtools/front_end/ui/UIUtils.js b/Source/devtools/front_end/ui/UIUtils.js
index c76593c4bbefe82d971fa3edeaf8de8c1b0b6426..186c55e628b4a507ac443b2cba3f734259ee340c 100644
--- a/Source/devtools/front_end/ui/UIUtils.js
+++ b/Source/devtools/front_end/ui/UIUtils.js
@@ -193,6 +193,20 @@ WebInspector.isBeingEdited = function(node)
}
/**
+ * @return {boolean}
+ */
+WebInspector.isEditing = function()
+{
+ if (WebInspector.__editingCount)
+ return true;
+
+ var element = WebInspector.currentFocusElement();
+ if (!element)
+ return false;
+ return element.classList.contains("text-prompt") || element.nodeName === "INPUT" || element.nodeName === "TEXTAREA";
+}
+
+/**
* @param {!Element} element
* @param {boolean} value
* @return {boolean}
@@ -628,9 +642,16 @@ WebInspector.currentFocusElement = function()
return WebInspector._currentFocusElement;
}
-WebInspector._focusChanged = function(event)
+/**
+ * @param {!Document} document
+ * @param {!Event} event
+ */
+WebInspector._focusChanged = function(document, event)
{
- WebInspector.setCurrentFocusElement(event.target);
+ var node = document.activeElement;
+ while (node && node.shadowRoot)
+ node = node.shadowRoot.activeElement;
+ WebInspector.setCurrentFocusElement(node);
}
/**
@@ -1121,6 +1142,6 @@ WebInspector.initializeUIUtils = function(window)
{
window.addEventListener("focus", WebInspector._windowFocused.bind(WebInspector, window.document), false);
window.addEventListener("blur", WebInspector._windowBlurred.bind(WebInspector, window.document), false);
- window.document.addEventListener("focus", WebInspector._focusChanged, true);
+ window.document.addEventListener("focus", WebInspector._focusChanged.bind(WebInspector, window.document), true);
window.document.addEventListener("blur", WebInspector._documentBlurred.bind(WebInspector, window.document), true);
}
« no previous file with comments | « Source/devtools/front_end/ui/ShortcutRegistry.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698