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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-control-state-extracted.js

Issue 1187823002: Update Polymer components and re-run reproduce.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 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-chromium/iron-behaviors/iron-control-state-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-control-state-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-control-state-extracted.js
index 5e4ed8e997f3938af333cfd74d64a84eb7f9fbf3..d84e4eeda12c65b8e070b4578d315059b27a1e72 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-control-state-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-behaviors/iron-control-state-extracted.js
@@ -1,17 +1,15 @@
- /** @polymerBehavior */
-
+ /**
+ * @demo demo/index.html
+ * @polymerBehavior
+ */
Polymer.IronControlState = {
properties: {
/**
* If true, the element currently has focus.
- *
- * @attribute focused
- * @type boolean
- * @default false
*/
focused: {
type: Boolean,
@@ -23,10 +21,6 @@
/**
* If true, the user cannot interact with this element.
- *
- * @attribute disabled
- * @type boolean
- * @default false
*/
disabled: {
type: Boolean,
@@ -38,32 +32,44 @@
_oldTabIndex: {
type: Number
+ },
+
+ _boundFocusBlurHandler: {
+ type: Function,
+ value: function() {
+ return this._focusBlurHandler.bind(this);
+ }
}
+
},
observers: [
'_changedControlState(focused, disabled)'
],
- listeners: {
- focus: '_focusHandler',
- blur: '_blurHandler'
- },
-
ready: function() {
// TODO(sjmiles): ensure read-only property is valued so the compound
// observer will fire
if (this.focused === undefined) {
this._setFocused(false);
}
+ this.addEventListener('focus', this._boundFocusBlurHandler, true);
+ this.addEventListener('blur', this._boundFocusBlurHandler, true);
},
- _focusHandler: function() {
- this._setFocused(true);
- },
-
- _blurHandler: function() {
- this._setFocused(false);
+ _focusBlurHandler: function(event) {
+ var target = event.path ? event.path[0] : event.target;
+ if (target === this) {
+ var focused = event.type === 'focus';
+ this._setFocused(focused);
+ } else if (!this.shadowRoot) {
+ event.stopPropagation();
+ this.fire(event.type, {sourceEvent: event}, {
+ node: this,
+ bubbles: event.bubbles,
+ cancelable: event.cancelable
+ });
+ }
},
_disabledChanged: function(disabled, old) {

Powered by Google App Engine
This is Rietveld 408576698