387 Commits
Author SHA1 Message Date
Jos van den Oever 7d306548a5 Use STORE as default method.
This is important because the file "mimetype" should *never* be compressed.
2015-09-02 09:49:16 +02:00
Jos van den Oever 3d016853b3 Report the modification date of the zip entries. 2015-09-02 09:49:16 +02:00
Philip Peitsch 435501c966 Replace existing zip implementation with jszip v2.4.0
jszip has a much cleaner API than the existing RawDeflate version. In
addition, jszip supports creation of a compressed output stream.

As it's non-trivial to make jszip behave with closure compiler, a second
concat-only step has been added during compilation to include 3rd party
dependencies.

Fixes #21.
2015-07-15 20:38:04 +10:00
Aditya Bhatt a7eb577fb8 Fix broken click-to-collapse-selection ability in Blink
This is achieved by not iterating over DOM objects using Object.keys
because Chrome >=43 move them onto the prototype chain.

The iteration in DomUtils.cloneEvent is now done over the event's
class prototype.
2015-07-10 11:14:54 +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 434a18a90d Add core.DomUtils.removeAllChildNodes() 2015-02-20 23:18:34 +01:00
Philip Peitsch 294542b6d2 Print function result rather than function.toString for test description 2014-09-24 09:04:01 +10:00
Philip Peitsch c0a1acc466 Cope with test names containing angle brackets 2014-09-24 09:04:00 +10:00
Philip Peitsch f79540fba3 Update detection code to correctly tag Internet Explorer 11 as IE
Thanks Microsoft!
2014-09-16 02:42:07 +10:00
Philip Peitsch 3172ad8dec Convert core.DomUtils into a static singleton 2014-09-12 10:17:09 +10:00
Philip Peitsch d6ced212b0 Migrate per-node checks out of TextPositionFilter
Moving these checks into a node filter ensures it is only required
once per node, rather than once per node-position.

This results in a 60% improvement in position iteration speed.
2014-09-12 09:21:22 +10:00
Philip Peitsch 2177e25b20 Correct IE detection code for containsNode workaround
Though a tiny code change, this appears to grant a further 20% speed
improvement for position iteration.
2014-09-12 09:21:22 +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 78abfbe30d Document usage guidelines for DomUtils.getElementsByTagName*
Adds documentation as requested. Fixed #736.
2014-09-11 15:10:41 +10:00
Philip Peitsch 1e6297dd5f Cache file data within the loaded Zip
The zip code has been refactored to ensure only a single GET request is
needed by the browser to load a document. This makes webodf slightly more
robust when loading documents as it avoids problems with the prior HEAD
request returning different file sizes, or even being unsupported by the
browser/server completely.

The current Zip implementation attempts to lazily load parts of the zip
file during decompression which is a good concept to preserve to allow
memory usage to be reduced in future. For now however, robustness of
file loading is more important.
2014-09-11 12:07: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
Jos van den Oever 7843279d78 Small fix so JSLint does not abort on the construct like [0][0].
JSLint cannot parse this line:
  l = 3 * l - [0, 0, 2, 1][padlen];
so, i've move [0, 0, 2, 1] to variable a and changed the line to
  l = 3 * l - a[padlen];
2014-09-10 16:10:56 +02:00
Jos van den Oever 18a182df06 Update JSLint 2014-09-10 15:50:07 +02: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
Satvik Kumar 865541a3ed Use core.StepsDirection enum for rounding direction
The rounding direction constants in OdtStepsTranslator overlap with the
existing enum in core.StepsDirection. It makes sense to use that enum here
to specify rounding behaviour in converting DOM points to steps so the
constants have been removed and the enum has been substituted for all
usages.
2014-08-07 23:53:05 +10:00
Philip Peitsch 08cfde88e9 Move simplified client rect typedef to a common location 2014-08-05 14:22:09 +10:00
Philip Peitsch 2ac30cad1d Attempt to report JSON strings in test output when two objects mis-match
Improves upon the existing reported string of "[Object object]". If the
object being serialised has recursive structures, the report string will
fall back to the previous implementation.
2014-07-28 19:06:22 +10:00
Philip Peitsch 5b7cd7c543 Re-implement up/down movements caching the last caret X position
When navigating vi the up/down arrow keys, the user often wants to move
multiple lines in sequence (e.g., to visually place the caret in one of
the following lines). To stop the caret suddenly jumping to the left
side of the page when crossing an empty paragraph, the caret's X position
will be stored and re-used by subsequent up/down movement for up to 2s
after navigating by line.

