which abstracts away browser prefixes
and simply executes the callback if it is
not supported by the browser.
Also adds cancelAnimationFrame() similarly.
This is required because webkit on mobile
does not seem to show any scrollbars if
`-webkit-overflow-scrolling: touch` is not
enabled -- and we cannot enable that because
it's kinetic scrolling is not controllable
or trackable.
Enable virtual scrollbars when in scroll mode,
othwerwise disable them. This is done because
the scrollbar size/position makes no sense
immediately after a removeScroll() call, because
the perceived panning is done through CSS.
This patch adds a new class ZoomHelper that
is used to control the zooming of the document
by API and/or touch gestures. CSS3D transforms
are used to do extremely fast bitmap scaling
of the sizer.
IE11 throws an exception when attempting to set an unsupported key such
as "text/plain". Could have done browser sniffing to detect IE instead,
but this approach seems equally valid.
Changing to an input element (1038583) affected how text ranges are
created in IE and Firefox. This stopped cut/paste from functioning.
setSelectionRange is supported on all major browsers.
Fixes an issue where clicking on the middle of
the character to the right of the caret would
cause the cursor to move to the start or end
of the document.
The StepsCache verification feature verifies the cache after every
modification to ensure it does not contain any bad data. This is quite
slow to do in practice, but is very helpful for debugging, and for
tests.
Converting the cache to a damage-based approach improves the per-update
efficiency immensely, but carries some additional risk as invalid
bookmarks are deliberately left behind for performance reasons.
This patch specifically fixes an issue where bookmarks between the
undamaged step and the current iterator position were being treated as
repaired bookmarks, when in fact they were still damaged (as they had
never been seen during iteration in the document). The new logic will
ensure these bookmarks stay in the damaged region until they are
eventually iterated over in an updateCache call.
A happy side effect of this is that all query functions now only ever
return undamaged bookmarks, making the class itself easier to use and
understand.
Calculating exact changes in a document can be extremely difficult to
do properly, as such, StepsCache ideally will not rely on them.
In this new approach, modifications to the step cache only require the
last known unmodified step. As iteration across the document occurs,
damaged regions of the cache are repaired and updated, and dead nodes
are removed from the system.
This improves the performance of local edits immensely, at the expense
of "long jump" type operations (e.g., add text then move immediately
to the document end).
Fixes issue #417
The StepsCache is built on the concept that nodes are not re-ordered in
the document during updates. This means the only operations that need to
be supported is adding or removing a node. By maintaining a double
linked list, nearby bookmarks can be very quickly found for any step.
The sizer element is replaced when an undo is performed, causing no
mouse move events to be reported after an undo. This breaks the shadow
cursor display.
There is no particular reason 67c1c23 changed the event binding to use
the sizer rather than the canvas element other than for consistency
with where the event trap was being added, so it is safe to revert
this particular modification.
Undo has additional logic to ensure the event trap is restored after
an undo is performed. At some point, this will need to split out of
the SessionController, but for now it is simplest to expose this to
the EditorSession for use.
Fixes remaining problems causing issue #426.