129 Commits
Author SHA1 Message Date
Jos van den Oever cc52a758c8 Add xmled test to tests.js.
And fix the tests so that they pass.
2015-06-07 20:25:02 +02:00
Jos van den Oever b8ad5b3889 Upgrade to Closure Compiler 20150505.
We are now using our own copy of the externs to deal with differences
of opinion on best typing of types.
2015-06-01 08:53:35 +02:00
Friedrich W. H. Kossebau b340d2b9af Extend core.DomUtils.removeUnwantedNodes with optional parameter shouldSkip 2015-03-23 13:28:07 +01:00
Friedrich W. H. Kossebau 963eabf0af Move UnitTester code into test dirs, no longer compile into webodf.js 2015-03-14 01:37:32 +01:00
Friedrich W. H. Kossebau 5a2db9c1ac Handle a possible BOM in Runtime.byteArrayToString for utf-8 2015-03-14 01:27:01 +01:00
Friedrich W. H. Kossebau 434a18a90d Add core.DomUtils.removeAllChildNodes() 2015-02-20 23:18:34 +01:00
Philip Peitsch 3172ad8dec Convert core.DomUtils into a static singleton 2014-09-12 10:17:09 +10:00
Philip Peitsch ad14efa800 Fix PositionIteration bug when first position is a rejected text node 2014-09-12 09:21:22 +10:00
Philip Peitsch 7f50cdc093 Remove now-unused runtime.isFile function 2014-09-11 15:02:02 +10:00
Philip Peitsch 741ea56a17 Add event subscription tracking object to simplify per-frame subscriptions
A common use-case for UI components is to only update the UI state just
before the next frame is rendered, irrespective of how many times a
signal is fired within a given batch of operations.

The event subscriptions object allows these to be easily created and
tracked, and also makes it easier to ensure all subscriptions are cleaned
up at the end.
2014-09-11 12:00:07 +10:00
Philip Peitsch e8ea129623 Fix setUnfilteredPosition to escape child text nodes of rejected parents
setUnfilteredPosition was incorrectly leaving the walker's currentNode
inside a rejected parent if the target node was a TEXT_NODE. Adjusted
branching logic to ensure the walker always moves to a valid position
if the specified position is not accepted by the current filters.

Fixes #797
2014-09-08 10:01:53 +10:00
Philip Peitsch adc5a08759 Re-implement navigate-to-line-boundary cursor movement 2014-07-23 02:17:19 +10:00
Philip Peitsch 06ecc7d8c8 Implement OpMergeParagraph
In order to improve the OT-ability of text and paragraph removal
with other operations, the merge behaviour has been extracted.

The logic for building up the necessary remove operations has
been encapsulated in TextController for now as all uses pass
through this point still.
2014-06-17 03:13:00 +10:00
Friedrich W. H. Kossebau 7f80e8e163 Normalize license headers of editor/benchmark/tests/firefox-addon/viewer source files
* remove @license tag, for consistency with library source files
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released stuff
* separate license header by empty line from following content
2014-06-02 17:49:46 +02:00
Philip Peitsch 5bf3e90d84 Only store the start node in DomUtils.getNodesInRange if within range
Fixes a regression introduced in 8b742ee. The currentNode was being
incorrectly added to the results array before it was checked to see if
it was contained inside the supplied range.
2014-05-27 01:12:16 +10:00
Friedrich W. H. Kossebau fa62c38767 remove no more needed returning of the class constructor at end of class files
runtime.loadClass(...) no longer expects that eval(fileContent) yields
the constructor, and a few loaded files rely on that (e.g. all singletons/namespaces),
so let's be consistent
2014-05-22 13:31:51 +02:00
Friedrich W. H. Kossebau 46d8dd224f Workaround for DOMParser.parseFromString problem on CI system 2014-05-13 19:07:58 +02:00
Philip Peitsch 70ba04e37a Fix DomUtils.getNodesInRange when started inside a rejected subtree
When the supplied range is started within a rejected node, this
function will now start iteration just after the highest rejected
node. This brings the getNodeInRange filter behaviour inline with
existing PositionIterator logic.
2014-03-26 10:35:11 +11:00
Philip Peitsch 7b7f457833 Fix DomUtils.getNodesInRange when started just before a rejected node
Stop getNodesInRange from returning children of rejected parents
when supplied range starts just before a rejected node.
2014-03-26 10:31:06 +11:00
Philip Peitsch 06bf81c8c7 Start iteration after highest rejected parent in PositionIterator
New logic will move to the next accepted node after the highest
rejected parent rather than the lowest rejected parent.
2014-02-20 21:25:45 +11:00
Philip Peitsch 36f3e4f89f Avoid slow calls when updating StepsTranslator cache
unfilteredDomOffset is extremely slow under certain conditions, greatly
limiting the iteration speed. This patch eliminates all calls that would
trigger this slow call, improving iteration performance.

