OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 4 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 5 * |
5 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
7 * are met: | 8 * are met: |
8 * | 9 * |
9 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
11 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
12 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
13 * documentation and/or other materials provided with the distribution. | 14 * documentation and/or other materials provided with the distribution. |
(...skipping 16 matching lines...) Expand all Loading... |
30 var Preferences = { | 31 var Preferences = { |
31 ignoreWhitespace: true, | 32 ignoreWhitespace: true, |
32 showUserAgentStyles: true, | 33 showUserAgentStyles: true, |
33 maxInlineTextChildLength: 80, | 34 maxInlineTextChildLength: 80, |
34 minConsoleHeight: 75, | 35 minConsoleHeight: 75, |
35 minSidebarWidth: 100, | 36 minSidebarWidth: 100, |
36 minElementsSidebarWidth: 200, | 37 minElementsSidebarWidth: 200, |
37 minScriptsSidebarWidth: 200, | 38 minScriptsSidebarWidth: 200, |
38 showInheritedComputedStyleProperties: false, | 39 showInheritedComputedStyleProperties: false, |
39 styleRulesExpandedState: {}, | 40 styleRulesExpandedState: {}, |
40 showMissingLocalizedStrings: false | 41 showMissingLocalizedStrings: false, |
| 42 heapProfilerPresent: false, |
41 } | 43 } |
42 | 44 |
43 var WebInspector = { | 45 var WebInspector = { |
44 resources: {}, | 46 resources: {}, |
45 resourceURLMap: {}, | 47 resourceURLMap: {}, |
46 missingLocalizedStrings: {}, | 48 missingLocalizedStrings: {}, |
47 | 49 |
48 get previousFocusElement() | 50 get previousFocusElement() |
49 { | 51 { |
50 return this._previousFocusElement; | 52 return this._previousFocusElement; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 112 } |
111 | 113 |
112 // Perform the search on a timeout so the panel switches fas
t. | 114 // Perform the search on a timeout so the panel switches fas
t. |
113 setTimeout(performPanelSearch.bind(this), 0); | 115 setTimeout(performPanelSearch.bind(this), 0); |
114 } else { | 116 } else { |
115 // Update to show Not found for panels that can't be searche
d. | 117 // Update to show Not found for panels that can't be searche
d. |
116 this.updateSearchMatchesCount(); | 118 this.updateSearchMatchesCount(); |
117 } | 119 } |
118 } | 120 } |
119 } | 121 } |
| 122 |
| 123 for (var panelName in WebInspector.panels) { |
| 124 if (WebInspector.panels[panelName] == x) |
| 125 InspectorController.storeLastActivePanel(panelName); |
| 126 } |
| 127 }, |
| 128 |
| 129 _createPanels: function() |
| 130 { |
| 131 var hiddenPanels = (InspectorController.hiddenPanels() || "").split(',')
; |
| 132 if (hiddenPanels.indexOf("elements") === -1) |
| 133 this.panels.elements = new WebInspector.ElementsPanel(); |
| 134 if (hiddenPanels.indexOf("resources") === -1) |
| 135 this.panels.resources = new WebInspector.ResourcesPanel(); |
| 136 if (hiddenPanels.indexOf("scripts") === -1) |
| 137 this.panels.scripts = new WebInspector.ScriptsPanel(); |
| 138 if (hiddenPanels.indexOf("profiles") === -1) |
| 139 this.panels.profiles = new WebInspector.ProfilesPanel(); |
| 140 if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("data
bases") === -1) |
| 141 this.panels.storage = new WebInspector.StoragePanel(); |
120 }, | 142 }, |
121 | 143 |
122 get attached() | 144 get attached() |
123 { | 145 { |
124 return this._attached; | 146 return this._attached; |
125 }, | 147 }, |
126 | 148 |
127 set attached(x) | 149 set attached(x) |
128 { | 150 { |
129 if (this._attached === x) | 151 if (this._attached === x) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 else | 246 else |
225 errorWarningElement.title = WebInspector.UIString("%d errors", t
his.errors); | 247 errorWarningElement.title = WebInspector.UIString("%d errors", t
his.errors); |
226 } else if (this.warnings == 1) | 248 } else if (this.warnings == 1) |
227 errorWarningElement.title = WebInspector.UIString("%d warning", this
.warnings); | 249 errorWarningElement.title = WebInspector.UIString("%d warning", this
.warnings); |
228 else if (this.warnings) | 250 else if (this.warnings) |
229 errorWarningElement.title = WebInspector.UIString("%d warnings", thi
s.warnings); | 251 errorWarningElement.title = WebInspector.UIString("%d warnings", thi
s.warnings); |
230 else | 252 else |
231 errorWarningElement.title = null; | 253 errorWarningElement.title = null; |
232 }, | 254 }, |
233 | 255 |
| 256 get styleChanges() |
| 257 { |
| 258 return this._styleChanges; |
| 259 }, |
| 260 |
| 261 set styleChanges(x) |
| 262 { |
| 263 x = Math.max(x, 0); |
| 264 |
| 265 if (this._styleChanges === x) |
| 266 return; |
| 267 this._styleChanges = x; |
| 268 this._updateChangesCount(); |
| 269 }, |
| 270 |
| 271 _updateChangesCount: function() |
| 272 { |
| 273 // TODO: Remove immediate return when enabling the Changes Panel |
| 274 return; |
| 275 |
| 276 var changesElement = document.getElementById("changes-count"); |
| 277 if (!changesElement) |
| 278 return; |
| 279 |
| 280 if (!this.styleChanges) { |
| 281 changesElement.addStyleClass("hidden"); |
| 282 return; |
| 283 } |
| 284 |
| 285 changesElement.removeStyleClass("hidden"); |
| 286 changesElement.removeChildren(); |
| 287 |
| 288 if (this.styleChanges) { |
| 289 var styleChangesElement = document.createElement("span"); |
| 290 styleChangesElement.id = "style-changes-count"; |
| 291 styleChangesElement.textContent = this.styleChanges; |
| 292 changesElement.appendChild(styleChangesElement); |
| 293 } |
| 294 |
| 295 if (this.styleChanges) { |
| 296 if (this.styleChanges === 1) |
| 297 changesElement.title = WebInspector.UIString("%d style change",
this.styleChanges); |
| 298 else |
| 299 changesElement.title = WebInspector.UIString("%d style changes",
this.styleChanges); |
| 300 } |
| 301 }, |
| 302 |
234 get hoveredDOMNode() | 303 get hoveredDOMNode() |
235 { | 304 { |
236 return this._hoveredDOMNode; | 305 return this._hoveredDOMNode; |
237 }, | 306 }, |
238 | 307 |
239 set hoveredDOMNode(x) | 308 set hoveredDOMNode(x) |
240 { | 309 { |
241 if (objectsAreSame(this._hoveredDOMNode, x)) | 310 if (this._hoveredDOMNode === x) |
242 return; | 311 return; |
243 | 312 |
244 this._hoveredDOMNode = x; | 313 this._hoveredDOMNode = x; |
245 | 314 |
246 if (this._hoveredDOMNode) | 315 if (this._hoveredDOMNode) |
247 this._updateHoverHighlightSoon(this.showingDOMNodeHighlight ? 50 : 5
00); | 316 this._updateHoverHighlightSoon(this.showingDOMNodeHighlight ? 50 : 5
00); |
248 else | 317 else |
249 this._updateHoverHighlight(); | 318 this._updateHoverHighlight(); |
250 }, | 319 }, |
251 | 320 |
252 _updateHoverHighlightSoon: function(delay) | 321 _updateHoverHighlightSoon: function(delay) |
253 { | 322 { |
254 if ("_updateHoverHighlightTimeout" in this) | 323 if ("_updateHoverHighlightTimeout" in this) |
255 clearTimeout(this._updateHoverHighlightTimeout); | 324 clearTimeout(this._updateHoverHighlightTimeout); |
256 this._updateHoverHighlightTimeout = setTimeout(this._updateHoverHighligh
t.bind(this), delay); | 325 this._updateHoverHighlightTimeout = setTimeout(this._updateHoverHighligh
t.bind(this), delay); |
257 }, | 326 }, |
258 | 327 |
259 _updateHoverHighlight: function() | 328 _updateHoverHighlight: function() |
260 { | 329 { |
261 if ("_updateHoverHighlightTimeout" in this) { | 330 if ("_updateHoverHighlightTimeout" in this) { |
262 clearTimeout(this._updateHoverHighlightTimeout); | 331 clearTimeout(this._updateHoverHighlightTimeout); |
263 delete this._updateHoverHighlightTimeout; | 332 delete this._updateHoverHighlightTimeout; |
264 } | 333 } |
265 | 334 |
266 if (this._hoveredDOMNode) { | 335 if (this._hoveredDOMNode) { |
267 InspectorController.highlightDOMNode(this._hoveredDOMNode); | 336 InspectorController.highlightDOMNode(this._hoveredDOMNode.id); |
268 this.showingDOMNodeHighlight = true; | 337 this.showingDOMNodeHighlight = true; |
269 } else { | 338 } else { |
270 InspectorController.hideDOMNodeHighlight(); | 339 InspectorController.hideDOMNodeHighlight(); |
271 this.showingDOMNodeHighlight = false; | 340 this.showingDOMNodeHighlight = false; |
272 } | 341 } |
273 } | 342 } |
274 } | 343 } |
275 | 344 |
276 WebInspector.loaded = function() | 345 WebInspector.loaded = function() |
277 { | 346 { |
278 var platform = InspectorController.platform(); | 347 var platform = InspectorController.platform(); |
279 document.body.addStyleClass("platform-" + platform); | 348 document.body.addStyleClass("platform-" + platform); |
280 | 349 |
281 this.console = new WebInspector.Console(); | 350 this.drawer = new WebInspector.Drawer(); |
| 351 this.console = new WebInspector.ConsoleView(this.drawer); |
| 352 // TODO: Uncomment when enabling the Changes Panel |
| 353 // this.changes = new WebInspector.ChangesView(this.drawer); |
| 354 // TODO: Remove class="hidden" from inspector.html on button#changes-status-
bar-item |
| 355 this.drawer.visibleView = this.console; |
| 356 this.domAgent = new WebInspector.DOMAgent(); |
| 357 |
| 358 this.resourceCategories = { |
| 359 documents: new WebInspector.ResourceCategory(WebInspector.UIString("Docu
ments"), "documents"), |
| 360 stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("St
ylesheets"), "stylesheets"), |
| 361 images: new WebInspector.ResourceCategory(WebInspector.UIString("Images"
), "images"), |
| 362 scripts: new WebInspector.ResourceCategory(WebInspector.UIString("Script
s"), "scripts"), |
| 363 xhr: new WebInspector.ResourceCategory(WebInspector.UIString("XHR"), "xh
r"), |
| 364 fonts: new WebInspector.ResourceCategory(WebInspector.UIString("Fonts"),
"fonts"), |
| 365 other: new WebInspector.ResourceCategory(WebInspector.UIString("Other"),
"other") |
| 366 }; |
282 | 367 |
283 this.panels = {}; | 368 this.panels = {}; |
284 var hiddenPanels = (InspectorController.hiddenPanels() || "").split(','); | 369 this._createPanels(); |
285 if (hiddenPanels.indexOf("elements") === -1) | |
286 this.panels.elements = new WebInspector.ElementsPanel(); | |
287 if (hiddenPanels.indexOf("resources") === -1) | |
288 this.panels.resources = new WebInspector.ResourcesPanel(); | |
289 if (hiddenPanels.indexOf("scripts") === -1) | |
290 this.panels.scripts = new WebInspector.ScriptsPanel(); | |
291 if (hiddenPanels.indexOf("profiles") === -1) | |
292 this.panels.profiles = new WebInspector.ProfilesPanel(); | |
293 if (hiddenPanels.indexOf("databases") === -1) | |
294 this.panels.databases = new WebInspector.DatabasesPanel(); | |
295 | 370 |
296 var toolbarElement = document.getElementById("toolbar"); | 371 var toolbarElement = document.getElementById("toolbar"); |
297 var previousToolbarItem = toolbarElement.children[0]; | 372 var previousToolbarItem = toolbarElement.children[0]; |
298 | 373 |
| 374 this.panelOrder = []; |
299 for (var panelName in this.panels) { | 375 for (var panelName in this.panels) { |
300 var panel = this.panels[panelName]; | 376 var panel = this.panels[panelName]; |
301 var panelToolbarItem = panel.toolbarItem; | 377 var panelToolbarItem = panel.toolbarItem; |
| 378 this.panelOrder.push(panel); |
302 panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind
(this)); | 379 panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind
(this)); |
303 if (previousToolbarItem) | 380 if (previousToolbarItem) |
304 toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.ne
xtSibling); | 381 toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.ne
xtSibling); |
305 else | 382 else |
306 toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstCh
ild); | 383 toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstCh
ild); |
307 previousToolbarItem = panelToolbarItem; | 384 previousToolbarItem = panelToolbarItem; |
308 } | 385 } |
309 | 386 |
310 this.currentPanel = this.panels.elements; | |
311 | |
312 this.resourceCategories = { | |
313 documents: new WebInspector.ResourceCategory(WebInspector.UIString("Docu
ments"), "documents"), | |
314 stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("St
ylesheets"), "stylesheets"), | |
315 images: new WebInspector.ResourceCategory(WebInspector.UIString("Images"
), "images"), | |
316 scripts: new WebInspector.ResourceCategory(WebInspector.UIString("Script
s"), "scripts"), | |
317 xhr: new WebInspector.ResourceCategory(WebInspector.UIString("XHR"), "xh
r"), | |
318 fonts: new WebInspector.ResourceCategory(WebInspector.UIString("Fonts"),
"fonts"), | |
319 other: new WebInspector.ResourceCategory(WebInspector.UIString("Other"),
"other") | |
320 }; | |
321 | |
322 this.Tips = { | 387 this.Tips = { |
323 ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could
save bandwidth by having your web server compress this transfer with gzip or zl
ib.")} | 388 ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could
save bandwidth by having your web server compress this transfer with gzip or zl
ib.")} |
324 }; | 389 }; |
325 | 390 |
326 this.Warnings = { | 391 this.Warnings = { |
327 IncorrectMIMEType: {id: 0, message: WebInspector.UIString("Resource inte
rpreted as %s but transferred with MIME type %s.")} | 392 IncorrectMIMEType: {id: 0, message: WebInspector.UIString("Resource inte
rpreted as %s but transferred with MIME type %s.")} |
328 }; | 393 }; |
329 | 394 |
330 this.addMainEventListeners(document); | 395 this.addMainEventListeners(document); |
331 | 396 |
(...skipping 18 matching lines...) Expand all Loading... |
350 | 415 |
351 var dockToggleButton = document.getElementById("dock-status-bar-item"); | 416 var dockToggleButton = document.getElementById("dock-status-bar-item"); |
352 dockToggleButton.addEventListener("click", this.toggleAttach.bind(this), fal
se); | 417 dockToggleButton.addEventListener("click", this.toggleAttach.bind(this), fal
se); |
353 | 418 |
354 if (this.attached) | 419 if (this.attached) |
355 dockToggleButton.title = WebInspector.UIString("Undock into separate win
dow."); | 420 dockToggleButton.title = WebInspector.UIString("Undock into separate win
dow."); |
356 else | 421 else |
357 dockToggleButton.title = WebInspector.UIString("Dock to main window."); | 422 dockToggleButton.title = WebInspector.UIString("Dock to main window."); |
358 | 423 |
359 var errorWarningCount = document.getElementById("error-warning-count"); | 424 var errorWarningCount = document.getElementById("error-warning-count"); |
360 errorWarningCount.addEventListener("click", this.console.show.bind(this.cons
ole), false); | 425 errorWarningCount.addEventListener("click", this.showConsole.bind(this), fal
se); |
361 this._updateErrorAndWarningCounts(); | 426 this._updateErrorAndWarningCounts(); |
362 | 427 |
| 428 this.styleChanges = 0; |
| 429 // TODO: Uncomment when enabling the Changes Panel |
| 430 // var changesElement = document.getElementById("changes-count"); |
| 431 // changesElement.addEventListener("click", this.showChanges.bind(this), fal
se); |
| 432 // this._updateErrorAndWarningCounts(); |
| 433 |
363 var searchField = document.getElementById("search"); | 434 var searchField = document.getElementById("search"); |
364 searchField.addEventListener("keydown", this.searchKeyDown.bind(this), false
); | 435 searchField.addEventListener("keydown", this.searchKeyDown.bind(this), false
); |
365 searchField.addEventListener("keyup", this.searchKeyUp.bind(this), false); | 436 searchField.addEventListener("keyup", this.searchKeyUp.bind(this), false); |
366 searchField.addEventListener("search", this.performSearch.bind(this), false)
; // when the search is emptied | 437 searchField.addEventListener("search", this.performSearch.bind(this), false)
; // when the search is emptied |
367 | 438 |
368 document.getElementById("toolbar").addEventListener("mousedown", this.toolba
rDragStart, true); | 439 document.getElementById("toolbar").addEventListener("mousedown", this.toolba
rDragStart, true); |
369 document.getElementById("close-button").addEventListener("click", this.close
, true); | 440 document.getElementById("close-button").addEventListener("click", this.close
, true); |
370 | 441 |
371 InspectorController.loaded(); | 442 InspectorController.loaded(); |
372 } | 443 } |
373 | 444 |
374 var windowLoaded = function() | 445 var windowLoaded = function() |
375 { | 446 { |
376 var localizedStringsURL = InspectorController.localizedStringsURL(); | 447 var localizedStringsURL = InspectorController.localizedStringsURL(); |
377 if (localizedStringsURL) { | 448 if (localizedStringsURL) { |
378 var localizedStringsScriptElement = document.createElement("script"); | 449 var localizedStringsScriptElement = document.createElement("script"); |
379 localizedStringsScriptElement.addEventListener("load", WebInspector.load
ed.bind(WebInspector), false); | 450 localizedStringsScriptElement.addEventListener("load", WebInspector.load
ed.bind(WebInspector), false); |
380 localizedStringsScriptElement.type = "text/javascript"; | 451 localizedStringsScriptElement.type = "text/javascript"; |
381 localizedStringsScriptElement.src = localizedStringsURL; | 452 localizedStringsScriptElement.src = localizedStringsURL; |
382 document.getElementsByTagName("head").item(0).appendChild(localizedStrin
gsScriptElement); | 453 document.getElementsByTagName("head").item(0).appendChild(localizedStrin
gsScriptElement); |
383 } else | 454 } else |
384 WebInspector.loaded(); | 455 WebInspector.loaded(); |
385 | 456 |
386 window.removeEventListener("load", windowLoaded, false); | 457 window.removeEventListener("load", windowLoaded, false); |
387 delete windowLoaded; | 458 delete windowLoaded; |
388 }; | 459 }; |
389 | 460 |
390 window.addEventListener("load", windowLoaded, false); | 461 window.addEventListener("load", windowLoaded, false); |
391 | 462 |
| 463 WebInspector.dispatch = function() { |
| 464 var methodName = arguments[0]; |
| 465 var parameters = Array.prototype.slice.call(arguments, 1); |
| 466 WebInspector[methodName].apply(this, parameters); |
| 467 } |
| 468 |
392 WebInspector.windowUnload = function(event) | 469 WebInspector.windowUnload = function(event) |
393 { | 470 { |
394 InspectorController.windowUnloading(); | 471 InspectorController.windowUnloading(); |
395 } | 472 } |
396 | 473 |
397 WebInspector.windowResize = function(event) | 474 WebInspector.windowResize = function(event) |
398 { | 475 { |
399 if (this.currentPanel && this.currentPanel.resize) | 476 if (this.currentPanel && this.currentPanel.resize) |
400 this.currentPanel.resize(); | 477 this.currentPanel.resize(); |
401 } | 478 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (this.currentFocusElement.handleKeyEvent) | 552 if (this.currentFocusElement.handleKeyEvent) |
476 this.currentFocusElement.handleKeyEvent(event); | 553 this.currentFocusElement.handleKeyEvent(event); |
477 else if (this.currentFocusElement.id && this.currentFocusElement.id.length &
& WebInspector[this.currentFocusElement.id + "KeyDown"]) | 554 else if (this.currentFocusElement.id && this.currentFocusElement.id.length &
& WebInspector[this.currentFocusElement.id + "KeyDown"]) |
478 WebInspector[this.currentFocusElement.id + "KeyDown"](event); | 555 WebInspector[this.currentFocusElement.id + "KeyDown"](event); |
479 | 556 |
480 if (!event.handled) { | 557 if (!event.handled) { |
481 var isMac = InspectorController.platform().indexOf("mac-") === 0; | 558 var isMac = InspectorController.platform().indexOf("mac-") === 0; |
482 | 559 |
483 switch (event.keyIdentifier) { | 560 switch (event.keyIdentifier) { |
484 case "U+001B": // Escape key | 561 case "U+001B": // Escape key |
485 this.console.visible = !this.console.visible; | 562 this.drawer.visible = !this.drawer.visible; |
486 event.preventDefault(); | 563 event.preventDefault(); |
487 break; | 564 break; |
488 | 565 |
489 case "U+0046": // F key | 566 case "U+0046": // F key |
490 if (isMac) | 567 if (isMac) |
491 var isFindKey = event.metaKey && !event.ctrlKey && !event.al
tKey && !event.shiftKey; | 568 var isFindKey = event.metaKey && !event.ctrlKey && !event.al
tKey && !event.shiftKey; |
492 else | 569 else |
493 var isFindKey = event.ctrlKey && !event.metaKey && !event.al
tKey && !event.shiftKey; | 570 var isFindKey = event.ctrlKey && !event.metaKey && !event.al
tKey && !event.shiftKey; |
494 | 571 |
495 if (isFindKey) { | 572 if (isFindKey) { |
(...skipping 14 matching lines...) Expand all Loading... |
510 if (isFindAgainKey) { | 587 if (isFindAgainKey) { |
511 if (event.shiftKey) { | 588 if (event.shiftKey) { |
512 if (this.currentPanel.jumpToPreviousSearchResult) | 589 if (this.currentPanel.jumpToPreviousSearchResult) |
513 this.currentPanel.jumpToPreviousSearchResult(); | 590 this.currentPanel.jumpToPreviousSearchResult(); |
514 } else if (this.currentPanel.jumpToNextSearchResult) | 591 } else if (this.currentPanel.jumpToNextSearchResult) |
515 this.currentPanel.jumpToNextSearchResult(); | 592 this.currentPanel.jumpToNextSearchResult(); |
516 event.preventDefault(); | 593 event.preventDefault(); |
517 } | 594 } |
518 | 595 |
519 break; | 596 break; |
| 597 |
| 598 case "U+005B": // [ key |
| 599 if (isMac) |
| 600 var isRotateLeft = event.metaKey && !event.shiftKey && !even
t.ctrlKey && !event.altKey; |
| 601 else |
| 602 var isRotateLeft = event.ctrlKey && !event.shiftKey && !even
t.metaKey && !event.altKey; |
| 603 |
| 604 if (isRotateLeft) { |
| 605 var index = this.panelOrder.indexOf(this.currentPanel); |
| 606 index = (index === 0) ? this.panelOrder.length - 1 : index -
1; |
| 607 this.panelOrder[index].toolbarItem.click(); |
| 608 event.preventDefault(); |
| 609 } |
| 610 |
| 611 break; |
| 612 |
| 613 case "U+005D": // ] key |
| 614 if (isMac) |
| 615 var isRotateRight = event.metaKey && !event.shiftKey && !eve
nt.ctrlKey && !event.altKey; |
| 616 else |
| 617 var isRotateRight = event.ctrlKey && !event.shiftKey && !eve
nt.metaKey && !event.altKey; |
| 618 |
| 619 if (isRotateRight) { |
| 620 var index = this.panelOrder.indexOf(this.currentPanel); |
| 621 index = (index + 1) % this.panelOrder.length; |
| 622 this.panelOrder[index].toolbarItem.click(); |
| 623 event.preventDefault(); |
| 624 } |
| 625 |
| 626 break; |
520 } | 627 } |
521 } | 628 } |
522 } | 629 } |
523 | 630 |
524 WebInspector.documentKeyUp = function(event) | 631 WebInspector.documentKeyUp = function(event) |
525 { | 632 { |
526 if (!this.currentFocusElement || !this.currentFocusElement.handleKeyUpEvent) | 633 if (!this.currentFocusElement || !this.currentFocusElement.handleKeyUpEvent) |
527 return; | 634 return; |
528 this.currentFocusElement.handleKeyUpEvent(event); | 635 this.currentFocusElement.handleKeyUpEvent(event); |
529 } | 636 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 682 |
576 var defaultUnit = "px"; | 683 var defaultUnit = "px"; |
577 var propertyUnit = {opacity: ""}; | 684 var propertyUnit = {opacity: ""}; |
578 | 685 |
579 for (var i = 0; i < animations.length; ++i) { | 686 for (var i = 0; i < animations.length; ++i) { |
580 var animation = animations[i]; | 687 var animation = animations[i]; |
581 var element = null; | 688 var element = null; |
582 var start = null; | 689 var start = null; |
583 var current = null; | 690 var current = null; |
584 var end = null; | 691 var end = null; |
| 692 var key = null; |
585 for (key in animation) { | 693 for (key in animation) { |
586 if (key === "element") | 694 if (key === "element") |
587 element = animation[key]; | 695 element = animation[key]; |
588 else if (key === "start") | 696 else if (key === "start") |
589 start = animation[key]; | 697 start = animation[key]; |
590 else if (key === "current") | 698 else if (key === "current") |
591 current = animation[key]; | 699 current = animation[key]; |
592 else if (key === "end") | 700 else if (key === "end") |
593 end = animation[key]; | 701 end = animation[key]; |
594 } | 702 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 document.body.style.removeProperty("cursor"); | 844 document.body.style.removeProperty("cursor"); |
737 | 845 |
738 delete this._elementDraggingEventListener; | 846 delete this._elementDraggingEventListener; |
739 delete this._elementEndDraggingEventListener; | 847 delete this._elementEndDraggingEventListener; |
740 | 848 |
741 event.preventDefault(); | 849 event.preventDefault(); |
742 } | 850 } |
743 | 851 |
744 WebInspector.showConsole = function() | 852 WebInspector.showConsole = function() |
745 { | 853 { |
746 this.console.show(); | 854 this.drawer.showView(this.console); |
| 855 } |
| 856 |
| 857 WebInspector.showChanges = function() |
| 858 { |
| 859 this.drawer.showView(this.changes); |
747 } | 860 } |
748 | 861 |
749 WebInspector.showElementsPanel = function() | 862 WebInspector.showElementsPanel = function() |
750 { | 863 { |
751 this.currentPanel = this.panels.elements; | 864 this.currentPanel = this.panels.elements; |
752 } | 865 } |
753 | 866 |
754 WebInspector.showResourcesPanel = function() | 867 WebInspector.showResourcesPanel = function() |
755 { | 868 { |
756 this.currentPanel = this.panels.resources; | 869 this.currentPanel = this.panels.resources; |
757 } | 870 } |
758 | 871 |
759 WebInspector.showScriptsPanel = function() | 872 WebInspector.showScriptsPanel = function() |
760 { | 873 { |
761 this.currentPanel = this.panels.scripts; | 874 this.currentPanel = this.panels.scripts; |
762 } | 875 } |
763 | 876 |
764 WebInspector.showProfilesPanel = function() | 877 WebInspector.showProfilesPanel = function() |
765 { | 878 { |
766 this.currentPanel = this.panels.profiles; | 879 this.currentPanel = this.panels.profiles; |
767 } | 880 } |
768 | 881 |
769 WebInspector.showDatabasesPanel = function() | 882 WebInspector.showStoragePanel = function() |
770 { | 883 { |
771 this.currentPanel = this.panels.databases; | 884 this.currentPanel = this.panels.storage; |
772 } | 885 } |
773 | 886 |
774 WebInspector.addResource = function(identifier, payload) | 887 WebInspector.addResource = function(identifier, payload) |
775 { | 888 { |
776 var resource = new WebInspector.Resource( | 889 var resource = new WebInspector.Resource( |
777 payload.requestHeaders, | 890 payload.requestHeaders, |
778 payload.requestURL, | 891 payload.requestURL, |
779 payload.host, | 892 payload.host, |
780 payload.path, | 893 payload.path, |
781 payload.lastPathComponent, | 894 payload.lastPathComponent, |
782 identifier, | 895 identifier, |
783 payload.isMainResource, | 896 payload.isMainResource, |
784 payload.cached); | 897 payload.cached); |
785 this.resources[identifier] = resource; | 898 this.resources[identifier] = resource; |
786 this.resourceURLMap[resource.url] = resource; | 899 this.resourceURLMap[resource.url] = resource; |
787 | 900 |
788 if (resource.mainResource) { | 901 if (resource.mainResource) { |
789 this.mainResource = resource; | 902 this.mainResource = resource; |
790 this.panels.elements.reset(); | 903 this.panels.elements.reset(); |
791 } | 904 } |
792 | 905 |
793 if (this.panels.resources) | 906 if (this.panels.resources) |
794 this.panels.resources.addResource(resource); | 907 this.panels.resources.addResource(resource); |
795 } | 908 } |
796 | 909 |
| 910 WebInspector.clearConsoleMessages = function() |
| 911 { |
| 912 WebInspector.console.clearMessages(false); |
| 913 } |
| 914 |
| 915 WebInspector.selectDatabase = function(o) |
| 916 { |
| 917 WebInspector.showStoragePanel(); |
| 918 WebInspector.panels.storage.selectDatabase(o); |
| 919 } |
| 920 |
| 921 WebInspector.selectDOMStorage = function(o) |
| 922 { |
| 923 WebInspector.showStoragePanel(); |
| 924 WebInspector.panels.storage.selectDOMStorage(o); |
| 925 } |
| 926 |
797 WebInspector.updateResource = function(identifier, payload) | 927 WebInspector.updateResource = function(identifier, payload) |
798 { | 928 { |
799 var resource = this.resources[identifier]; | 929 var resource = this.resources[identifier]; |
800 if (!resource) | 930 if (!resource) |
801 return; | 931 return; |
802 | 932 |
803 if (payload.didRequestChange) { | 933 if (payload.didRequestChange) { |
804 resource.url = payload.url; | 934 resource.url = payload.url; |
805 resource.domain = payload.domain; | 935 resource.domain = payload.domain; |
806 resource.path = payload.path; | 936 resource.path = payload.path; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 this.panels.resources.removeResource(resource); | 985 this.panels.resources.removeResource(resource); |
856 } | 986 } |
857 | 987 |
858 WebInspector.addDatabase = function(payload) | 988 WebInspector.addDatabase = function(payload) |
859 { | 989 { |
860 var database = new WebInspector.Database( | 990 var database = new WebInspector.Database( |
861 payload.database, | 991 payload.database, |
862 payload.domain, | 992 payload.domain, |
863 payload.name, | 993 payload.name, |
864 payload.version); | 994 payload.version); |
865 this.panels.databases.addDatabase(database); | 995 this.panels.storage.addDatabase(database); |
866 } | 996 } |
867 | 997 |
868 WebInspector.addDOMStorage = function(payload) | 998 WebInspector.addDOMStorage = function(payload) |
869 { | 999 { |
870 var domStorage = new WebInspector.DOMStorage( | 1000 var domStorage = new WebInspector.DOMStorage( |
871 payload.domStorage, | 1001 payload.domStorage, |
872 payload.host, | 1002 payload.host, |
873 payload.isLocalStorage); | 1003 payload.isLocalStorage); |
874 this.panels.databases.addDOMStorage(domStorage); | 1004 this.panels.storage.addDOMStorage(domStorage); |
| 1005 } |
| 1006 |
| 1007 WebInspector.resourceTrackingWasEnabled = function() |
| 1008 { |
| 1009 this.panels.resources.resourceTrackingWasEnabled(); |
| 1010 } |
| 1011 |
| 1012 WebInspector.resourceTrackingWasDisabled = function() |
| 1013 { |
| 1014 this.panels.resources.resourceTrackingWasDisabled(); |
| 1015 } |
| 1016 |
| 1017 WebInspector.attachDebuggerWhenShown = function() |
| 1018 { |
| 1019 this.panels.scripts.attachDebuggerWhenShown(); |
875 } | 1020 } |
876 | 1021 |
877 WebInspector.debuggerWasEnabled = function() | 1022 WebInspector.debuggerWasEnabled = function() |
878 { | 1023 { |
879 this.panels.scripts.debuggerWasEnabled(); | 1024 this.panels.scripts.debuggerWasEnabled(); |
880 } | 1025 } |
881 | 1026 |
882 WebInspector.debuggerWasDisabled = function() | 1027 WebInspector.debuggerWasDisabled = function() |
883 { | 1028 { |
884 this.panels.scripts.debuggerWasDisabled(); | 1029 this.panels.scripts.debuggerWasDisabled(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 1081 |
937 this.resources = {}; | 1082 this.resources = {}; |
938 this.resourceURLMap = {}; | 1083 this.resourceURLMap = {}; |
939 this.hoveredDOMNode = null; | 1084 this.hoveredDOMNode = null; |
940 | 1085 |
941 delete this.mainResource; | 1086 delete this.mainResource; |
942 | 1087 |
943 this.console.clearMessages(); | 1088 this.console.clearMessages(); |
944 } | 1089 } |
945 | 1090 |
946 WebInspector.inspectedWindowCleared = function(inspectedWindow) | |
947 { | |
948 this.panels.elements.inspectedWindowCleared(inspectedWindow); | |
949 } | |
950 | |
951 WebInspector.resourceURLChanged = function(resource, oldURL) | 1091 WebInspector.resourceURLChanged = function(resource, oldURL) |
952 { | 1092 { |
953 delete this.resourceURLMap[oldURL]; | 1093 delete this.resourceURLMap[oldURL]; |
954 this.resourceURLMap[resource.url] = resource; | 1094 this.resourceURLMap[resource.url] = resource; |
955 } | 1095 } |
956 | 1096 |
957 WebInspector.addMessageToConsole = function(payload) | 1097 WebInspector.addMessageToConsole = function(payload) |
958 { | 1098 { |
959 var consoleMessage = new WebInspector.ConsoleMessage( | 1099 var consoleMessage = new WebInspector.ConsoleMessage( |
960 payload.source, | 1100 payload.source, |
| 1101 payload.type, |
961 payload.level, | 1102 payload.level, |
962 payload.line, | 1103 payload.line, |
963 payload.url, | 1104 payload.url, |
964 payload.groupLevel, | 1105 payload.groupLevel, |
965 payload.repeatCount); | 1106 payload.repeatCount); |
966 consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1)); | 1107 consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1)); |
967 this.console.addMessage(consoleMessage); | 1108 this.console.addMessage(consoleMessage); |
968 } | 1109 } |
969 | 1110 |
970 WebInspector.addProfile = function(profile) | 1111 WebInspector.addProfile = function(profile) |
(...skipping 29 matching lines...) Expand all Loading... |
1000 | 1141 |
1001 g.beginPath(); | 1142 g.beginPath(); |
1002 g.moveTo(cx, cy); | 1143 g.moveTo(cx, cy); |
1003 g.arc(cx, cy, r, startangle, endangle, false); | 1144 g.arc(cx, cy, r, startangle, endangle, false); |
1004 g.closePath(); | 1145 g.closePath(); |
1005 | 1146 |
1006 g.fillStyle = darkColor; | 1147 g.fillStyle = darkColor; |
1007 g.fill(); | 1148 g.fill(); |
1008 } | 1149 } |
1009 | 1150 |
1010 WebInspector.updateFocusedNode = function(node) | 1151 WebInspector.updateFocusedNode = function(nodeId) |
1011 { | 1152 { |
| 1153 var node = WebInspector.domAgent.nodeForId(nodeId); |
1012 if (!node) | 1154 if (!node) |
1013 // FIXME: Should we deselect if null is passed in? | 1155 // FIXME: Should we deselect if null is passed in? |
1014 return; | 1156 return; |
1015 | 1157 |
1016 this.currentPanel = this.panels.elements; | 1158 this.currentPanel = this.panels.elements; |
1017 this.panels.elements.focusedDOMNode = node; | 1159 this.panels.elements.focusedDOMNode = node; |
1018 } | 1160 } |
1019 | 1161 |
1020 WebInspector.displayNameForURL = function(url) | 1162 WebInspector.displayNameForURL = function(url) |
1021 { | 1163 { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 | 1333 |
1192 this.updateSearchMatchesCount(); | 1334 this.updateSearchMatchesCount(); |
1193 | 1335 |
1194 if (!this.currentPanel.performSearch) | 1336 if (!this.currentPanel.performSearch) |
1195 return; | 1337 return; |
1196 | 1338 |
1197 this.currentPanel.currentQuery = query; | 1339 this.currentPanel.currentQuery = query; |
1198 this.currentPanel.performSearch(query); | 1340 this.currentPanel.performSearch(query); |
1199 } | 1341 } |
1200 | 1342 |
| 1343 WebInspector.addNodesToSearchResult = function(nodeIds) |
| 1344 { |
| 1345 WebInspector.panels.elements.addNodesToSearchResult(nodeIds); |
| 1346 } |
| 1347 |
1201 WebInspector.updateSearchMatchesCount = function(matches, panel) | 1348 WebInspector.updateSearchMatchesCount = function(matches, panel) |
1202 { | 1349 { |
1203 if (!panel) | 1350 if (!panel) |
1204 panel = this.currentPanel; | 1351 panel = this.currentPanel; |
1205 | 1352 |
1206 panel.currentSearchMatches = matches; | 1353 panel.currentSearchMatches = matches; |
1207 | 1354 |
1208 if (panel !== this.currentPanel) | 1355 if (panel !== this.currentPanel) |
1209 return; | 1356 return; |
1210 | 1357 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 } | 1396 } |
1250 | 1397 |
1251 WebInspector.startEditing = function(element, committedCallback, cancelledCallba
ck, context) | 1398 WebInspector.startEditing = function(element, committedCallback, cancelledCallba
ck, context) |
1252 { | 1399 { |
1253 if (element.__editing) | 1400 if (element.__editing) |
1254 return; | 1401 return; |
1255 element.__editing = true; | 1402 element.__editing = true; |
1256 | 1403 |
1257 var oldText = element.textContent; | 1404 var oldText = element.textContent; |
1258 var oldHandleKeyEvent = element.handleKeyEvent; | 1405 var oldHandleKeyEvent = element.handleKeyEvent; |
| 1406 var moveDirection = ""; |
1259 | 1407 |
1260 element.addStyleClass("editing"); | 1408 element.addStyleClass("editing"); |
1261 | 1409 |
1262 var oldTabIndex = element.tabIndex; | 1410 var oldTabIndex = element.tabIndex; |
1263 if (element.tabIndex < 0) | 1411 if (element.tabIndex < 0) |
1264 element.tabIndex = 0; | 1412 element.tabIndex = 0; |
1265 | 1413 |
1266 function blurEventListener() { | 1414 function blurEventListener() { |
1267 editingCommitted.call(element); | 1415 editingCommitted.call(element); |
1268 } | 1416 } |
(...skipping 17 matching lines...) Expand all Loading... |
1286 this.innerText = oldText; | 1434 this.innerText = oldText; |
1287 | 1435 |
1288 cleanUpAfterEditing.call(this); | 1436 cleanUpAfterEditing.call(this); |
1289 | 1437 |
1290 cancelledCallback(this, context); | 1438 cancelledCallback(this, context); |
1291 } | 1439 } |
1292 | 1440 |
1293 function editingCommitted() { | 1441 function editingCommitted() { |
1294 cleanUpAfterEditing.call(this); | 1442 cleanUpAfterEditing.call(this); |
1295 | 1443 |
1296 committedCallback(this, this.textContent, oldText, context); | 1444 committedCallback(this, this.textContent, oldText, context, moveDirectio
n); |
1297 } | 1445 } |
1298 | 1446 |
1299 element.handleKeyEvent = function(event) { | 1447 element.handleKeyEvent = function(event) { |
1300 if (oldHandleKeyEvent) | 1448 if (oldHandleKeyEvent) |
1301 oldHandleKeyEvent(event); | 1449 oldHandleKeyEvent(event); |
1302 if (event.handled) | 1450 if (event.handled) |
1303 return; | 1451 return; |
1304 | 1452 |
1305 if (event.keyIdentifier === "Enter") { | 1453 if (event.keyIdentifier === "Enter") { |
1306 editingCommitted.call(element); | 1454 editingCommitted.call(element); |
1307 event.preventDefault(); | 1455 event.preventDefault(); |
1308 } else if (event.keyCode === 27) { // Escape key | 1456 } else if (event.keyCode === 27) { // Escape key |
1309 editingCancelled.call(element); | 1457 editingCancelled.call(element); |
1310 event.preventDefault(); | 1458 event.preventDefault(); |
1311 event.handled = true; | 1459 event.handled = true; |
1312 } | 1460 } else if (event.keyIdentifier === "U+0009") // Tab key |
| 1461 moveDirection = (event.shiftKey ? "backward" : "forward"); |
1313 } | 1462 } |
1314 | 1463 |
1315 element.addEventListener("blur", blurEventListener, false); | 1464 element.addEventListener("blur", blurEventListener, false); |
1316 | 1465 |
1317 WebInspector.currentFocusElement = element; | 1466 WebInspector.currentFocusElement = element; |
1318 } | 1467 } |
1319 | 1468 |
1320 WebInspector._toolbarItemClicked = function(event) | 1469 WebInspector._toolbarItemClicked = function(event) |
1321 { | 1470 { |
1322 var toolbarItem = event.currentTarget; | 1471 var toolbarItem = event.currentTarget; |
(...skipping 28 matching lines...) Expand all Loading... |
1351 "text/ecmascript": {4: true}, | 1500 "text/ecmascript": {4: true}, |
1352 "application/javascript": {4: true}, | 1501 "application/javascript": {4: true}, |
1353 "application/ecmascript": {4: true}, | 1502 "application/ecmascript": {4: true}, |
1354 "application/x-javascript": {4: true}, | 1503 "application/x-javascript": {4: true}, |
1355 "text/javascript1.1": {4: true}, | 1504 "text/javascript1.1": {4: true}, |
1356 "text/javascript1.2": {4: true}, | 1505 "text/javascript1.2": {4: true}, |
1357 "text/javascript1.3": {4: true}, | 1506 "text/javascript1.3": {4: true}, |
1358 "text/jscript": {4: true}, | 1507 "text/jscript": {4: true}, |
1359 "text/livescript": {4: true}, | 1508 "text/livescript": {4: true}, |
1360 } | 1509 } |
OLD | NEW |