mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 05:38:00 +01:00
first checkin of the new FF3-based genElemCoords
This commit is contained in:
@@ -92,38 +92,37 @@ function Hints() //{{{
|
||||
function genElemCoords(elem)
|
||||
{
|
||||
// NOTE: experiment for making the function faster, report problems
|
||||
// only works for FF3.0:
|
||||
//var rect = elem.getClientRects()[0];
|
||||
//if (rect)
|
||||
//{
|
||||
// elem.absoLeft = rect.left;
|
||||
// elem.absoTop = rect.top;
|
||||
//}
|
||||
//return;
|
||||
|
||||
if (typeof(elem.validCoord) != "undefined")
|
||||
var rect = elem.getClientRects()[0];
|
||||
if (rect)
|
||||
{
|
||||
if (elem.validCoord == elem.ownerDocument.validCoords)
|
||||
elem.absoLeft = rect.left;
|
||||
elem.absoTop = rect.top;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (elem.offsetParent)
|
||||
{
|
||||
genElemCoords(elem.offsetParent);
|
||||
elem.absoLeft = elem.offsetParent.absoLeft + elem.offsetLeft;
|
||||
elem.absoTop = elem.offsetParent.absoTop + elem.offsetTop;
|
||||
}
|
||||
else if (elem.offsetLeft && elem.offsetTop) // TODO: ugly and broken temporary fix until FF3
|
||||
{
|
||||
elem.absoLeft = elem.offsetLeft;
|
||||
elem.absoTop = elem.offsetTop;
|
||||
}
|
||||
else
|
||||
{
|
||||
elem.absoLeft = 0;
|
||||
elem.absoTop = 0;
|
||||
}
|
||||
elem.validCoord = elem.ownerDocument.validCoords;
|
||||
//if (typeof(elem.validCoord) != "undefined")
|
||||
//{
|
||||
// if (elem.validCoord == elem.ownerDocument.validCoords)
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (elem.offsetParent)
|
||||
//{
|
||||
// genElemCoords(elem.offsetParent);
|
||||
// elem.absoLeft = elem.offsetParent.absoLeft + elem.offsetLeft;
|
||||
// elem.absoTop = elem.offsetParent.absoTop + elem.offsetTop;
|
||||
//}
|
||||
//else if (elem.offsetLeft && elem.offsetTop) // TODO: ugly and broken temporary fix until FF3
|
||||
//{
|
||||
// elem.absoLeft = elem.offsetLeft;
|
||||
// elem.absoTop = elem.offsetTop;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// elem.absoLeft = 0;
|
||||
// elem.absoTop = 0;
|
||||
//}
|
||||
//elem.validCoord = elem.ownerDocument.validCoords;
|
||||
}
|
||||
|
||||
function createHints(win)
|
||||
|
||||
Reference in New Issue
Block a user