An additional advantage of this is that the adjusted logic now avoids
the somewhat messy logic that involved diving into the the container
and offset just in case the container's child was a paragraph as
well. By using isBeforeNode, the bookmark creator now knows that
the current node is fetched by getCurrentNode.
2014-02-20 21:24:41 +11:00
Philip Peitsch f3faa597ec Don't map empty objects as an attribute with value "[object Object]"
Oops. Empty objects were incorrectly being set as attributes with the
value "[object Object]", which would cause updateStyles to crash in
rather spectacular ways when setting the same text alignment multiple
times on a paragraph style that had an empty text properties obj.
2014-02-19 10:03:38 +11:00
Jos van den Oever ed7270442f Remove loadClass calls from class files. The load system reads the dependencies from the manifest.json files now. 2014-02-07 15:38:09 +01:00
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +01:00
Philip Peitsch 8b742ee28a Rewrite DomUtils.getNodesInRange to improve performance
By changing how boundaries are being checked, iteration
performance is boosted quite significantly for text node
retrieval.

* Replace @returns with @return in affected files
2014-01-30 04:10:36 +11:00
Philip Peitsch b1189d1762 Add tests for the StepIterator class 2014-01-22 23:29:02 +11:00
Friedrich W. H. Kossebau 6d099688fb Use NodeFilter.SHOW_ALL instead of value constant everywhere 2014-01-16 15:56:08 +01:00
Jos van den Oever c88e781eb1 Add a the ability to run tests outside of the tests.js script.
This is preparation for using Karma to run the tests.
2013-12-18 09:03:09 +01:00
lli 599d5b3415 Restore the end point of selection range to where it was initially after
splitting boundaries.

Given the following selection <p>a[bcd]<span>efg</span></p> calling the
splitBoundaries at the moment moves the end point of selection to immediately after opening span <p>a[bcd<span>]efg</span></p>
this causes getTextElements (passing includePartial = true) to return
both "bcd" and "efg" which is incorrect.
2013-12-11 23:34:34 +11:00
Jos van den Oever 545c15fedb Add more type information to class UnitTester.
The names of the test functions are now passed separately from the function in
a structure. The reason for this is that Closure Compiler does not allow adding
additional fields to functions.
2013-11-26 16:55:00 +01:00
Jos van den Oever 83982c5059 More type fixes.
This patch also contains quite some cleanups and reorganization in runtime.js.
2013-11-22 18:32:20 +01:00
Jos van den Oever 9521e7c2de Revert CC for now. 2013-11-22 18:32:20 +01:00
Jos van den Oever 29b04dbbd3 Update Closure compiler and more typechecking.
The type Runtime.ByteArray is removed. Uint8Array is used instead.
The more rigorous type checking is enabled by the flag --jscomp_error reportUnknownTypes.
To compile with this flag, build the target typecheck-target.
2013-11-22 18:32:20 +01:00
Aditya Bhatt 210c817f4e * Fix faulty range comparison logic for
DomUtils.rangeIntersectsNode by using
DomUtils.rangesIntersect.
* Similarly clean up DomUtils.rangeContainsNode
using DomUtils.containsRange.

