WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 44962
deduplicate code from Node::checkReplaceChild and Node::checkAddChild
https://bugs.webkit.org/show_bug.cgi?id=44962
Summary
deduplicate code from Node::checkReplaceChild and Node::checkAddChild
Ojan Vafai
Reported
2010-08-31 10:18:01 PDT
deduplicate code from Node::checkReplaceChild and Node::checkAddChild
Attachments
Patch
(7.76 KB, patch)
2010-08-31 10:20 PDT
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Patch
(7.79 KB, patch)
2010-08-31 10:33 PDT
,
Ojan Vafai
tony
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Ojan Vafai
Comment 1
2010-08-31 10:20:12 PDT
Created
attachment 66068
[details]
Patch
Eric Seidel (no email)
Comment 2
2010-08-31 10:29:36 PDT
Comment on
attachment 66068
[details]
Patch
> WebCore/dom/Node.cpp:1076 > + if (child->nodeType() != parent->DOCUMENT_FRAGMENT_NODE) {
parent-> isn't needed here. I would have made the fragment case an early return instead. It's really hard to tell what this diff is doing. I know it's small, but maybe it could be smallr?
Ojan Vafai
Comment 3
2010-08-31 10:31:55 PDT
(In reply to
comment #2
)
> (From update of
attachment 66068
[details]
) > > WebCore/dom/Node.cpp:1076 > > + if (child->nodeType() != parent->DOCUMENT_FRAGMENT_NODE) { > parent-> isn't needed here. > > I would have made the fragment case an early return instead.
I was just copy-pasting the code. But I agree. I'll make it an early return.
> It's really hard to tell what this diff is doing. I know it's small, but maybe it could be smallr?
Meh. This is really a small change. We just really need side-by-side diffs.
Ojan Vafai
Comment 4
2010-08-31 10:33:57 PDT
Created
attachment 66069
[details]
Patch
Ojan Vafai
Comment 5
2010-08-31 10:36:28 PDT
As a side-by-side diff:
http://codereview.appspot.com/2046045/
Tony Chang
Comment 6
2010-08-31 10:43:08 PDT
Comment on
attachment 66069
[details]
Patch
> diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp > -bool Node::canReplaceChild(Node* newChild, Node*) > +static bool isChildTypeAllowed(Node* parent, Node* child)
Nit: Perhaps newParent or newChild to make it clear that child->parent() != parent? The side by side diff was much easier to read.
Eric Seidel (no email)
Comment 7
2010-08-31 10:43:38 PDT
That link only helps a little. this si still *ridiculously* confusing. :( The names are all getting changed around. They were similar to begin with, so that didn't help.
Eric Seidel (no email)
Comment 8
2010-08-31 10:44:54 PDT
Comment on
attachment 66069
[details]
Patch
> WebCore/dom/Node.cpp:1076 > + if (child->nodeType() != parent->DOCUMENT_FRAGMENT_NODE) {
You still don't need parent-> here.
Ojan Vafai
Comment 9
2010-08-31 10:48:36 PDT
(In reply to
comment #8
)
> (From update of
attachment 66069
[details]
) > > WebCore/dom/Node.cpp:1076 > > + if (child->nodeType() != parent->DOCUMENT_FRAGMENT_NODE) { > You still don't need parent-> here.
Really? It didn't compile without it.
Eric Seidel (no email)
Comment 10
2010-08-31 10:54:28 PDT
(In reply to
comment #9
)
> (In reply to
comment #8
) > > (From update of
attachment 66069
[details]
[details]) > > > WebCore/dom/Node.cpp:1076 > > > + if (child->nodeType() != parent->DOCUMENT_FRAGMENT_NODE) { > > You still don't need parent-> here. > > Really? It didn't compile without it.
Yes, but it's an enum. You can use Node:: OK. I've read through the diff again. I believe Ojan has correctly moved code/not-changed-behavior now.
Ojan Vafai
Comment 11
2010-08-31 11:03:51 PDT
> Yes, but it's an enum. You can use Node::
Oh, duh. Will do.
Ojan Vafai
Comment 12
2010-08-31 11:22:39 PDT
Committed
r66511
: <
http://trac.webkit.org/changeset/66511
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug