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

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

Issue 663083004: [DevTools] Remove remaining usages of global properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed review comments 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 * @param {!Element} element 383 * @param {!Element} element
384 */ 384 */
385 setDefaultFocusedElement: function(element) 385 setDefaultFocusedElement: function(element)
386 { 386 {
387 this._defaultFocusedElement = element; 387 this._defaultFocusedElement = element;
388 }, 388 },
389 389
390 focus: function() 390 focus: function()
391 { 391 {
392 var element = this.defaultFocusedElement(); 392 var element = this.defaultFocusedElement();
393 if (!element || element.isAncestor(document.activeElement)) 393 if (!element || element.isAncestor(this.element.ownerDocument.activeElem ent))
394 return; 394 return;
395 395
396 WebInspector.setCurrentFocusElement(element); 396 WebInspector.setCurrentFocusElement(element);
397 }, 397 },
398 398
399 /** 399 /**
400 * @return {boolean} 400 * @return {boolean}
401 */ 401 */
402 hasFocus: function() 402 hasFocus: function()
403 { 403 {
404 var activeElement = document.activeElement; 404 var activeElement = this.element.ownerDocument.activeElement;
405 return activeElement && activeElement.isSelfOrDescendant(this.element); 405 return activeElement && activeElement.isSelfOrDescendant(this.element);
406 }, 406 },
407 407
408 /** 408 /**
409 * @return {!Size} 409 * @return {!Size}
410 */ 410 */
411 measurePreferredSize: function() 411 measurePreferredSize: function()
412 { 412 {
413 var document = this.element.ownerDocument;
413 WebInspector.View._originalAppendChild.call(document.body, this.element) ; 414 WebInspector.View._originalAppendChild.call(document.body, this.element) ;
414 this.element.positionAt(0, 0); 415 this.element.positionAt(0, 0);
415 var result = new Size(this.element.offsetWidth, this.element.offsetHeigh t); 416 var result = new Size(this.element.offsetWidth, this.element.offsetHeigh t);
416 this.element.positionAt(undefined, undefined); 417 this.element.positionAt(undefined, undefined);
417 WebInspector.View._originalRemoveChild.call(document.body, this.element) ; 418 WebInspector.View._originalRemoveChild.call(document.body, this.element) ;
418 return result; 419 return result;
419 }, 420 },
420 421
421 /** 422 /**
422 * @return {!Constraints} 423 * @return {!Constraints}
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 { 645 {
645 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t o remove element containing view via regular DOM operation"); 646 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t o remove element containing view via regular DOM operation");
646 return WebInspector.View._originalRemoveChild.call(this, child); 647 return WebInspector.View._originalRemoveChild.call(this, child);
647 } 648 }
648 649
649 Element.prototype.removeChildren = function() 650 Element.prototype.removeChildren = function()
650 { 651 {
651 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c ontaining view via regular DOM operation"); 652 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c ontaining view via regular DOM operation");
652 WebInspector.View._originalRemoveChildren.call(this); 653 WebInspector.View._originalRemoveChildren.call(this);
653 } 654 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/UIUtils.js ('k') | Source/devtools/front_end/ui/ViewportControl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698