* Added various tests for range intersection.

This fixes issue #200 because now OpApplyDirectStyling
knows for which paragraphs it should fire
signalParagraphChanged.
2013-11-20 22:50:27 +01:00
Philip Peitsch 7941fd3d2d Replace references to non-standard Range.comparePoint
Range.comparePoint is unsupported by IE10
2013-11-19 20:25:17 +11:00
Jos van den Oever d4607cf63c Add documentation to PositionIterator. 2013-11-18 01:13:02 +01:00
Philip Peitsch 9ba2ac64cb Ensure all args are specified for createNodeIterator
IE10 considers all of these arguments required and will throw if any are
undefined.
2013-10-25 20:39:05 +11:00
Friedrich W. H. Kossebau c2a795e668 Update link to repo: now https://github.com/kogmbh/WebODF/ 2013-10-23 18:20:30 +02:00
Friedrich W. H. Kossebau 508570dab8 Add copy of the AGPL3 to sources (+ add to created zip files) 2013-10-21 17:55:16 +02:00
Philip Peitsch 4ba4eaf312 Ensure PositionIterator.setUnfilteredPosition has round-trip stability
Calling setUnfilteredPosition with a result previously obtained from the
iterator should effectively resume iteration at exactly this position.
As added tests demonstrated, specifying a node with no children and an
offset of 0 was incorrectly causing currentPos to be restored to the value
of 0. This meant calls to iterator.container() would return the a different
value.
2013-10-08 01:30:32 +11:00
Lu Li a2ab096b2c Add method to remove entry from zip 2013-10-02 13:39:35 +10:00
Lu Li 477d7fd8e8 fix image removing issue where draw:frame is removed but draw:image is left behind in the document 2013-10-01 13:10:27 +10:00
Philip Peitsch 0727acf238 Jump to next valid position when setUnfilteredPosition is passed a child of an invalid parent
PositionIterator.setUnfilteredPosition API doc report that when given
a forbidden position, the iterator jumps to the next visible position.
Add code to cover a missed corner case if the container was a child of
a forbidden parent (or grand parent) node.
2013-09-24 18:10:31 +10:00
Friedrich W. H. Kossebau f71565bcc6 Brush over DomUtils.mergeTextNodes and add some unit tests for it
the comment from 6081c1bc, "in chrome it is important to add node1 to node2." was mistakenly inversed, fixed
2013-09-20 14:36:03 +02:00
Philip Peitsch 0c456fcd89 Add some DomUtils.rangeContainsNode tests to ensure correct behaviour 2013-09-20 14:28:00 +02:00
Lu Li 70729a7eb7 fix broken runtimeTests on Windows
testRead runs fine on Unix-like/Mac OS but not on Windows. Offset 27
returns 'e>Web' on Windows because line ending is changed by git to \r\n, thus 2 characters.
2013-08-07 13:24:05 +02:00
Jos van den Oever 64d57c96cf Fix issues exposed by latest JSLint. 2013-07-24 21:41:56 +02:00
Philip Peitsch 15effae773 Prevent range boundaries from being incorrectly reset during split
When splitting text nodes, a more stable point will need to be found
for the end point if the start point is split, as DOM modifications
can potentially cause the end point to be lost
2013-07-24 01:20:29 +02:00
Philip Peitsch f7cd9fe437 Allow position iterator to complete even if root is never reached 2013-07-15 09:40:50 +02:00
Philip Peitsch 402ae2a023 Removed PositionIterator.setPosition
PositionIterator.setPosition has been superseded by the unfiltered
variant for all use cases.
2013-07-03 21:52:40 +10:00