| 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 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); | 341 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); |
| 342 if (uiSourceCode.url() === url) { | 342 if (uiSourceCode.url() === url) { |
| 343 Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)
); | 343 Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)
); |
| 344 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou
rceCodeAdded, listener); | 344 Workspace.workspace.removeEventListener(Workspace.Workspace.Events.UISou
rceCodeAdded, listener); |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode
Added, listener); | 348 Workspace.workspace.addEventListener(Workspace.Workspace.Events.UISourceCode
Added, listener); |
| 349 } | 349 } |
| 350 | 350 |
| 351 _documentClick(event) { | |
| 352 var target = event.target; | |
| 353 if (target.shadowRoot) | |
| 354 target = event.deepElementFromPoint(); | |
| 355 if (!target) | |
| 356 return; | |
| 357 | |
| 358 var anchor = target.enclosingNodeOrSelfWithNodeName('a'); | |
| 359 if (!anchor || !anchor.href) | |
| 360 return; | |
| 361 | |
| 362 // Prevent the link from navigating, since we don't do any navigation by fol
lowing links normally. | |
| 363 event.consume(true); | |
| 364 | |
| 365 if (anchor.preventFollow) | |
| 366 return; | |
| 367 | |
| 368 function followLink() { | |
| 369 if (UI.isBeingEdited(target)) | |
| 370 return; | |
| 371 if (Components.openAnchorLocationRegistry.dispatch({url: anchor.href, line
Number: anchor.lineNumber})) | |
| 372 return; | |
| 373 | |
| 374 var uiSourceCode = Workspace.workspace.uiSourceCodeForURL(anchor.href); | |
| 375 if (uiSourceCode) { | |
| 376 Common.Revealer.reveal(uiSourceCode.uiLocation(anchor.lineNumber || 0, a
nchor.columnNumber || 0)); | |
| 377 return; | |
| 378 } | |
| 379 | |
| 380 var resource = Bindings.resourceForURL(anchor.href); | |
| 381 if (resource) { | |
| 382 Common.Revealer.reveal(resource); | |
| 383 return; | |
| 384 } | |
| 385 | |
| 386 var request = SDK.NetworkLog.requestForURL(anchor.href); | |
| 387 if (request) { | |
| 388 Common.Revealer.reveal(request); | |
| 389 return; | |
| 390 } | |
| 391 InspectorFrontendHost.openInNewTab(anchor.href); | |
| 392 } | |
| 393 | |
| 394 followLink(); | |
| 395 } | |
| 396 | |
| 397 _registerShortcuts() { | 351 _registerShortcuts() { |
| 398 var shortcut = UI.KeyboardShortcut; | 352 var shortcut = UI.KeyboardShortcut; |
| 399 var section = Components.shortcutsScreen.section(Common.UIString('All Panels
')); | 353 var section = Components.shortcutsScreen.section(Common.UIString('All Panels
')); |
| 400 var keys = [ | 354 var keys = [ |
| 401 shortcut.makeDescriptor('[', shortcut.Modifiers.CtrlOrMeta), | 355 shortcut.makeDescriptor('[', shortcut.Modifiers.CtrlOrMeta), |
| 402 shortcut.makeDescriptor(']', shortcut.Modifiers.CtrlOrMeta) | 356 shortcut.makeDescriptor(']', shortcut.Modifiers.CtrlOrMeta) |
| 403 ]; | 357 ]; |
| 404 section.addRelatedKeys(keys, Common.UIString('Go to the panel to the left/ri
ght')); | 358 section.addRelatedKeys(keys, Common.UIString('Go to the panel to the left/ri
ght')); |
| 405 | 359 |
| 406 keys = [ | 360 keys = [ |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 /** | 444 /** |
| 491 * @param {!Document} document | 445 * @param {!Document} document |
| 492 */ | 446 */ |
| 493 _addMainEventListeners(document) { | 447 _addMainEventListeners(document) { |
| 494 document.addEventListener('keydown', this._postDocumentKeyDown.bind(this), f
alse); | 448 document.addEventListener('keydown', this._postDocumentKeyDown.bind(this), f
alse); |
| 495 document.addEventListener('beforecopy', this._redispatchClipboardEvent.bind(
this), true); | 449 document.addEventListener('beforecopy', this._redispatchClipboardEvent.bind(
this), true); |
| 496 document.addEventListener('copy', this._redispatchClipboardEvent.bind(this),
false); | 450 document.addEventListener('copy', this._redispatchClipboardEvent.bind(this),
false); |
| 497 document.addEventListener('cut', this._redispatchClipboardEvent.bind(this),
false); | 451 document.addEventListener('cut', this._redispatchClipboardEvent.bind(this),
false); |
| 498 document.addEventListener('paste', this._redispatchClipboardEvent.bind(this)
, false); | 452 document.addEventListener('paste', this._redispatchClipboardEvent.bind(this)
, false); |
| 499 document.addEventListener('contextmenu', this._contextMenuEventFired.bind(th
is), true); | 453 document.addEventListener('contextmenu', this._contextMenuEventFired.bind(th
is), true); |
| 500 document.addEventListener('click', this._documentClick.bind(this), false); | |
| 501 } | 454 } |
| 502 | 455 |
| 503 /** | 456 /** |
| 504 * @param {!Common.Event} event | 457 * @param {!Common.Event} event |
| 505 */ | 458 */ |
| 506 _reloadInspectedPage(event) { | 459 _reloadInspectedPage(event) { |
| 507 var hard = /** @type {boolean} */ (event.data); | 460 var hard = /** @type {boolean} */ (event.data); |
| 508 Main.Main._reloadPage(hard); | 461 Main.Main._reloadPage(hard); |
| 509 } | 462 } |
| 510 | 463 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 * @override | 1004 * @override |
| 1052 * @return {?Element} | 1005 * @return {?Element} |
| 1053 */ | 1006 */ |
| 1054 settingElement() { | 1007 settingElement() { |
| 1055 return UI.SettingsUI.createSettingCheckbox( | 1008 return UI.SettingsUI.createSettingCheckbox( |
| 1056 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); | 1009 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); |
| 1057 } | 1010 } |
| 1058 }; | 1011 }; |
| 1059 | 1012 |
| 1060 new Main.Main(); | 1013 new Main.Main(); |
| OLD | NEW |