Chromium Code Reviews| 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); |
| } |