Commit graph

2791 commits

Author SHA1 Message Date
Trevor Parscal 52f1aac90a Merge "Test: Enforce # of expected assertions." 2012-10-26 16:48:18 +00:00
Krinkle b6b899c396 Merge "Documentation fixes" 2012-10-25 21:19:05 +00:00
Timo Tijhof 4cc2101ffd Test: Enforce # of expected assertions.
Change-Id: I041c792d1841f69677f8c7d38f67108475a0afc9
2012-10-25 22:06:07 +02:00
Translation updater bot 1cb270417e Merge "Localisation updates from http://translatewiki.net." 2012-10-25 20:05:11 +00:00
Translation updater bot a764d0b350 Localisation updates from http://translatewiki.net.
Change-Id: Ib8b826ea7d5d2b6080d71a9cf2fc4ac6f375bd6a
2012-10-25 20:04:29 +00:00
Krinkle dae235111c Merge "Fix JS error in ve.setProp()" 2012-10-25 19:55:16 +00:00
Catrope 84efb81e7e Fix JS error in ve.setProp()
Attempting to descend into a string or number would cause a JS error,
because we would attempt to create prop[arguments[i]] as an empty object
(which is ignored), then try to descend into it (which blows up because
it's undefined, even though we've just set it). Guard against this by
explicitly checking for non-object-ness.

Change-Id: Ie65550baaae0ab88476c9a1ff40cc136090740a0
2012-10-25 21:54:45 +02:00
Trevor Parscal 4e87a7a79b Fix number of doc sync tests
Follow up to I84f0368b1d7b601ed0766806607152dc97f34603

Change-Id: Ic1e9de1e755b8966b6e964b01b00f4d99d27245e
2012-10-25 11:06:12 -07:00
Catrope 2c1683ecff DocumentSynchronizer fix and cleanup
* Adjust the range in the annotation synchronizer, otherwise we emit
  events for the wrong node
* Expanded test suite to the point where it was able to catch the bug
  caused by not adjusting annotated ranges
* Removed selection.length === 0 check, no longer needed because
  selectNodes() now throws an exception in this case
* Added a FIXME comment about duplicate update events that occur when
  length adjustments are combined with something else
* Add a few more comments

Change-Id: I84f0368b1d7b601ed0766806607152dc97f34603
2012-10-25 11:02:58 -07:00
Trevor Parscal 551a30bc64 Merge "Actually use nodeOuterRange, selectNodes() has provided this forever" 2012-10-25 18:00:15 +00:00
Trevor Parscal fe5c5b78f9 Merge "Reorganize text-only replacement detection" 2012-10-25 17:56:45 +00:00
Trevor Parscal 8e7facf222 Merge "Guard transactions against double commit/rollback" 2012-10-25 17:55:56 +00:00
Trevor Parscal 9c51bb2d7b Merge "No longer copy data in ve.dm.Document constructor" 2012-10-25 17:54:23 +00:00
Catrope f1dbdac3d8 Actually use nodeOuterRange, selectNodes() has provided this forever
Change-Id: Ie1d3cbb6e475248927d10f411cf383f701a3ad71
2012-10-24 17:48:48 -07:00
Catrope 5d5335b498 Reorganize text-only replacement detection
* Lift node assignment out of the if/else
* Flip the condition so we detect text-only replacements rather than
  non-text-only replacements
* Additionally assert that there is exactly one selected node, and that
  it is a text node

Change-Id: Iaaddf532f06709e860ac44457470e6d8bfcb6dd9
2012-10-24 17:48:20 -07:00
Catrope 29cff8c105 Guard transactions against double commit/rollback
* Store the applied state in the Transaction
* Store the Transaction in the TransactionProcessor (previously, only
  its operations were stored)
* Have commit() and rollback() throw exceptions when passed transactions
  with the wrong applied state
* Add tests for this behavior

Change-Id: I27b7a96fdf4d3555d78f64c05a03702ea560c802
2012-10-24 17:47:41 -07:00
Catrope 43f1612324 No longer copy data in ve.dm.Document constructor
The data array is now taken by reference, and the caller must perform
any copying required.

Changed tests to make a deep copy of shared data sets (mostly
ve.dm.example) before passing them to ve.dm.Document().

Change-Id: Iedc64f9fd9cd689640de9a19379cf5f3db94a2bb
2012-10-24 17:32:35 -07:00
Catrope aa2836aa6e Remove 'internal' property from DM nodes
There's no use case for keeping a deep copy of the 'internal' property
in the node tree, and it was breaking some of my new tests concerning
change markers. We could keep internal data in the node tree if we
wanted to, but to be correct we'd have to synchronize every time we
changed it, which is a pain.

