Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 * @return {boolean} | 172 * @return {boolean} |
| 173 */ | 173 */ |
| 174 WebInspector.isBeingEdited = function(node) | 174 WebInspector.isBeingEdited = function(node) |
| 175 { | 175 { |
| 176 if (!node || node.nodeType !== Node.ELEMENT_NODE) | 176 if (!node || node.nodeType !== Node.ELEMENT_NODE) |
| 177 return false; | 177 return false; |
| 178 var element = /** {!Element} */ (node); | 178 var element = /** {!Element} */ (node); |
| 179 if (element.classList.contains("text-prompt") || element.nodeName === "INPUT " || element.nodeName === "TEXTAREA") | 179 if (element.classList.contains("text-prompt") || element.nodeName === "INPUT " || element.nodeName === "TEXTAREA") |
| 180 return true; | 180 return true; |
| 181 | 181 |
| 182 if (!WebInspector.__editingCount) | 182 return !!WebInspector.__editingCount; |
|
vsevik
2014/10/21 11:18:15
Looks like this method becomes a generic isEditing
| |
| 183 return false; | |
| 184 | |
| 185 while (element) { | |
| 186 if (element.__editing) | |
| 187 return true; | |
| 188 element = element.parentElementOrShadowHost(); | |
| 189 } | |
| 190 return false; | |
| 191 } | 183 } |
| 192 | 184 |
| 193 /** | 185 /** |
| 194 * @param {!Element} element | 186 * @param {!Element} element |
| 195 * @param {boolean} value | 187 * @param {boolean} value |
| 196 * @return {boolean} | 188 * @return {boolean} |
| 197 */ | 189 */ |
| 198 WebInspector.markBeingEdited = function(element, value) | 190 WebInspector.markBeingEdited = function(element, value) |
| 199 { | 191 { |
| 200 if (value) { | 192 if (value) { |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1083 __proto__: WebInspector.Object.prototype | 1075 __proto__: WebInspector.Object.prototype |
| 1084 } | 1076 } |
| 1085 | 1077 |
| 1086 WebInspector.initializeUIUtils = function() | 1078 WebInspector.initializeUIUtils = function() |
| 1087 { | 1079 { |
| 1088 window.addEventListener("focus", WebInspector._windowFocused, false); | 1080 window.addEventListener("focus", WebInspector._windowFocused, false); |
| 1089 window.addEventListener("blur", WebInspector._windowBlurred, false); | 1081 window.addEventListener("blur", WebInspector._windowBlurred, false); |
| 1090 document.addEventListener("focus", WebInspector._focusChanged, true); | 1082 document.addEventListener("focus", WebInspector._focusChanged, true); |
| 1091 document.addEventListener("blur", WebInspector._documentBlurred, true); | 1083 document.addEventListener("blur", WebInspector._documentBlurred, true); |
| 1092 } | 1084 } |
| OLD | NEW |