RESOLVED FIXED 43385
Range::create should not be calling deprecatedEditingOffset and node on start and end
https://bugs.webkit.org/show_bug.cgi?id=43385
Summary Range::create should not be calling deprecatedEditingOffset and node on start...
Ryosuke Niwa
Reported 2010-08-02 15:33:49 PDT
The version of Range::create that takes two positions calls deprecatedEditingOffset() and node() on start and end to create a range object. Since these two methods are deprecated and have side-effects, we should be calling containerNode() and computeOffsetInContainerNode() instead. A simple patch coming with the following change: @@ -94,8 +94,7 @@ PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, const Position& start, const Position& end) { - // FIXME: we shouldn't be using deprecatedEditingOffset here - return adoptRef(new Range(ownerDocument, start.node(), start.deprecatedEditingOffset(), end.node(), end.deprecatedEditingOffset())); + return adoptRef(new Range(ownerDocument, start.containerNode(), start.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInContainerNode())); }
Attachments
fixes the bug (1.47 KB, patch)
2010-08-02 15:40 PDT, Ryosuke Niwa
eric: review+
Ryosuke Niwa
Comment 1 2010-08-02 15:40:50 PDT
Created attachment 63270 [details] fixes the bug
Eric Seidel (no email)
Comment 2 2010-08-02 15:42:41 PDT
Comment on attachment 63270 [details] fixes the bug I wonder if this is tesable. It's obviously wrong, but I wonder how we would trigger it. This should make it so we don't need to call rangeCompliantPosition on positions before passing them to this function. :) So we could remove that in a later patch.
Ryosuke Niwa
Comment 3 2010-08-02 18:00:11 PDT
Note You need to log in before you can comment on or make changes to this bug.