Bug 1356766 - Support HTMLTooltop when running launchpad on Chrome r=ntim
authorRicky Chien <ricky060709@gmail.com>
Sat, 15 Apr 2017 15:28:29 +0800
changeset 563315 8d8211a959921c2315540ce1bef71bc932f8f8bb
parent 563314 9a16c329034e5793a14a8aba3d003b657bf6553e
child 563316 af51323bf014feb7fb47dd6bc3f9b11ffc354354
push id54258
push usercpeterson@mozilla.com
push dateSun, 16 Apr 2017 05:52:14 +0000
reviewersntim
bugs1356766
milestone55.0a1
Bug 1356766 - Support HTMLTooltop when running launchpad on Chrome r=ntim MozReview-Commit-ID: KNeN8hrJjdl
devtools/client/shared/widgets/tooltip/HTMLTooltip.js
--- a/devtools/client/shared/widgets/tooltip/HTMLTooltip.js
+++ b/devtools/client/shared/widgets/tooltip/HTMLTooltip.js
@@ -169,16 +169,25 @@ function (anchorRect, viewportRect, widt
 };
 
 /**
  * Get the bounding client rectangle for a given node, relative to a custom
  * reference element (instead of the default for getBoundingClientRect which
  * is always the element's ownerDocument).
  */
 const getRelativeRect = function (node, relativeTo) {
+  // getBoxQuads is a non-standard WebAPI which will not work on non-firefox
+  // browser when running launchpad on Chrome.
+  if (!node.getBoxQuads) {
+    let {top, left, width, height} = node.getBoundingClientRect();
+    let right = left + width;
+    let bottom = top + height;
+    return {top, right, bottom, left, width, height};
+  }
+
   // Width and Height can be taken from the rect.
   let {width, height} = node.getBoundingClientRect();
 
   let quads = node.getBoxQuads({relativeTo});
   let top = quads[0].bounds.top;
   let left = quads[0].bounds.left;
 
   // Compute right and bottom coordinates using the rest of the data.