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

Unified Diff: third_party/polymer/components-chromium/core-tooltip/core-tooltip-extracted.js

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/echo ""/echo/ Created 6 years, 3 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/components-chromium/core-tooltip/core-tooltip-extracted.js
diff --git a/third_party/polymer/components-chromium/core-tooltip/core-tooltip-extracted.js b/third_party/polymer/components-chromium/core-tooltip/core-tooltip-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f1a19a5ba84a62acdd8bc0b5b2b89c851ad7eb1
--- /dev/null
+++ b/third_party/polymer/components-chromium/core-tooltip/core-tooltip-extracted.js
@@ -0,0 +1,73 @@
+
+
+ Polymer('core-tooltip', {
+
+ /**
+ * A simple string label for the tooltip to display. To display a rich
+ * that includes HTML, use the `tip` attribute on the content.
+ *
+ * @attribute label
+ * @type string
+ * @default null
+ */
+ label: null,
+
+ /**
+ * If true, the tooltip an arrow pointing towards the content.
+ *
+ * @attribute noarrow
+ * @type boolean
+ * @default false
+ */
+ noarrow: false,
+
+ /**
+ * If true, the tooltip displays by default.
+ *
+ * @attribute show
+ * @type boolean
+ * @default false
+ */
+ show: false,
+
+ /**
+ * Positions the tooltip to the top, right, bottom, left of its content.
+ *
+ * @attribute position
+ * @type string
+ * @default 'bottom'
+ */
+ position: 'bottom',
+
+ attached: function() {
+ this.setPosition();
+ },
+
+ labelChanged: function(oldVal, newVal) {
+ // Run if we're not after attached().
+ if (oldVal) {
+ this.setPosition();
+ }
+ },
+
+ setPosition: function() {
+ var controlWidth = this.clientWidth;
+ var controlHeight = this.clientHeight;
+
+ var styles = getComputedStyle(this.$.tooltip);
+ var toolTipWidth = parseFloat(styles.width);
+ var toolTipHeight = parseFloat(styles.height);
+
+ switch (this.position) {
+ case 'top':
+ case 'bottom':
+ this.$.tooltip.style.left = (controlWidth - toolTipWidth) / 2 + 'px';
+ break;
+ case 'left':
+ case 'right':
+ this.$.tooltip.style.top = (controlHeight - toolTipHeight) / 2 + 'px';
+ break;
+ }
+ }
+ });
+

Powered by Google App Engine
This is Rietveld 408576698