Commit graph

10 commits

Author SHA1 Message Date
Ed Sanders 8b09dd7650 The resurrection
By removing the transaction listeners from surface fragments we
no longer have to make sure they are always manually destroyed.

In order to retain the functionality of having fragments update
with transactions elsewhere we keep a pointer to a place in the
new complete history stack in the surface. The complete history
stack records all transactions, even undone ones.

Whenever getRange is called we replay all transactions in the
complete history (in the correct order) since the fragment was
last updated.

Also in this commit:
* Updated Format/IndentationAction to test undo(). This increases
  coverage of surface fragment behaviour.
* .range is always accessed by .getRange now, although as an
  optimisation we can use the noCopy mode when we a sure the
  returned range will not be modified.
* Added undo test to .update (previously .onTransact)

Bug: 47343
Change-Id: I9e9818da1baa8319a3002f6d74fd1aad6732a8f5
2013-04-22 12:50:23 +01:00
Ed Sanders fdf30b1ac8 Store data in LinearData class with an index-value store for objects
Created an IndexValueStore class which can store any object and return
an integer index to its hash map.

Linear data is now stored in ve.dm.LinearData instances. Two subclasses
for element and meta data contain methods specific to those data types
(ElementLinearData and MetaLinearData).

The static methods in ve.dm.Document that inspected data at a given
offset are now instance methods of ve.dm.ElementLinearData.

AnnotationSets (which are no longer OrderedHashSets) have been moved
to /dm and also have to be instantiated with a pointer the store.

Bug: 46320
Change-Id: I249a5d48726093d1cb3e36351893f4bff85f52e2
2013-03-30 10:06:34 +00:00
Ed Sanders 387d8d6d39 Fix Surface constructor in IndentationAction tests
The IndentationAction was created against a version of master which
didn't have the new Surface constructor signature. This commit resolves
that conflict.

Change-Id: Ifc17f95acfa6057963d503448405355831b1ff97
2013-03-13 23:55:25 +00:00
jenkins-bot acf72c72c4 Merge "Refactor convert to use isolateAndUnwrap" 2013-03-13 16:37:17 +00:00
Ed Sanders a03d0d68cb Refactor convert to use isolateAndUnwrap
isolateAndUnwrap now unwraps to a level determined by a target type
i.e. the type you are going to convert to.

Also in this commit wrap/unwrap/rewrap have been refactored to use
getLengthDifference. unwrap now takes an inner/outer unwrap depth.

Change-Id: I3c6249de43232a9ef64f498a0aaf66b1c44973f2
2013-03-13 01:07:52 +00:00
jenkins-bot 9dfa6945b4 Merge "Only unwrap { generated: wrapper } based on context." 2013-03-13 00:55:14 +00:00
Ed Sanders 9a7b8aacf8 Only unwrap { generated: wrapper } based on context.
Wrapper paragraphs should only be unwrapped if they are the first
element in their parent - or if there is a block level element separating
them from the previous unwrapped paragraph.

Empty paragraphs should only be unwrapped if they are empty and the
last element in their parent.

Also in this commit is a simple test for IndentationAction.decrease().

Bug: 45590
Change-Id: I1f47d12db6d57d984fd4607f667a3b62c53f3dd6
2013-03-13 00:42:16 +00:00
Ed Sanders 404ddbf7cc Fix broken FormatAction tests.
The ve.Surface constructor was recently changed, but the instantiation
in the FormatAction tests was not updated accordingly.

The constructor now requires a ve.init.Target object.

Bug: 39597
Change-Id: Ia4193fbab5c63007ed057009bf9a39f1f9d18fb7
2013-03-11 16:53:44 +00:00
Catrope 8b74c70a34 After creating a ve.Surface in a test, destroy it
I was seeing intermittent test failures caused by exceptions in
ce.SurfaceObserver (!!), seems to be caused by the FormatAction test
creating a surface but not destroying it.

Change-Id: I7ab070d3c8db934eb9781ac8a6466475144c214e
2013-02-22 16:22:30 -08:00
Ed Sanders c05b5d13cd Create tests for ve.FormatAction.convert
These 3 tests convert different selections of list items to headings.

Bug: 45216
Change-Id: I6cf042d9d5aa4afb68c0992f444b600ed69f0c04
2013-02-22 11:52:12 -08:00