3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
16 isCSS1 = doc.compatMode == "CSS1Compat",
\r
19 PARSEINT = parseInt;
\r
22 isAncestor : function(p, c) {
\r
29 return p.contains(c);
\r
30 } else if (p.compareDocumentPosition) {
\r
31 return !!(p.compareDocumentPosition(c) & 16);
\r
33 while (c = c.parentNode) {
\r
34 ret = c == p || ret;
\r
41 getViewWidth : function(full) {
\r
42 return full ? this.getDocumentWidth() : this.getViewportWidth();
\r
45 getViewHeight : function(full) {
\r
46 return full ? this.getDocumentHeight() : this.getViewportHeight();
\r
49 getDocumentHeight: function() {
\r
50 return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());
\r
53 getDocumentWidth: function() {
\r
54 return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());
\r
57 getViewportHeight: function(){
\r
59 (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :
\r
63 getViewportWidth : function() {
\r
64 return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :
\r
65 Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;
\r
68 getY : function(el) {
\r
69 return this.getXY(el)[1];
\r
72 getX : function(el) {
\r
73 return this.getXY(el)[0];
\r
76 getXY : function(el) {
\r
87 bd = (doc.body || doc.documentElement),
\r
90 el = Ext.getDom(el);
\r
93 if (el.getBoundingClientRect) {
\r
94 b = el.getBoundingClientRect();
\r
95 scroll = fly(document).getScroll();
\r
96 ret = [ROUND(b.left + scroll.left), ROUND(b.top + scroll.top)];
\r
99 hasAbsolute = fly(el).isStyle("position", "absolute");
\r
106 hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");
\r
108 if (Ext.isGecko) {
\r
109 y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;
\r
110 x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;
\r
112 if (p != el && !pe.isStyle('overflow','visible')) {
\r
117 p = p.offsetParent;
\r
120 if (Ext.isSafari && hasAbsolute) {
\r
121 x -= bd.offsetLeft;
\r
125 if (Ext.isGecko && !hasAbsolute) {
\r
127 x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;
\r
128 y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;
\r
132 while (p && p != bd) {
\r
133 if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {
\r
145 setXY : function(el, xy) {
\r
146 (el = Ext.fly(el, '_setXY')).position();
\r
148 var pts = el.translatePoints(xy),
\r
149 style = el.dom.style,
\r
152 for (pos in pts) {
\r
153 if(!isNaN(pts[pos])) style[pos] = pts[pos] + "px"
\r
157 setX : function(el, x) {
\r
158 this.setXY(el, [x, false]);
\r
161 setY : function(el, y) {
\r
162 this.setXY(el, [false, y]);
\r