Change-Id: I024de1ff8b6b6154da82c103c4bb21db8ff2ec14
2012-10-24 16:47:14 -07:00
Trevor Parscal f17fc65c41 Documentation fixes
Change-Id: I5020623ba59cd9d1794b7d1f97d3adf77b833d6e
2012-10-24 16:47:04 -07:00
Trevor Parscal b8dc697f17 Merge "ve.ui.CommandFactory: Initial implementation" 2012-10-24 18:48:40 +00:00
Timo Tijhof 34cbc729db ve.ui.CommandFactory: Initial implementation
Based on https://github.com/ccampbell/mousetrap.

Cleaned up to fit our coding standards, pass JSHint, and assume
jQuery's fixes where possible (e.g. no need for an addEvent
utility, no need for filling e.target, e.which, etc. cross-browser
which jQuery.Event already does).

Initially all were local functions in the constructor, but to
allow some customisations in subclasses moved various methods
to the prototype instead and marked with @private.

Really, only .register() must be called from the outside. The rest
assumes normalisation etc. or might break things if called
incorrectly.

Change-Id: Ic69a3c70759052094aefbeab623d885f8b118e14
2012-10-24 17:48:16 +00:00
Timo Tijhof 37f3a288ec Standards: Fix global variables and pass JSHint.
Follows-up:
* IK 714e29d30f
* IK 3b8a5ae4d5
* IK 72eb2825e5
* RK 7fe7182f43
* ...

Change-Id: I671f08e4899bfb9508cef272190ec72721a0af9a
2012-10-23 00:53:48 +02:00
Timo Tijhof 5b8aa91fe8 Upstream: jQuery 1.8.2, QUnit 1.10.0.
* http://code.jquery.com/jquery-1.8.2.js
* http://code.jquery.com/qunit/qunit-1.10.0.js
* http://code.jquery.com/qunit/qunit-1.10.0.css

Change-Id: Id254d377557ee690acfd44cf6b33a5f60f152f6e
2012-10-23 00:31:27 +02:00
Trevor Parscal bb97cd928b Merge "Add parentOuterRange to selectNodes() output" 2012-10-22 17:34:53 +00:00
Catrope 8d82da1fb5 Merge "Rename property "timeout" to "timeoutId" - more descriptive." 2012-10-22 17:08:39 +00:00
Translation updater bot c31698b381 Localisation updates from http://translatewiki.net.
Change-Id: I7646f89310781f0da59173347886b1a12776edae
2012-10-22 01:54:09 +00:00
Inez Korczyński 88c22b3a46 Rename property "timeout" to "timeoutId" - more descriptive.
Change-Id: I198d07e3c59ba1283085135f45882ce606bb2389
2012-10-19 17:11:59 -07:00
Catrope 4e89867fc0 Merge "Removed htmlTagName and htmlAttributes from hash" 2012-10-19 23:35:57 +00:00
Trevor Parscal d09bc496c3 Merge "Fix for native deletion - it was breaking document (model and view) when deleting really fast (holding the key for example). This solution completely fix the problem, however it is not optimal - stop and start is called more often than should be." 2012-10-19 23:33:24 +00:00
Trevor Parscal 8ea206c743 Removed htmlTagName and htmlAttributes from hash
This was only causing data bloat and also errors because htmlTagName and htmlAttributes are only set if the annotation was constructed from an HTML element

Change-Id: I3d36bca6cd0194e1a4456bb51156117f70b96b13
2012-10-19 16:01:28 -07:00
Catrope 61b6c1ce86 Add parentOuterRange to selectNodes() output
This is the outer range of the parent of the node, if known. We'll need
this for change marking: when resizing a text node, for instance, we
need to mark its containing parent. This way we get the containing
parent's element's offset for free (selectNodes already tracks it in
currentFrame) rather than having to compute it with another traversal.

Change-Id: Ia335d8080ea9d414ab9f89b943e2ea0cd11d7df3
2012-10-19 15:28:26 -07:00
Trevor Parscal 969c256e34 Merge "Make the debug tool (Dump all data) compatible with ve.AnnotationsSet (instead of array)" 2012-10-19 22:22:38 +00:00
Trevor Parscal 54171d03b6 Merge "Do reference comparison in selectNodes() tests and fix test data" 2012-10-19 22:21:55 +00:00
Trevor Parscal 2aec6b04e8 Merge "Add missing var statement" 2012-10-19 22:20:46 +00:00
Inez Korczyński 4d351ff459 Make the debug tool (Dump all data) compatible with ve.AnnotationsSet (instead of array)
Change-Id: I0ff131d69933a0fe98232410eb7be72ea2492066
2012-10-19 15:20:40 -07:00
Catrope ef513244be Do reference comparison in selectNodes() tests and fix test data
Some tests were using the wrong node in the expected data, but because
only the summaries were compared, this would succeeed as long as the
type and length were equal (and paragraphs of length 1 are quite common
in our test data). Fixed equalNodeSelection() to compare each node by
reference as well as comparing the summaries. If one of the equality
tests fails, the summaries will still be displayed as expected/actual
data (even though they might be equal), and the message will  have
"(reference equality for selection[3].node)" appended to it.

