3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
9 isCSS1 = doc.compatMode == "CSS1Compat",
\r
12 PARSEINT = parseInt;
\r
15 isAncestor : function(p, c) {
\r
22 return p.contains(c);
\r
23 } else if (p.compareDocumentPosition) {
\r
24 return !!(p.compareDocumentPosition(c) & 16);
\r
26 while (c = c.parentNode) {
\r
27 ret = c == p || ret;
\r
34 getViewWidth : function(full) {
\r
35 return full ? this.getDocumentWidth() : this.getViewportWidth();
\r
38 getViewHeight : function(full) {
\r
39 return full ? this.getDocumentHeight() : this.getViewportHeight();
\r
42 getDocumentHeight: function() {
\r
43 return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());
\r
46 getDocumentWidth: function() {
\r
47 return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());
\r
50 getViewportHeight: function(){
\r
52 (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
\r
56 getViewportWidth : function() {
\r
57 return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :
\r
58 Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
\r
61 getY : function(el) {
\r
62 return this.getXY(el)[1];
\r
65 getX : function(el) {
\r
66 return this.getXY(el)[0];
\r
69 getXY : function(el) {
\r
80 bd = (doc.body || doc.documentElement),
\r
83 el = Ext.getDom(el);
\r
86 if (el.getBoundingClientRect) {
\r
87 b = el.getBoundingClientRect();
\r
88 scroll = fly(document).getScroll();
\r
89 ret = [ROUND(b.left + scroll.left), ROUND(b.top + scroll.top)];
\r
92 hasAbsolute = fly(el).isStyle("position", "absolute");
\r
99 hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
\r
101 if (Ext.isGecko) {
\r
102 y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;
\r
103 x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;
\r
105 if (p != el && !pe.isStyle('overflow','visible')) {
\r
110 p = p.offsetParent;
\r
113 if (Ext.isSafari && hasAbsolute) {
\r
114 x -= bd.offsetLeft;
\r
118 if (Ext.isGecko && !hasAbsolute) {
\r
120 x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;
\r
121 y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;
\r
125 while (p && p != bd) {
\r
126 if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
\r
138 setXY : function(el, xy) {
\r
139 (el = Ext.fly(el, '_setXY')).position();
\r
141 var pts = el.translatePoints(xy),
\r
142 style = el.dom.style,
\r
145 for (pos in pts) {
\r
146 if(!isNaN(pts[pos])) style[pos] = pts[pos] + "px"
\r
150 setX : function(el, x) {
\r
151 this.setXY(el, [x, false]);
\r
154 setY : function(el, y) {
\r
155 this.setXY(el, [false, y]);
\r