* remove @license tag (to prevent Closure compiler keeping the comment)
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released webodf.js
* separate license header by empty line from following content
Also, decrease the maximum latency between a render request and when the
update is performed to be 0ms. The previous value of 200ms was quite
noticeable when indenting or unindenting paragraphs.
In certain cases it is useful to be able to swap out the technique used
to render cursor selections on the document. For example, SVG polygon
based rendering interacts badly with mouse events on the WebKit build
shipped on MacOS X 10.7.5.
Adds an SVG overlay that takes no pointer-events,
and uses a polygon element inside to it draw
selections with stroke and fill of the user's
color.
Removes the 3 divs used previously.
This is an interm fix until a "grown-up" undo stack arrives.
The current undo implementation for single user replaces the document
content, which causes OdfCanvas to entirely clear and replace all
children in the parent element.
Most overlays are unaffected as they are re-added when the cursor is
redraw. The shadow cursor is not an added cursor however, and so after
an undo it stops functioning.
IE reports 0 client rects for an empty element, even if the
element has pre-specified fixed dimensions.
As part of this, a more advanced quirk detection system has been put in
place to make these easier to track.
A region selection is made when the user clicks directly on an image or
another object that will have a custom frame drawn around the target. In
this case, the selection overlay should not be drawn on top.
Selections going backwards (to the left in a LTR language) were not
allowing character elements such as spaces to be selected, as the
selection view was incorrectly using the right-side of the selection
rectangle.
Unfortunately, in Chrome, a collapsed selection reports a width of 1px,
and using the left-side produces a rather odd looking overlap on the
previous character. To workaround this, the rectangle calculation now
uses the bounding client rectangle instead.
Groups of spaces will be represented with space character elements which
are not considered or returned as part of the fetched text nodes. This
logic has now been adjusted to fetch all text elements, which will return
non-text node character element as well.
An individual range may have no client rectangles if it is not visible
on the screen. In text nodes, this often means a sequence of collapsed
whitespace, or discarded whitespace at the start or end of an element
with "display: block" properties (e.g., p or HTML div).
All virtual cursor calculations are now down using range bounding client
rects rather than element-based rectangles, so proper scaling can be
achieved.
When a cursor is removed from the document (e.g., exiting edit mode),
the most recent selection is left visible.
* Don't re-append the overlayBottom on destroy
The filler rect is now calculated with extra
granularity, and getFillerRect now has different
code paths for various conditions. The computing
is quite fast because we do not walk over every
single node in the fillerRange, and only look
at the start and end siblings below the common
ancestor element in detail.
This fixes several annoying bugs:
* If you dragged a selection towards the right
just over a blinking cursor, it would extend
to the far right
* Drawing selections over annotation markers
caused them to have bad widths due to rects from
nodes that were not of the same root.
of a range that is collapsed at the last position of a
text node are empty.
This used to throw lots of errors when computing the
firstRect and lastRect in a SelectionView, when the mouse
moved near the ends of certain textnodes
hold the 'selected range' fed to it, like with any other OdtCursor. It
provides a minimal OdtCursor-like interface, with only the methods
absolutely required to make it work. It does not modify the DOM in any
way.
* Make the shadowCursor object an instance of ShadowCursor, not
OdtCursor. This is ideal because ShadowCursor does not modify anything
in the DOM, and therefore is safer and faster to use for tracking
browser selections. This makes backwards-selections work finally,
because now there are no anchor nodes to interfere with the selection
whilst dragging.
* With the introduction of the ShadowCursor, we no longer have the
selection range's endpoints coinciding the with beginning and end of the
respective startContainer and endContainer. Therefore, modify
getExtremeRanges to reflect this. If an endpoint of the selection range
does not lie within a TextNode, we latch on to the nearest text node
within.
* In the SessionController, call maintainShadowSelection() if the
selection might leak outside the allowed local root, so that the
window selection object remains root-confined.
* Clone ranges if they may be later modified.
Properly detach ranges once they are used in SelectionView, less
memory leaks.
SelectionViewManager that maintains SelectionView instances, and a
shadow cursor object that is an invisible caret-less cursor, fed to both
SessionController and SessionView, which follows the selection as it
changes.
Selections by each cursor are colored according to their memberid