Commit graph

1334 commits

Author SHA1 Message Date
Trevor Parscal 2747ff05c5 Added basic test for ve.dm.DocumentSychronizer
Change-Id: Ieea96aaf0477b4d9ba7e59f5cf6f20f4b867a419
2012-05-09 17:13:55 -07:00
Rob Moen d417c571a4 * Ported getAnnotationsFromOffset into DocumentFragment
* Wrote unit test for getAnnotationsFromOffset

Change-Id: Ie88b15ac6c16838b2d2bf9a2d83ca2952f5df817
2012-05-09 16:31:56 -07:00
Trevor Parscal 89a2b1bc40 Fixed naming in test moved from ve.dm.DocumentFragment to ve.dm.Document
Change-Id: I6843e452b0222632d1d244568bd75f3b229b4954
2012-05-09 15:30:18 -07:00
Trevor Parscal c017d7421c Removed use of expected in conjunction with ve.dm.example.*Equal methods
Change-Id: I48108f3fac7dda32344e105b7c52483cd2a84ef9
2012-05-09 15:28:06 -07:00
Trevor Parscal a0178fd3bb Cleanup and renaming
Change-Id: Ie0b742029f95e1475d58bb38b790bae3110259b0
2012-05-09 15:27:18 -07:00
Catrope 17f4dc220a Don't use data.length in selectNodes()
I was using data.length to check if the range was out of bounds, but
this is a problem when using selectNodes() inside of tree sync code
(which happens when performing rebuilds). While tree sync is in
progress, the model tree and the linear model don't match, so we
shouldn't be looking at the linear model for information about the model
tree. Instead, get the length of the DocumentNode and use that.
`

Change-Id: I11a378544ce1281a89cdcd4363c5cb1bf56f3434
2012-05-08 18:31:51 -07:00
Catrope 00950f3a67 Add rebuild action to DocumentSynchronizer
Change-Id: I379ceef3829026c4b4157e59243b7663b6c7ab2f
2012-05-08 18:31:51 -07:00
Catrope 94697a3241 Emit an 'update' event in addition to an 'annotation' event
Change-Id: Idab673bce4fa4b10816d753020adae40598c8b7a
2012-05-08 18:31:51 -07:00
Catrope 09631f1466 Make TransactionProcessor actually use DocumentSynchronizer
Change-Id: If0ac69026fa34430d811de5f7ca0748d9b1e01cc
2012-05-08 18:31:51 -07:00
Catrope 22c88f77c3 Add a 'siblings' mode to selectNodes(), and add tests for it
Change-Id: Ib3fd3ee5aba7aab7c26193a2a9c48612f624862a
2012-05-08 18:31:50 -07:00
Trevor Parscal d061b62a72 Added some documentation to ve.dm.DocumentSynchronizer constructor
Change-Id: Ib24f0101e60b34af292d46d3ea866859a89a18f5
2012-05-07 19:43:34 -07:00
Trevor Parscal d43ee569ac Cleanup of HTMLConverter
Change-Id: I145bfbbb8b759ea33eef291b53daf935e97ac341
2012-05-07 19:43:03 -07:00
Trevor Parscal 123c64cbd5 Added more tests for selectNodes
Change-Id: Ibd9672fb9b6ce682905d20f9346fada6fb47b380
2012-05-07 19:03:59 -07:00
Catrope 4d9299b808 Fix bugs in selectNodes(), tests pass now
Also fix one instance of bad expected data in a selectNodes test

Change-Id: Ie226b237cf537143bce2f6b1e531b9067b140cb4
2012-05-07 17:03:42 -07:00
Catrope 32c65cdaa8 Change 'leaf' to 'leaves' and document it
Change-Id: I09d5995d3d9bf82670802f0efe849f40be2a18a3
2012-05-07 17:03:42 -07:00
Catrope 770775eec0 Fix rebuildNodes tests, were messing up ve.dm.example
Fixed by operating on a copy of the data instead

Change-Id: Ia2607d94f07b8d43e8c98ae8a94c34df90081508
2012-05-07 17:03:42 -07:00
Trevor Parscal 4bae026190 Added additional test to rebuildNodes, now testing rebuilding after a change
Change-Id: I669457389bf742c100dec5205b972f6d1e14ef44
2012-05-07 16:25:39 -07:00
Trevor Parscal 811110d7c6 Simplified selectNode tests
Change-Id: I878fd430b24661fc11c953b3303e395cdd617006
2012-05-07 16:18:24 -07:00
Trevor Parscal 88a05b5606 Added another falling selectNodes test
Change-Id: I1f18b0af956c98a5facaf12a88fd94ca76e50a65
2012-05-07 16:05:40 -07:00
Trevor Parscal e1f8fef228 Changed selectNodes test to desired behavior (which fails atm)
Change-Id: I79eb5caaa3e2193e2309d37dc1d0ca67c2602836
2012-05-07 15:50:11 -07:00
Trevor Parscal f4fcf9663e Added documentation and tests for ve.dm.Document.selectNodes
Also:
* Broke node lookup method out into ve.dm.example.lookupNode
* Added ve.dm.example.nodeSelectionEqual

Change-Id: I437cdd3f3154d10782f03f78df6d5c457ecfc845
2012-05-07 15:15:21 -07:00
Inez Korczynski 82ef058cb7 Add two more cats to demo/example article
Change-Id: I25757965ffdfceed2c85c9d76ce58af3d23716f2
2012-05-07 14:30:05 -07:00
Catrope ad5ee8f822 First implementation of selectNodes()
Currently only implements mode=='leaves', i.e. traverse all leaf nodes.
Seems to work from casual testing, but is missing unit tests. See also
other TODO comments in this commit

Change-Id: I41292c21c627a18af7985e8ef9e23c7b14252b21
2012-05-07 13:57:58 -07:00
Trevor Parscal cbb868577e Whitespace and syntax fixes
Change-Id: I5a553272c1faf1e83a5e8be8ecf7911a11ec27a8
2012-05-07 13:40:09 -07:00
Catrope 4427122f90 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-07 12:00:59 -07:00
Catrope 93d6adb5f2 Add an isWrapped property and make getOuterLength use it
This gets rid of the length == outerLength-2 hack in getDataFromNode()
and will make it easier to implement similar logic in selectNodes()

Change-Id: I1294350b67ca3eefde2b7fe9fea0bc6d8b90f772
2012-05-07 12:00:07 -07:00
Trevor Parscal 39b3755310 Line-length fixes
Change-Id: I5258ad2e550313a95ae5b7bba951992db2db966c
2012-05-07 11:45:31 -07:00
Christian Williams 1ef380984f Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-04 20:44:10 -07:00
Christian Williams 6e7588a33b Support for new annotation format
Change-Id: Ib873981792d2cb4d78a3e4805287c48b3de78558
2012-05-04 20:22:05 -07:00
Trevor Parscal e34ec4b479 Added canHaveChildren and canHaveGrandchildren to all nodes
Change-Id: Ibe53292f7269736750e03da49e5bb5913c0124ab
2012-05-04 17:50:54 -07:00
Trevor Parscal 1d74945dfc Fixes for Roan's crazy half-baked commit
Change-Id: Ic104debc3a941e4cf8e4dca19633dcad04a0fe0a
2012-05-04 16:13:54 -07:00
Trevor Parscal 0433717b29 Added attribute add and remove tests and cleaned some things up
Change-Id: If339e0b59a8cdd90a151128138cec85b902681a8
2012-05-04 15:50:50 -07:00
Trevor Parscal bce509195b Removed unused attributes in example data
Change-Id: I0ce52456113e6efc5d879041270e06fd0b6bdebe
2012-05-04 15:50:32 -07:00
Christian Williams 28eb0c82e5 Adding HTML DOM -> Linear Model converter
Change-Id: Iae109d75e64321a7fe4ee8492d79ef5481716246
2012-05-04 15:47:41 -07:00
Catrope d11af2b687 Queue and deduplicate events in DocumentSynchronizer
Change-Id: I90577cd078c3d0b6706f5f827b66b46a450e7086
2012-05-04 15:42:35 -07:00
Rob Moen d42e738636 - Optimize surface model and write unit tests
Change-Id: I8de24c840c5aa2d4232e6e2cc5f72cbd30be96b4
2012-05-04 15:29:47 -07:00
Inez Korczynski 0562d83f2f Merge branch 'dmrewrite' of ssh://review/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-04 15:20:47 -07:00
Inez Korczynski bab1a9672c Fix method getDocument in dm.Surface and start using it
Change-Id: I613b1e938cd0d8f3a6ac8a48121901287c8fc5af
2012-05-04 15:20:14 -07:00
Catrope 2baeb5532d Initial stab at DocumentSynchronizer
Change-Id: I7176fd7235a82a6314bf431d00870d9ddb40f370
2012-05-04 15:18:07 -07:00
Trevor Parscal dc27d8acb4 Refactored dom wrapper functionality in ce nodes
* Moved implementation of getting and updating a DOM wrapper to ve.ce.BranchNode
* Updated ve.ce.BranchNode tests
* Renamed ve.NodeFactory.createNode to ve.NodeFactory.create
* Added  ve.NodeFactory.lookup which gets the constructor of a type
* Added attribute pass-through to ve.dm.BranchNodeStub

Change-Id: I8f5b7d3d3ae616cc5f39828b24b655163d782ae5
2012-05-04 13:31:14 -07:00
Trevor Parscal d2480baed0 Removed bubbling update events in dm and ce node trees and splice events from ce branches
The bubbling update events are not needed with ce or dm, but were once upon a time useful for es, this just eliminates some unused cruft that was costing extra function call overhead.

Change-Id: Ia16d0f4cd74c84cded5caecada33ee83d0882f30
2012-05-04 12:28:32 -07:00
Trevor Parscal 9887dbd96f Split Broke DefinitionListNode out of ListNode and DefinitionListItemNode out of ListItemNode
* Makes it simpler in the linear model because we don't have to use style: "item" for regular list items and style: "definition" for definition lists
* Enforces correct nesting through existing node rules systems
* Updates tests accordingly

Change-Id: I64d80af938e325f1961226505bdc386bb35ccdda
2012-05-04 11:56:32 -07:00
Catrope 11a3b6886b Implement basic replace processor
* Implement basic TransactionProcessor.replace(), only does content
  replacements
* Add ve.dm.Document.containsElementData()
* Fix bug in attribute()
* Write basic tests for attribute() and replace()

Change-Id: Ie9c22aec3f2631be5b0bd66790408ad283565491
2012-05-04 11:09:10 -07:00
Trevor Parscal a9b26c8b55 Removed recursive rendering calls in favor of 100% event driven updates
Change-Id: I636222518e4cbeddb1c02901b79a9dcb09eeb952
2012-05-03 17:19:01 -07:00
Trevor Parscal 458ba0b7d5 Added tests for getModel, getParent, attach and detach on ve.ce.Node
Change-Id: I064b2a13cbfe7a7ebc11af83fb7744ebbad39da1
2012-05-03 17:06:23 -07:00
Rob Moen 014084fc65 - fix demo styling for docs list
Change-Id: I5e5d16fe9a002e3cafd01138ad9b92ff987178d6
2012-05-03 16:27:28 -07:00
Rob Moen 0cd31fba2e rename surfaceModel to model in ce.Surface
Change-Id: I5d49915b4645464729ab1e4552982cbd38f712b1
2012-05-03 16:14:54 -07:00
Rob Moen b05347ac4e removed margin-top for documentNode
Change-Id: I6e888ca858bc2d9e6772150715b10ab157f84b46
2012-05-03 16:07:51 -07:00
Rob Moen bead2050b9 Merge branch 'dmrewrite' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor into dmrewrite 2012-05-03 16:04:47 -07:00
Rob Moen da65ad48c8 - extend surface model and surface view with event emitter
- added surface view base methods
- enabled toolbar in ve.Surface

Change-Id: Ib6a62ef2509712f812f262283c45bb30c8f97ef1
2012-05-03 16:02:21 -07:00