3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
9 isCSS1 = doc.compatMode == "CSS1Compat",
\r
11 PARSEINT = parseInt;
\r
14 isAncestor : function(p, c) {
\r
21 return p.contains(c);
\r
22 } else if (p.compareDocumentPosition) {
\r
23 return !!(p.compareDocumentPosition(c) & 16);
\r
25 while (c = c.parentNode) {
\r
26 ret = c == p || ret;
\r
33 getViewWidth : function(full) {
\r
34 return full ? this.getDocumentWidth() : this.getViewportWidth();
\r
37 getViewHeight : function(full) {
\r
38 return full ? this.getDocumentHeight() : this.getViewportHeight();
\r
41 getDocumentHeight: function() {
\r
42 return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());
\r
45 getDocumentWidth: function() {
\r
46 return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());
\r
49 getViewportHeight: function(){
\r
51 (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
\r
55 getViewportWidth : function() {
\r
56 return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :
\r
57 Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
\r
60 getY : function(el) {
\r
61 return this.getXY(el)[1];
\r
64 getX : function(el) {
\r
65 return this.getXY(el)[0];
\r
68 getXY : function(el) {
\r
79 bd = (doc.body || doc.documentElement),
\r
82 el = Ext.getDom(el);
\r
85 if (el.getBoundingClientRect) {
\r
86 b = el.getBoundingClientRect();
\r
87 scroll = fly(document).getScroll();
\r
88 ret = [b.left + scroll.left, b.top + scroll.top];
\r
91 hasAbsolute = fly(el).isStyle("position", "absolute");
\r
98 hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
\r
100 if (Ext.isGecko) {
\r
101 y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;
\r
102 x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;
\r
104 if (p != el && !pe.isStyle('overflow','visible')) {
\r
109 p = p.offsetParent;
\r
112 if (Ext.isSafari && hasAbsolute) {
\r
113 x -= bd.offsetLeft;
\r
117 if (Ext.isGecko && !hasAbsolute) {
\r
119 x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;
\r
120 y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;
\r
124 while (p && p != bd) {
\r
125 if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
\r
137 setXY : function(el, xy) {
\r
138 (el = Ext.fly(el, '_setXY')).position();
\r
140 var pts = el.translatePoints(xy),
\r
141 style = el.dom.style,
\r
144 for (pos in pts) {
\r
145 if(!isNaN(pts[pos])) style[pos] = pts[pos] + "px"
\r
149 setX : function(el, x) {
\r
150 this.setXY(el, [x, false]);
\r
153 setY : function(el, y) {
\r
154 this.setXY(el, [false, y]);
\r