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

Side by Side Diff: third_party/polymer/v1_0/components/paper-header-panel/paper-header-panel.html

Issue 1261403002: Add paper-menu-button and its dependencies to third_party/polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
6 Code distributed by Google as part of the polymer project is also 6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 --> 8 -->
9 9
10 <link rel="import" href="../polymer/polymer.html"> 10 <link rel="import" href="../polymer/polymer.html">
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 @group Paper Elements 109 @group Paper Elements
110 @element paper-header-panel 110 @element paper-header-panel
111 @demo demo/index.html 111 @demo demo/index.html
112 @hero hero.svg 112 @hero hero.svg
113 --> 113 -->
114 114
115 <dom-module id="paper-header-panel"> 115 <dom-module id="paper-header-panel">
116 116
117 <style> 117 <link rel="import" type="css" href="paper-header-panel.css">
118 :host {
119 @apply(--layout);
120 @apply(--layout-vertical);
121
122 display: block;
123 position: relative;
124 height: 100%;
125
126 /* Create a stack context, we will need it for the shadow*/
127 z-index: 0;
128 }
129
130 :root {
131 /**
132 * Default paper header panel shadow
133 */
134 --paper-header-panel-shadow: {
135 height: 6px;
136 bottom: -6px;
137 box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4);
138 };
139 }
140
141 #mainContainer {
142 @apply(--layout-flex);
143
144 position: relative;
145 overflow-y: auto;
146 overflow-x: hidden;
147 -webkit-overflow-scrolling: touch;
148 flex-basis: 0.0001px;
149 }
150
151 /*
152 * mode: scroll
153 */
154 :host([mode=scroll]) #mainContainer {
155 @apply(--paper-header-panel-scroll-container);
156 overflow: visible;
157 }
158
159 :host([mode=scroll]) {
160 overflow-y: auto;
161 overflow-x: hidden;
162 -webkit-overflow-scrolling: touch;
163 }
164
165 /*
166 * mode: cover
167 */
168 :host([mode=cover]) #mainContainer {
169 @apply(--paper-header-panel-cover-container);
170 position: absolute;
171 top: 0;
172 right: 0;
173 bottom: 0;
174 left: 0;
175 }
176
177 /*
178 * mode: standard
179 */
180 :host([mode=standard]) #mainContainer {
181 @apply(--paper-header-panel-standard-container);
182 }
183
184 /*
185 * mode: waterfall
186 */
187 :host([mode=waterfall]) #mainContainer {
188 @apply(--paper-header-panel-waterfall-container);
189 }
190
191 /*
192 * mode: waterfall-tall
193 */
194 :host([mode=waterfall-tall]) #mainContainer {
195 @apply(--paper-header-panel-waterfall-tall-container);
196 }
197
198 :host ::content paper-toolbar,
199 :host ::content .paper-header {
200 position: relative;
201 overflow: visible !important;
202 }
203
204 :host ::content paper-toolbar:after,
205 :host ::content .paper-header:after {
206 @apply(--paper-header-panel-shadow);
207
208 -webkit-transition: opacity 0.5s, -webkit-transform 0.5s;
209 transition: opacity 0.5s, transform 0.5s;
210
211 opacity: 0;
212 content: "";
213
214 width: 100%;
215 position: absolute;
216 left: 0px;
217 right: 0px;
218 z-index: 1;
219
220 -webkit-transform: scale3d(1, 0, 1);
221 -webkit-transform-origin: 0% 0%;
222
223 transform: scale3d(1, 0, 1);
224 transform-origin: 0% 0%;
225 }
226
227 :host ::content paper-toolbar.has-shadow:after,
228 :host ::content .paper-header.has-shadow:after {
229 opacity: 1;
230 -webkit-transform: scale3d(1, 1, 1);
231 transform: scale3d(1, 1, 1);
232 }
233 </style>
234 118
235 <template> 119 <template>
236 <content id="headerContent" select="paper-toolbar, .paper-header"></content> 120 <content id="headerContent" select="paper-toolbar, .paper-header"></content>
237 <div id="mainContainer" class$="[[_computeMainContainerClass(mode)]]"> 121
238 <content id="mainContent" select="*"></content> 122 <div id="mainPanel">
123 <div id="mainContainer" class$="[[_computeMainContainerClass(mode)]]">
124 <content id="mainContent" select="*"></content>
125 </div>
126 <div id="dropShadow"></div>
239 </div> 127 </div>
240 </template> 128 </template>
241 129
242 </dom-module> 130 </dom-module>
243 131
244 <script> 132 <script>
245 133
246 (function() { 134 (function() {
247 135
248 'use strict'; 136 'use strict';
249 137
250 var SHADOW_WHEN_SCROLLING = 1; 138 var SHADOW_WHEN_SCROLLING = 1;
251 var SHADOW_ALWAYS = 2; 139 var SHADOW_ALWAYS = 2;
252 140
253 141
254 var MODE_CONFIGS = { 142 var MODE_CONFIGS = {
255 143
256 outerScroll: { 144 outerScroll: {
257 scroll: true 145 'scroll': true
258 }, 146 },
259 147
260 shadowMode: { 148 shadowMode: {
261 standard: SHADOW_ALWAYS, 149 'standard': SHADOW_ALWAYS,
262 waterfall: SHADOW_WHEN_SCROLLING, 150 'waterfall': SHADOW_WHEN_SCROLLING,
263 'waterfall-tall': SHADOW_WHEN_SCROLLING 151 'waterfall-tall': SHADOW_WHEN_SCROLLING
264 }, 152 },
265 153
266 tallMode: { 154 tallMode: {
267 'waterfall-tall': true 155 'waterfall-tall': true
268 } 156 }
269 }; 157 };
270 158
271 Polymer({ 159 Polymer({
272 160
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return this._getScrollerForMode(this.mode); 281 return this._getScrollerForMode(this.mode);
394 }, 282 },
395 283
396 /** 284 /**
397 * Returns true if the scroller has a visible shadow. 285 * Returns true if the scroller has a visible shadow.
398 * 286 *
399 * @property visibleShadow 287 * @property visibleShadow
400 * @type Boolean 288 * @type Boolean
401 */ 289 */
402 get visibleShadow() { 290 get visibleShadow() {
403 return this.header.classList.contains('has-shadow'); 291 return this.$.dropShadow.classList.contains('has-shadow');
404 }, 292 },
405 293
406 _computeDropShadowHidden: function(atTop, mode, shadow) { 294 _computeDropShadowHidden: function(atTop, mode, shadow) {
407 295
408 var shadowMode = MODE_CONFIGS.shadowMode[mode]; 296 var shadowMode = MODE_CONFIGS.shadowMode[mode];
409 297
410 if (this.shadow) { 298 if (this.shadow) {
411 this.toggleClass('has-shadow', true, this.header); 299 this.toggleClass('has-shadow', true, this.$.dropShadow);
412 300
413 } else if (shadowMode === SHADOW_ALWAYS) { 301 } else if (shadowMode === SHADOW_ALWAYS) {
414 this.toggleClass('has-shadow', true, this.header); 302 this.toggleClass('has-shadow', true, this.$.dropShadow);
415 303
416 } else if (shadowMode === SHADOW_WHEN_SCROLLING && !atTop) { 304 } else if (shadowMode === SHADOW_WHEN_SCROLLING && !atTop) {
417 this.toggleClass('has-shadow', true, this.header); 305 this.toggleClass('has-shadow', true, this.$.dropShadow);
418 306
419 } else { 307 } else {
420 this.toggleClass('has-shadow', false, this.header); 308 this.toggleClass('has-shadow', false, this.$.dropShadow);
421 309
422 } 310 }
423 }, 311 },
424 312
425 _computeMainContainerClass: function(mode) { 313 _computeMainContainerClass: function(mode) {
426 // TODO: It will be useful to have a utility for classes 314 // TODO: It will be useful to have a utility for classes
427 // e.g. Polymer.Utils.classes({ foo: true }); 315 // e.g. Polymer.Utils.classes({ foo: true });
428 316
429 var classes = {}; 317 var classes = {};
430 318
(...skipping 26 matching lines...) Expand all
457 this.async(function() { 345 this.async(function() {
458 header.classList.remove('animate'); 346 header.classList.remove('animate');
459 }, animateDuration); 347 }, animateDuration);
460 } else { 348 } else {
461 header.classList.toggle('animate', configs.tallMode[newMode]); 349 header.classList.toggle('animate', configs.tallMode[newMode]);
462 } 350 }
463 } 351 }
464 this._keepScrollingState(); 352 this._keepScrollingState();
465 }, 353 },
466 354
467 _keepScrollingState: function () { 355 _keepScrollingState: function() {
468 var main = this.scroller; 356 var main = this.scroller;
469 var header = this.header; 357 var header = this.header;
470 358
471 this._setAtTop(main.scrollTop === 0); 359 this._setAtTop(main.scrollTop === 0);
472 360
473 if (header && MODE_CONFIGS.tallMode[this.mode]) { 361 if (header && this.tallClass && MODE_CONFIGS.tallMode[this.mode]) {
474 this.toggleClass(this.tallClass, this.atTop || 362 this.toggleClass(this.tallClass, this.atTop ||
475 header.classList.contains(this.tallClass) && 363 header.classList.contains(this.tallClass) &&
476 main.scrollHeight < this.offsetHeight, header); 364 main.scrollHeight < this.offsetHeight, header);
477 } 365 }
478 }, 366 },
479 367
480 _scroll: function(e) { 368 _scroll: function() {
481 this._keepScrollingState(); 369 this._keepScrollingState();
482 this.fire('content-scroll', {target: this.scroller}, {bubbles: false}); 370 this.fire('content-scroll', {target: this.scroller}, {bubbles: false});
483 }, 371 },
484 372
485 _getScrollerForMode: function(mode) { 373 _getScrollerForMode: function(mode) {
486 return MODE_CONFIGS.outerScroll[mode] ? 374 return MODE_CONFIGS.outerScroll[mode] ?
487 this : this.$.mainContainer; 375 this : this.$.mainContainer;
488 } 376 }
489 377
490 }); 378 });
491 379
492 })(); 380 })();
493 381
494 </script> 382 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698