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

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

Issue 663083004: [DevTools] Remove remaining usages of global properties. (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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 { 85 {
86 if (this._disposed) 86 if (this._disposed)
87 return; 87 return;
88 this.contentElement = contentElement; 88 this.contentElement = contentElement;
89 89
90 // This should not happen, but we hide previous popup to be on the safe side. 90 // This should not happen, but we hide previous popup to be on the safe side.
91 if (WebInspector.Popover._popover) 91 if (WebInspector.Popover._popover)
92 WebInspector.Popover._popover.hide(); 92 WebInspector.Popover._popover.hide();
93 WebInspector.Popover._popover = this; 93 WebInspector.Popover._popover = this;
94 94
95 var document = anchor instanceof AnchorBox ? contentElement.ownerDocumen t : anchor.ownerDocument;
apavlov 2014/10/21 15:15:38 The inverted check would be a lot more readable:
dgozman 2014/10/22 08:04:03 Done.
96 var window = document.defaultView;
97
95 // Temporarily attach in order to measure preferred dimensions. 98 // Temporarily attach in order to measure preferred dimensions.
96 var preferredSize = view ? view.measurePreferredSize() : this.contentEle ment.measurePreferredSize(); 99 var preferredSize = view ? view.measurePreferredSize() : this.contentEle ment.measurePreferredSize();
97 preferredWidth = preferredWidth || preferredSize.width; 100 preferredWidth = preferredWidth || preferredSize.width;
98 preferredHeight = preferredHeight || preferredSize.height; 101 preferredHeight = preferredHeight || preferredSize.height;
99 102
100 window.addEventListener("resize", this._hideBound, false); 103 window.addEventListener("resize", this._hideBound, false);
101 document.body.appendChild(this._containerElement); 104 document.body.appendChild(this._containerElement);
102 WebInspector.View.prototype.show.call(this, this._containerElement); 105 WebInspector.View.prototype.show.call(this, this._containerElement);
103 106
104 if (view) 107 if (view)
105 view.show(this._contentDiv); 108 view.show(this._contentDiv);
106 else 109 else
107 this._contentDiv.appendChild(this.contentElement); 110 this._contentDiv.appendChild(this.contentElement);
108 111
109 this._positionElement(anchor, preferredWidth, preferredHeight, arrowDire ction); 112 this._positionElement(anchor, preferredWidth, preferredHeight, arrowDire ction);
110 113
111 if (this._popoverHelper) { 114 if (this._popoverHelper) {
112 this._contentDiv.addEventListener("mousemove", this._popoverHelper._ killHidePopoverTimer.bind(this._popoverHelper), true); 115 this._contentDiv.addEventListener("mousemove", this._popoverHelper._ killHidePopoverTimer.bind(this._popoverHelper), true);
113 this.element.addEventListener("mouseout", this._popoverHelper._popov erMouseOut.bind(this._popoverHelper), true); 116 this.element.addEventListener("mouseout", this._popoverHelper._popov erMouseOut.bind(this._popoverHelper), true);
114 } 117 }
115 }, 118 },
116 119
117 hide: function() 120 hide: function()
118 { 121 {
119 window.removeEventListener("resize", this._hideBound, false); 122 this._containerElement.ownerDocument.defaultView.removeEventListener("re size", this._hideBound, false);
120 this.detach(); 123 this.detach();
121 this._containerElement.remove(); 124 this._containerElement.remove();
122 delete WebInspector.Popover._popover; 125 delete WebInspector.Popover._popover;
123 }, 126 },
124 127
125 get disposed() 128 get disposed()
126 { 129 {
127 return this._disposed; 130 return this._disposed;
128 }, 131 },
129 132
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 this._resetHoverTimer(); 400 this._resetHoverTimer();
398 } 401 }
399 } 402 }
400 } 403 }
401 404
402 /** @enum {string} */ 405 /** @enum {string} */
403 WebInspector.Popover.Orientation = { 406 WebInspector.Popover.Orientation = {
404 Top: "top", 407 Top: "top",
405 Bottom: "bottom" 408 Bottom: "bottom"
406 } 409 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698