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

Side by Side Diff: polymer_0.5.0/bower_components/paper-button/paper-button-base.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 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 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. 2 Copyright (c) 2014 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 <!-- 10 <!--
11 @group Paper Elements 11 @group Paper Elements
12 12
13 `paper-button-base` is the base class for button-like elements with ripple and o ptional shadow. 13 `paper-button-base` is the base class for button-like elements with ripple and o ptional shadow.
14 14
15 @element paper-button-base 15 @element paper-button-base
16 @extends paper-focusable 16 @mixins Polymer.CoreFocusable
17 @status unstable 17 @status unstable
18 --> 18 -->
19 19
20 <link href="../polymer/polymer.html" rel="import"> 20 <link href="../polymer/polymer.html" rel="import">
21 <link href="../paper-focusable/paper-focusable.html" rel="import"> 21 <link href="../core-focusable/core-focusable.html" rel="import">
22 <link href="../paper-ripple/paper-ripple.html" rel="import">
22 23
23 <polymer-element name="paper-button-base" extends="paper-focusable"> 24 <polymer-element name="paper-button-base" tabindex="0">
24 25
25 <script> 26 <script>
26 Polymer({
27 27
28 z: 1, 28 (function() {
29
30 var p = {
31
32 eventDelegates: {
33 down: 'downAction'
34 },
29 35
30 activeChanged: function() { 36 activeChanged: function() {
31 this.super(); 37 this.super();
32 38
33 if (this.active) { 39 if (this.$.ripple) {
34 // FIXME: remove when paper-ripple can have a default 'down' state. 40 if (this.active) {
35 if (!this.lastEvent) { 41 // FIXME: remove when paper-ripple can have a default 'down' state.
36 var rect = this.getBoundingClientRect(); 42 if (!this.lastEvent) {
37 this.lastEvent = { 43 var rect = this.getBoundingClientRect();
38 x: rect.left + rect.width / 2, 44 this.lastEvent = {
39 y: rect.top + rect.height / 2 45 x: rect.left + rect.width / 2,
46 y: rect.top + rect.height / 2
47 }
40 } 48 }
49 this.$.ripple.downAction(this.lastEvent);
50 } else {
51 this.$.ripple.upAction();
41 } 52 }
42 this.$.ripple.downAction(this.lastEvent);
43 } else {
44 this.$.ripple.upAction();
45 } 53 }
54
46 this.adjustZ(); 55 this.adjustZ();
47 }, 56 },
48 57
49 disabledChanged: function() { 58 disabledChanged: function() {
50 this.super(); 59 this._disabledChanged();
51 if (this.disabled) {
52 this.setAttribute('aria-disabled', '');
53 } else {
54 this.removeAttribute('aria-disabled');
55 }
56 this.adjustZ(); 60 this.adjustZ();
57 }, 61 },
58 62
59 recenteringTouchChanged: function() { 63 recenteringTouchChanged: function() {
60 if (this.$.ripple) { 64 if (this.$.ripple) {
61 this.$.ripple.classList.toggle('recenteringTouch', this.recenteringTou ch); 65 this.$.ripple.classList.toggle('recenteringTouch', this.recenteringTou ch);
62 } 66 }
63 }, 67 },
64 68
65 fillChanged: function() { 69 fillChanged: function() {
66 if (this.$.ripple) { 70 if (this.$.ripple) {
67 this.$.ripple.classList.toggle('fill', this.fill); 71 this.$.ripple.classList.toggle('fill', this.fill);
68 } 72 }
69 }, 73 },
70 74
71 adjustZ: function() { 75 adjustZ: function() {
76 if (!this.$.shadow) {
77 return;
78 }
72 if (this.active) { 79 if (this.active) {
73 this.z = 2; 80 this.$.shadow.setZ(2);
74 } else if (this.disabled) { 81 } else if (this.disabled) {
75 this.z = 0; 82 this.$.shadow.setZ(0);
76 } else { 83 } else {
77 this.z = 1; 84 this.$.shadow.setZ(1);
78 } 85 }
79 }, 86 },
80 87
81 downAction: function(e) { 88 downAction: function(e) {
82 this.super(e); 89 this._downAction();
90
91 if (this.hasAttribute('noink')) {
92 return;
93 }
94
83 this.lastEvent = e; 95 this.lastEvent = e;
84 if (!this.$.ripple) { 96 if (!this.$.ripple) {
85 var ripple = document.createElement('paper-ripple'); 97 var ripple = document.createElement('paper-ripple');
86 ripple.setAttribute('id', 'ripple'); 98 ripple.setAttribute('id', 'ripple');
87 ripple.setAttribute('fit', ''); 99 ripple.setAttribute('fit', '');
88 if (this.recenteringTouch) { 100 if (this.recenteringTouch) {
89 ripple.classList.add('recenteringTouch'); 101 ripple.classList.add('recenteringTouch');
90 } 102 }
91 if (!this.fill) { 103 if (!this.fill) {
92 ripple.classList.add('circle'); 104 ripple.classList.add('circle');
93 } 105 }
94 this.$.ripple = ripple; 106 this.$.ripple = ripple;
95 this.shadowRoot.insertBefore(ripple, this.shadowRoot.firstChild); 107 this.shadowRoot.insertBefore(ripple, this.shadowRoot.firstChild);
96 // No need to forward the event to the ripple because the ripple 108 // No need to forward the event to the ripple because the ripple
97 // is triggered in activeChanged 109 // is triggered in activeChanged
98 } 110 }
99 } 111 }
100 112
101 }); 113 };
102 </script> 114
115 Polymer.mixin2(p, Polymer.CoreFocusable);
116 Polymer(p);
117
118 })();
119
120 </script>
103 </polymer-element> 121 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698