Commit Graph

15 Commits

Author SHA1 Message Date
Samuel Mannehed
b2dc76ee18 Add encodeUTF8 function to core/util/strings.js 2021-03-29 12:01:15 +03:00
Pierre Ossman
12cdad066e Make Cursor.detach() safe to call when not attached
Avoids having checks in higher layers.
2021-03-29 12:01:10 +03:00
Samuel Mannehed
6067290169 Rename document.capturedElem to captureElement
To better fit most naming.
2021-03-29 11:55:52 +03:00
Samuel Mannehed
996895268e Hide the emulated cursor when target is null
Makes it easier to understand what happens when a real element isn't
passed as a target to updateVisibility(). Also makes the code more
robust to future changes.

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:38 +03:00
Samuel Mannehed
fb14c2dec9 Fix disappearing cursor after click
In the cursor emulation when deciding if the cursor should be hidden -
Instead of checking what's under the cursor, we check the element that
has capture.

This introduced another bug in the cursor emulation. The cursor did not
always disappear properly when using our cursor emulation together with
our setCapture polyfill. More specifically, we saw a problem when a
capture ended on an element without cursor emulation.

We solved this by introducing another visibility check on a timer in
the cursor emulation. However this led to yet another problem where
this timer conflicted with the timer in the setCapture polyfill.

We removed the timeout in the setCapture polyfill and created a
variable to make sure that all the events remaining in the queue can be
completed.

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:28 +03:00
Samuel Mannehed
83d5e5bffd Check next elem at mouseleave in cursor emulation
It's not obvious that we want to hide the cursor when we get a leave,
it depends on the element that we're leaving to. This makes the code
more robust.

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:20 +03:00
Samuel Mannehed
19dfb7901c Rename variables in setCapture proxy
The names of many variables were too similar. To make the code easier
to follow we renamed:

* _captureElem to _capturedElem
* _captureElemChanged() to _capturedElemChanged()
* captureElem to proxyElem
* elem to target

Co-authored-by: Alex Tanskanen <aleta@cendio.se>
Co-authored-by: Niko Lehto <nikle@cendio.se>
2021-03-29 11:55:13 +03:00
Samuel Mannehed
0dcb896920 Update copyright to 2019 for modified files 2021-03-29 11:54:44 +03:00
Niko Lehto
19f0803636 Fix url cursor detection on Edge
_supportCursorURIs was set to true even when Edge didn't support
URIs because the fallback value "default" was used.
2021-03-29 11:51:50 +03:00
Juanjo Diaz
c6c278f9d5 Replace unnecessary function supportsCursorURIs by a constant variable 2021-03-29 11:35:44 +03:00
Juanjo Diaz
37c17ddbf9 Move support check from display to browser 2021-03-29 11:35:38 +03:00
Juanjo Diaz
5964156a6f Remove unnecessary context from eventtarget 2021-03-29 11:35:11 +03:00
Juanjo Diaz
1ff792cf4b Remove unnecessary constructor parameter from Cursor 2021-03-29 11:35:06 +03:00
Pierre Ossman
d20f751441 Throw correct Error object
We've already defined the name Error as a logging function, so we
need to be more explicit when we want to refer to the exception
class.
2021-03-29 11:34:45 +03:00
matt
408c005d3e Initial commit 2020-09-20 12:16:44 +00:00