Skip to content
Browse files

Merge branch 'native_inputs' of git://github.com/jimevans/ghostdriver…

… into jimevans-native_inputs

Conflicts:
	src/request_handlers/webelement_request_handler.js
  • Loading branch information...
2 parents b157e79 + 44cb536 commit 5d25594f9b7b41e9b9c59bb6ffd24753f7bc0217 @detro committed Oct 30, 2012
View
341 src/inputs.js
@@ -0,0 +1,341 @@
+/*
+This file is part of the GhostDriver project from Neustar inc.
+
+Copyright (c) 2012, Ivan De Marino <ivan.de.marino@gmail.com / detronizator@gmail.com>
+Copyright (c) 2012, Alex Anderson <@alxndrsn>
+Copyright (c) 2012, Jim Evans <james.h.evans.jr@gmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+var ghostdriver = ghostdriver || {};
+
+ghostdriver.Inputs = function () {
+ // private:
+ var
+ _mousePos = { x: 0, y: 0 },
+ _keyboardState = {},
+ _specialKeys = {
+ '\uE000': "Escape", // NULL
+ '\uE001': "Cancel", // Cancel
+ '\uE002': "F1", // Help
+ '\uE003': "Backspace", // Backspace
+ '\uE004': "Tab", // Tab
+ '\uE005': "Clear", // Clear
+ '\uE006': "\n",
+ '\uE007': "\n",
+ '\uE008': "Shift", // Shift
+ '\uE009': "Control", // Control
+ '\uE00A': "Alt", // Alt
+ '\uE00B': "Pause", // Pause
+ '\uE00C': "Escape", // Escape
+ '\uE00D': "Space", // Space
+ '\uE00E': "PageUp", // PageUp
+ '\uE00F': "PageDown", // PageDown
+ '\uE010': "End", // End
+ '\uE011': "Home", // Home
+ '\uE012': "Left", // Left arrow
+ '\uE013': "Up", // Up arrow
+ '\uE014': "Right", // Right arrow
+ '\uE015': "Down", // Down arrow
+ '\uE016': "Insert", // Insert
+ '\uE017': "Delete", // Delete
+ '\uE018': ";", // Semicolon
+ '\uE019': "=", // Equals
+ '\uE01A': "0", // Numpad 0
+ '\uE01B': "1", // Numpad 1
+ '\uE01C': "2", // Numpad 2
+ '\uE01D': "3", // Numpad 3
+ '\uE01E': "4", // Numpad 4
+ '\uE01F': "5", // Numpad 5
+ '\uE020': "6", // Numpad 6
+ '\uE021': "7", // Numpad 7
+ '\uE022': "8", // Numpad 8
+ '\uE023': "9", // Numpad 9
+ '\uE024': "*", // Multiply
+ '\uE025': "+", // Add
+ '\uE026': ",", // Separator
+ '\uE027': "-", // Subtract
+ '\uE028': ".", // Decimal
+ '\uE029': "/", // Divide
+ '\uE031': "F1", // F1
+ '\uE032': "F2", // F2
+ '\uE033': "F3", // F3
+ '\uE034': "F4", // F4
+ '\uE035': "F5", // F5
+ '\uE036': "F6", // F6
+ '\uE037': "F7", // F7
+ '\uE038': "F8", // F8
+ '\uE039': "F9", // F9
+ '\uE03A': "F10", // F10
+ '\uE03B': "F11", // F11
+ '\uE03C': "F12", // F12
+ '\uE03D': "Meta" // Command/Meta
+ },
+
+ _implicitShiftKeys = {
+ "A": "a",
+ "B": "b",
+ "C": "c",
+ "D": "d",
+ "E": "e",
+ "F": "f",
+ "G": "g",
+ "H": "h",
+ "I": "i",
+ "J": "j",
+ "K": "k",
+ "L": "l",
+ "M": "m",
+ "N": "n",
+ "O": "o",
+ "P": "p",
+ "Q": "q",
+ "R": "r",
+ "S": "s",
+ "T": "t",
+ "U": "u",
+ "V": "v",
+ "W": "w",
+ "X": "x",
+ "Y": "y",
+ "Z": "z",
+ "!": "1",
+ "@": "2",
+ "#": "3",
+ "$": "4",
+ "%": "5",
+ "^": "6",
+ "&": "7",
+ "*": "8",
+ "(": "9",
+ ")": "0",
+ "_": "-",
+ "+": "=",
+ "{": "[",
+ "}": "]",
+ "|": "\\",
+ ":": ";",
+ "<": ",",
+ ">": ".",
+ "?": "/",
+ "~": "`",
+ "\"": "'"
+ },
+
+ _shiftKeys = {
+ "a": "A",
+ "b": "B",
+ "c": "C",
+ "d": "D",
+ "e": "E",
+ "f": "F",
+ "g": "G",
+ "h": "H",
+ "i": "I",
+ "j": "J",
+ "k": "K",
+ "l": "L",
+ "m": "M",
+ "n": "N",
+ "o": "O",
+ "p": "P",
+ "q": "Q",
+ "r": "R",
+ "s": "S",
+ "t": "T",
+ "u": "U",
+ "v": "V",
+ "w": "W",
+ "x": "X",
+ "y": "Y",
+ "z": "Z",
+ "1": "!",
+ "2": "@",
+ "3": "#",
+ "4": "$",
+ "5": "%",
+ "6": "^",
+ "7": "&",
+ "8": "*",
+ "9": "(",
+ "0": ")",
+ "-": "_",
+ "=": "+",
+ "[": "{",
+ "]": "}",
+ "\\": "|",
+ ";": ":",
+ ",": "<",
+ ".": ">",
+ "/": "?",
+ "`": "~",
+ "'": "\""
+ },
+
+ _modifierKeyValues = {
+ "SHIFT": 0x02000000, // A Shift key on the keyboard is pressed.
+ "CONTROL": 0x04000000, // A Ctrl key on the keyboard is pressed.
+ "ALT": 0x08000000, // An Alt key on the keyboard is pressed.
+ "META": 0x10000000, // A Meta key on the keyboard is pressed.
+ "NUMPAD": 0x20000000 // Keypad key.
+ },
+
+ _currentModifierKeys = 0,
+
+ _isModifierKey = function (key) {
+ return key === "\uE008" || key === "\uE009" || key === "\uE00A" || key === "\uE03D";
+ },
+
+ _isModifierKeyPressed = function (key) {
+ return _currentModifierKeys & _modifierKeyValues[_specialKeys[key].toUpperCase()];
+ },
+
+ _sendKeys = function (session, keys) {
+ var keySequence = keys.split('');
+ for (var i = 0; i < keySequence.length; i++) {
+ var key = keys[i];
+ var actualKey = _translateKey(session, key);
+
+ if (_isModifierKey(key)) {
+ if (_isModifierKeyPressed(key)) {
+ _keyUp(session, actualKey);
+ } else {
+ _keyDown(session, actualKey);
+ }
+ } else {
+ if (_implicitShiftKeys.hasOwnProperty(actualKey)) {
+ session.getCurrentWindow().sendEvent("keydown", _translateKey(session, "\uE008"));
+ _pressKey(session, actualKey);
+ session.getCurrentWindow().sendEvent("keyup", _translateKey(session, "\uE008"));
+ } else {
+ if ((_currentModifierKeys & _modifierKeyValues.SHIFT) && _shiftKeys.hasOwnProperty(actualKey)) {
+ _pressKey(session, _shiftKeys[actualKey]);
+ } else {
+ _pressKey(session, actualKey);
+ }
+ }
+ }
+ }
+ },
+
+ _clearModifierKeys = function (session) {
+ if (_currentModifierKeys & _modifierKeyValues.SHIFT) {
+ _keyUp(session, _translateKey(session, "\uE008"));
+ }
+ if (_currentModifierKeys & _modifierKeyValues.CONTROL) {
+ _keyUp(session, _translateKey(session, "\uE009"));
+ }
+ if (_currentModifierKeys & _modifierKeyValues.ALT) {
+ _keyUp(session, _translateKey(session, "\uE00A"));
+ }
+ },
+
+ _updateModifierKeys = function (modifierKeyValue, on) {
+ if (on) {
+ _currentModifierKeys = _currentModifierKeys | modifierKeyValue;
+ } else {
+ _currentModifierKeys = _currentModifierKeys & ~modifierKeyValue;
+ }
+ },
+
+ _translateKey = function (session, key) {
+ var actualKey = key;
+ var phantomjskeys = session.getCurrentWindow().event.key;
+ if (_specialKeys.hasOwnProperty(key)) {
+ actualKey = _specialKeys[key];
+ if (session.getCurrentWindow().event.key.hasOwnProperty(actualKey)) {
+ actualKey = session.getCurrentWindow().event.key[actualKey];
+ }
+ }
+ return actualKey;
+ },
+
+ _pressKey = function (session, key) {
+ // translate WebDriver key value to key code.
+ _keyEvent(session, "keypress", key);
+ },
+
+ _keyDown = function (session, key) {
+ _keyEvent(session, "keydown", key);
+ if (key == _translateKey(session, "\uE008")) {
+ _updateModifierKeys(_modifierKeyValues.SHIFT, true);
+ } else if (key == _translateKey(session, "\uE009")) {
+ _updateModifierKeys(_modifierKeyValues.CONTROL, true);
+ } else if (key == _translateKey(session, "\uE00A")) {
+ _updateModifierKeys(_modifierKeyValues.ALT, true);
+ }
+ },
+
+ _keyUp = function (session, key) {
+ _keyEvent(session, "keyup", key);
+ if (key == _translateKey(session, "\uE008")) {
+ _updateModifierKeys(_modifierKeyValues.SHIFT, false);
+ } else if (key == _translateKey(session, "\uE009")) {
+ _updateModifierKeys(_modifierKeyValues.CONTROL, false);
+ } else if (key == _translateKey(session, "\uE00A")) {
+ _updateModifierKeys(_modifierKeyValues.ALT, false);
+ }
+ },
+
+ _mouseClick = function (session, coords) {
+ _mouseMove(session, coords);
+ _mouseButtonEvent(session, "click", "left");
+ },
+
+ _mouseMove = function (session, coords) {
+ session.getCurrentWindow().sendEvent("mousemove", coords.x, coords.y);
+ _mousePos = { x: coords.x, y: coords.y };
+ },
+
+ _mouseButtonDown = function (session, button) {
+ _mouseButtonClick(session, "mousedown", button);
+ },
+
+ _mouseButtonUp = function (session, button) {
+ _mouseButtonClick(session, "mouseUp", button);
+ },
+
+ _keyEvent = function (session, eventType, keyCode) {
+ eventType = eventType || "keypress";
+ session.getCurrentWindow().sendEvent(eventType, keyCode, null, null, _currentModifierKeys);
+ },
+
+ _mouseButtonEvent = function (session, eventType, button) {
+ button = button || "left";
+ eventType = eventType || "click";
+ session.getCurrentWindow().sendEvent(eventType,
+ _mousePos.x, _mousePos.y, //< x, y
+ button, _currentModifierKeys);
+ };
+
+ return {
+ getCurrentCoordinates: function () { return _mousePos; },
+ mouseClick: _mouseClick,
+ mouseMove: _mouseMove,
+ mouseButtonDown: _mouseButtonDown,
+ mouseButtonUp: _mouseButtonUp,
+ mouseButtonClick: _mouseButtonEvent,
+ sendKeys: _sendKeys,
+ clearModifierKeys: _clearModifierKeys
+ };
+};
View
1 src/main.js
@@ -40,6 +40,7 @@ parseURI = require("./third_party/parseuri.js");
parseURI.options.strictMode = true;
phantom.injectJs("session.js");
+phantom.injectJs("inputs.js");
phantom.injectJs("request_handlers/request_handler.js");
phantom.injectJs("request_handlers/status_request_handler.js");
phantom.injectJs("request_handlers/shutdown_request_handler.js");
View
17 src/request_handlers/session_request_handler.js
@@ -31,7 +31,6 @@ var ghostdriver = ghostdriver || {};
ghostdriver.SessionReqHand = function(session) {
// private:
var
- _mousePos = {x: 0, y: 0},
_session = session,
_protoParent = ghostdriver.SessionReqHand.prototype,
_locator = new ghostdriver.WebElementLocator(session),
@@ -584,17 +583,16 @@ ghostdriver.SessionReqHand = function(session) {
if (elementSpecified) {
// Get Element's Location and add it to the coordinates
var requestHandler = new ghostdriver.WebElementReqHand(postObj.element, _session);
- elementLocation = requestHandler.getLocation();
+ elementLocation = requestHandler.getLocationInView();
elementSize = requestHandler.getSize();
// If the Element has a valid location
if (elementLocation !== null) {
- coords.x += elementLocation.x;
- coords.y += elementLocation.y;
+ coords.x = elementLocation.x;
+ coords.y = elementLocation.y;
}
// console.log("element specified. initial coordinates (" + coords.x + "," + coords.y + ")");
} else {
- coords.x = _mousePos.x;
- coords.y = _mousePos.y;
+ coords = _session.inputs.getCurrentCoordinates();
// console.log("no element specified. initial coordinates (" + coords.x + "," + coords.y + ")");
}
@@ -610,8 +608,7 @@ ghostdriver.SessionReqHand = function(session) {
}
// Send the Mouse Move as native event
- _protoParent.getSessionCurrWindow.call(this, _session, req).sendEvent("mousemove", coords.x, coords.y);
- _mousePos = { x: coords.x, y: coords.y };
+ _session.inputs.mouseMove(_session, coords);
res.success(_session.getId());
} else {
// Neither "element" nor "xoffset/yoffset" were provided
@@ -638,9 +635,7 @@ ghostdriver.SessionReqHand = function(session) {
mouseButton = (postObj.button === 2) ? "right" : (postObj.button === 1) ? "middle" : "left";
}
// Send the Mouse Click as native event
- _protoParent.getSessionCurrWindow.call(this, _session, req).sendEvent(clickType,
- _mousePos.x, _mousePos.y, //< x, y
- mouseButton);
+ _session.inputs.mouseButtonClick(_session, clickType, mouseButton);
res.success(_session.getId());
} else {
// Neither "element" nor "xoffset/yoffset" were provided
View
48 src/request_handlers/webelement_request_handler.js
@@ -163,21 +163,32 @@ ghostdriver.WebElementReqHand = function(idOrElement, session) {
res.respondBasedOnResult(_session, req, locationRes);
},
- _getLocationInViewCommand = function(req, res) {
- var scrollRes = _protoParent.getSessionCurrWindow.call(this, _session, req).evaluate(
- require("./webdriver_atoms.js").get("scroll_into_view"),
- _getJSON());
+ _getLocationInViewResult = function (req) {
+ return _protoParent.getSessionCurrWindow.call(this, _session, req).evaluate(
+ require("./webdriver_atoms.js").get("execute_script"),
+ "return (" + require("./webdriver_atoms.js").get("get_location_in_view") + ")(arguments[0]);",
+ [_getJSON()]);
+ },
- // console.log("Scrolling into View result: "+JSON.stringify(scrollRes));
+ _getLocationInView = function (req) {
+ var result = _getLocationInViewResult(req);
- scrollRes = JSON.parse(scrollRes);
- if (scrollRes && scrollRes.status === 0) {
- res.respondBasedOnResult(_session, req, _getLocationResult(req));
- return;
+ // console.log("Location: "+JSON.stringify(result));
+
+ if (result.status === 0) {
+ return result.value;
+ } else {
+ return null;
}
+ },
+
+ _getLocationInViewCommand = function (req, res) {
+ var locationInViewRes = _getLocationInViewResult(req);
+
+ // console.log("Scrolling into View result: "+JSON.stringify(locationInViewRes));
// Something went wrong: report the error
- res.respondBasedOnResult(_session, req, scrollRes);
+ res.respondBasedOnResult(_session, req, locationInViewRes);
},
_getSizeResult = function (req) {
@@ -230,8 +241,18 @@ ghostdriver.WebElementReqHand = function(idOrElement, session) {
replace(/\t/g, '\uE004'). // Tab
replace(/(\r\n|\n|\r)/g, '\uE006'); // Return
- // Execute the "type" atom
- typeRes = currWindow.evaluate(require("./webdriver_atoms.js").get("type"), _getJSON(), text.split(""));
+ // Execute the "type" atom on an empty string only to force focus to the element.
+ // TODO: This is a hack that needs to be corrected with a proper method to set focus.
+ typeRes = currWindow.evaluate(require("./webdriver_atoms.js").get("type"), _getJSON(), "");
+
+ // Send keys to the page, using Native Events
+ _session.inputs.sendKeys(_session, text);
+
+ // Only clear the modifier keys if this was called using element.sendKeys().
+ // Calling this from the Advanced Interactions API doesn't clear the modifier keys.
+ if (req.urlParsed.file === _const.VALUE) {
+ _session.inputs.clearModifierKeys(_session);
+ }
}
// Return the result of this typing
@@ -418,7 +439,8 @@ ghostdriver.WebElementReqHand = function(idOrElement, session) {
getSession : _getSession,
postValueCommand : _postValueCommand,
getLocation : _getLocation,
- getSize : _getSize
+ getLocationInView: _getLocationInView,
+ getSize: _getSize
};
};
// prototype inheritance:
View
4 src/session.js
@@ -91,6 +91,7 @@ ghostdriver.Session = function(desiredCapabilities) {
_windows = {}, //< NOTE: windows are "webpage" in Phantom-dialect
_currentWindowHandle = null,
_id = "SID-" + require("./third_party/uuid.js").v1(),
+ _inputs = ghostdriver.Inputs(),
/**
* Executes a function and waits for Load to happen.
@@ -374,7 +375,8 @@ ghostdriver.Session = function(desiredCapabilities) {
aboutToDelete : _aboutToDelete,
setTimeout : _setTimeout,
getTimeout : _getTimeout,
- timeoutNames : _timeoutNames
+ timeoutNames : _timeoutNames,
+ inputs: _inputs
};
};
View
49 src/third_party/webdriver-atoms/get_location_in_view.js
@@ -0,0 +1,49 @@
+function(){return function(){function h(a){throw a;}var i=void 0,j=!0,k=null,l=!1;function m(a){return function(){return this[a]}}function aa(a){return function(){return a}}var q=this;
+function ba(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
+else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function r(a){return"string"==typeof a}Math.floor(2147483648*Math.random()).toString(36);function s(a,b){function c(){}c.prototype=b.prototype;a.da=b.prototype;a.prototype=new c};function u(a){Error.captureStackTrace?Error.captureStackTrace(this,u):this.stack=Error().stack||"";a&&(this.message=String(a))}s(u,Error);u.prototype.name="CustomError";function ca(a,b){for(var c=1;c<arguments.length;c++)var d=String(arguments[c]).replace(/\$/g,"$$$$"),a=a.replace(/\%s/,d);return a}
+function da(a,b){for(var c=0,d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=String(b).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=Math.max(d.length,e.length),g=0;0==c&&g<f;g++){var n=d[g]||"",x=e[g]||"",p=RegExp("(\\d*)(\\D*)","g"),t=RegExp("(\\d*)(\\D*)","g");do{var y=p.exec(n)||["","",""],z=t.exec(x)||["","",""];if(0==y[0].length&&0==z[0].length)break;c=((0==y[1].length?0:parseInt(y[1],10))<(0==z[1].length?0:parseInt(z[1],10))?-1:(0==y[1].length?0:parseInt(y[1],10))>(0==z[1].length?
+0:parseInt(z[1],10))?1:0)||((0==y[2].length)<(0==z[2].length)?-1:(0==y[2].length)>(0==z[2].length)?1:0)||(y[2]<z[2]?-1:y[2]>z[2]?1:0)}while(0==c)}return c};function ea(a,b){b.unshift(a);u.call(this,ca.apply(k,b));b.shift();this.aa=a}s(ea,u);ea.prototype.name="AssertionError";function fa(a,b,c,d){var e="Assertion failed";if(c)var e=e+(": "+c),f=d;else a&&(e+=": "+a,f=b);h(new ea(""+e,f||[]))}function ga(a,b,c){a||fa("",k,b,Array.prototype.slice.call(arguments,2))}function ha(a,b,c){var d=typeof a;"object"==d&&a!=k||"function"==d||fa("Expected object but got %s: %s.",[ba(a),a],b,Array.prototype.slice.call(arguments,2))};var ia=Array.prototype;function v(a,b){for(var c=a.length,d=r(a)?a.split(""):a,e=0;e<c;e++)e in d&&b.call(i,d[e],e,a)}function ja(a,b){for(var c=a.length,d=[],e=0,f=r(a)?a.split(""):a,g=0;g<c;g++)if(g in f){var n=f[g];b.call(i,n,g,a)&&(d[e++]=n)}return d}function ka(a,b,c){if(a.reduce)return a.reduce(b,c);var d=c;v(a,function(c,f){d=b.call(i,d,c,f,a)});return d}function la(a,b){for(var c=a.length,d=r(a)?a.split(""):a,e=0;e<c;e++)if(e in d&&b.call(i,d[e],e,a))return j;return l}
+function ma(a){return ia.concat.apply(ia,arguments)}function na(a,b,c){ga(a.length!=k);return 2>=arguments.length?ia.slice.call(a,b):ia.slice.call(a,b,c)};function oa(a,b){this.code=a;this.message=b||"";this.name=pa[a]||pa[13];var c=Error(this.message);c.name=this.name;this.stack=c.stack||""}s(oa,Error);
+var pa={7:"NoSuchElementError",8:"NoSuchFrameError",9:"UnknownCommandError",10:"StaleElementReferenceError",11:"ElementNotVisibleError",12:"InvalidElementStateError",13:"UnknownError",15:"ElementNotSelectableError",19:"XPathLookupError",23:"NoSuchWindowError",24:"InvalidCookieDomainError",25:"UnableToSetCookieError",26:"ModalDialogOpenedError",27:"NoModalDialogOpenError",28:"ScriptTimeoutError",32:"InvalidSelectorError",35:"SqlDatabaseError",34:"MoveTargetOutOfBoundsError"};
+oa.prototype.toString=function(){return"["+this.name+"] "+this.message};var w,qa,ra,sa;function ta(){return q.navigator?q.navigator.userAgent:k}sa=ra=qa=w=l;var ua;if(ua=ta()){var va=q.navigator;w=0==ua.indexOf("Opera");qa=!w&&-1!=ua.indexOf("MSIE");ra=!w&&-1!=ua.indexOf("WebKit");sa=!w&&!ra&&"Gecko"==va.product}var A=w,B=qa,C=sa,D=ra,wa;
+a:{var xa="",ya;if(A&&q.opera)var za=q.opera.version,xa="function"==typeof za?za():za;else if(C?ya=/rv\:([^\);]+)(\)|;)/:B?ya=/MSIE\s+([^\);]+)(\)|;)/:D&&(ya=/WebKit\/(\S+)/),ya)var Aa=ya.exec(ta()),xa=Aa?Aa[1]:"";if(B){var Ba,Ca=q.document;Ba=Ca?Ca.documentMode:i;if(Ba>parseFloat(xa)){wa=String(Ba);break a}}wa=xa}var Da={};function Ea(a){return Da[a]||(Da[a]=0<=da(wa,a))}var Fa={};function E(a){return Fa[a]||(Fa[a]=B&&!!document.documentMode&&document.documentMode>=a)};var Ga,Ha,Ia,Ja,Ka,La,Ma;Ma=La=Ka=Ja=Ia=Ha=Ga=l;var F=ta();F&&(-1!=F.indexOf("Firefox")?Ga=j:-1!=F.indexOf("Camino")?Ha=j:-1!=F.indexOf("iPhone")||-1!=F.indexOf("iPod")?Ia=j:-1!=F.indexOf("iPad")?Ja=j:-1!=F.indexOf("Android")?Ka=j:-1!=F.indexOf("Chrome")?La=j:-1!=F.indexOf("Safari")&&(Ma=j));var Na=Ga,Oa=Ha,Pa=Ia,Qa=Ja,Ra=Ka,Sa=La,Ta=Ma;function G(a){return(a=a.exec(ta()))?a[1]:""}(function(){if(Na)return G(/Firefox\/([0-9.]+)/);if(B||A)return wa;if(Sa)return G(/Chrome\/([0-9.]+)/);if(Ta)return G(/Version\/([0-9.]+)/);if(Pa||Qa){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(ta());if(a)return a[1]+"."+a[2]}else{if(Ra)return(a=G(/Android\s+([0-9.]+)/))?a:G(/Version\/([0-9.]+)/);if(Oa)return G(/Camino\/([0-9.]+)/)}return""})();var Ua,Va=function(){if(!C)return l;var a=q.Components;if(!a)return l;try{if(!a.classes)return l}catch(b){return l}var c=a.classes,a=a.interfaces,d=c["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator),e=c["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo).platformVersion;Ua=function(a){d.$(e,""+a)};return j}();var Wa;!B||E(9);!C&&!B||B&&E(9)||C&&Ea("1.9.1");B&&Ea("9");function I(a,b){this.x=a!==i?a:0;this.y=b!==i?b:0}I.prototype.toString=function(){return"("+this.x+", "+this.y+")"};function Xa(a,b){this.width=a;this.height=b}Xa.prototype.toString=function(){return"("+this.width+" x "+this.height+")"};Xa.prototype.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};Xa.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};Xa.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};function Ya(a){return a?new Za(J(a)):Wa||(Wa=new Za)}function $a(a,b){if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}
+function ab(a,b){if(a==b)return 0;if(a.compareDocumentPosition)return a.compareDocumentPosition(b)&2?1:-1;if((9==a.nodeType||9==b.nodeType)&&B&&!Ea(9)){if(9==a.nodeType)return-1;if(9==b.nodeType)return 1}if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var c=1==a.nodeType,d=1==b.nodeType;if(c&&d)return a.sourceIndex-b.sourceIndex;var e=a.parentNode,f=b.parentNode;return e==f?bb(a,b):!c&&$a(e,b)?-1*cb(a,b):!d&&$a(f,a)?cb(b,a):(c?a.sourceIndex:e.sourceIndex)-(d?b.sourceIndex:f.sourceIndex)}d=
+J(a);c=d.createRange();c.selectNode(a);c.collapse(j);d=d.createRange();d.selectNode(b);d.collapse(j);return c.compareBoundaryPoints(q.Range.START_TO_END,d)}function cb(a,b){var c=a.parentNode;if(c==b)return-1;for(var d=b;d.parentNode!=c;)d=d.parentNode;return bb(d,a)}function bb(a,b){for(var c=b;c=c.previousSibling;)if(c==a)return-1;return 1}function J(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function Za(a){this.v=a||q.document||document}
+function db(a){var b=a.v,a=!D&&"CSS1Compat"==b.compatMode?b.documentElement:b.body,b=b.parentWindow||b.defaultView;return new I(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}Za.prototype.contains=$a;function eb(a,b,c){this.f=a;this.Y=b||1;this.h=c||1};var K=B&&!E(9),fb=B&&!E(8);function gb(a,b,c,d,e){this.f=a;this.nodeName=c;this.nodeValue=d;this.nodeType=2;this.ownerElement=b;this.ba=e;this.parentNode=b}function hb(a,b,c){var d=fb&&"href"==b.nodeName?a.getAttribute(b.nodeName,2):b.nodeValue;return new gb(b,a,b.nodeName,d,c)};function L(a){var b=k,c=a.nodeType;1==c&&(b=a.textContent,b=b==i||b==k?a.innerText:b,b=b==i||b==k?"":b);if("string"!=typeof b)if(K&&"title"==a.nodeName.toLowerCase()&&1==c)b=a.text;else if(9==c||1==c)for(var a=9==c?a.documentElement:a.firstChild,c=0,d=[],b="";a;){do 1!=a.nodeType&&(b+=a.nodeValue),K&&"title"==a.nodeName.toLowerCase()&&(b+=a.text),d[c++]=a;while(a=a.firstChild);for(;c&&!(a=d[--c].nextSibling););}else b=a.nodeValue;return""+b}
+function M(a,b,c){if(b===k)return j;try{if(!a.getAttribute)return l}catch(d){return l}fb&&"class"==b&&(b="className");return c==k?!!a.getAttribute(b):a.getAttribute(b,2)==c}function ib(a,b,c,d,e){return(K?jb:kb).call(k,a,b,r(c)?c:k,r(d)?d:k,e||new N)}
+function jb(a,b,c,d,e){if(8==a.g||c&&a.g===k){var f=b.all;if(!f)return e;a=lb(a);if("*"!=a&&(f=b.getElementsByTagName(a),!f))return e;if(c){for(var g=[],n=0;b=f[n++];)M(b,c,d)&&g.push(b);f=g}for(n=0;b=f[n++];)("*"!=a||"!"!=b.tagName)&&e.add(b);return e}mb(a,b,c,d,e);return e}
+function kb(a,b,c,d,e){b.getElementsByName&&d&&"name"==c&&!B?(b=b.getElementsByName(d),v(b,function(b){a.matches(b)&&e.add(b)})):b.getElementsByClassName&&d&&"class"==c?(b=b.getElementsByClassName(d),v(b,function(b){b.className==d&&a.matches(b)&&e.add(b)})):a instanceof O?mb(a,b,c,d,e):b.getElementsByTagName&&(b=b.getElementsByTagName(a.getName()),v(b,function(a){M(a,c,d)&&e.add(a)}));return e}
+function nb(a,b,c,d,e){var f;if((8==a.g||c&&a.g===k)&&(f=b.childNodes)){var g=lb(a);if("*"!=g&&(f=ja(f,function(a){return a.tagName&&a.tagName.toLowerCase()==g}),!f))return e;c&&(f=ja(f,function(a){return M(a,c,d)}));v(f,function(a){("*"!=g||"!"!=a.tagName&&!("*"==g&&1!=a.nodeType))&&e.add(a)});return e}return ob(a,b,c,d,e)}function ob(a,b,c,d,e){for(b=b.firstChild;b;b=b.nextSibling)M(b,c,d)&&a.matches(b)&&e.add(b);return e}
+function mb(a,b,c,d,e){for(b=b.firstChild;b;b=b.nextSibling)M(b,c,d)&&a.matches(b)&&e.add(b),mb(a,b,c,d,e)}function lb(a){if(a instanceof O){if(8==a.g)return"!";if(a.g===k)return"*"}return a.getName()};function N(){this.h=this.e=k;this.r=0}function pb(a){this.j=a;this.next=this.p=k}function qb(a,b){if(a.e){if(!b.e)return a}else return b;for(var c=a.e,d=b.e,e=k,f=k,g=0;c&&d;)c.j==d.j||c.j instanceof gb&&d.j instanceof gb&&c.j.f==d.j.f?(f=c,c=c.next,d=d.next):0<ab(c.j,d.j)?(f=d,d=d.next):(f=c,c=c.next),(f.p=e)?e.next=f:a.e=f,e=f,g++;for(f=c||d;f;)f.p=e,e=e.next=f,g++,f=f.next;a.h=e;a.r=g;return a}
+N.prototype.unshift=function(a){a=new pb(a);a.next=this.e;this.h?this.e.p=a:this.e=this.h=a;this.e=a;this.r++};N.prototype.add=function(a){a=new pb(a);a.p=this.h;this.e?this.h.next=a:this.e=this.h=a;this.h=a;this.r++};function rb(a){return(a=a.e)?a.j:k}N.prototype.n=m("r");function sb(a){return(a=rb(a))?L(a):""}function P(a,b){return new tb(a,!!b)}function tb(a,b){this.V=a;this.H=(this.t=b)?a.h:a.e;this.D=k}
+tb.prototype.next=function(){var a=this.H;if(a==k)return k;var b=this.D=a;this.H=this.t?a.p:a.next;return b.j};tb.prototype.remove=function(){var a=this.V,b=this.D;b||h(Error("Next must be called at least once before remove."));var c=b.p,b=b.next;c?c.next=b:a.e=b;b?b.p=c:a.h=c;a.r--;this.D=k};function Q(a){this.d=a;this.c=this.i=l;this.s=k}Q.prototype.b=m("i");Q.prototype.l=m("s");function R(a,b){var c=a.evaluate(b);return c instanceof N?+sb(c):+c}function S(a,b){var c=a.evaluate(b);return c instanceof N?sb(c):""+c}function T(a,b){var c=a.evaluate(b);return c instanceof N?!!c.n():!!c};function ub(a,b,c){Q.call(this,a.d);this.G=a;this.L=b;this.P=c;this.i=b.b()||c.b();this.c=b.c||c.c;this.G==vb&&(!c.c&&!c.b()&&4!=c.d&&0!=c.d&&b.l()?this.s={name:b.l().name,q:c}:!b.c&&(!b.b()&&4!=b.d&&0!=b.d&&c.l())&&(this.s={name:c.l().name,q:b}))}s(ub,Q);
+function U(a,b,c,d,e){var b=b.evaluate(d),c=c.evaluate(d),f;if(b instanceof N&&c instanceof N){f=P(b);for(b=f.next();b;b=f.next()){e=P(c);for(d=e.next();d;d=e.next())if(a(L(b),L(d)))return j}return l}if(b instanceof N||c instanceof N){b instanceof N?e=b:(e=c,c=b);e=P(e);b=typeof c;for(d=e.next();d;d=e.next()){switch(b){case "number":f=+L(d);break;case "boolean":f=!!L(d);break;case "string":f=L(d);break;default:h(Error("Illegal primitive type for comparison."))}if(a(f,c))return j}return l}return e?
+"boolean"==typeof b||"boolean"==typeof c?a(!!b,!!c):"number"==typeof b||"number"==typeof c?a(+b,+c):a(b,c):a(+b,+c)}ub.prototype.evaluate=function(a){return this.G.m(this.L,this.P,a)};ub.prototype.toString=function(a){var a=a||"",b=a+"binary expression: "+this.G+"\n",a=a+" ",b=b+(this.L.toString(a)+"\n");return b+=this.P.toString(a)};function wb(a,b,c,d){this.X=a;this.ca=b;this.d=c;this.m=d}wb.prototype.toString=m("X");var xb={};
+function V(a,b,c,d){a in xb&&h(Error("Binary operator already created: "+a));a=new wb(a,b,c,d);return xb[a.toString()]=a}V("div",6,1,function(a,b,c){return R(a,c)/R(b,c)});V("mod",6,1,function(a,b,c){return R(a,c)%R(b,c)});V("*",6,1,function(a,b,c){return R(a,c)*R(b,c)});V("+",5,1,function(a,b,c){return R(a,c)+R(b,c)});V("-",5,1,function(a,b,c){return R(a,c)-R(b,c)});V("<",4,2,function(a,b,c){return U(function(a,b){return a<b},a,b,c)});
+V(">",4,2,function(a,b,c){return U(function(a,b){return a>b},a,b,c)});V("<=",4,2,function(a,b,c){return U(function(a,b){return a<=b},a,b,c)});V(">=",4,2,function(a,b,c){return U(function(a,b){return a>=b},a,b,c)});var vb=V("=",3,2,function(a,b,c){return U(function(a,b){return a==b},a,b,c,j)});V("!=",3,2,function(a,b,c){return U(function(a,b){return a!=b},a,b,c,j)});V("and",2,2,function(a,b,c){return T(a,c)&&T(b,c)});V("or",1,2,function(a,b,c){return T(a,c)||T(b,c)});function yb(a,b){b.n()&&4!=a.d&&h(Error("Primary expression must evaluate to nodeset if filter has predicate(s)."));Q.call(this,a.d);this.O=a;this.a=b;this.i=a.b();this.c=a.c}s(yb,Q);yb.prototype.evaluate=function(a){a=this.O.evaluate(a);return zb(this.a,a)};yb.prototype.toString=function(a){var a=a||"",b=a+"Filter: \n",a=a+" ",b=b+this.O.toString(a);return b+=this.a.toString(a)};function Ab(a,b){b.length<a.N&&h(Error("Function "+a.o+" expects at least"+a.N+" arguments, "+b.length+" given"));a.F!==k&&b.length>a.F&&h(Error("Function "+a.o+" expects at most "+a.F+" arguments, "+b.length+" given"));a.W&&v(b,function(b,d){4!=b.d&&h(Error("Argument "+d+" to function "+a.o+" is not of type Nodeset: "+b))});Q.call(this,a.d);this.w=a;this.B=b;this.i=a.i||la(b,function(a){return a.b()});this.c=a.U&&!b.length||a.T&&!!b.length||la(b,function(a){return a.c})}s(Ab,Q);
+Ab.prototype.evaluate=function(a){return this.w.m.apply(k,ma(a,this.B))};Ab.prototype.toString=function(a){var b=a||"",a=b+"Function: "+this.w+"\n",b=b+" ";this.B.length&&(a+=b+"Arguments:",b+=" ",a=ka(this.B,function(a,d){return a+"\n"+d.toString(b)},a));return a};function Bb(a,b,c,d,e,f,g,n,x){this.o=a;this.d=b;this.i=c;this.U=d;this.T=e;this.m=f;this.N=g;this.F=n!==i?n:g;this.W=!!x}Bb.prototype.toString=m("o");var Cb={};
+function W(a,b,c,d,e,f,g,n){a in Cb&&h(Error("Function already created: "+a+"."));Cb[a]=new Bb(a,b,c,d,l,e,f,g,n)}W("boolean",2,l,l,function(a,b){return T(b,a)},1);W("ceiling",1,l,l,function(a,b){return Math.ceil(R(b,a))},1);W("concat",3,l,l,function(a,b){var c=na(arguments,1);return ka(c,function(b,c){return b+S(c,a)},"")},2,k);W("contains",2,l,l,function(a,b,c){b=S(b,a);a=S(c,a);return-1!=b.indexOf(a)},2);W("count",1,l,l,function(a,b){return b.evaluate(a).n()},1,1,j);W("false",2,l,l,aa(l),0);
+W("floor",1,l,l,function(a,b){return Math.floor(R(b,a))},1);
+W("id",4,l,l,function(a,b){function c(a){if(K){var b=e.all[a];if(b){if(b.nodeType&&a==b.id)return b;if(b.length){var c;a:{c=function(b){return a==b.id};for(var d=b.length,f=r(b)?b.split(""):b,g=0;g<d;g++)if(g in f&&c.call(i,f[g])){c=g;break a}c=-1}return 0>c?k:r(b)?b.charAt(c):b[c]}}return k}return e.getElementById(a)}var d=a.f,e=9==d.nodeType?d:d.ownerDocument,d=S(b,a).split(/\s+/),f=[];v(d,function(a){var a=c(a),b;if(b=a){a:if(r(f))b=!r(a)||1!=a.length?-1:f.indexOf(a,0);else{for(b=0;b<f.length;b++)if(b in
+f&&f[b]===a)break a;b=-1}b=!(0<=b)}b&&f.push(a)});f.sort(ab);var g=new N;v(f,function(a){g.add(a)});return g},1);W("lang",2,l,l,aa(l),1);W("last",1,j,l,function(a){1!=arguments.length&&h(Error("Function last expects ()"));return a.h},0);W("local-name",3,l,j,function(a,b){var c=b?rb(b.evaluate(a)):a.f;return c?c.nodeName.toLowerCase():""},0,1,j);W("name",3,l,j,function(a,b){var c=b?rb(b.evaluate(a)):a.f;return c?c.nodeName.toLowerCase():""},0,1,j);W("namespace-uri",3,j,l,aa(""),0,1,j);
+W("normalize-space",3,l,j,function(a,b){return(b?S(b,a):L(a.f)).replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,"")},0,1);W("not",2,l,l,function(a,b){return!T(b,a)},1);W("number",1,l,j,function(a,b){return b?R(b,a):+L(a.f)},0,1);W("position",1,j,l,function(a){return a.Y},0);W("round",1,l,l,function(a,b){return Math.round(R(b,a))},1);W("starts-with",2,l,l,function(a,b,c){b=S(b,a);a=S(c,a);return 0==b.lastIndexOf(a,0)},2);W("string",3,l,j,function(a,b){return b?S(b,a):L(a.f)},0,1);
+W("string-length",1,l,j,function(a,b){return(b?S(b,a):L(a.f)).length},0,1);W("substring",3,l,l,function(a,b,c,d){c=R(c,a);if(isNaN(c)||Infinity==c||-Infinity==c)return"";d=d?R(d,a):Infinity;if(isNaN(d)||-Infinity===d)return"";var c=Math.round(c)-1,e=Math.max(c,0),a=S(b,a);if(Infinity==d)return a.substring(e);b=Math.round(d);return a.substring(e,c+b)},2,3);W("substring-after",3,l,l,function(a,b,c){b=S(b,a);a=S(c,a);c=b.indexOf(a);return-1==c?"":b.substring(c+a.length)},2);
+W("substring-before",3,l,l,function(a,b,c){b=S(b,a);a=S(c,a);a=b.indexOf(a);return-1==a?"":b.substring(0,a)},2);W("sum",1,l,l,function(a,b){for(var c=P(b.evaluate(a)),d=0,e=c.next();e;e=c.next())d+=+L(e);return d},1,1,j);W("translate",3,l,l,function(a,b,c,d){for(var b=S(b,a),c=S(c,a),e=S(d,a),a=[],d=0;d<c.length;d++){var f=c.charAt(d);f in a||(a[f]=e.charAt(d))}c="";for(d=0;d<b.length;d++)f=b.charAt(d),c+=f in a?a[f]:f;return c},3);W("true",2,l,l,aa(j),0);function O(a,b){this.R=a;this.M=b!==i?b:k;this.g=k;switch(a){case "comment":this.g=8;break;case "text":this.g=3;break;case "processing-instruction":this.g=7;break;case "node":break;default:h(Error("Unexpected argument"))}}O.prototype.matches=function(a){return this.g===k||this.g==a.nodeType};O.prototype.getName=m("R");O.prototype.toString=function(a){var a=a||"",b=a+"kindtest: "+this.R;this.M===k||(b+="\n"+this.M.toString(a+" "));return b};function Db(a){Q.call(this,3);this.Q=a.substring(1,a.length-1)}s(Db,Q);Db.prototype.evaluate=m("Q");Db.prototype.toString=function(a){return(a||"")+"literal: "+this.Q};function Eb(a){Q.call(this,1);this.S=a}s(Eb,Q);Eb.prototype.evaluate=m("S");Eb.prototype.toString=function(a){return(a||"")+"number: "+this.S};function Fb(a,b){Q.call(this,a.d);this.J=a;this.u=b;this.i=a.b();this.c=a.c;if(1==this.u.length){var c=this.u[0];!c.C&&c.k==Gb&&(c=c.A,"*"!=c.getName()&&(this.s={name:c.getName(),q:k}))}}s(Fb,Q);function Hb(){Q.call(this,4)}s(Hb,Q);Hb.prototype.evaluate=function(a){var b=new N,a=a.f;9==a.nodeType?b.add(a):b.add(a.ownerDocument);return b};Hb.prototype.toString=function(a){return a+"RootHelperExpr"};function Ib(){Q.call(this,4)}s(Ib,Q);Ib.prototype.evaluate=function(a){var b=new N;b.add(a.f);return b};
+Ib.prototype.toString=function(a){return a+"ContextHelperExpr"};
+Fb.prototype.evaluate=function(a){var b=this.J.evaluate(a);b instanceof N||h(Error("FilterExpr must evaluate to nodeset."));for(var a=this.u,c=0,d=a.length;c<d&&b.n();c++){var e=a[c],f=P(b,e.k.t),g;if(!e.b()&&e.k==Jb){for(g=f.next();(b=f.next())&&(!g.contains||g.contains(b))&&b.compareDocumentPosition(g)&8;g=b);b=e.evaluate(new eb(g))}else if(!e.b()&&e.k==Kb)g=f.next(),b=e.evaluate(new eb(g));else{g=f.next();for(b=e.evaluate(new eb(g));(g=f.next())!=k;)g=e.evaluate(new eb(g)),b=qb(b,g)}}return b};
+Fb.prototype.toString=function(a){var b=a||"",c=b+"PathExpr:\n",b=b+" ",c=c+this.J.toString(b);this.u.length&&(c+=b+"Steps:\n",b+=" ",v(this.u,function(a){c+=a.toString(b)}));return c};function Lb(a,b){this.a=a;this.t=!!b}function zb(a,b,c){for(c=c||0;c<a.a.length;c++)for(var d=a.a[c],e=P(b),f=b.n(),g,n=0;g=e.next();n++){var x=a.t?f-n:n+1;g=d.evaluate(new eb(g,x,f));var p;"number"==typeof g?p=x==g:"string"==typeof g||"boolean"==typeof g?p=!!g:g instanceof N?p=0<g.n():h(Error("Predicate.evaluate returned an unexpected type."));p||e.remove()}return b}Lb.prototype.l=function(){return 0<this.a.length?this.a[0].l():k};
+Lb.prototype.b=function(){for(var a=0;a<this.a.length;a++){var b=this.a[a];if(b.b()||1==b.d||0==b.d)return j}return l};Lb.prototype.n=function(){return this.a.length};Lb.prototype.toString=function(a){var b=a||"",a=b+"Predicates:",b=b+" ";return ka(this.a,function(a,d){return a+"\n"+b+d.toString(b)},a)};function Mb(a,b,c,d){Q.call(this,4);this.k=a;this.A=b;this.a=c||new Lb([]);this.C=!!d;b=this.a.l();a.Z&&b&&(a=b.name,a=K?a.toLowerCase():a,this.s={name:a,q:b.q});this.i=this.a.b()}s(Mb,Q);
+Mb.prototype.evaluate=function(a){var b=a.f,c=k,c=this.l(),d=k,e=k,f=0;c&&(d=c.name,e=c.q?S(c.q,a):k,f=1);if(this.C)if(!this.b()&&this.k==Nb)c=ib(this.A,b,d,e),c=zb(this.a,c,f);else if(a=P((new Mb(Ob,new O("node"))).evaluate(a)),b=a.next())for(c=this.m(b,d,e,f);(b=a.next())!=k;)c=qb(c,this.m(b,d,e,f));else c=new N;else c=this.m(a.f,d,e,f);return c};Mb.prototype.m=function(a,b,c,d){a=this.k.w(this.A,a,b,c);return a=zb(this.a,a,d)};
+Mb.prototype.toString=function(a){var a=a||"",b=a+"Step: \n",a=a+" ",b=b+(a+"Operator: "+(this.C?"//":"/")+"\n");this.k.o&&(b+=a+"Axis: "+this.k+"\n");b+=this.A.toString(a);if(this.a.length)for(var b=b+(a+"Predicates: \n"),c=0;c<this.a.length;c++)var d=c<this.a.length-1?", ":"",b=b+(this.a[c].toString(a)+d);return b};function Pb(a,b,c,d){this.o=a;this.w=b;this.t=c;this.Z=d}Pb.prototype.toString=m("o");var Qb={};
+function X(a,b,c,d){a in Qb&&h(Error("Axis already created: "+a));b=new Pb(a,b,c,!!d);return Qb[a]=b}X("ancestor",function(a,b){for(var c=new N,d=b;d=d.parentNode;)a.matches(d)&&c.unshift(d);return c},j);X("ancestor-or-self",function(a,b){var c=new N,d=b;do a.matches(d)&&c.unshift(d);while(d=d.parentNode);return c},j);
+var Gb=X("attribute",function(a,b){var c=new N,d=a.getName();if("style"==d&&b.style&&K)return c.add(new gb(b.style,b,"style",b.style.cssText,b.sourceIndex)),c;var e=b.attributes;if(e)if(a instanceof O&&a.g===k||"*"==d)for(var d=b.sourceIndex,f=0,g;g=e[f];f++)K?g.nodeValue&&c.add(hb(b,g,d)):c.add(g);else(g=e.getNamedItem(d))&&(K?g.nodeValue&&c.add(hb(b,g,b.sourceIndex)):c.add(g));return c},l),Nb=X("child",function(a,b,c,d,e){return(K?nb:ob).call(k,a,b,r(c)?c:k,r(d)?d:k,e||new N)},l,j);
+X("descendant",ib,l,j);var Ob=X("descendant-or-self",function(a,b,c,d){var e=new N;M(b,c,d)&&a.matches(b)&&e.add(b);return ib(a,b,c,d,e)},l,j),Jb=X("following",function(a,b,c,d){var e=new N;do for(var f=b;f=f.nextSibling;)M(f,c,d)&&a.matches(f)&&e.add(f),e=ib(a,f,c,d,e);while(b=b.parentNode);return e},l,j);X("following-sibling",function(a,b){for(var c=new N,d=b;d=d.nextSibling;)a.matches(d)&&c.add(d);return c},l);X("namespace",function(){return new N},l);
+X("parent",function(a,b){var c=new N;if(9==b.nodeType)return c;if(2==b.nodeType)return c.add(b.ownerElement),c;var d=b.parentNode;a.matches(d)&&c.add(d);return c},l);var Kb=X("preceding",function(a,b,c,d){var e=new N,f=[];do f.unshift(b);while(b=b.parentNode);for(var g=1,n=f.length;g<n;g++){for(var x=[],b=f[g];b=b.previousSibling;)x.unshift(b);for(var p=0,t=x.length;p<t;p++)b=x[p],M(b,c,d)&&a.matches(b)&&e.add(b),e=ib(a,b,c,d,e)}return e},j,j);
+X("preceding-sibling",function(a,b){for(var c=new N,d=b;d=d.previousSibling;)a.matches(d)&&c.unshift(d);return c},j);X("self",function(a,b){var c=new N;a.matches(b)&&c.add(b);return c},l);function Rb(a){Q.call(this,1);this.I=a;this.i=a.b();this.c=a.c}s(Rb,Q);Rb.prototype.evaluate=function(a){return-R(this.I,a)};Rb.prototype.toString=function(a){var a=a||"",b=a+"UnaryExpr: -\n";return b+=this.I.toString(a+" ")};function Sb(a){Q.call(this,4);this.z=a;this.i=la(this.z,function(a){return a.b()});this.c=la(this.z,function(a){return a.c})}s(Sb,Q);Sb.prototype.evaluate=function(a){var b=new N;v(this.z,function(c){c=c.evaluate(a);c instanceof N||h(Error("PathExpr must evaluate to NodeSet."));b=qb(b,c)});return b};Sb.prototype.toString=function(a){var b=a||"",c=b+"UnionExpr:\n",b=b+" ";v(this.z,function(a){c+=a.toString(b)+"\n"});return c.substring(0,c.length)};!A&&D&&(Va?Ua("533"):B?da(document.documentMode,"533"):Ea("533"));function Tb(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}Tb.prototype.toString=function(){return"("+this.top+"t, "+this.right+"r, "+this.bottom+"b, "+this.left+"l)"};Tb.prototype.contains=function(a){return!this||!a?l:a instanceof Tb?a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom};function Y(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}Y.prototype.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"};Y.prototype.contains=function(a){return a instanceof Y?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};function Ub(a,b){var c=J(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,k))?c[b]||c.getPropertyValue(b)||"":""}function Z(a,b){return Ub(a,b)||(a.currentStyle?a.currentStyle[b]:k)||a.style&&a.style[b]}function Vb(a){var b=a.getBoundingClientRect();B&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
+function Wb(a){if(B&&!E(8))return a.offsetParent;for(var b=J(a),c=Z(a,"position"),d="fixed"==c||"absolute"==c,a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=Z(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return k}
+function Xb(a){var b,c=J(a),d=Z(a,"position");ha(a,"Parameter is required");var e=C&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new I(0,0),g;b=c?J(c):document;if(g=B)if(g=!E(9))g="CSS1Compat"!=Ya(b).v.compatMode;g=g?b.body:b.documentElement;if(a==g)return f;if(a.getBoundingClientRect)b=Vb(a),a=db(Ya(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,
+f.y=b.screenY-a.screenY;else{e=a;do{f.x+=e.offsetLeft;f.y+=e.offsetTop;e!=a&&(f.x+=e.clientLeft||0,f.y+=e.clientTop||0);if(D&&"fixed"==Z(e,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}e=e.offsetParent}while(e&&e!=a);if(A||D&&"absolute"==d)f.y-=c.body.offsetTop;for(e=a;(e=Wb(e))&&e!=c.body&&e!=g;)if(f.x-=e.scrollLeft,!A||"TR"!=e.tagName)f.y-=e.scrollTop}return f}var Yb={thin:2,medium:4,thick:6};
+function Zb(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:k))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:k,d;if(c in Yb)d=Yb[c];else if(/^\d+px?$/.test(c))d=parseInt(c,10);else{d=a.style.left;var e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=c;c=a.style.pixelLeft;a.style.left=d;a.runtimeStyle.left=e;d=c}return d}var $b=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function ac(a){for(a=a.parentNode;a&&1!=a.nodeType&&9!=a.nodeType&&11!=a.nodeType;)a=a.parentNode;return a&&1==a.nodeType?a:k}function bc(a,b){b.scrollLeft+=Math.min(a.left,Math.max(a.left-a.width,0));b.scrollTop+=Math.min(a.top,Math.max(a.top-a.height,0))};function cc(a,b){var c;c=b?new Y(b.left,b.top,b.width,b.height):new Y(0,0,a.offsetWidth,a.offsetHeight);for(var d=J(a),e=ac(a);e&&e!=d.body&&e!=d.documentElement;e=ac(e)){var f=c,g=e,n=Xb(a),x=Xb(g),p;var t=g;if(B){p=Zb(t,"borderLeft");var y=Zb(t,"borderRight"),z=Zb(t,"borderTop"),t=Zb(t,"borderBottom");p=new Tb(z,y,t,p)}else p=Ub(t,"borderLeftWidth"),y=Ub(t,"borderRightWidth"),z=Ub(t,"borderTopWidth"),t=Ub(t,"borderBottomWidth"),p=new Tb(parseFloat(z),parseFloat(y),parseFloat(t),parseFloat(p));bc(new Y(n.x+
+f.left-x.x-p.left,n.y+f.top-x.y-p.top,g.clientWidth-f.width,g.clientHeight-f.height),g)}e=Xb(a);f=Ya(d);f=(f.v.parentWindow||f.v.defaultView||window).document;f="CSS1Compat"==f.compatMode?f.documentElement:f.body;f=new Xa(f.clientWidth,f.clientHeight);bc(new Y(e.x+c.left-d.body.scrollLeft,e.y+c.top-d.body.scrollTop,f.width-c.width,f.height-c.height),d.body||d.documentElement);var d=a.getClientRects?a.getClientRects()[0]:k,o;if(d)o=new I(d.left,d.top);else{d=new I;if(1==a.nodeType){if(a.getBoundingClientRect?
+(e=Vb(a),d.x=e.left,d.y=e.top):(e=db(Ya(a)),f=Xb(a),d.x=f.x-e.x,d.y=f.y-e.y),C&&!Ea(12)){B?o="-ms-transform":D?o="-webkit-transform":A?o="-o-transform":C&&(o="-moz-transform");var H;o&&(H=Z(a,o));H||(H=Z(a,"transform"));H?(o=H.match($b),o=!o?new I(0,0):new I(parseFloat(o[1]),parseFloat(o[2]))):o=new I(0,0);d=new I(d.x+o.x,d.y+o.y)}}else o="function"==ba(a.K),H=a,a.targetTouches?H=a.targetTouches[0]:o&&a.K().targetTouches&&(H=a.K().targetTouches[0]),d.x=H.clientX,d.y=H.clientY;o=d}return new I(o.x+
+c.left,o.y+c.top)}var dc=["_"],$=q;!(dc[0]in $)&&$.execScript&&$.execScript("var "+dc[0]);for(var ec;dc.length&&(ec=dc.shift());)!dc.length&&cc!==i?$[ec]=cc:$=$[ec]?$[ec]:$[ec]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!=undefined?window.navigator:null}, arguments);}
View
1 tools/atoms_build_dir/build.desc
@@ -121,6 +121,7 @@ js_deps(name = "build_atoms",
"//javascript/webdriver/atoms:execute_async_script",
"//javascript/webdriver/atoms:get_attribute",
"//javascript/webdriver/atoms:get_location",
+ "//javascript/webdriver/atoms:get_location_in_view",
"//javascript/webdriver/atoms:get_in_view_location",
"//javascript/webdriver/atoms:get_window_size",
"//javascript/webdriver/atoms:set_window_size",

0 comments on commit 5d25594

Please sign in to comment.
Something went wrong with that request. Please try again.