summaryrefslogtreecommitdiffstats
path: root/testing/marionette/element.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-23 11:54:06 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-23 11:54:06 +0200
commitd9d3b687b7c892b400e781dd5c57897efd7173aa (patch)
tree835dacc8cb3df7b05d4b62f4c551d8ad9f791371 /testing/marionette/element.js
parent1ea8529cfb0a246d09daf1ec742d063c08cf1899 (diff)
downloadUXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar.gz
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar.lz
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.tar.xz
UXP-d9d3b687b7c892b400e781dd5c57897efd7173aa.zip
moebius#195: DOM - PointerEvent - improvements
https://github.com/MoonchildProductions/moebius/pull/195
Diffstat (limited to 'testing/marionette/element.js')
-rw-r--r--testing/marionette/element.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/testing/marionette/element.js b/testing/marionette/element.js
index 8e66ee6df..9687fb27d 100644
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -953,6 +953,12 @@ element.getContainer = function (el) {
* pointer-interactable, if it is found somewhere in the
* |elementsFromPoint| list at |el|'s in-view centre coordinates.
*
+ * Before running the check, we change |el|'s pointerEvents style property
+ * to "auto", since elements without pointer events enabled do not turn
+ * up in the paint tree we get from document.elementsFromPoint. This is
+ * a specialisation that is only relevant when checking if the element is
+ * in view.
+ *
* @param {Element} el
* Element to check if is in view.
*
@@ -960,8 +966,14 @@ element.getContainer = function (el) {
* True if |el| is inside the viewport, or false otherwise.
*/
element.isInView = function (el) {
- let tree = element.getPointerInteractablePaintTree(el);
- return tree.includes(el);
+ let originalPointerEvents = el.style.pointerEvents;
+ try {
+ el.style.pointerEvents = "auto";
+ const tree = element.getPointerInteractablePaintTree(el);
+ return tree.includes(el);
+ } finally {
+ el.style.pointerEvents = originalPointerEvents;
+ }
};
/**