Changeset 237482 in webkit
- Timestamp:
- Oct 26, 2018, 2:03:47 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Base/Main.js (modified) (1 diff)
-
UserInterface/Base/Utilities.js (modified) (1 diff)
-
UserInterface/Views/EditingSupport.js (modified) (4 diffs)
-
UserInterface/Views/QuickConsole.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r237481 r237482 1 2018-10-26 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: simplify some editing code checks 4 https://bugs.webkit.org/show_bug.cgi?id=190970 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Base/Main.js: 9 (WI._focusChanged): 10 11 * UserInterface/Base/Utilities.js: 12 13 * UserInterface/Views/EditingSupport.js: 14 (WI.enclosingCodeMirror): Added. 15 (WI.isBeingEdited): 16 (WI.isEventTargetAnEditableField): 17 18 * UserInterface/Views/QuickConsole.js: 19 (WI.QuickConsole): 20 1 21 2018-10-26 Devin Rousso <drousso@apple.com> 2 22 -
trunk/Source/WebInspectorUI/UserInterface/Base/Main.js
r237212 r237482 1295 1295 if (WI.isEventTargetAnEditableField(event)) { 1296 1296 // Still update the currentFocusElement if inside of a CodeMirror editor or an input element. 1297 let codeMirrorEditorElement = event.target.enclosingNodeOrSelfWithClass("CodeMirror"); 1298 if (codeMirrorEditorElement && codeMirrorEditorElement !== this.currentFocusElement) { 1297 let newFocusElement = null; 1298 if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) 1299 newFocusElement = event.target; 1300 else { 1301 let codeMirror = WI.enclosingCodeMirror(event.target); 1302 if (codeMirror) { 1303 let codeMirrorElement = codeMirror.getWrapperElement(); 1304 if (codeMirrorElement && codeMirrorElement !== this.currentFocusElement) 1305 newFocusElement = codeMirrorElement; 1306 } 1307 } 1308 1309 if (newFocusElement) { 1299 1310 this.previousFocusElement = this.currentFocusElement; 1300 this.currentFocusElement = codeMirrorEditorElement; 1301 } else if (event.target.tagName === "INPUT") { 1302 this.previousFocusElement = this.currentFocusElement; 1303 this.currentFocusElement = event.target; 1311 this.currentFocusElement = newFocusElement; 1304 1312 } 1305 1313 -
trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js
r237436 r237482 380 380 }); 381 381 382 Object.defineProperty(Element.prototype, "removeMatchingStyleClasses",383 {384 value(classNameRegex)385 {386 var regex = new RegExp("(^|\\s+)" + classNameRegex + "($|\\s+)");387 if (regex.test(this.className))388 this.className = this.className.replace(regex, " ");389 }390 });391 392 382 Object.defineProperty(Element.prototype, "createChild", 393 383 { -
trunk/Source/WebInspectorUI/UserInterface/Views/EditingSupport.js
r230001 r237482 24 24 */ 25 25 26 WI.enclosingCodeMirror = function(element) 27 { 28 while (element) { 29 if (element.CodeMirror) 30 return element.CodeMirror; 31 element = element.parentNode; 32 } 33 return null; 34 }; 35 26 36 WI.isBeingEdited = function(element) 27 37 { … … 31 41 element = element.parentNode; 32 42 } 33 34 43 return false; 35 44 }; … … 58 67 WI.isEventTargetAnEditableField = function(event) 59 68 { 60 let textInputTypes = new Set(["text", "search", "number", "tel", "url", "email", "password"]); 61 if (event.target instanceof HTMLInputElement) 62 return textInputTypes.has(event.target.type); 63 64 let codeMirrorEditorElement = event.target.enclosingNodeOrSelfWithClass("CodeMirror"); 65 if (codeMirrorEditorElement && codeMirrorEditorElement.CodeMirror) 66 return !codeMirrorEditorElement.CodeMirror.getOption("readOnly"); 67 68 if (event.target instanceof HTMLTextAreaElement) 69 if (event.target instanceof HTMLInputElement || event.target instanceof HTMLTextAreaElement) 69 70 return true; 70 71 … … 72 73 return true; 73 74 74 if (event.target.enclosingNodeOrSelfWithClass("text-prompt"))75 return true;76 77 75 if (WI.isBeingEdited(event.target)) 78 76 return true; 77 78 let codeMirror = WI.enclosingCodeMirror(event.target); 79 if (codeMirror) 80 return !codeMirror.getOption("readOnly"); 79 81 80 82 return false; -
trunk/Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
r236885 r237482 45 45 46 46 this.prompt = new WI.ConsolePrompt(null, "text/javascript"); 47 this.prompt.element.classList.add("text-prompt");48 47 this.addSubview(this.prompt); 49 48
Note:
See TracChangeset
for help on using the changeset viewer.