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

Side by Side Diff: Source/devtools/front_end/ui/UIUtils.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/ui/TextPrompt.js ('k') | Source/devtools/front_end/ui/View.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 event.preventDefault(); 138 event.preventDefault();
139 if (elementDragEnd) 139 if (elementDragEnd)
140 elementDragEnd(/** @type {!MouseEvent} */ (event)); 140 elementDragEnd(/** @type {!MouseEvent} */ (event));
141 } 141 }
142 142
143 /** 143 /**
144 * @constructor 144 * @constructor
145 */ 145 */
146 WebInspector.GlassPane = function() 146 WebInspector.GlassPane = function()
147 { 147 {
148 this.element = document.createElement("div"); 148 this.element = createElement("div");
149 this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right: 0;background-color:transparent;z-index:1000;"; 149 this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right: 0;background-color:transparent;z-index:1000;";
150 this.element.id = "glass-pane"; 150 this.element.id = "glass-pane";
151 document.body.appendChild(this.element); 151 document.body.appendChild(this.element);
152 WebInspector._glassPane = this; 152 WebInspector._glassPane = this;
153 } 153 }
154 154
155 WebInspector.GlassPane.prototype = { 155 WebInspector.GlassPane.prototype = {
156 dispose: function() 156 dispose: function()
157 { 157 {
158 delete WebInspector._glassPane; 158 delete WebInspector._glassPane;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 // Need to check for null explicitly. 363 // Need to check for null explicitly.
364 if (number === null) 364 if (number === null)
365 return false; 365 return false;
366 366
367 replacementString = customNumberHandler ? customNumberHandler(prefix , number, suffix) : prefix + number + suffix; 367 replacementString = customNumberHandler ? customNumberHandler(prefix , number, suffix) : prefix + number + suffix;
368 } 368 }
369 } 369 }
370 370
371 if (replacementString) { 371 if (replacementString) {
372 var replacementTextNode = document.createTextNode(replacementString); 372 var replacementTextNode = createTextNode(replacementString);
373 373
374 wordRange.deleteContents(); 374 wordRange.deleteContents();
375 wordRange.insertNode(replacementTextNode); 375 wordRange.insertNode(replacementTextNode);
376 376
377 var finalSelectionRange = document.createRange(); 377 var finalSelectionRange = document.createRange();
378 finalSelectionRange.setStart(replacementTextNode, 0); 378 finalSelectionRange.setStart(replacementTextNode, 0);
379 finalSelectionRange.setEnd(replacementTextNode, replacementString.length ); 379 finalSelectionRange.setEnd(replacementTextNode, replacementString.length );
380 380
381 selection.removeAllRanges(); 381 selection.removeAllRanges();
382 selection.addRange(finalSelectionRange); 382 selection.addRange(finalSelectionRange);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 661
662 WebInspector.restoreFocusFromElement = function(element) 662 WebInspector.restoreFocusFromElement = function(element)
663 { 663 {
664 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement())) 664 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement()))
665 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()) ; 665 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()) ;
666 } 666 }
667 667
668 WebInspector.setToolbarColors = function(backgroundColor, color) 668 WebInspector.setToolbarColors = function(backgroundColor, color)
669 { 669 {
670 if (!WebInspector._themeStyleElement) { 670 if (!WebInspector._themeStyleElement) {
671 WebInspector._themeStyleElement = document.createElement("style"); 671 WebInspector._themeStyleElement = createElement("style");
672 document.head.appendChild(WebInspector._themeStyleElement); 672 document.head.appendChild(WebInspector._themeStyleElement);
673 } 673 }
674 var parsedColor = WebInspector.Color.parse(color); 674 var parsedColor = WebInspector.Color.parse(color);
675 var shadowColor = parsedColor ? parsedColor.invert().setAlpha(0.33).toString (WebInspector.Color.Format.RGBA) : "white"; 675 var shadowColor = parsedColor ? parsedColor.invert().setAlpha(0.33).toString (WebInspector.Color.Format.RGBA) : "white";
676 var prefix = WebInspector.isMac() ? "body:not(.undocked)" : ""; 676 var prefix = WebInspector.isMac() ? "body:not(.undocked)" : "";
677 WebInspector._themeStyleElement.textContent = 677 WebInspector._themeStyleElement.textContent =
678 String.sprintf( 678 String.sprintf(
679 "%s .toolbar-colors {\ 679 "%s .toolbar-colors {\
680 background-image: none !important;\ 680 background-image: none !important;\
681 background-color: %s !important;\ 681 background-color: %s !important;\
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 __proto__: WebInspector.Object.prototype 1071 __proto__: WebInspector.Object.prototype
1072 } 1072 }
1073 1073
1074 WebInspector.initializeUIUtils = function() 1074 WebInspector.initializeUIUtils = function()
1075 { 1075 {
1076 window.addEventListener("focus", WebInspector._windowFocused, false); 1076 window.addEventListener("focus", WebInspector._windowFocused, false);
1077 window.addEventListener("blur", WebInspector._windowBlurred, false); 1077 window.addEventListener("blur", WebInspector._windowBlurred, false);
1078 document.addEventListener("focus", WebInspector._focusChanged, true); 1078 document.addEventListener("focus", WebInspector._focusChanged, true);
1079 document.addEventListener("blur", WebInspector._documentBlurred, true); 1079 document.addEventListener("blur", WebInspector._documentBlurred, true);
1080 } 1080 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/TextPrompt.js ('k') | Source/devtools/front_end/ui/View.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698