Summary: | DOMRange doesn't correctly re-size when inserting items (Acid3) | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Andrew Wellington <andrew> | ||||
Component: | DOM | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | cdumez | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Mac | ||||||
OS: | OS X 10.4 | ||||||
Attachments: |
|
Description
Andrew Wellington
2008-01-06 03:32:25 PST
Created attachment 18299 [details]
Proposed patch
Move the endOffset as required when new items are inserted.
I'm not sure that this is right approach - ranges should be fixed for any DOM mutations, not just those that happen to be made via DOMRange interface. See <http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Mutation>. Comment on attachment 18299 [details]
Proposed patch
Usually a count would be named with a noun. The word "move" is more like a verb, so "offsetMove" is not a great variable name. Maybe offsetDelta or endOffsetAdjustment?
+ if (m_startContainer == m_endContainer)
+ m_endOffset += offsetMove;
There's no if statement needed here -- you already ensured that the variable will be 0 in the case where the two are not equal.
r=me
(In reply to comment #2) > I'm not sure that this is right approach - ranges should be fixed for any DOM > mutations, not just those that happen to be made via DOMRange interface. See > <http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Mutation>. I agree with Alexey. This approach is incorrect. However, I see no major harm in having this code which fixes only one particular case checked in, in the mean time. We can do the real fix later and remove this one special case -- the test case here will ensure we don't break this particular case. Comment on attachment 18299 [details] Proposed patch Landed in r29214 I agree with Alexy on this, so I'll leave this bug open and clear the review flag on this patch. Calling this one fixed as I made a more general bug for this at http://bugs.webkit.org/show_bug.cgi?id=16766 Mass moving XML DOM bugs to the "DOM" Component. |