<?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>61997</bug_id>
          
          <creation_ts>2011-06-03 00:53:42 -0700</creation_ts>
          <short_desc>Cloning elements with shadow DOM does redundant element creation</short_desc>
          <delta_ts>2011-06-06 21:51:34 -0700</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>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>61983</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dominic Cooney">dominicc</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>morrita</cc>
    
    <cc>tkent</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>414703</commentid>
    <comment_count>0</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2011-06-03 00:53:42 -0700</bug_when>
    <thetext>Cloning an element with shadow DOM typically does redundant element creation.

For example, cloning an &lt;input type=&quot;range&quot; style=&quot;…&quot;&gt; creates one shadow slider element during the HTMLInputElement clone when it clones its type attribute (which creates a RangeInputType, which creates a shadow subtree for the slider.) Then Element::copyNonAttributeProperties destroys that shadow subtree and creates another shadow subtree that is a clone of the shadow subtree of the original node.

We only need one of these two shadow trees.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>414759</commentid>
    <comment_count>1</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2011-06-03 03:32:28 -0700</bug_when>
    <thetext>So, reverting http://trac.webkit.org/changeset/84528/trunk/Source/WebCore/dom/Element.cpp will solve everything?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>414760</commentid>
    <comment_count>2</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2011-06-03 03:33:08 -0700</bug_when>
    <thetext>I meant reverting http://trac.webkit.org/changeset/84528 .</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>414762</commentid>
    <comment_count>3</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2011-06-03 03:42:16 -0700</bug_when>
    <thetext>Reverting 84528 will ensure that there is no redundant element creation. However it does not ensure that cloned elements end up with valid shadow trees. (For example, &lt;keygen&gt; has no hook to clone its shadow.)

I think we need a general solution where elements with shadow roots get notified when they are cloned, so that they can participate in the clone. For elements like &lt;input type=&quot;…&quot;&gt; where setting the type attribute will create a shadow tree anyway, it can just assert that the shadow tree was created.

For elements like keygen, it can create the clone shadow tree at that point.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>414763</commentid>
    <comment_count>4</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2011-06-03 03:53:44 -0700</bug_when>
    <thetext>(In reply to comment #3)
Keygen build the shadow tree in the constructor.   Cloning a keygen needs nothing else, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>414767</commentid>
    <comment_count>5</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2011-06-03 04:03:19 -0700</bug_when>
    <thetext>Yes, you’re right, keygen would work if r84528 was reverted. Maybe we should revert it…</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416295</commentid>
    <comment_count>6</comment_count>
    <who name="Hajime Morrita">morrita</who>
    <bug_when>2011-06-06 21:36:36 -0700</bug_when>
    <thetext>Is this valid yet?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>416308</commentid>
    <comment_count>7</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2011-06-06 21:51:34 -0700</bug_when>
    <thetext>Since r84528 was reverted, this bug is no longer applicable.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>