Bug 110146

Summary: Rename AncestorChainWalker
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Hayato Ito <hayato>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, darin, dglazkov, gyuyoung.kim, hayato, koivisto, mjs, mkwst, morrita, ojan.autocc, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Renamed none

Ryosuke Niwa
Reported 2013-02-18 12:03:31 PST
AncestorChainWalker walker(node); walker.parent(); return walker.get(); It's not obvious that the above code should behave differently from: return node ? node->parentNode() : 0; The class name should communicate the semantic difference.
Attachments
Renamed (32.29 KB, patch)
2013-02-19 01:46 PST, Hayato Ito
no flags
Ryosuke Niwa
Comment 1 2013-02-18 12:08:22 PST
AncestorChainAcrossInsertionPointWalker?
Ryosuke Niwa
Comment 2 2013-02-18 12:09:10 PST
Also, m_isCrossingInsertionPoint should be named m_hasCrossedInsertionPoint and parent() should be named moveToParent().
Mike West
Comment 3 2013-02-18 12:10:41 PST
+Hayato-san, who will likely have opinions.
Dimitri Glazkov (Google)
Comment 4 2013-02-18 12:16:25 PST
EventPathWalker should be a good name.
Ryosuke Niwa
Comment 5 2013-02-18 12:17:10 PST
(In reply to comment #4) > EventPathWalker should be a good name. I like that!
Hayato Ito
Comment 6 2013-02-18 18:33:41 PST
(In reply to comment #4) > EventPathWalker should be a good name. +1. I've recently introduced 'EventPath' into EventContext in http://trac.webkit.org/changeset/142575. We should spread this term, which is used in DOM Core spec, to Walker class too. Hopefully, we can avoid a kind of confusion. This kind of confusion is apparently bad for the project. AncestorChainWalker was formally called ComposedShadowTreeParentWalker, which was separated from ComposedShadowTreeWalker. I think there are some historical debts. We should clean up now.
Darin Adler
Comment 7 2013-02-18 18:38:49 PST
I think that for simple cases we need a function rather than a class so we don’t have use three lines for the idiom Ryosuke quoted.
Hayato Ito
Comment 8 2013-02-18 18:58:29 PST
Let me add one more history. Before ComposedShadowTreeWalker was introduced, there was a 'Reified DOM Tree traversal'. http://trac.webkit.org/changeset/112055 This is function style APIs. All public APIs are just static functions. ComposedShadowTreeWalker was introduced, deprecating ReifiedTreeTraversal. The reasons: - We need to parameterize Walker class. It might be good to have a parameter in its constructor. - I'd like to optimize the performance of walker without affecting the usage in caller side. I think NodeTraversal, which was introduced recently, might be wrapper APIs for common use cases for walker. If we can apply NodeTraversal, we should use it rather than using Walker directly.
Ryosuke Niwa
Comment 9 2013-02-18 19:00:59 PST
(In reply to comment #8) > I think NodeTraversal, which was introduced recently, might be wrapper APIs for common use cases for walker. > If we can apply NodeTraversal, we should use it rather than using Walker directly. NodeTraversal isn't a class though...
Hayato Ito
Comment 10 2013-02-19 00:26:19 PST
I have to use yet another unfamiliar term, *reprojection*, to explain that. :) Node can be distributed to more than one insertion point during reprojection. https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#reprojection Therefore, the walker has to visit each insertion point consecutively since an event should be fired on these insertion points. I am feeling that isCrossingInsertinPoint() is not good name, isVisitingInsertionPointInReprojection() might be a better name. (In reply to comment #2) > Also, m_isCrossingInsertionPoint should be named m_hasCrossedInsertionPoint and parent() should be named moveToParent().
Hayato Ito
Comment 11 2013-02-19 01:46:28 PST
Hayato Ito
Comment 12 2013-02-19 18:15:25 PST
Though it seems mac bot and win bot stopped working, let me set cq+ and see what will happen.
WebKit Review Bot
Comment 13 2013-02-19 18:29:13 PST
Comment on attachment 189026 [details] Renamed Clearing flags on attachment: 189026 Committed r143422: <http://trac.webkit.org/changeset/143422>
WebKit Review Bot
Comment 14 2013-02-19 18:29:18 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.