summaryrefslogtreecommitdiffstats
path: root/third_party/webdriver
diff options
context:
space:
mode:
authorchrisgao@chromium.org <chrisgao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-13 18:12:41 +0000
committerchrisgao@chromium.org <chrisgao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-13 18:12:41 +0000
commitd323ffcdacf5690f35877e2323b42dfa0bc4024d (patch)
treef55b3e24fd436cefb8438de5b5103e16771d7936 /third_party/webdriver
parent0b595b810489482f51bbd1cada7c1a53171faae5 (diff)
downloadchromium_src-d323ffcdacf5690f35877e2323b42dfa0bc4024d.zip
chromium_src-d323ffcdacf5690f35877e2323b42dfa0bc4024d.tar.gz
chromium_src-d323ffcdacf5690f35877e2323b42dfa0bc4024d.tar.bz2
[chromedriver] Fix atoms for scrolling elements due to a change on blink side.
BUG=chromedriver:569 Review URL: https://codereview.chromium.org/26142006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/webdriver')
-rw-r--r--third_party/webdriver/README.chromium2
-rw-r--r--third_party/webdriver/atoms.cc128
-rw-r--r--third_party/webdriver/patch.diff27
3 files changed, 98 insertions, 59 deletions
diff --git a/third_party/webdriver/README.chromium b/third_party/webdriver/README.chromium
index c09e84f..ace662e 100644
--- a/third_party/webdriver/README.chromium
+++ b/third_party/webdriver/README.chromium
@@ -34,7 +34,7 @@ Contents:
<chromium_dir>/src/third_party/webdriver/atoms.cc
The atoms.h/cc files are only used directly in the chrome version of
- webdriver found under the path src/chrome/test/webdriver.
+ webdriver found under the path src/chrome/test/chromedriver.
Local Modifications:
- Applied changes in patch.diff to the selenium tree prior to building the atoms.
diff --git a/third_party/webdriver/atoms.cc b/third_party/webdriver/atoms.cc
index 03365275..78f8c9b 100644
--- a/third_party/webdriver/atoms.cc
+++ b/third_party/webdriver/atoms.cc
@@ -76,7 +76,7 @@ const char* const GET_FIRST_CLIENT_RECT[] = {
};
const char* const GET_LOCATION_IN_VIEW[] = {
- "function(){return function(){var k=this;\nfunction l(a){var b=typeof a;",
+ "function(){return function(){var m=this;\nfunction n(a){var b=typeof a;",
"if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a insta",
"nceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[obj",
"ect Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"=",
@@ -85,63 +85,75 @@ const char* const GET_LOCATION_IN_VIEW[] = {
"ray\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"unde",
"fined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call",
"\"))return\"function\"}else return\"null\";else if(\"function\"==\nb&&",
- "\"undefined\"==typeof a.call)return\"object\";return b};var m;function ",
- "n(a,b){this.x=void 0!==a?a:0;this.y=void 0!==b?b:0}n.prototype.toString",
- "=function(){return\"(\"+this.x+\", \"+this.y+\")\"};function p(a,b){thi",
- "s.width=a;this.height=b}p.prototype.toString=function(){return\"(\"+thi",
- "s.width+\" x \"+this.height+\")\"};function q(a){return a?new r(s(a)):m",
- "||(m=new r)}function s(a){return 9==a.nodeType?a:a.ownerDocument||a.doc",
- "ument}function r(a){this.a=a||k.document||document}function t(a){a=(a.a",
- ".parentWindow||a.a.defaultView||window).document;a=\"CSS1Compat\"==a.co",
- "mpatMode?a.documentElement:a.body;return new p(a.clientWidth,a.clientHe",
- "ight)}function u(a){var b=a.a;a=b.body;b=b.parentWindow||b.defaultView;",
- "return new n(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)};f",
- "unction v(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}v.",
- "prototype.toString=function(){return\"(\"+this.top+\"t, \"+this.right+",
- "\"r, \"+this.bottom+\"b, \"+this.left+\"l)\"};function w(a,b,c,d){this.",
- "left=a;this.top=b;this.width=c;this.height=d}w.prototype.toString=funct",
- "ion(){return\"(\"+this.left+\", \"+this.top+\" - \"+this.width+\"w x \"",
- "+this.height+\"h)\"};function x(a,b){var c=s(a);return c.defaultView&&c",
- ".defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,null",
- "))?c[b]||c.getPropertyValue(b)||\"\":\"\"}function y(a){return x(a,\"po",
- "sition\")||(a.currentStyle?a.currentStyle.position:null)||a.style&&a.st",
- "yle.position}function z(a){var b;try{b=a.getBoundingClientRect()}catch(",
- "c){return{left:0,top:0,right:0,bottom:0}}return b}\nfunction A(a){var b",
- "=s(a),c=y(a),d=\"fixed\"==c||\"absolute\"==c;for(a=a.parentNode;a&&a!=b",
- ";a=a.parentNode)if(c=y(a),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 null}",
- "\nfunction B(a){var b=s(a),c=y(a),d=new n(0,0),f=(b?s(b):document).docu",
- "mentElement;if(a==f)return d;if(a.getBoundingClientRect)a=z(a),b=u(q(b)",
- "),d.x=a.left+b.x,d.y=a.top+b.y;else if(b.getBoxObjectFor)a=b.getBoxObje",
- "ctFor(a),b=b.getBoxObjectFor(f),d.x=a.screenX-b.screenX,d.y=a.screenY-b",
- ".screenY;else{var e=a;do{d.x+=e.offsetLeft;d.y+=e.offsetTop;e!=a&&(d.x+",
- "=e.clientLeft||0,d.y+=e.clientTop||0);if(\"fixed\"==y(e)){d.x+=b.body.s",
- "crollLeft;d.y+=b.body.scrollTop;break}e=e.offsetParent}while(e&&e!=a);",
- "\"absolute\"==\nc&&(d.y-=b.body.offsetTop);for(e=a;(e=A(e))&&e!=b.body&",
- "&e!=f;)d.x-=e.scrollLeft,d.y-=e.scrollTop}return d}function C(a){if(1==",
- "a.nodeType){if(a.getBoundingClientRect)a=z(a),a=new n(a.left,a.top);els",
- "e{var b=u(q(a));a=B(a);a=new n(a.x-b.x,a.y-b.y)}return a}var b=\"functi",
- "on\"==l(a.b),c=a;a.targetTouches?c=a.targetTouches[0]:b&&a.b().targetTo",
- "uches&&(c=a.b().targetTouches[0]);return new n(c.clientX,c.clientY)};fu",
- "nction D(a,b){var c;c=B(b);var d=B(a);c=new n(c.x-d.x,c.y-d.y);var f,e,",
- "h;h=x(a,\"borderLeftWidth\");e=x(a,\"borderRightWidth\");f=x(a,\"border",
- "TopWidth\");d=x(a,\"borderBottomWidth\");d=new v(parseFloat(f),parseFlo",
- "at(e),parseFloat(d),parseFloat(h));c.x-=d.left;c.y-=d.top;return c}\nfu",
- "nction E(a,b,c){function d(a,b,c,d,e){d=new w(c.x+d.left,c.y+d.top,d.wi",
- "dth,d.height);c=[0,0];b=[b.width,b.height];var f=[d.left,d.top];d=[d.wi",
- "dth,d.height];for(var g=0;2>g;g++)if(d[g]>b[g])c[g]=e?f[g]+d[g]/2-b[g]/",
- "2:f[g];else{var h=f[g]-b[g]+d[g];0<h?c[g]=h:0>f[g]&&(c[g]=f[g])}e=new n",
- "(c[0],c[1]);a.scrollLeft+=e.x;a.scrollTop+=e.y}for(var f=s(a),e=a.paren",
- "tNode,h;e&&e!=f.documentElement&&e!=f.body;)h=D(e,a),d(e,new p(e.client",
- "Width,e.clientHeight),h,b,c),e=e.parentNode;h=C(a);a=t(q(a));d(f.body,a",
- ",h,\nb,c)};function F(a,b,c){c||(c=new w(0,0,a.offsetWidth,a.offsetHeig",
- "ht));E(a,c,b);a=C(a);return new n(a.x+c.left,a.y+c.top)}var G=[\"_\"],H",
- "=k;G[0]in H||!H.execScript||H.execScript(\"var \"+G[0]);for(var I;G.len",
- "gth&&(I=G.shift());)G.length||void 0===F?H=H[I]?H[I]:H[I]={}:H[I]=F;; r",
- "eturn this._.apply(null,arguments);}.apply({navigator:typeof window!=un",
- "defined?window.navigator:null,document:typeof window!=undefined?window.",
- "document:null}, arguments);}",
+ "\"undefined\"==typeof a.call)return\"object\";return b};function p(){fo",
+ "r(var a=0,b=String(q).replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g,\"\").split(",
+ "\".\"),c=\"32\".replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g,\"\").split(\".\")",
+ ",d=Math.max(b.length,c.length),f=0;0==a&&f<d;f++){var e=b[f]||\"\",h=c[",
+ "f]||\"\",K=RegExp(\"(\\\\d*)(\\\\D*)\",\"g\"),L=RegExp(\"(\\\\d*)(\\\\D",
+ "*)\",\"g\");do{var k=K.exec(e)||[\"\",\"\",\"\"],l=L.exec(h)||[\"\",\"",
+ "\",\"\"];if(0==k[0].length&&0==l[0].length)break;a=((0==k[1].length?0:p",
+ "arseInt(k[1],10))<(0==l[1].length?0:parseInt(l[1],10))?-1:(0==k[1].leng",
+ "th?0:parseInt(k[1],10))>(0==l[1].length?\n0:parseInt(l[1],10))?1:0)||((",
+ "0==k[2].length)<(0==l[2].length)?-1:(0==k[2].length)>(0==l[2].length)?1",
+ ":0)||(k[2]<l[2]?-1:k[2]>l[2]?1:0)}while(0==a)}return a};var q,r=/Chrome",
+ "\\/([0-9.]+)/.exec(m.navigator?m.navigator.userAgent:null);q=r?r[1]:\"",
+ "\";var s;function t(a,b){this.x=void 0!==a?a:0;this.y=void 0!==b?b:0}t.",
+ "prototype.toString=function(){return\"(\"+this.x+\", \"+this.y+\")\"};f",
+ "unction u(a,b){this.width=a;this.height=b}u.prototype.toString=function",
+ "(){return\"(\"+this.width+\" x \"+this.height+\")\"};function v(a){retu",
+ "rn a?new w(x(a)):s||(s=new w)}function x(a){return 9==a.nodeType?a:a.ow",
+ "nerDocument||a.document}function w(a){this.a=a||m.document||document}fu",
+ "nction y(a){a=(a.a.parentWindow||a.a.defaultView||window).document;a=\"",
+ "CSS1Compat\"==a.compatMode?a.documentElement:a.body;return new u(a.clie",
+ "ntWidth,a.clientHeight)}function z(a){var b=a.a;a=b.body;b=b.parentWind",
+ "ow||b.defaultView;return new t(b.pageXOffset||a.scrollLeft,b.pageYOffse",
+ "t||a.scrollTop)};function A(a,b,c,d){this.top=a;this.right=b;this.botto",
+ "m=c;this.left=d}A.prototype.toString=function(){return\"(\"+this.top+\"",
+ "t, \"+this.right+\"r, \"+this.bottom+\"b, \"+this.left+\"l)\"};function",
+ " B(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}B.prototy",
+ "pe.toString=function(){return\"(\"+this.left+\", \"+this.top+\" - \"+th",
+ "is.width+\"w x \"+this.height+\"h)\"};function C(a,b){var c=x(a);return",
+ " c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getCom",
+ "putedStyle(a,null))?c[b]||c.getPropertyValue(b)||\"\":\"\"}function D(a",
+ "){return C(a,\"position\")||(a.currentStyle?a.currentStyle.position:nul",
+ "l)||a.style&&a.style.position}function E(a){var b;try{b=a.getBoundingCl",
+ "ientRect()}catch(c){return{left:0,top:0,right:0,bottom:0}}return b}\nfu",
+ "nction F(a){var b=x(a),c=D(a),d=\"fixed\"==c||\"absolute\"==c;for(a=a.p",
+ "arentNode;a&&a!=b;a=a.parentNode)if(c=D(a),d=d&&\"static\"==c&&a!=b.doc",
+ "umentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeigh",
+ "t>a.clientHeight||\"fixed\"==c||\"absolute\"==c||\"relative\"==c))retur",
+ "n a;return null}\nfunction G(a){var b=x(a),c=D(a),d=new t(0,0),f=(b?x(b",
+ "):document).documentElement;if(a==f)return d;if(a.getBoundingClientRect",
+ ")a=E(a),b=z(v(b)),d.x=a.left+b.x,d.y=a.top+b.y;else if(b.getBoxObjectFo",
+ "r)a=b.getBoxObjectFor(a),b=b.getBoxObjectFor(f),d.x=a.screenX-b.screenX",
+ ",d.y=a.screenY-b.screenY;else{var e=a;do{d.x+=e.offsetLeft;d.y+=e.offse",
+ "tTop;e!=a&&(d.x+=e.clientLeft||0,d.y+=e.clientTop||0);if(\"fixed\"==D(e",
+ ")){d.x+=b.body.scrollLeft;d.y+=b.body.scrollTop;break}e=e.offsetParent}",
+ "while(e&&e!=a);\"absolute\"==\nc&&(d.y-=b.body.offsetTop);for(e=a;(e=F(",
+ "e))&&e!=b.body&&e!=f;)d.x-=e.scrollLeft,d.y-=e.scrollTop}return d}funct",
+ "ion H(a){if(1==a.nodeType){if(a.getBoundingClientRect)a=E(a),a=new t(a.",
+ "left,a.top);else{var b=z(v(a));a=G(a);a=new t(a.x-b.x,a.y-b.y)}return a",
+ "}var b=\"function\"==n(a.b),c=a;a.targetTouches?c=a.targetTouches[0]:b&",
+ "&a.b().targetTouches&&(c=a.b().targetTouches[0]);return new t(c.clientX",
+ ",c.clientY)};function I(a,b){var c;c=G(b);var d=G(a);c=new t(c.x-d.x,c.",
+ "y-d.y);var f,e,h;h=C(a,\"borderLeftWidth\");e=C(a,\"borderRightWidth\")",
+ ";f=C(a,\"borderTopWidth\");d=C(a,\"borderBottomWidth\");d=new A(parseFl",
+ "oat(f),parseFloat(e),parseFloat(d),parseFloat(h));c.x-=d.left;c.y-=d.to",
+ "p;return c}\nfunction J(a,b,c){function d(a,b,c,d,e){d=new B(c.x+d.left",
+ ",c.y+d.top,d.width,d.height);c=[0,0];b=[b.width,b.height];var f=[d.left",
+ ",d.top];d=[d.width,d.height];for(var g=0;2>g;g++)if(d[g]>b[g])c[g]=e?f[",
+ "g]+d[g]/2-b[g]/2:f[g];else{var h=f[g]-b[g]+d[g];0<h?c[g]=h:0>f[g]&&(c[g",
+ "]=f[g])}e=new t(c[0],c[1]);a.scrollLeft+=e.x;a.scrollTop+=e.y}for(var f",
+ "=x(a),e=a.parentNode,h;e&&e!=f.documentElement&&e!=f.body;)h=I(e,a),d(e",
+ ",new u(e.clientWidth,e.clientHeight),h,b,c),e=e.parentNode;h=H(a);a=y(v",
+ "(a));0<=p()&&\"CSS1Compat\"==\nf.compatMode?d(f.documentElement,a,h,b,c",
+ "):d(f.body,a,h,b,c)};function M(a,b,c){c||(c=new B(0,0,a.offsetWidth,a.",
+ "offsetHeight));J(a,c,b);a=H(a);return new t(a.x+c.left,a.y+c.top)}var N",
+ "=[\"_\"],O=m;N[0]in O||!O.execScript||O.execScript(\"var \"+N[0]);for(v",
+ "ar P;N.length&&(P=N.shift());)N.length||void 0===M?O=O[P]?O[P]:O[P]={}:",
+ "O[P]=M;; return this._.apply(null,arguments);}.apply({navigator:typeof ",
+ "window!=undefined?window.navigator:null,document:typeof window!=undefin",
+ "ed?window.document:null}, arguments);}",
NULL
};
diff --git a/third_party/webdriver/patch.diff b/third_party/webdriver/patch.diff
index e13623c..0b148ee 100644
--- a/third_party/webdriver/patch.diff
+++ b/third_party/webdriver/patch.diff
@@ -10,6 +10,33 @@ index e2693f8..3731db3 100644
(goog.userAgent.product.ANDROID && bot.userAgent.isProductVersion(4))) {
bot.events.fire(select, bot.events.EventType.CHANGE);
}
+diff --git a/javascript/chrome-driver/atoms.js b/javascript/chrome-driver/atoms.js
+index 66d508c..4dad19d 100644
+--- a/javascript/chrome-driver/atoms.js
++++ b/javascript/chrome-driver/atoms.js
+@@ -20,6 +20,7 @@
+
+ goog.provide('webdriver.chrome');
+
++goog.require('bot.userAgent');
+ goog.require('goog.dom');
+ goog.require('goog.math.Coordinate');
+ goog.require('goog.math.Rect');
+@@ -124,7 +125,13 @@ webdriver.chrome.scrollIntoView_ = function(elem, region, center) {
+
+ offset = goog.style.getClientPosition(elem);
+ var windowSize = goog.dom.getDomHelper(elem).getViewportSize();
+- scrollHelper(doc.body, windowSize, offset, region, center);
++ // From Chrome 32+, setting scrollTop/Left properties of both
++ // document.documentElement and document.body differs according to the HTML
++ // mode used (strict or quirks).
++ if (bot.userAgent.isProductVersion(32) && doc.compatMode == "CSS1Compat")
++ scrollHelper(doc.documentElement, windowSize, offset, region, center);
++ else
++ scrollHelper(doc.body, windowSize, offset, region, center);
+ };
+
+
diff --git a/javascript/chrome-driver/build.desc b/javascript/chrome-driver/build.desc
index 423c450..1889095 100644
--- a/javascript/chrome-driver/build.desc