Index: third_party/polymer/components/paper-tooltip/paper-tooltip.html |
diff --git a/third_party/polymer/components/paper-tooltip/paper-tooltip.html b/third_party/polymer/components/paper-tooltip/paper-tooltip.html |
index 4c2f0391b62ee50f428aabdf0dfd070ab9f67656..670280b17985f5cc2b0b490b15663ebb1f5ce4cc 100644 |
--- a/third_party/polymer/components/paper-tooltip/paper-tooltip.html |
+++ b/third_party/polymer/components/paper-tooltip/paper-tooltip.html |
@@ -244,8 +244,20 @@ Custom property | Description | Default |
if (this._showing) |
return; |
- if (Polymer.dom(this).textContent.trim() === '') |
- return; |
+ if (Polymer.dom(this).textContent.trim() === ''){ |
+ // Check if effective children are also empty |
+ var allChildrenEmpty = true; |
+ var effectiveChildren = Polymer.dom(this).getEffectiveChildNodes(); |
+ for (var i = 0; i < effectiveChildren.length; i++) { |
+ if (effectiveChildren[i].textContent.trim() !== '') { |
+ allChildrenEmpty = false; |
+ break; |
+ } |
+ } |
+ if (allChildrenEmpty) { |
+ return; |
+ } |
+ } |
this.cancelAnimation(); |
@@ -321,8 +333,8 @@ Custom property | Description | Default |
// TODO(noms): This should use IronFitBehavior if possible. |
if (this.fitToVisibleBounds) { |
- // Clip the left/right side. |
- if (tooltipLeft + thisRect.width > window.innerWidth) { |
+ // Clip the left/right side |
+ if (parentRect.left + tooltipLeft + thisRect.width > window.innerWidth) { |
this.style.right = '0px'; |
this.style.left = 'auto'; |
} else { |
@@ -331,11 +343,11 @@ Custom property | Description | Default |
} |
// Clip the top/bottom side. |
- if (tooltipTop + thisRect.height > window.innerHeight) { |
- this.style.bottom = '0px'; |
+ if (parentRect.top + tooltipTop + thisRect.height > window.innerHeight) { |
+ this.style.bottom = parentRect.height + 'px'; |
this.style.top = 'auto'; |
} else { |
- this.style.top = Math.max(0, tooltipTop) + 'px'; |
+ this.style.top = Math.max(-parentRect.top, tooltipTop) + 'px'; |
this.style.bottom = 'auto'; |
} |
} else { |