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

Side by Side Diff: polymer_1.2.3/bower_components/iron-image/iron-image.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
11 <link rel="import" href="../polymer/polymer.html"> 11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> 12 <link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
13 13
14 <!-- 14 <!--
15 `iron-image` is an element for displaying an image that provides useful sizing a nd 15 `iron-image` is an element for displaying an image that provides useful sizing a nd
16 preloading options not found on the standard `<img>` tag. 16 preloading options not found on the standard `<img>` tag.
17 17
18 The `sizing` option allows the image to be either cropped (`cover`) or 18 The `sizing` option allows the image to be either cropped (`cover`) or
19 letterboxed (`contain`) to fill a fixed user-size placed on the element. 19 letterboxed (`contain`) to fill a fixed user-size placed on the element.
20 20
21 The `preload` option prevents the browser from rendering the image until the 21 The `preload` option prevents the browser from rendering the image until the
22 image is fully loaded. In the interim, either the element's CSS `background-col or` 22 image is fully loaded. In the interim, either the element's CSS `background-col or`
(...skipping 28 matching lines...) Expand all
51 Will show a base-64 encoded placeholder image until the image loads: 51 Will show a base-64 encoded placeholder image until the image loads:
52 52
53 <iron-image style="width:400px; height:400px;" placeholder="data:image/gif;b ase64,..." 53 <iron-image style="width:400px; height:400px;" placeholder="data:image/gif;b ase64,..."
54 sizing="cover" preload src="http://lorempixel.com/600/400"></iron-image> 54 sizing="cover" preload src="http://lorempixel.com/600/400"></iron-image>
55 55
56 Will fade the light-gray background out once the image is loaded: 56 Will fade the light-gray background out once the image is loaded:
57 57
58 <iron-image style="width:400px; height:400px; background-color: lightgray;" 58 <iron-image style="width:400px; height:400px; background-color: lightgray;"
59 sizing="cover" preload fade src="http://lorempixel.com/600/400"></iron-ima ge> 59 sizing="cover" preload fade src="http://lorempixel.com/600/400"></iron-ima ge>
60 60
61 Custom property | Description | Default
62 ----------------|-------------|----------
63 `--iron-image-placeholder` | Mixin applied to #placeholder | `{}`
64 `--iron-image-width` | Sets the width of the wrapped image | `auto`
65 `--iron-image-height` | Sets the height of the wrapped image | `auto`
61 66
62 @group Iron Elements 67 @group Iron Elements
63 @element iron-image 68 @element iron-image
64 @demo demo/index.html 69 @demo demo/index.html
65 --> 70 -->
66 71
67 <dom-module id="iron-image"> 72 <dom-module id="iron-image">
68 73
69 <style> 74 <style>
70 75
71 :host { 76 :host {
72 display: inline-block; 77 display: inline-block;
73 overflow: hidden; 78 overflow: hidden;
74 position: relative; 79 position: relative;
75 } 80 }
76 81
82 #img {
83 display: block;
84 width: var(--iron-image-width, auto);
85 height: var(--iron-image-height, auto);
86 }
87
77 :host([sizing]) #img { 88 :host([sizing]) #img {
78 display: none; 89 display: none;
79 } 90 }
80 91
81 #placeholder { 92 #placeholder {
82 background-color: inherit; 93 background-color: inherit;
83 opacity: 1; 94 opacity: 1;
95 @apply(--layout-fit);
96 @apply(--iron-image-placeholder);
84 } 97 }
85 98
86 #placeholder.faded-out { 99 #placeholder.faded-out {
87 transition: opacity 0.5s linear; 100 transition: opacity 0.5s linear;
88 opacity: 0; 101 opacity: 0;
89 } 102 }
90 103
91 </style> 104 </style>
92 105
93 <template> 106 <template>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 * aspect ratio of the image is contained within the element and 144 * aspect ratio of the image is contained within the element and
132 * letterboxed) or `cover` (image is cropped in order to fully cover the 145 * letterboxed) or `cover` (image is cropped in order to fully cover the
133 * bounds of the element), or `null` (default: image takes natural size). 146 * bounds of the element), or `null` (default: image takes natural size).
134 */ 147 */
135 sizing: { 148 sizing: {
136 type: String, 149 type: String,
137 value: null 150 value: null
138 }, 151 },
139 152
140 /** 153 /**
141 * When a sizing option is uzed (`cover` or `contain`), this determines 154 * When a sizing option is used (`cover` or `contain`), this determines
142 * how the image is aligned within the element bounds. 155 * how the image is aligned within the element bounds.
143 */ 156 */
144 position: { 157 position: {
145 type: String, 158 type: String,
146 value: 'center' 159 value: 'center'
147 }, 160 },
148 161
149 /** 162 /**
150 * When `true`, any change to the `src` property will cause the `placehold er` 163 * When `true`, any change to the `src` property will cause the `placehold er`
151 * image to be shown until the 164 * image to be shown until the new image has loaded.
152 */ 165 */
153 preload: { 166 preload: {
154 type: Boolean, 167 type: Boolean,
155 value: false 168 value: false
156 }, 169 },
157 170
158 /** 171 /**
159 * This image will be used as a background/placeholder until the src image has 172 * This image will be used as a background/placeholder until the src image has
160 * loaded. Use of a data-URI for placeholder is encouraged for instant re ndering. 173 * loaded. Use of a data-URI for placeholder is encouraged for instant re ndering.
161 */ 174 */
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 265
253 _computePlaceholderVisibility: function() { 266 _computePlaceholderVisibility: function() {
254 return !this.preload || (this.loaded && !this.fade); 267 return !this.preload || (this.loaded && !this.fade);
255 }, 268 },
256 269
257 _computePlaceholderClassName: function() { 270 _computePlaceholderClassName: function() {
258 if (!this.preload) { 271 if (!this.preload) {
259 return ''; 272 return '';
260 } 273 }
261 274
262 var className = 'fit';
263 if (this.loaded && this.fade) { 275 if (this.loaded && this.fade) {
264 className += ' faded-out'; 276 return 'faded-out';
265 } 277 }
266 return className; 278
279 return '';
267 }, 280 },
268 281
269 _computePlaceholderBackgroundUrl: function() { 282 _computePlaceholderBackgroundUrl: function() {
270 if (this.preload && this.placeholder) { 283 if (this.preload && this.placeholder) {
271 return 'url(' + this.placeholder + ')'; 284 return 'url(' + this.placeholder + ')';
272 } 285 }
273 286
274 return null; 287 return null;
275 }, 288 },
276 289
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 358
346 if (this.sizing) { 359 if (this.sizing) {
347 this.style.backgroundImage = this.src ? 'url(' + this.src + ')': ''; 360 this.style.backgroundImage = this.src ? 'url(' + this.src + ')': '';
348 } else { 361 } else {
349 this.$.img.src = this.src || ''; 362 this.$.img.src = this.src || '';
350 } 363 }
351 } 364 }
352 }); 365 });
353 366
354 </script> 367 </script>
OLDNEW
« no previous file with comments | « polymer_1.2.3/bower_components/iron-image/index.html ('k') | polymer_1.2.3/bower_components/iron-image/test/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698