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

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js

Issue 1287713002: [MD settings] merge polymer 1.0.11; hack for settings checkbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/paper-input/paper-input-container-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
index d307fe68ba87cc6b0fc289b7e1588c38bd8ee1d6..585e4c8d377bcee07957480b523b83fdd52053a4 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-input/paper-input-container-extracted.js
@@ -1,4 +1,3 @@
-
(function() {
Polymer({
@@ -183,7 +182,7 @@
}
// type="number" hack needed because this.value is empty until it's valid
- if (value || (inputElement.type === 'number' && !inputElement.checkValidity())) {
+ if (value || value === 0 || (inputElement.type === 'number' && !inputElement.checkValidity())) {
this._inputHasContent = true;
} else {
this._inputHasContent = false;
@@ -219,6 +218,8 @@
_computeInputContentClass: function(noLabelFloat, alwaysFloatLabel, focused, invalid, _inputHasContent) {
var cls = 'input-content';
if (!noLabelFloat) {
+ var label = this.querySelector('label');
+
if (alwaysFloatLabel || _inputHasContent) {
cls += ' label-is-floating';
if (invalid) {
@@ -226,6 +227,17 @@
} else if (focused) {
cls += " label-is-highlighted";
}
+ // The label might have a horizontal offset if a prefix element exists
+ // which needs to be undone when displayed as a floating label.
+ if (this.$.prefix && label && label.offsetParent &&
+ Polymer.dom(this.$.prefix).getDistributedNodes().length > 0) {
+ label.style.left = -label.offsetParent.offsetLeft + 'px';
+ }
+ } else {
+ // When the label is not floating, it should overlap the input element.
+ if (label) {
+ label.style.left = 0;
+ }
}
} else {
if (_inputHasContent) {
@@ -257,4 +269,4 @@
});
-})();
+})();

Powered by Google App Engine
This is Rietveld 408576698