Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(933)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2527763003: [DevTools] Turn links into spans to prevent default behavior. (Closed)
Patch Set: fixed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 /** 69 /**
70 * @param {!Object<string, string>} prefs 70 * @param {!Object<string, string>} prefs
71 * Note: this function is called from testSettings in Tests.js. 71 * Note: this function is called from testSettings in Tests.js.
72 */ 72 */
73 _createSettings(prefs) { 73 _createSettings(prefs) {
74 this._initializeExperiments(prefs); 74 this._initializeExperiments(prefs);
75 var storagePrefix = ''; 75 var storagePrefix = '';
76 if (Host.isCustomDevtoolsFrontend()) 76 if (Host.isCustomDevtoolsFrontend())
77 storagePrefix = '__custom__'; 77 storagePrefix = '__custom__';
78 else if ( 78 else if (!Runtime.queryParam('can_dock') && !!Runtime.queryParam('debugFront end') && !Host.isUnderTest(prefs))
79 !Runtime.queryParam('can_dock') && !!Runtime.queryParam('debugFrontend') &&
80 !Host.isUnderTest(prefs))
81 storagePrefix = '__bundled__'; 79 storagePrefix = '__bundled__';
82 var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind (window.localStorage) : undefined; 80 var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind (window.localStorage) : undefined;
83 var localStorage = 81 var localStorage =
84 new Common.SettingsStorage(window.localStorage || {}, undefined, undefin ed, clearLocalStorage, storagePrefix); 82 new Common.SettingsStorage(window.localStorage || {}, undefined, undefin ed, clearLocalStorage, storagePrefix);
85 var globalStorage = new Common.SettingsStorage( 83 var globalStorage = new Common.SettingsStorage(
86 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference, 84 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove Preference,
87 InspectorFrontendHost.clearPreferences, storagePrefix); 85 InspectorFrontendHost.clearPreferences, storagePrefix);
88 Common.settings = new Common.Settings(globalStorage, localStorage); 86 Common.settings = new Common.Settings(globalStorage, localStorage);
89 if (!Host.isUnderTest(prefs)) 87 if (!Host.isUnderTest(prefs))
90 new Common.VersionController().updateVersion(); 88 new Common.VersionController().updateVersion();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 shortcut.makeDescriptor('g', shortcut.Modifiers.Meta | shortcut.Modifier s.Shift) 382 shortcut.makeDescriptor('g', shortcut.Modifiers.Meta | shortcut.Modifier s.Shift)
385 ]; 383 ];
386 section.addRelatedKeys(keys, Common.UIString('Find next/previous')); 384 section.addRelatedKeys(keys, Common.UIString('Find next/previous'));
387 } 385 }
388 } 386 }
389 387
390 _postDocumentKeyDown(event) { 388 _postDocumentKeyDown(event) {
391 if (event.handled) 389 if (event.handled)
392 return; 390 return;
393 391
394 var document = event.target && event.target.ownerDocument;
395 var target = document ? document.deepActiveElement() : null;
396 if (target) {
397 var anchor = target.enclosingNodeOrSelfWithNodeName('a');
398 if (anchor)
399 event.preventDefault();
400 }
401
402 if (!UI.Dialog.hasInstance() && UI.inspectorView.currentPanelDeprecated()) { 392 if (!UI.Dialog.hasInstance() && UI.inspectorView.currentPanelDeprecated()) {
403 UI.inspectorView.currentPanelDeprecated().handleShortcut(event); 393 UI.inspectorView.currentPanelDeprecated().handleShortcut(event);
404 if (event.handled) { 394 if (event.handled) {
405 event.consume(true); 395 event.consume(true);
406 return; 396 return;
407 } 397 }
408 } 398 }
409 399
410 UI.shortcutRegistry.handleShortcut(event); 400 UI.shortcutRegistry.handleShortcut(event);
411 } 401 }
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 * @override 982 * @override
993 * @return {?Element} 983 * @return {?Element}
994 */ 984 */
995 settingElement() { 985 settingElement() {
996 return UI.SettingsUI.createSettingCheckbox( 986 return UI.SettingsUI.createSettingCheckbox(
997 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 987 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
998 } 988 }
999 }; 989 };
1000 990
1001 new Main.Main(); 991 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698