From c7ebea3eae4b7b3d1b070ec2651ec68bfae13fb9 Mon Sep 17 00:00:00 2001 From: Philip Peitsch Date: Mon, 2 Dec 2013 20:06:52 +1100 Subject: [PATCH] Use cursor to dom range conversion functions on OdtDocument --- webodf/lib/ops/OpApplyDirectStyling.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/webodf/lib/ops/OpApplyDirectStyling.js b/webodf/lib/ops/OpApplyDirectStyling.js index a44b0fd8..b2e14356 100644 --- a/webodf/lib/ops/OpApplyDirectStyling.js +++ b/webodf/lib/ops/OpApplyDirectStyling.js @@ -68,18 +68,6 @@ ops.OpApplyDirectStyling = function OpApplyDirectStyling() { this.isEdit = true; - function getRange(odtDocument) { - var point1 = length >= 0 ? position : position + length, - point2 = length >= 0 ? position + length : position, - p1 = odtDocument.getIteratorAtPosition(point1), - p2 = length ? odtDocument.getIteratorAtPosition(point2) : p1, - range = odtDocument.getDOM().createRange(); - - range.setStart(p1.container(), p1.unfilteredDomOffset()); - range.setEnd(p2.container(), p2.unfilteredDomOffset()); - return range; - } - /** * Apply the specified style properties to all elements within the given range. * Currently, only text styles are applied. @@ -112,7 +100,7 @@ ops.OpApplyDirectStyling = function OpApplyDirectStyling() { } this.execute = function (odtDocument) { - var range = getRange(odtDocument), + var range = odtDocument.convertCursorToDomRange(position, length), impactedParagraphs = odfUtils.getImpactedParagraphs(range); applyStyle(odtDocument, range, setProperties);