Any other operations performed by the local user (e.g., cursor movement
to the left or right), or edit operations by collaborative users will
immediately clear the stored X position.
2014-07-23 02:17:20 +10:00
Philip Peitsch adc5a08759 Re-implement navigate-to-line-boundary cursor movement 2014-07-23 02:17:19 +10:00
Friedrich W. H. Kossebau 561c18fd9d Handle IE10 obv. destructing event objects once the event handler is done 2014-07-16 19:20:07 +02:00
Friedrich W. H. Kossebau 46b4a89286 Remove currently unused RawDeflate 2014-06-20 16:22:35 +02:00
Friedrich W. H. Kossebau 6d5c5d7170 Replace inflating code in RawInflate.js with code from the pako project 2014-06-20 16:22:35 +02:00
Aditya Bhatt 82ae28fd60 Fix closure annotations for DomUtils.getNodesInRange and
OdfUtils.getTextNodes.
2014-06-19 16:00:53 +02: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
Philip Peitsch 41c7b36302 Slight performance improvement for StepIterator.roundToClosestStep
Fetching the offset for a position can be prohibitively slow in some
cases. Avoid storing this value until absolutely necessary.
2014-06-16 22:18:23 +10:00
Philip Peitsch 7de8ff00e7 Group up style information changes and report at the end of an op batch
Operation batches that modify a large number of paragraphs (or repeatedly
modify the same paragraph) can cause numerous unnecessary style change
events to be triggered. Rather than reporting these instantly, track them
as they occur and emit the style change summary on batch end.

Related to #610.
2014-06-14 01:28:40 +10:00
Philip Peitsch 767a1934f3 Ensure a caret doesn't receive any new events after destroy is invoked
Deleting the caret before calling ensures there is no way for any external
sources to get access to the soon-to-be destroyed caret.

As part of tracking this down, scheduled tasks will now throw an error
if an attempt is made to trigger the task (either delayed or immediate)
after the particular instance has been destroyed.

This then showed that functions bound to browser events swallow errors
quietly, so additional logging was added to the EventManager delegation
code to ensure errors generated when processing an event are logged.
2014-06-11 20:33:32 +10:00
Aditya Bhatt abc836d17f Add a register method to EventNotifier,
so we can add more events later to the
same instance.
2014-06-06 14:30:41 +02:00
Jos van den Oever 252999e4fe Add getElementsByTagName to DomUtils. 2014-06-04 13:35:06 +02:00
Friedrich W. H. Kossebau 1e2a4a8323 Normalize license headers of the webodf.js source files
* 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
2014-06-02 12:19:05 +02:00
Philip Peitsch b31501219c Extract re-usable step direction concept 2014-05-28 21:57:16 +10:00
Philip Peitsch 94ae6ab7b4 Report the names of failing tests as well as the failed test count
Output from the headless Qt test runner is difficult to parse and
generally flows off screen very quickly. Appending the failed test names
makes it easier to troubleshoot which tests are problematic.
2014-05-28 20:36:16 +10: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
Philip Peitsch c0332ed1f9 Make caret and avatar overlays rather than inline content
Having the caret and avatar display inside the cursor node causes text
wrapping and other element shifts to occur in some browsers (mainly FF)
due to there being layout impacts from the almost-but-not-quite 0-width
cursor element.

Moving to non-inline overlays for these bits of chrome allows the cursor
to be hidden completely.

TODO
This commit introduces a regression when composing text using an IME
as the overlay doesn't advance properly during composition.

Fixes #86
2014-05-17 00:43:42 +10:00
Philip Peitsch 942450f427 Extract common concept for retrieving text content associated with a step 2014-05-16 21:40:13 +10:00
Philip Peitsch cd8bf92832 Suppress manual task processing to prevent skewing of benchmark figures
Manually processing the redraw tasks vastly affects the current benchmark
results, dwarfing impacts from most other subsystems. Disabling this for
now to aid tuning of non-UI components.
2014-05-16 21:28:46 +10:00
Friedrich W. H. Kossebau 67141e77a6 Use absolute tolerance for unit test number comparison
relative tolerance is hard to do with an expected value of 0
2014-05-05 12:36:59 +02:00
Friedrich W. H. Kossebau 2d8f183c93 Add parameter "epsilon" to core.UnitTestRunner.shouldBe(), for fuzzy number comparison 2014-04-30 20:45:52 +02:00
Jos van den Oever 458081302d Merge pull request #542 from vandenoever/datenow
Slight optimization: use Date.now() instead of (new Date()).getTime().
2014-04-17 16:37:18 +02:00
Jos van den Oever 4702b73090 Slight optimization: use Date.now() instead of (new Date()).getTime().
This avoids creating a new date object that is discarded immediately.
2014-04-17 16:36:13 +02:00
Friedrich W. H. Kossebau 47240a4927 Add core.UnitTest.createXmlDocument, to reduce duplicated code 2014-04-17 13:23:31 +02:00
Friedrich W. H. Kossebau fd020eee3f Use Error objects in callback passed to "destroy" methods
The currently plain undefined objects are not useful at all, because
the properties are undefined.
2014-04-11 13:53:10 +02:00