From 66e3c4c95c0ad3173254d60ed36635b9efad1e60 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 5 Oct 2009 18:38:25 +1100 Subject: [PATCH] Work around failing getComputedStyle on Facebook. getComputedStyle returns null for the channel_iframe document. --- common/content/hints.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/content/hints.js b/common/content/hints.js index 799e8c43..60a81d3c 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -252,11 +252,13 @@ function Hints() //{{{ function getContainerOffsets(doc) { let body = doc.body || doc.documentElement; + // TODO: getComputedStyle returns null for Facebook channel_iframe doc - probable Gecko bug. + let style = util.computedStyle(body); - if (/^(absolute|fixed|relative)$/.test(util.computedStyle(body)["position"])) + if (style && /^(absolute|fixed|relative)$/.test(style.position)) { - let bodyRect = body.getClientRects()[0]; - return [-bodyRect.left, -bodyRect.top]; + let rect = body.getClientRects()[0]; + return [-rect.left, -rect.top]; } else return [doc.defaultView.scrollX, doc.defaultView.scrollY];