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

Side by Side Diff: polymer_1.2.3/bower_components/iron-fit-behavior/iron-fit-behavior.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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
OLDNEW
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --> 9 -->
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 get _fitHeight() { 84 get _fitHeight() {
85 var fitHeight; 85 var fitHeight;
86 if (this.fitInto === window) { 86 if (this.fitInto === window) {
87 fitHeight = this.fitInto.innerHeight; 87 fitHeight = this.fitInto.innerHeight;
88 } else { 88 } else {
89 fitHeight = this.fitInto.getBoundingClientRect().height; 89 fitHeight = this.fitInto.getBoundingClientRect().height;
90 } 90 }
91 return fitHeight; 91 return fitHeight;
92 }, 92 },
93 93
94 get _fitLeft() {
95 var fitLeft;
96 if (this.fitInto === window) {
97 fitLeft = 0;
98 } else {
99 fitLeft = this.fitInto.getBoundingClientRect().left;
100 }
101 return fitLeft;
102 },
103
104 get _fitTop() {
105 var fitTop;
106 if (this.fitInto === window) {
107 fitTop = 0;
108 } else {
109 fitTop = this.fitInto.getBoundingClientRect().top;
110 }
111 return fitTop;
112 },
113
94 attached: function() { 114 attached: function() {
95 if (this.autoFitOnAttach) { 115 if (this.autoFitOnAttach) {
96 if (window.getComputedStyle(this).display === 'none') { 116 if (window.getComputedStyle(this).display === 'none') {
97 setTimeout(function() { 117 setTimeout(function() {
98 this.fit(); 118 this.fit();
99 }.bind(this)); 119 }.bind(this));
100 } else { 120 } else {
101 this.fit(); 121 this.fit();
102 } 122 }
103 } 123 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 */ 200 */
181 constrain: function() { 201 constrain: function() {
182 var info = this._fitInfo; 202 var info = this._fitInfo;
183 // position at (0px, 0px) if not already positioned, so we can measure the natural size. 203 // position at (0px, 0px) if not already positioned, so we can measure the natural size.
184 if (!this._fitInfo.positionedBy.vertically) { 204 if (!this._fitInfo.positionedBy.vertically) {
185 this.style.top = '0px'; 205 this.style.top = '0px';
186 } 206 }
187 if (!this._fitInfo.positionedBy.horizontally) { 207 if (!this._fitInfo.positionedBy.horizontally) {
188 this.style.left = '0px'; 208 this.style.left = '0px';
189 } 209 }
210 if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy. horizontally) {
211 // need position:fixed to properly size the element
212 this.style.position = 'fixed';
213 }
190 // need border-box for margin/padding 214 // need border-box for margin/padding
191 this.sizingTarget.style.boxSizing = 'border-box'; 215 this.sizingTarget.style.boxSizing = 'border-box';
192 // constrain the width and height if not already set 216 // constrain the width and height if not already set
193 var rect = this.getBoundingClientRect(); 217 var rect = this.getBoundingClientRect();
194 if (!info.sizedBy.height) { 218 if (!info.sizedBy.height) {
195 this._sizeDimension(rect, info.positionedBy.vertically, 'top', 'bottom', 'Height'); 219 this._sizeDimension(rect, info.positionedBy.vertically, 'top', 'bottom', 'Height');
196 } 220 }
197 if (!info.sizedBy.width) { 221 if (!info.sizedBy.width) {
198 this._sizeDimension(rect, info.positionedBy.horizontally, 'left', 'right ', 'Width'); 222 this._sizeDimension(rect, info.positionedBy.horizontally, 'left', 'right ', 'Width');
199 } 223 }
(...skipping 13 matching lines...) Expand all
213 /** 237 /**
214 * Centers horizontally and vertically if not already positioned. This also sets 238 * Centers horizontally and vertically if not already positioned. This also sets
215 * `position:fixed`. 239 * `position:fixed`.
216 */ 240 */
217 center: function() { 241 center: function() {
218 if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy. horizontally) { 242 if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy. horizontally) {
219 // need position:fixed to center 243 // need position:fixed to center
220 this.style.position = 'fixed'; 244 this.style.position = 'fixed';
221 } 245 }
222 if (!this._fitInfo.positionedBy.vertically) { 246 if (!this._fitInfo.positionedBy.vertically) {
223 var top = (this._fitHeight - this.offsetHeight) / 2; 247 var top = (this._fitHeight - this.offsetHeight) / 2 + this._fitTop;
224 top -= this._fitInfo.margin.top; 248 top -= this._fitInfo.margin.top;
225 this.style.top = top + 'px'; 249 this.style.top = top + 'px';
226 } 250 }
227 if (!this._fitInfo.positionedBy.horizontally) { 251 if (!this._fitInfo.positionedBy.horizontally) {
228 var left = (this._fitWidth - this.offsetWidth) / 2; 252 var left = (this._fitWidth - this.offsetWidth) / 2 + this._fitLeft;
229 left -= this._fitInfo.margin.left; 253 left -= this._fitInfo.margin.left;
230 this.style.left = left + 'px'; 254 this.style.left = left + 'px';
231 } 255 }
232 } 256 }
233 257
234 }; 258 };
235 259
236 </script> 260 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698