RESOLVED DUPLICATE of bug 79197 64072
[Meta] "Flattened tree" concept should be explicit in the code
https://bugs.webkit.org/show_bug.cgi?id=64072
Summary [Meta] "Flattened tree" concept should be explicit in the code
Hajime Morrita
Reported 2011-07-07 01:13:03 PDT
Working on Bug 63977, It became clear that we should have a way to beware "flattened tree" concept in XBL mean. Here is a rough idea: - At first, extract NodeFlattener from NodeRenderingContext. - Then expand its usage to where we should care about flattened tree: - Focus handling, - Text iteration, - And possibly more! NodeFlattener would look like this: ---- class NodeFlattener { public: Node* nextSibling() const; Node* previousSibling() const; Node* parent() const; Node* next() const; // dfs traversal like traverseNextNode() void moveToNextSibling(); .... // more moveTo family will come here. private: Node* m_node; ... // Pull a part of NodeRenderingContext state here. }; ---- NodeFlattener is like TreeWalker, but should be more lightweight. - It doesn't have script binding. - It's stack-based. Ideally, it would be great if the flattener can be used as a smart pointer for the node. But I think it isn't feasible because it has a many state which makes a copy operation bit expensive.
Attachments
Hajime Morrita
Comment 1 2011-07-07 01:33:36 PDT
Bug 61110 might relates.
Dimitri Glazkov (Google)
Comment 2 2011-07-07 07:52:31 PDT
I think "Flattener" is a completely wrong term here. It's just a tree walker, aware of shadow DOM subtrees. Can we call it TreeIterator instead?
Hajime Morrita
Comment 3 2011-07-07 18:33:52 PDT
(In reply to comment #2) > I think "Flattener" is a completely wrong term here. It's just a tree walker, aware of shadow DOM subtrees. > > Can we call it TreeIterator instead? That sounds fine. It's a bit too generic though. We would also want to have non-shadow aware iterator... FlatTreeIterator?
Hajime Morrita
Comment 4 2011-07-11 02:07:58 PDT
I found that this change is hard to be done with only naive refactoring because there is no link from forwarded nodes to content elements. So I'm trying to introduce that link, which is tracked on Bug 64251 and Bug 64252.
Hayato Ito
Comment 5 2012-02-27 19:02:50 PST
I marked it DUPLICATE in favor of bug79197. https://bugs.webkit.org/show_bug.cgi?id=79197 If you have any concerns, please reopen this. *** This bug has been marked as a duplicate of bug 79197 ***
Note You need to log in before you can comment on or make changes to this bug.