<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>64072</bug_id>
          
          <creation_ts>2011-07-07 01:13:03 -0700</creation_ts>
          <short_desc>[Meta] &quot;Flattened tree&quot; concept should be explicit in the code</short_desc>
          <delta_ts>2012-02-27 19:02:50 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>79197</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>61110</dependson>
    
    <dependson>64144</dependson>
    
    <dependson>64251</dependson>
    
    <dependson>64849</dependson>
    
    <dependson>64850</dependson>
          <blocked>72352</blocked>
    
    <blocked>63522</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Hajime Morrita">morrita</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dglazkov</cc>
    
    <cc>dominicc</cc>
    
    <cc>hayato</cc>
    
    <cc>rolandsteiner</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>433339</commentid>
    <comment_count>0</comment_count>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2011-07-07 01:13:03 -0700</bug_when>
    <thetext>Working on Bug 63977, It became clear that we should have a way to beware &quot;flattened tree&quot; 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&apos;t have script binding.
- It&apos;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&apos;t feasible because it has a many state
which makes a copy operation bit expensive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>433346</commentid>
    <comment_count>1</comment_count>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2011-07-07 01:33:36 -0700</bug_when>
    <thetext>Bug 61110 might relates.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>433450</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov (Google)">dglazkov</who>
    <bug_when>2011-07-07 07:52:31 -0700</bug_when>
    <thetext>I think &quot;Flattener&quot; is a completely wrong term here. It&apos;s just a tree walker, aware of shadow DOM subtrees.

Can we call it TreeIterator instead?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>433845</commentid>
    <comment_count>3</comment_count>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2011-07-07 18:33:52 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; I think &quot;Flattener&quot; is a completely wrong term here. It&apos;s just a tree walker, aware of shadow DOM subtrees.
&gt; 
&gt; Can we call it TreeIterator instead?
That sounds fine. It&apos;s a bit too generic though.
We would also want to have non-shadow aware iterator... FlatTreeIterator?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>434716</commentid>
    <comment_count>4</comment_count>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2011-07-11 02:07:58 -0700</bug_when>
    <thetext>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&apos;m trying to introduce that link, which is tracked on Bug 64251 and Bug 64252.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>566262</commentid>
    <comment_count>5</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2012-02-27 19:02:50 -0800</bug_when>
    <thetext>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 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>