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