OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 _normalizeEventTypes: function(types) | 1999 _normalizeEventTypes: function(types) |
2000 { | 2000 { |
2001 if (typeof types === "undefined") | 2001 if (typeof types === "undefined") |
2002 types = ["mouse", "key", "touch", "control", "load", "unload", "abor
t", "error", "select", "input", "change", "submit", "reset", "focus", "blur", "r
esize", "scroll", "search", "devicemotion", "deviceorientation"]; | 2002 types = ["mouse", "key", "touch", "control", "load", "unload", "abor
t", "error", "select", "input", "change", "submit", "reset", "focus", "blur", "r
esize", "scroll", "search", "devicemotion", "deviceorientation"]; |
2003 else if (typeof types === "string") | 2003 else if (typeof types === "string") |
2004 types = [types]; | 2004 types = [types]; |
2005 | 2005 |
2006 var result = []; | 2006 var result = []; |
2007 for (var i = 0; i < types.length; ++i) { | 2007 for (var i = 0; i < types.length; ++i) { |
2008 if (types[i] === "mouse") | 2008 if (types[i] === "mouse") |
2009 push(result, "mousedown", "mouseup", "click", "dblclick", "mouse
move", "mouseover", "mouseout", "mousewheel"); | 2009 push(result, "click", "dblclick", "mousedown", "mouseeenter", "m
ouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "mouseleave", "mous
ewheel"); |
2010 else if (types[i] === "key") | 2010 else if (types[i] === "key") |
2011 push(result, "keydown", "keyup", "keypress", "textInput"); | 2011 push(result, "keydown", "keyup", "keypress", "textInput"); |
2012 else if (types[i] === "touch") | 2012 else if (types[i] === "touch") |
2013 push(result, "touchstart", "touchmove", "touchend", "touchcancel
"); | 2013 push(result, "touchstart", "touchmove", "touchend", "touchcancel
"); |
2014 else if (types[i] === "control") | 2014 else if (types[i] === "control") |
2015 push(result, "resize", "scroll", "zoom", "focus", "blur", "selec
t", "input", "change", "submit", "reset"); | 2015 push(result, "resize", "scroll", "zoom", "focus", "blur", "selec
t", "input", "change", "submit", "reset"); |
2016 else | 2016 else |
2017 push(result, types[i]); | 2017 push(result, types[i]); |
2018 } | 2018 } |
2019 return result; | 2019 return result; |
2020 }, | 2020 }, |
2021 | 2021 |
2022 /** | 2022 /** |
2023 * @param {!Event} event | 2023 * @param {!Event} event |
2024 */ | 2024 */ |
2025 _logEvent: function(event) | 2025 _logEvent: function(event) |
2026 { | 2026 { |
2027 inspectedWindow.console.log(event.type, event); | 2027 inspectedWindow.console.log(event.type, event); |
2028 } | 2028 } |
2029 } | 2029 } |
2030 | 2030 |
2031 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 2031 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
2032 return injectedScript; | 2032 return injectedScript; |
2033 }) | 2033 }) |
OLD | NEW |