Ticket #6921: abs_wip.3.patch

File abs_wip.3.patch, 1.7 kB (added by haysmark, 6 months ago)

Fix for Opera and FF2. All abs tests pass with this patch.

  • _base/html.js

     
    978978                                        endNode = db.parentNode; 
    979979                                } 
    980980                                // Opera seems to be double counting for some elements 
    981                                 ret.x -= _sumAncestorProperties(node, "scrollLeft"); 
    982                                 ret.y -= _sumAncestorProperties(node, "scrollTop"); 
     981                                var cs=gcs(node); 
     982                                var n=node; 
     983                                if(d.isOpera&&cs.position!="absolute"){ 
     984                                        n=n.offsetParent; 
     985                                } 
     986                                ret.x -= _sumAncestorProperties(n, "scrollLeft"); 
     987                                ret.y -= _sumAncestorProperties(n, "scrollTop"); 
    983988 
    984989                                var curnode = node; 
    985990                                do{ 
     
    992997                                        } 
    993998                                        var t = curnode.offsetTop; 
    994999                                        ret.y += isNaN(t) ? 0 : t; 
     1000                                        var cs = gcs(curnode); 
    9951001                                        if(curnode != node){ 
    996                                                 var cs = gcs(curnode); 
    9971002                                                if(d.isSafari){ 
    9981003                                                        ret.x += px(curnode, cs.borderLeftWidth); 
    9991004                                                        ret.y += px(curnode, cs.borderTopWidth); 
     
    10041009                                                        ret.y += 2*px(curnode,cs.borderTopWidth); 
    10051010                                                } 
    10061011                                        } 
    1007                                         // FIXME: static children in a static div in FF2 are affected by the div's border as well 
     1012                                        // static children in a static div in FF2 are affected by the div's border as well 
    10081013                                        // but offsetParent will skip this div! 
     1014                                        if(d.isFF&&cs.position=="static"){ 
     1015                                                var parent=curnode.parentNode; 
     1016                                                while(parent!=curnode.offsetParent){ 
     1017                                                        var pcs=gcs(parent); 
     1018                                                        if(pcs.position=="static"){ 
     1019                                                                ret.x += px(curnode,pcs.borderLeftWidth); 
     1020                                                                ret.y += px(curnode,pcs.borderTopWidth); 
     1021                                                        } 
     1022                                                        parent=parent.parentNode; 
     1023                                                } 
     1024                                        } 
    10091025                                        curnode = curnode.offsetParent; 
    10101026                                }while((curnode != endNode) && curnode); 
    10111027                        }else if(node.x && node.y){