This change broke the tests because a few test cases had bad data, fixed
those in this commit as well.

Change-Id: Iab420cf29d47f7368c8a9ce79f6309efae75685c
2012-10-19 13:56:46 -07:00
Catrope cc9c530690 Add ve.setProp()
Change-Id: I6f932917f8e6321e9c415900b70404406af96d5c
2012-10-19 11:22:12 -07:00
Catrope bfb7e6f40c Add missing var statement
Change-Id: I573e952c60550c29bf7958c221899b72a934fb0c
2012-10-19 11:06:46 -07:00
Christian Williams bab6ca6a60 (bug 41055) Fixing large content copy and paste from external source for Firefox/Windows
Change-Id: I7169566cca486eb5085922c5ac8d932c60a7dcbb
2012-10-18 15:59:55 -07:00
Inez Korczyński 6735a47dcb Fix for native deletion - it was breaking document (model and view) when deleting really fast (holding the key for example). This solution completely fix the problem, however it is not optimal - stop and start is called more often than should be.
Change-Id: Ied5b34f92056407311aa1e84fbff35943138987f
2012-10-18 13:22:20 -07:00
Trevor Parscal 7ee5245a2d Merge "Fix selectNodes() bug reported by Inez" 2012-10-17 23:24:43 +00:00
Catrope 937607893c Fix selectNodes() bug reported by Inez
For <p>1<br/>2</p>, selectNodes([2,2]) correctly returned the end of the
first text node, but selectNodes([4,4]) returned index 2 in the
paragraph (i.e. between the break node and the second text node). The
correct behavior is to return the start of the second text node, i.e.
the mirror image of the behavior for [2,2].

Fixed this by applying the startBetween/endBetween logic only if the
relevant adjacent node is wrapped (or if it's missing). In the code,
this is expressed as !(adjacent node present && adjacent node wrapped).

Change-Id: Ie3b7fdf1de38ee253a798a7a73bc89734f4ca4fa
2012-10-17 16:09:49 -07:00
Inez Korczyński 4b1b63d357 "Is there data?" a.k.a. Insert data only if there is a data to be inserted.
Change-Id: If5957c38668f4dedcba72fc79f9a273614c6dce3
2012-10-17 16:08:02 -07:00
Trevor Parscal 435d45cf9e Merge "Fix bug in ve.ce.BrancNode.setupSlugs. It was removing slugs from the DOM, but not from the internal (this.slugs) collection, so getSlugAtOffset was returning incorrect information." 2012-10-17 21:17:23 +00:00
Inez Korczyński 829b070330 Fix bug in ve.ce.BrancNode.setupSlugs. It was removing slugs from the DOM, but not from the internal (this.slugs) collection, so getSlugAtOffset was returning incorrect information.
Change-Id: I0307d2dfe5c62f992287532ef8925fead2899c58
2012-10-17 13:54:14 -07:00
Catrope 84e598953a Wrap inline elements properly
The HTML "1<br/>2" was being converted to a linmod that looked like
"<p>1</p><br></br><p>2</p>". This commit fixes the wrapping logic such
that the result is "<p>1<br></br>2</p>" instead. In general, inline
nodes (content nodes) should not interrupt the wrapping, but block nodes
should.

This creates a problem for alien nodes: normally, we determine whether an
alien node is a block alien or an inline alien based on context, but if
we're in wrapping mode we're unsure of the context. We can't tell the
difference between "1<tt>Foo</tt>2" (should be wrapped as one, because
tt is inline) and "1<figure></figure>2" (1 and 2 should be wrapped
separately, because figure is block) using context alone, so in these
cases (and ONLY in these cases) we look up whether the HTML tag in
question is an inline tag or a block tag and use that to decide.

Change-Id: I75e7f3da387dd401d9b93e09a21751951eccbb83
2012-10-17 13:50:29 -07:00
Catrope efa8a23591 Merge "Fixing location of ve.ce.CenterNode.js and adding comma between variable declarations" 2012-10-17 20:23:38 +00:00
Christian Williams 156e56b47b Fixing location of ve.ce.CenterNode.js and adding comma between variable declarations
Change-Id: If54e314f47860ac30060bec6b3f5997ed3709e0b
2012-10-17 13:18:57 -07:00
Inez Korczyński 5c83742313 (Bug 41120) Missing coma. Who knows how it happened...
Change-Id: I4c0a65cc751bf378368df9f8b793f672fb7cca15
2012-10-17 12:48:11 -07:00
Trevor Parscal 5cd4222d9c Whitespace and comment cleanup for dm annotation classes
* Added comments to classes and methods
* Quieted a jshint warning
* Broke some long lines
* Replaced instances of "var\t" with "var "

Change-Id: I1d617ed9e5180f1a3dff42078fb5debb5d718407
2012-10-17 12:35:28 -07:00