Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Issue 125503002: We should unify various forms of tree traversal in DOM (Closed)

Created:
6 years, 11 months ago by atreat
Modified:
6 years, 11 months ago
CC:
blink-reviews, loislo+blink_chromium.org, sof, eae+blinkwatch, yurys+blink_chromium.org, abarth-chromium, dglazkov+blink, adamk+blink_chromium.org, use-l.gombos-samsung.com
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

We should unify various forms of tree traversal in DOM Unifies tree-traversal methods in newer WTF::TreeNode class to reduce code copying and ensure that traversals are as fast as possible. This is hopefully a first step towards unifying the data structures and traversal algorithms for Node/ContainerNode and RenderObject/RenderObjectChildList. The plan is to eventually merge NodeTraversal.h into TreeNode.h and replace all usage of the former with the latter. This first step is more modest in scope, replacing only those methods that are templated and/or are copy pasted copies between the current user of TreeNode.h -- HTMLImport -- and NodeTraversal.h. BUG=331880 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=164625

Patch Set 1 #

Total comments: 3

Patch Set 2 : Fix the unit tests and review fixes #

Total comments: 4

Patch Set 3 : Fix the comments in TreeNode.h to be more descriptive #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+176 lines, -119 lines) Patch
M Source/core/dom/Node.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/dom/NodeTraversal.h View 1 2 chunks +12 lines, -47 lines 0 comments Download
M Source/core/dom/StyleEngine.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/html/HTMLImport.cpp View 5 chunks +5 lines, -5 lines 0 comments Download
M Source/wtf/TreeNode.h View 1 2 5 chunks +138 lines, -49 lines 1 comment Download
M Source/wtf/TreeNodeTest.cpp View 1 8 chunks +16 lines, -16 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
atreat
What do you think?
6 years, 11 months ago (2014-01-06 22:46:03 UTC) #1
Hajime Morrita
Oh, basically we're just moving traversal fucntions to TreeNode.h? This looks reasonable for me.
6 years, 11 months ago (2014-01-07 03:27:29 UTC) #2
Inactive
Reducing code duplication makes sense. Looks like you have valid compilation errors in treenodetest.cpp. Make ...
6 years, 11 months ago (2014-01-07 14:37:02 UTC) #3
atreat
On 2014/01/07 14:37:02, Chris Dumez wrote: > Reducing code duplication makes sense. Updated patch taking ...
6 years, 11 months ago (2014-01-07 17:15:23 UTC) #4
Inactive
Thanks for updating the patch. lgtm for core/ but please make sure Googlers are also ...
6 years, 11 months ago (2014-01-07 19:07:07 UTC) #5
eseidel
lgtm https://codereview.chromium.org/125503002/diff/100001/Source/core/dom/Node.h File Source/core/dom/Node.h (right): https://codereview.chromium.org/125503002/diff/100001/Source/core/dom/Node.h#newcode174 Source/core/dom/Node.h:174: // FIXME: We should get rid of parentNode() ...
6 years, 11 months ago (2014-01-07 19:14:00 UTC) #6
esprehn
I'm not sure how I feel about this. Node::parentNode() checks for the ShadowRoot encapsulation so ...
6 years, 11 months ago (2014-01-07 19:16:36 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adam.treat@samsung.com/125503002/100001
6 years, 11 months ago (2014-01-07 19:16:54 UTC) #8
atreat
On 2014/01/07 19:16:36, esprehn wrote: > I'm not sure how I feel about this. Node::parentNode() ...
6 years, 11 months ago (2014-01-07 19:25:46 UTC) #9
esprehn
On 2014/01/07 19:25:46, atreat wrote: > On 2014/01/07 19:16:36, esprehn wrote: > > I'm not ...
6 years, 11 months ago (2014-01-07 19:38:58 UTC) #10
atreat
On 2014/01/07 19:16:36, esprehn wrote: > I'm not sure how I feel about this. Node::parentNode() ...
6 years, 11 months ago (2014-01-07 19:40:51 UTC) #11
esprehn
On 2014/01/07 19:40:51, atreat wrote: > On 2014/01/07 19:16:36, esprehn wrote: > > I'm not ...
6 years, 11 months ago (2014-01-07 19:44:34 UTC) #12
esprehn
lgtm
6 years, 11 months ago (2014-01-07 19:48:54 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adam.treat@samsung.com/125503002/260001
6 years, 11 months ago (2014-01-07 19:58:59 UTC) #14
commit-bot: I haz the power
Change committed as 164625
6 years, 11 months ago (2014-01-07 22:47:29 UTC) #15
esprehn
On 2014/01/07 22:47:29, I haz the power (commit-bot) wrote: > Change committed as 164625 This ...
6 years, 11 months ago (2014-01-08 02:34:56 UTC) #16
Inactive
On 2014/01/08 02:34:56, esprehn wrote: > On 2014/01/07 22:47:29, I haz the power (commit-bot) wrote: ...
6 years, 11 months ago (2014-01-08 02:51:07 UTC) #17
Inactive
https://codereview.chromium.org/125503002/diff/260001/Source/wtf/TreeNode.h File Source/wtf/TreeNode.h (right): https://codereview.chromium.org/125503002/diff/260001/Source/wtf/TreeNode.h#newcode147 Source/wtf/TreeNode.h:147: template<class NodeType, class ContainerType> BTW, I am not a ...
6 years, 11 months ago (2014-01-08 03:08:00 UTC) #18
esprehn
6 years, 11 months ago (2014-01-08 03:39:40 UTC) #19
Message was sent while issue was closed.
On 2014/01/08 03:08:00, Chris Dumez wrote:
> https://codereview.chromium.org/125503002/diff/260001/Source/wtf/TreeNode.h
> File Source/wtf/TreeNode.h (right):
> 
>
https://codereview.chromium.org/125503002/diff/260001/Source/wtf/TreeNode.h#n...
> Source/wtf/TreeNode.h:147: template<class NodeType, class ContainerType>
> BTW, I am not a big fan of the NodeType / ContainerType naming. They are both
> Node types, but they may be different.

Yeah it does appear to be that.

> 
> ContainerType may be a Node here (as opposed to a ContainerNode) so I think
the
> naming is a bit confusing. I would have preferred more generic names (e.g.
> NodeType1 / NodeType2), what do others think?

I think the current naming makes sense, one is the type for things with children
and one is the type for things where you're not sure.

Powered by Google App Engine
This is Rietveld 408576698