diff --git a/javascript/atoms/action.js b/javascript/atoms/action.js index 74a0fa1c1b..204cd73323 100644 --- a/javascript/atoms/action.js +++ b/javascript/atoms/action.js @@ -98,7 +98,6 @@ bot.action.clear = function(element) { element.value = ''; } bot.events.fire(element, bot.events.EventType.CHANGE); - bot.events.fire(element, bot.events.EventType.BLUR); var body = bot.getDocument().body; if (body) { bot.action.LegacyDevice_.focusOnElement(body); diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js index 9bd669a05d..569de66f58 100644 --- a/javascript/atoms/dom.js +++ b/javascript/atoms/dom.js @@ -587,14 +587,8 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) { var parent = bot.dom.getParentNodeInComposedDom(e); if (bot.dom.IS_SHADOW_DOM_ENABLED && (parent instanceof ShadowRoot)) { - if (parent.host.shadowRoot !== parent) { - // There is a younger shadow root, which will take precedence over - // the shadow this element is in, thus this element won't be - // displayed. - return false; - } else { - parent = parent.host; - } + // For backward compatibility, treat all shadow roots as shown. + return true; } if (parent && (parent.nodeType == goog.dom.NodeType.DOCUMENT || @@ -602,7 +596,7 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) { return true; } - return parent && displayed(parent); + return !!parent && displayed(parent); } return bot.dom.isShown_(elem, !!opt_ignoreOpacity, displayed); @@ -1262,13 +1256,6 @@ bot.dom.getOpacityNonIE_ = function(elem) { bot.dom.getParentNodeInComposedDom = function(node) { var /**@type {Node}*/ parent = node.parentNode; - // Shadow DOM v1 - if (parent && parent.shadowRoot && node.assignedSlot !== undefined) { - // Can be null on purpose, meaning it has no parent as - // it hasn't yet been slotted - return node.assignedSlot ? node.assignedSlot.parentNode : null; - } - // Shadow DOM V0 (deprecated) if (node.getDestinationInsertionPoints) { var destinations = node.getDestinationInsertionPoints(); @@ -1277,6 +1264,13 @@ bot.dom.getParentNodeInComposedDom = function(node) { } } + // Shadow DOM v1 + if (parent && parent.shadowRoot && node.assignedSlot !== undefined) { + // Can be null on purpose, meaning it has no parent as + // it hasn't yet been slotted + return node.assignedSlot ? node.assignedSlot.parentNode : null; + } + return parent; }; diff --git a/javascript/atoms/mouse.js b/javascript/atoms/mouse.js index 737ed50f62..1bc9e858f5 100644 --- a/javascript/atoms/mouse.js +++ b/javascript/atoms/mouse.js @@ -143,7 +143,7 @@ bot.Mouse.NO_BUTTON_VALUE_INDEX_ = 3; * click/ mouseup/ mouseout/ mousemove contextmenu * dblclick mousedown mouseover * IE_DOC_PRE9 0 0 0 X 1 4 2 X 0 0 0 0 1 4 2 0 X X 0 X - * WEBKIT/IE9 0 1 2 X 0 1 2 X 0 1 2 0 0 1 2 0 X X 2 X + * WEBKIT/IE9 0 1 2 X 0 1 2 X 0 1 2 4 0 1 2 4 X X 2 X * GECKO 0 1 2 X 0 1 2 X 0 0 0 0 0 0 0 0 X X 2 X * * @private {!Object.>} @@ -163,8 +163,8 @@ bot.Mouse.MOUSE_BUTTON_VALUE_MAP_ = (function() { buttonValueMap[bot.events.EventType.CLICK] = [0, 1, 2, null]; buttonValueMap[bot.events.EventType.CONTEXTMENU] = [null, null, 2, null]; buttonValueMap[bot.events.EventType.MOUSEUP] = [0, 1, 2, null]; - buttonValueMap[bot.events.EventType.MOUSEOUT] = [0, 1, 2, 0]; - buttonValueMap[bot.events.EventType.MOUSEMOVE] = [0, 1, 2, 0]; + buttonValueMap[bot.events.EventType.MOUSEOUT] = [0, 1, 2, 4]; + buttonValueMap[bot.events.EventType.MOUSEMOVE] = [0, 1, 2, 4]; } else { buttonValueMap[bot.events.EventType.CLICK] = [0, 1, 2, null]; buttonValueMap[bot.events.EventType.CONTEXTMENU] = [null, null, 2, null]; diff --git a/javascript/chrome-driver/atoms.js b/javascript/chrome-driver/atoms.js index 5cf4416460..7cd02f0507 100644 --- a/javascript/chrome-driver/atoms.js +++ b/javascript/chrome-driver/atoms.js @@ -142,7 +142,12 @@ 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); + // Chrome uses either doc.documentElement or doc.body, depending on + // compatibility settings. For reliability, call scrollHelper on both. + // Calling scrollHelper on the wrong object is harmless. + scrollHelper(doc.documentElement, windowSize, offset, region, center); + if (doc.body) + scrollHelper(doc.body, windowSize, offset, region, center); }; diff --git a/rake-tasks/crazy_fun/mappings/javascript.rb b/rake-tasks/crazy_fun/mappings/javascript.rb index 1ac2b2066a..dfa11fbbc2 100644 --- a/rake-tasks/crazy_fun/mappings/javascript.rb +++ b/rake-tasks/crazy_fun/mappings/javascript.rb @@ -857,6 +857,8 @@ module Javascript flags.push("--jscomp_error=undefinedVars") flags.push("--jscomp_error=uselessCode") flags.push("--jscomp_error=visibility") + # Work around https://github.com/google/closure-compiler/issues/1044 + flags.push("--use_types_for_optimization=false") expanded_flags = flags.join(" ") << " --js='" <<