Commit Graph
10 Commits
Author SHA1 Message Date
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +01:00
Philip Peitsch ebb7462022 Extend step translation interface to allow custom rounding
Step translation from a DOM point to a step usually results in some
rounding. The existing interface provided a simple bool flag to control
this, but this does not provide help for a caller that doesn't know
ahead of time which step is "closer" to the desired node (e.g., asking
for steps at paragraph boundaries should round within the paragraph).

This extension now allows a custom delegate that will be called with the
prev and next position to choose between rounding options.
2013-11-28 00:35:36 +11:00
Philip Peitsch 80980cd33c Improved API dox for the steps cache implementation 2013-11-14 20:28:37 +11:00
Philip Peitsch f28151e4c2 Find a nearby known cached point when requested DOM point is outside any cached areas 2013-11-14 20:28:34 +11:00
Philip Peitsch 9cf01b8754 Reset steps cache when the document root is replaced (i.e., cope with undo!) 2013-11-14 20:28:34 +11:00
Philip Peitsch 3a74bbc121 Add caching for steps to DOM point conversion 2013-11-14 20:28:34 +11:00
Philip Peitsch 410280fe14 Add signals necessary to keep a caching implementation in sync with the document 2013-11-14 20:28:33 +11:00
Philip Peitsch abb9e55dd1 Cope with translating DOM points outside the root node to steps
Previously, various consumers needed to be careful about only
asking for nodes inside the root node. Failure to do so resulted
in unpredictable behaviour.

To simplify the interface and improve the system robustness, this
rounding is now taken care of behind the StepsTranslator interface.
2013-11-14 20:28:33 +11:00
Philip Peitsch 946c6e69b0 Requesting negative steps or too many steps will return 0 or doc length
Further improve the safety of the steps translation API. Requesting
invalid ranges will log a warning and return an appropriate step.
2013-11-14 20:28:32 +11:00
Philip Peitsch 4a11179b23 Extract StepsTranslator interface to allow a safe interface to start caching improvements 2013-11-14 20:28:32 +11:00