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

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: 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
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 11941cd2858e3b5f16654223026434a510ef8658..0a57616f120bc499b1265a5befabada7cdc7261d 100644
--- a/Source/devtools/front_end/ui/UIUtils.js
+++ b/Source/devtools/front_end/ui/UIUtils.js
@@ -179,7 +179,7 @@ WebInspector.isBeingEdited = function(node)
if (element.classList.contains("text-prompt") || element.nodeName === "INPUT" || element.nodeName === "TEXTAREA")
return true;
- if (!WebInspector.__editingCount)
+ if (!!WebInspector.__editingCount)
vsevik 2014/10/21 12:59:56 !
pfeldman 2014/10/21 13:01:55 Done.
return false;
while (element) {
@@ -191,6 +191,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}
@@ -608,7 +622,10 @@ WebInspector.currentFocusElement = function()
WebInspector._focusChanged = function(event)
{
- WebInspector.setCurrentFocusElement(event.target);
+ var node = document.activeElement;
+ while (node && node.shadowRoot)
+ node = node.shadowRoot.activeElement;
+ WebInspector.setCurrentFocusElement(node);
}
WebInspector._documentBlurred = function(event)
@@ -1087,6 +1104,6 @@ WebInspector.initializeUIUtils = function()
{
window.addEventListener("focus", WebInspector._windowFocused, false);
window.addEventListener("blur", WebInspector._windowBlurred, false);
- document.addEventListener("focus", WebInspector._focusChanged, true);
document.addEventListener("blur", WebInspector._documentBlurred, true);
vsevik 2014/10/21 12:59:56 revert
pfeldman 2014/10/21 13:01:55 Done.
+ document.addEventListener("focus", WebInspector._focusChanged, true);
}
« Source/devtools/front_end/main/Main.js ('K') | « 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