Commit ac0bacff authored by yukishiino's avatar yukishiino Committed by Commit bot

Fixes wrong inheritance of PrefSelect.

PrefSelect must inherit from HTMLSelectElement, otherwise it will be
broken when the DOM attributes are moved to prototype chains.

Note that HTMLSelectElement does NOT inherit from HTMLInputElement, so
it's simply wrong that PrefSelect inherits from HTMLInputElement.

BUG=43394

Review URL: https://codereview.chromium.org/1061263004

Cr-Commit-Position: refs/heads/master@{#327023}
parent 8d080c8e
...@@ -390,7 +390,13 @@ cr.define('options', function() { ...@@ -390,7 +390,13 @@ cr.define('options', function() {
PrefSelect.prototype = { PrefSelect.prototype = {
// Set up the prototype chain // Set up the prototype chain
__proto__: PrefInputElement.prototype, __proto__: HTMLSelectElement.prototype,
/** @override */
decorate: PrefInputElement.prototype.decorate,
/** @override */
handleChange: PrefInputElement.prototype.handleChange,
/** /**
* Update the associated pref when when the user selects an item. * Update the associated pref when when the user selects an item.
...@@ -449,8 +455,47 @@ cr.define('options', function() { ...@@ -449,8 +455,47 @@ cr.define('options', function() {
if (this.onchange) if (this.onchange)
this.onchange(event); this.onchange(event);
}, },
/** @override */
setDisabled: PrefInputElement.prototype.setDisabled,
/** @override */
customChangeHandler: PrefInputElement.prototype.customChangeHandler,
/** @override */
customPrefChangeHandler: PrefInputElement.prototype.customPrefChangeHandler,
}; };
/**
* The name of the associated preference.
*/
cr.defineProperty(PrefSelect, 'pref', cr.PropertyKind.ATTR);
/**
* The data type of the associated preference, only relevant for derived
* classes that support different data types.
*/
cr.defineProperty(PrefSelect, 'dataType', cr.PropertyKind.ATTR);
/**
* Whether this input element is part of a dialog. If so, changes take effect
* in the settings UI immediately but are only actually committed when the
* user confirms the dialog. If the user cancels the dialog instead, the
* changes are rolled back in the settings UI and never committed.
*/
cr.defineProperty(PrefSelect, 'dialogPref', cr.PropertyKind.BOOL_ATTR);
/**
* Whether the associated preference is controlled by a source other than the
* user's setting (can be 'policy', 'extension', 'recommended' or unset).
*/
cr.defineProperty(PrefSelect, 'controlledBy', cr.PropertyKind.ATTR);
/**
* The user metric string.
*/
cr.defineProperty(PrefSelect, 'metric', cr.PropertyKind.ATTR);
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// PrefTextField class: // PrefTextField class:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment