Bug 64072
Summary: | [Meta] "Flattened tree" concept should be explicit in the code | ||
---|---|---|---|
Product: | WebKit | Reporter: | Hajime Morrita <morrita> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | dglazkov, dominicc, hayato, rolandsteiner |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 61110, 64144, 64251, 64849, 64850 | ||
Bug Blocks: | 72352, 63522 |
Hajime Morrita
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Hajime Morrita
Bug 61110 might relates.
Dimitri Glazkov (Google)
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
(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
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
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 ***