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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/paper-behaviors/paper-ripple-behavior-extracted.js

Issue 1468623004: Update Polymer from 1.2.1 -> 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@travis-yml
Patch Set: local-state.html Created 5 years 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 * `Polymer.PaperRippleBehavior` dynamically implements a ripple 2 * `Polymer.PaperRippleBehavior` dynamically implements a ripple
3 * when the element has focus via pointer or keyboard. 3 * when the element has focus via pointer or keyboard.
4 * 4 *
5 * NOTE: This behavior is intended to be used in conjunction with and after 5 * NOTE: This behavior is intended to be used in conjunction with and after
6 * `Polymer.IronButtonState` and `Polymer.IronControlState`. 6 * `Polymer.IronButtonState` and `Polymer.IronControlState`.
7 * 7 *
8 * @polymerBehavior Polymer.PaperRippleBehavior 8 * @polymerBehavior Polymer.PaperRippleBehavior
9 */ 9 */
10 Polymer.PaperRippleBehavior = { 10 Polymer.PaperRippleBehavior = {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 _downHandler: function(event) { 44 _downHandler: function(event) {
45 Polymer.IronButtonStateImpl._downHandler.call(this, event); 45 Polymer.IronButtonStateImpl._downHandler.call(this, event);
46 if (this.pressed) { 46 if (this.pressed) {
47 this.ensureRipple(event); 47 this.ensureRipple(event);
48 } 48 }
49 }, 49 },
50 50
51 /** 51 /**
52 * Ensures this element contains a ripple effect. For startup efficiency 52 * Ensures this element contains a ripple effect. For startup efficiency
53 * the ripple effect is dynamically on demand when needed. 53 * the ripple effect is dynamically on demand when needed.
54 * @param {!Event=} opt_triggeringEvent (optional) event that triggered the 54 * @param {!Event=} optTriggeringEvent (optional) event that triggered the
55 * ripple. 55 * ripple.
56 */ 56 */
57 ensureRipple: function(opt_triggeringEvent) { 57 ensureRipple: function(optTriggeringEvent) {
58 if (!this.hasRipple()) { 58 if (!this.hasRipple()) {
59 this._ripple = this._createRipple(); 59 this._ripple = this._createRipple();
60 this._ripple.noink = this.noink; 60 this._ripple.noink = this.noink;
61 var rippleContainer = this._rippleContainer || this.root; 61 var rippleContainer = this._rippleContainer || this.root;
62 if (rippleContainer) { 62 if (rippleContainer) {
63 Polymer.dom(rippleContainer).appendChild(this._ripple); 63 Polymer.dom(rippleContainer).appendChild(this._ripple);
64 } 64 }
65 var domContainer = rippleContainer === this.shadyRoot ? this : 65 if (optTriggeringEvent) {
66 rippleContainer; 66 // Check if the event happened inside of the ripple container
67 if (opt_triggeringEvent) { 67 // Fall back to host instead of the root because distributed text
68 var target = opt_triggeringEvent.target; 68 // nodes are not valid event targets
69 if (domContainer.contains(/** @type {Node} */(target))) { 69 var domContainer = Polymer.dom(this._rippleContainer || this);
70 this._ripple.uiDownAction(opt_triggeringEvent); 70 var target = Polymer.dom(optTriggeringEvent).rootTarget;
71 if (domContainer.deepContains( /** @type {Node} */(target))) {
72 this._ripple.uiDownAction(optTriggeringEvent);
71 } 73 }
72 } 74 }
73 } 75 }
74 }, 76 },
75 77
76 /** 78 /**
77 * Returns the `<paper-ripple>` element used by this element to create 79 * Returns the `<paper-ripple>` element used by this element to create
78 * ripple effects. The element's ripple is created on demand, when 80 * ripple effects. The element's ripple is created on demand, when
79 * necessary, and calling this method will force the 81 * necessary, and calling this method will force the
80 * ripple to be created. 82 * ripple to be created.
(...skipping 21 matching lines...) Expand all
102 document.createElement('paper-ripple')); 104 document.createElement('paper-ripple'));
103 }, 105 },
104 106
105 _noinkChanged: function(noink) { 107 _noinkChanged: function(noink) {
106 if (this.hasRipple()) { 108 if (this.hasRipple()) {
107 this._ripple.noink = noink; 109 this._ripple.noink = noink;
108 } 110 }
109 } 111 }
110 112
111 }; 113 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698