Commit Graph
44 Commits
Author SHA1 Message Date
Jos van den Oever 3634d63e3b Compile fix. 2013-06-19 17:08:52 +02:00
Philip Peitsch ea8c135546 PositionIterator.setUnfilteredPosition automatically advances to the next valid position
This makes the result of next & previous always a node that will pass
the filter. Previous implementations could return entirely unexpected
nodes

* Corrected module load order for tests
2013-06-19 16:58:13 +02:00
Friedrich W. H. Kossebau 55fc7ab9c6 Switch code to use Node.${XXX}_NODE instead of magic values 2013-06-17 13:49:07 +02:00
Philip Peitsch d7360bab22 getAppliedStyles returns unique computed styles for all text nodes within a given range
This is useful for determining whether all text within a given selection is bold or italic, or
has a uniform size or font name.
2013-06-14 18:16:15 +10:00
Jos van den Oever e76ecd15d0 Add a few comments to clarify the new function. 2013-06-12 11:17:43 +02:00
Philip Peitsch ff4033be4b OdtDocument.getDistanceFromCursor expects filtered offsets
* Fixed api comments incorrectly claiming unfiltered offsets
2013-06-12 11:00:01 +02:00
Jos van den Oever a3b311060a Add failing test and make leftNode and rightNode return only filtered nodes. 2013-05-08 18:38:01 +02:00
Jos van den Oever 6cf5bbef1e Insert a new text node at the correct position.
A new PositionIterator function is needed for this: rightNode. For completeness sake, leftNode() is also introduced.
2013-05-06 11:39:48 +02:00
Friedrich W. H. Kossebau bd07b2c8a9 Support END key, by going to end of paragraph for now 2013-05-03 19:12:38 +02:00
Friedrich W. H. Kossebau 84c4ba7813 Fix broken calculation in SelectionMover's countStepsToPosition() (ignored that comparePoints() used unfiltered offsets) 2013-05-03 19:12:28 +02:00
Aditya Bhatt 2869ffa4bf Make positions in the beginning of a container but right before a span
unwalkable.
Additionally, make the offset=0 in spans that have no allowable siblings
to the left walkable.
2013-04-25 09:11:38 +02:00
Tobias Hintze ab60ca51c7 add and fixup some asserts 2013-04-25 09:10:50 +02:00
Aditya Bhatt ef492dcefb Make closure stop complaining 2013-04-24 16:13:13 +05:30
Aditya Bhatt a1e7644aad jsdoc 2013-04-24 16:13:13 +05:30
Aditya Bhatt c9f9a5d2c2 When calculating the offset in Cursor::getPositionInContainer, if it is
not in a text node, then use the nodefilter to make unwanted nodes not
count towards the offset
2013-04-24 16:13:13 +05:30
Aditya Bhatt 4c80c84e4e Rewritten OpRemoveText, using the new and awesome getTextNeighborhood
method, which can delete text across serveral nodes.
2013-04-24 16:07:41 +05:30
Aditya Bhatt e68ed4ee27 Rename nextPosition and previousPosition methods in Position Iterator
to get() versions, and add a method to OdtDocument to get a position
iterator at a desired position value
2013-04-24 16:07:40 +05:30
Aditya Bhatt c2c9106cd7 a getNeighborhood method for PositionIterator, which gives an array of
textNodes (which was 1 textNode, but splitted for some reason like
having a cursor)
2013-04-24 16:07:40 +05:30
Aditya Bhatt b8b2418d5a Some convenience retriever methods - previousSibling(), nextSibling(), and
text() for positionIterator, for when we need more information about a
position's surroundings. Use these methods in getPositionInTextNode and
in the TextPositionFilter in OdtDocument to have (as far as I have
tested) smooth movement across spans and text nodes within a paragraph.
Also, text is now inserted near the cursor position instead of at a
paragraph's extremities. Text removal offsets are broken after this.
2013-04-24 16:07:40 +05:30
Tobias Hintze 377f925a66 PositionIterator: more assert 2013-04-22 14:10:56 +02:00
Tobias Hintze e96ebc7128 PositionIterator: more asserts 2013-04-22 12:36:39 +02:00
Tobias Hintze a9b7caaf97 insert some asserts against node===null in various places
(PositionIterator, SelectionMover, Document)
2013-02-04 20:39:05 +01:00
Jos van den Oever e4b8a83eac Fix the jumping cursor issue.
Counting of DOM positions was done with filtering, but the cursor requires no filtering.
2013-01-31 10:32:51 +01:00
Jos van den Oever bc3e2f9f08 Update to newer Closure Compiler. 2012-12-28 11:59:47 +01:00
Jos van den Oever b23fd669d3 Use dom offset when synchronizing with selection.
The DOM Selection uses 'normal' offset counting. This offset should be used when the PositionIterator is used to set the selection.
2012-11-16 17:24:39 +01:00
Jos van den Oever 8b0c05095b Update iterator position properly for inserting a cursor for another user in the same text node. 2012-11-15 11:24:56 +01:00
Jos van den Oever f3b0a0ebf4 Small clean-up of unused code. 2012-11-09 21:34:36 +01:00
Jos van den Oever 5dcdb449c3 Make sure that setPosition works even if there are neighboring Text nodes. 2012-11-09 18:01:43 +01:00
Jos van den Oever e966700c7a Implement getPositionInTextNode. 2012-10-22 15:01:46 +02:00
Jos van den Oever 669399f5f7 Handle the case when a position is set to the end of a text node. 2012-10-21 16:24:43 +02:00
Tobias Hintze 758333d210 update "@source:" references to gitorious.org/webodf
(as in master: de1a79c36f)
2012-10-21 12:18:15 +02:00
Jos van den Oever 236dd81f31 Work towards moving the avatar line up and line down.
For this to work, the checking of the position of the selection should be stricter. This patch refactors the way the PositionIterator is updated when the cursor is removed. The iterator is now updated in such a way that no not-yet-valid offset needs to be set.
2012-10-05 17:31:58 +02:00
Jos van den Oever a1c9d6202b Simplify setPosition function. 2012-10-03 15:37:36 +02:00
Jos van den Oever 3e3de5be29 Fix failing PositionIteratorTests. 2012-10-03 15:28:01 +02:00
Jos van den Oever ac51bbc948 Make the session caret iterator move more nicely. 2012-10-03 09:01:14 +02:00
Jos van den Oever 025dde0c55 Fix PositionIterator to use the filter when setting the position. 2012-10-02 08:21:47 +02:00
Jos van den Oever 031b6a2b05 Add functions to get neighboring text parts in the PositionIterator.
Also add more tests.
2012-09-01 20:57:44 +02:00
Jos van den Oever 566749728e Get avatar to move somewhat along with the caret. 2012-08-28 22:19:58 +02:00
Jos van den Oever 643d631dbc Workaround for versions of createTreeWalker that need a function instead of an object with a function such as IE 9 and older webkits 2012-08-27 13:02:11 +02:00
Jos van den Oever 98bc24d7bc Fix PositionIterator to handle empty text nodes. 2012-08-26 17:59:15 +02:00
Jos van den Oever e6611afe38 Fix more tests. 2012-08-25 00:04:58 +02:00
Jos van den Oever 7c2540fa61 Add more tests. 2012-08-24 22:44:37 +02:00
Jos van den Oever 27a0c2a614 Adapt tests in PositionIteratorTests and fix PositionIterator so they pass. 2012-08-24 21:52:24 +02:00
Jos van den Oever a75a4432a3 Change to use PositionIterator instead of PointWalker.
This class still needs to be implemented.
2012-08-24 18:05:20 +02:00