<?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>103153</bug_id>
          
          <creation_ts>2012-11-23 10:49:47 -0800</creation_ts>
          <short_desc>[CSS Regions] renderer is attached improperly when undo affects a node inside a flow thread</short_desc>
          <delta_ts>2012-11-29 02:01:20 -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>Layout and Rendering</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>103501</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>103501</dependson>
          <blocked>57312</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Pravin D">pravind.2k4</reporter>
          <assigned_to name="Pravin D">pravind.2k4</assigned_to>
          <cc>abucur</cc>
    
    <cc>jchaffraix</cc>
    
    <cc>rniwa</cc>
    
    <cc>WebkitBugTracker</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>774644</commentid>
    <comment_count>0</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-11-23 10:49:47 -0800</bug_when>
    <thetext>Steps to repo:
1) Select all the text inside the red box.
2) Press indent button(once).
3) Press Undo.

Do the same with text inside the green box n compare.

The behavior in the green is correct. The issue is with red box.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>774645</commentid>
    <comment_count>1</comment_count>
      <attachid>175828</attachid>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-11-23 10:50:21 -0800</bug_when>
    <thetext>Created attachment 175828
TestCase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>774648</commentid>
    <comment_count>2</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-11-23 10:55:11 -0800</bug_when>
    <thetext>The issue is due to the fact that in case of text nodes which get inserted into anonymous block, insertbefore does not work properly.


When Indent button is pressed,  the nodes from &lt;div class=&quot;artical&quot; contenteditable=&quot;true&quot;&gt; are removed in the order

&quot;Non-Workingcase1&quot;, &lt;br&gt;, &quot;Non-Workingcase2&quot; and placed inside htmlQuote elem.

 

When Undo button is pressed, the reverse should happen. The content from htmlquote is removed and inserted into the original div, in the reverse order.

(Skipping the node removals)

&quot;Non-Workingcase 2&quot; is first inserted to div. As its a text node, an Anonymous Block is created.

Then  an attempt to insert &lt;br &gt;  before &quot;Non-Workingcase 2 &quot; is made. While doing so &quot;Non-Workingcase 2 &quot; &apos;s renderer is queried  to check if its part of same

flow thread as &lt;div class=&quot;artical&quot; contenteditable=&quot;true&quot;&gt; . However as the parent of &quot;Non-Workingcase2 &quot; is an Anonymous Block , flow thread info is not set and results in a mismatch. So the renderer before which &lt;br&gt; must be inserted comes null. Which results in &lt;br&gt; being appended to the  Anonymous Block .... {&quot;Non-Workingcase 2 &quot; , &lt;br&gt; } .

When an attemp to insert &quot;Non-Workingcase 1&quot; before &lt;br&gt; is made, it succeeds as &lt;br&gt; does not have any flowthread info, n proper renderer is returmed resulting in {&quot;Non-Workingcase 2 &quot; , &quot;Non-Workingcase 1&quot;, &lt;br&gt; } .

Will try n upload a better testcase.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>775736</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-11-26 11:51:08 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Then  an attempt to insert &lt;br &gt;  before &quot;Non-Workingcase 2 &quot; is made. While doing so &quot;Non-Workingcase 2 &quot; &apos;s renderer is queried  to check if its part of same flow thread as &lt;div class=&quot;artical&quot; contenteditable=&quot;true&quot;&gt;.

Who does this check?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>776423</commentid>
    <comment_count>4</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-11-27 00:02:37 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; Then  an attempt to insert &lt;br &gt;  before &quot;Non-Workingcase 2 &quot; is made. While doing so &quot;Non-Workingcase 2 &quot; &apos;s renderer is queried  to check if its part of same flow thread as &lt;div class=&quot;artical&quot; contenteditable=&quot;true&quot;&gt;.
&gt; 
&gt; Who does this check?
&gt; 

The check is done in nextRenderer() in NodeRenderingContext.cpp .
if (renderer-&gt;style() &amp;&amp; !renderer-&gt;style()-&gt;flowThread().isEmpty())
                continue;

However the fix need not be here. I think I&apos;ll submit a sample patch, so that we&apos;ll have more context to discuss the issue.

Thank you Rniwa</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>777128</commentid>
    <comment_count>5</comment_count>
      <attachid>176328</attachid>
    <who name="Andrei Bucur">abucur</who>
    <bug_when>2012-11-27 12:41:55 -0800</bug_when>
    <thetext>Created attachment 176328
Same issue different repro?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>778125</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-11-28 11:42:14 -0800</bug_when>
    <thetext>I don&apos;t understand this bug. Undo/redo code should not be accessing renderer at all other than to check its editability. If you&apos;re saying that attach/detach doesn&apos;t work properly, then that&apos;s a layout bug, not an editing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>778686</commentid>
    <comment_count>7</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-11-28 21:56:27 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; I don&apos;t understand this bug. Undo/redo code should not be accessing renderer at all other than to check its editability. If you&apos;re saying that attach/detach doesn&apos;t work properly, then that&apos;s a layout bug, not an editing bug.
