Bug 82089 - Match DOM4 spec with respect to DocumentFragment insertion
Summary: Match DOM4 spec with respect to DocumentFragment insertion
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adam Klein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-23 14:06 PDT by Adam Klein
Modified: 2012-03-29 00:35 PDT (History)
10 users (show)

See Also:


Attachments
Patch (18.69 KB, patch)
2012-03-23 14:15 PDT, Adam Klein
no flags Details | Formatted Diff | Diff
Patch (19.01 KB, patch)
2012-03-23 14:17 PDT, Adam Klein
no flags Details | Formatted Diff | Diff
Patch (19.01 KB, patch)
2012-03-23 14:31 PDT, Adam Klein
no flags Details | Formatted Diff | Diff
Patch minus replaceChild ordering change (15.80 KB, patch)
2012-03-23 15:19 PDT, Adam Klein
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Klein 2012-03-23 14:06:52 PDT
Match DOM4 spec with respect to DocumentFragment insertion
Comment 1 Adam Klein 2012-03-23 14:15:10 PDT
Created attachment 133557 [details]
Patch
Comment 2 Adam Klein 2012-03-23 14:17:36 PDT
Created attachment 133558 [details]
Patch
Comment 3 Philippe Normand 2012-03-23 14:23:03 PDT
Comment on attachment 133558 [details]
Patch

Attachment 133558 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12122801
Comment 4 Early Warning System Bot 2012-03-23 14:28:06 PDT
Comment on attachment 133558 [details]
Patch

Attachment 133558 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12123773
Comment 5 Adam Klein 2012-03-23 14:31:20 PDT
Created attachment 133564 [details]
Patch
Comment 6 Ryosuke Niwa 2012-03-23 15:04:21 PDT
Comment on attachment 133558 [details]
Patch

Talked with aklein in person. There appears to be some errors in the spec with respect to the order of mutations. I've asked aklein to separate the  atomic-removal from a document fragment for now since that's a pretty safe change to make.
Comment 7 Adam Klein 2012-03-23 15:19:02 PDT
Created attachment 133570 [details]
Patch minus replaceChild ordering change
Comment 8 Ryosuke Niwa 2012-03-23 15:31:40 PDT
Comment on attachment 133570 [details]
Patch minus replaceChild ordering change

View in context: https://bugs.webkit.org/attachment.cgi?id=133570&action=review

> Source/WebCore/dom/ContainerNode.cpp:287
> +    if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do

What if next had been removed from this during the mutation event? r- because of this.

In general, it's better to define a boolean or a helper function that documents this than adding a comment like "nothing to do",
Comment 9 Ryosuke Niwa 2012-03-23 15:38:28 PDT
Comment on attachment 133570 [details]
Patch minus replaceChild ordering change

View in context: https://bugs.webkit.org/attachment.cgi?id=133570&action=review

>> Source/WebCore/dom/ContainerNode.cpp:287
>> +    if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do
> 
> What if next had been removed from this during the mutation event? r- because of this.
> 
> In general, it's better to define a boolean or a helper function that documents this than adding a comment like "nothing to do",

On my second thought, this condition was present in the old code and it'll only match one-node case so this is probably okay.

> Source/WebCore/dom/ContainerNode.cpp:-289
> -        // If the new child is already in the right place, we're done.
> -        if (next && (next == child || next == child->previousSibling()))
> -            break;

I don't think this old code was correct to begin with for the document fragment case since there are more nodes next in the targets.
It's probably a left over from the days we still used to iterate through nextSibling instead of collecting nodes upfront.
Comment 10 WebKit Review Bot 2012-03-23 15:51:43 PDT
Comment on attachment 133570 [details]
Patch minus replaceChild ordering change

Clearing flags on attachment: 133570

Committed r111925: <http://trac.webkit.org/changeset/111925>
Comment 11 WebKit Review Bot 2012-03-23 15:51:49 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Ryosuke Niwa 2012-03-29 00:35:21 PDT
Note a regression fix was landed in http://trac.webkit.org/changeset/112323.