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

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

Issue 1082403004: Import Polymer 0.8 and several key elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also remove polymer/explainer Created 5 years, 8 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/v0_8/components-chromium/iron-behaviors/iron-control-state-extracted.js
diff --git a/third_party/polymer/v0_8/components-chromium/iron-behaviors/iron-control-state-extracted.js b/third_party/polymer/v0_8/components-chromium/iron-behaviors/iron-control-state-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e09eeae37d713504a6d2029cc8bf6acbffe1b1f
--- /dev/null
+++ b/third_party/polymer/v0_8/components-chromium/iron-behaviors/iron-control-state-extracted.js
@@ -0,0 +1,87 @@
+
+
+ Polymer.IronControlState = {
+
+ properties: {
+
+ /**
+ * If true, the element currently has focus.
+ *
+ * @attribute focused
+ * @type boolean
+ * @default false
+ */
+ focused: {
+ type: Boolean,
+ value: false,
+ notify: true,
+ readOnly: true,
+ reflectToAttribute: true
+ },
+
+ /**
+ * If true, the user cannot interact with this element.
+ *
+ * @attribute disabled
+ * @type boolean
+ * @default false
+ */
+ disabled: {
+ type: Boolean,
+ value: false,
+ notify: true,
+ observer: '_disabledChanged',
+ reflectToAttribute: true
+ },
+
+ _oldTabIndex: {
+ type: String
+ }
+ },
+
+ 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);
+ }
+ },
+
+ _focusHandler: function() {
+ this._setFocused(true);
+ },
+
+ _blurHandler: function() {
+ this._setFocused(false);
+ },
+
+ _disabledChanged: function(disabled, old) {
+ this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
+ this.style.pointerEvents = disabled ? 'none' : '';
+ if (disabled) {
+ this._oldTabIndex = this.tabIndex;
+ this.focused = false;
+ this.tabIndex = -1;
+ } else if (this._oldTabIndex !== undefined) {
+ this.tabIndex = this._oldTabIndex;
+ }
+ },
+
+ _changedControlState: function() {
+ // _controlStateChanged is abstract, follow-on behaviors may implement it
+ if (this._controlStateChanged) {
+ this._controlStateChanged();
+ }
+ }
+
+ };
+

Powered by Google App Engine
This is Rietveld 408576698