&gt; 
Yes its an layout and rendering bug only. The component is also set to the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>778833</commentid>
    <comment_count>8</comment_count>
    <who name="Andrei Bucur">abucur</who>
    <bug_when>2012-11-29 02:01:20 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 103501 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>175828</attachid>
            <date>2012-11-23 10:50:21 -0800</date>
            <delta_ts>2012-11-23 10:50:21 -0800</delta_ts>
            <desc>TestCase</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>789</size>
            <attacher name="Pravin D">pravind.2k4</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8aGVhZD4NCjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4NCmZ1bmN0aW9u
IENoYW5nZUluZGVudCgpDQp7DQogIGRvY3VtZW50LmV4ZWNDb21tYW5kKCJJbmRlbnQiLCBmYWxz
ZSwgMCk7ICANCn0NCg0KZnVuY3Rpb24gQ2hhbmdlVW5kbygpDQp7DQogIGRvY3VtZW50LmV4ZWND
b21tYW5kKCJVbmRvIiwgZmFsc2UsIDApOyAgDQp9DQoNCjwvc2NyaXB0Pg0KPHN0eWxlIHR5cGU9
InRleHQvY3NzIj4NCi5hcnRpY2Fsew0KIC13ZWJraXQtZmxvdy1pbnRvOiB0aHJlYWQ7DQogYm9y
ZGVyOiAycHggc29saWQgcmVkOw0KfQ0KLnJlZ2lvbnsNCmhlaWdodDogMTAwcHg7DQotd2Via2l0
LWZsb3ctZnJvbTp0aHJlYWQ7DQpib3JkZXIgOiAycHggc29saWQgYmx1ZTsNCn0NCjwvc3R5bGU+
DQo8L2hlYWQ+DQo8Ym9keT4NCjxpbnB1dCB0eXBlPSJCdXR0b24iIG9uY2xpY2s9IkNoYW5nZUlu
ZGVudCgpIiB2YWx1ZT0iSW5kZW50Ij4NCjxpbnB1dCB0eXBlPSJCdXR0b24iIG9uY2xpY2s9IkNo
YW5nZVVuZG8oKSIgdmFsdWU9IlVuZG8iPg0KPGRpdiBjbGFzcz0iYXJ0aWNhbCIgY29udGVudGVk
aXRhYmxlPSJ0cnVlIj4NCk5vbi1Xb3JraW5nQ2FzZSAxPGJyPk5vbi1Xb3JraW5nQ2FzZSAyLg0K
PC9kaXY+DQo8ZGl2IHN0eWxlPSJib3JkZXI6IDJweCBzb2xpZCBncmVlbjsiIGNvbnRlbnRlZGl0
YWJsZT0idHJ1ZSI+DQpXb3JraW5nQ2FzZSAxPGJyPldvcmtpbmdDYXNlIDIuDQo8L2Rpdj4NCjxi
cj4NCjxkaXYgY2xhc3M9InJlZ2lvbiI+PC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>176328</attachid>
            <date>2012-11-27 12:41:55 -0800</date>
            <delta_ts>2012-11-27 12:41:55 -0800</delta_ts>
            <desc>Same issue different repro?</desc>
            <filename>test_hover.html</filename>
            <type>text/html</type>
            <size>1275</size>
            <attacher name="Andrei Bucur">abucur</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+DQo8aHRtbD4NCiAgICA8aGVhZD4NCiAgICAgICAgPHN0eWxlPg0KICAg
ICAgICAgICAgLmNvbnRlbnQgeyAtd2Via2l0LWZsb3ctaW50bzogY29udGVudC1mbG93OyB9DQoN
CiAgICAgICAgICAgIC5yZWdpb24gew0KICAgICAgICAgICAgICAgIC13ZWJraXQtZmxvdy1mcm9t
OiBjb250ZW50LWZsb3c7DQogICAgICAgICAgICAgICAgaGVpZ2h0OiA1MDBweDsNCiAgICAgICAg
ICAgICAgICB3aWR0aDogNjAwcHg7DQogICAgICAgICAgICAgICAgYm9yZGVyOiAxcHggc29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k7DQogICAgICAgICAgICAgICAgZXZlbnRT
ZW5kZXIubW91c2VNb3ZlVG8oNTAsIDUwKTsNCiAgICAgICAgICAgICAgICBldmVudFNlbmRlci5t
b3VzZU1vdmVUbyg1MCwgNDAwKTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgPC9zY3JpcHQ+DQog
ICAgPC9ib2R5Pg0KPC9odG1sPg0K
</data>

          </attachment>
      

    </bug>

</bugzilla>