mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 04:52:28 +01:00
Work around failing getComputedStyle on Facebook.
getComputedStyle returns null for the channel_iframe document.
This commit is contained in:
@@ -252,11 +252,13 @@ function Hints() //{{{
|
|||||||
function getContainerOffsets(doc)
|
function getContainerOffsets(doc)
|
||||||
{
|
{
|
||||||
let body = doc.body || doc.documentElement;
|
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];
|
let rect = body.getClientRects()[0];
|
||||||
return [-bodyRect.left, -bodyRect.top];
|
return [-rect.left, -rect.top];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return [doc.defaultView.scrollX, doc.defaultView.scrollY];
|
return [doc.defaultView.scrollX, doc.defaultView.scrollY];
|
||||||
|
|||||||
Reference in New Issue
Block a user