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

Unified Diff: third_party/polymer/v1_0/components/iron-behaviors/iron-button-state.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, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components/iron-behaviors/iron-button-state.html
diff --git a/third_party/polymer/v1_0/components/iron-behaviors/iron-button-state.html b/third_party/polymer/v1_0/components/iron-behaviors/iron-button-state.html
index fc52e172f920d899737e5800564b8730cff3764e..11c03d76b2fc7dde0e1cd3e5e7a489dc37687360 100644
--- a/third_party/polymer/v1_0/components/iron-behaviors/iron-button-state.html
+++ b/third_party/polymer/v1_0/components/iron-behaviors/iron-button-state.html
@@ -91,6 +91,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'space:keyup': '_spaceKeyUpHandler',
},
+ _mouseEventRe: /^mouse/,
+
_tapHandler: function() {
if (this.toggles) {
// a tap is needed to toggle the active state
@@ -111,7 +113,33 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this.fire('change');
},
- _downHandler: function() {
+ _eventSourceIsPrimaryInput: function(event) {
+ event = event.detail.sourceEvent || event;
+
+ // Always true for non-mouse events....
+ if (!this._mouseEventRe.test(event.type)) {
+ return true;
+ }
+
+ // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
+ if ('buttons' in event) {
+ return event.buttons === 1;
+ }
+
+ // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which
+ if (typeof event.which === 'number') {
+ return event.which < 2;
+ }
+
+ // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
+ return event.button < 1;
+ },
+
+ _downHandler: function(event) {
+ if (!this._eventSourceIsPrimaryInput(event)) {
+ return;
+ }
+
this._setPointerDown(true);
this._setPressed(true);
this._setReceivedFocusFromKeyboard(false);

Powered by Google App Engine
This is Rietveld 408576698