Bug 110146 - Rename AncestorChainWalker
Summary: Rename AncestorChainWalker
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hayato Ito
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-18 12:03 PST by Ryosuke Niwa
Modified: 2013-02-19 18:29 PST (History)
12 users (show)

See Also:


Attachments
Renamed (32.29 KB, patch)
2013-02-19 01:46 PST, Hayato Ito
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 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.
Comment 1 Ryosuke Niwa 2013-02-18 12:08:22 PST
AncestorChainAcrossInsertionPointWalker?
Comment 2 Ryosuke Niwa 2013-02-18 12:09:10 PST
Also, m_isCrossingInsertionPoint should be named m_hasCrossedInsertionPoint and parent() should be named moveToParent().
Comment 3 Mike West 2013-02-18 12:10:41 PST
+Hayato-san, who will likely have opinions.
Comment 4 Dimitri Glazkov (Google) 2013-02-18 12:16:25 PST
EventPathWalker should be a good name.
Comment 5 Ryosuke Niwa 2013-02-18 12:17:10 PST
(In reply to comment #4)
> EventPathWalker should be a good name.

I like that!
Comment 6 Hayato Ito 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.
Comment 7 Darin Adler 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.
Comment 8 Hayato Ito 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.
Comment 9 Ryosuke Niwa 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...
Comment 10 Hayato Ito 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().
Comment 11 Hayato Ito 2013-02-19 01:46:28 PST
Created attachment 189026 [details]
Renamed
Comment 12 Hayato Ito 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.
Comment 13 WebKit Review Bot 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>
Comment 14 WebKit Review Bot 2013-02-19 18:29:18 PST
All reviewed patches have been landed.  Closing bug.