<?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>17926</bug_id>
          
          <creation_ts>2008-03-18 16:41:40 -0700</creation_ts>
          <short_desc>Unformat deletes images</short_desc>
          <delta_ts>2010-10-25 15:19:08 -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>HTML Editing</component>
          <version>525.x (Safari 3.1)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://rtef.info/demo.htm</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>NeedsReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>43017</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anders Jenbo">fuck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>jparent</cc>
    
    <cc>justin.garcia</cc>
    
    <cc>ojan</cc>
    
    <cc>rniwa</cc>
    
    <cc>tkent</cc>
    
    <cc>tony</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>74349</commentid>
    <comment_count>0</comment_count>
    <who name="Anders Jenbo">fuck</who>
    <bug_when>2008-03-18 16:41:40 -0700</bug_when>
    <thetext>Go to
http://rtef.info/demo.htm
Switch to HTML mode

Insert this code

Please don&apos;t kill my brother, &lt;img src=&quot;http://www.dcs.dk/imgNewDesign/frontBrother.gif&quot; alt=&quot;Brother&quot; /&gt;

Switch to RichText mode

Select all content (button 1 or how ever you do it), hit unformat (button 2)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74353</commentid>
    <comment_count>1</comment_count>
    <who name="Anders Jenbo">fuck</who>
    <bug_when>2008-03-18 16:51:51 -0700</bug_when>
    <thetext>Probably should mention that unfromat calls &quot;rteCommand(&apos;RemoveFormat&apos;)
rteCommand(&apos;JustifyNone&apos;) and rteCommand(&apos;FormatBlock&apos;, &apos;&lt;p&gt;&apos;) on the selected contnet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105102</commentid>
    <comment_count>2</comment_count>
    <who name="Jeff">contact</who>
    <bug_when>2009-01-09 18:54:43 -0800</bug_when>
    <thetext>I have the same issue when executing :

document.execCommand(&apos;RemoveFormat&apos;,false,null);

on a mix text / img, img are deleted. I avoid selection
on img by adding &quot;-khtml-user-select:none&quot; on them same problem.

another thing the text lost class inherit properties
&lt;div id=&apos;editor&apos; class=&apos;textclass&apos;&gt; .... my text ...  &lt;/div&gt;
When apply &quot;RemoveFormat&quot; the text CSS class might be &apos;textclass&apos; !

Same problem on Chrome

Regards

Jeff






</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299095</commentid>
    <comment_count>3</comment_count>
      <attachid>71792</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-10-25 14:02:24 -0700</bug_when>
    <thetext>Created attachment 71792
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299096</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-10-25 14:03:31 -0700</bug_when>
    <thetext>This bug has been fixed since http://trac.webkit.org/changeset/70283.  I&apos;m adding two more tests to make sure we&apos;re not removing any images.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299104</commentid>
    <comment_count>5</comment_count>
      <attachid>71792</attachid>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2010-10-25 14:25:55 -0700</bug_when>
    <thetext>Comment on attachment 71792
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=71792&amp;action=review

&gt; LayoutTests/editing/execCommand/remove-format-image.html:2
&gt; +&lt;html&gt;

Don&apos;t need this tag. It just adds clutter. The doctype is useful because it forces standards mode though.

&gt; LayoutTests/editing/execCommand/remove-format-image.html:3
&gt; +&lt;body onload=&quot;runTests();&quot;&gt;

Do you need to run this onload? Can&apos;t you just run the script inline? If you do that, you won&apos;t need the body tag in the test.

&gt; LayoutTests/editing/execCommand/remove-format-image.html:5
&gt; +&lt;div id=&quot;test1&quot; contenteditable&gt;&lt;storng&gt;hello&lt;/strong&gt; &lt;img src=&quot;../resources/abe.png&quot;&gt; world&lt;/div&gt;

typo:storng</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299113</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-10-25 14:43:33 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; &gt; LayoutTests/editing/execCommand/remove-format-image.html:2
&gt; &gt; +&lt;html&gt;
&gt; 
&gt; Don&apos;t need this tag. It just adds clutter. The doctype is useful because it forces standards mode though.

I don&apos;t think having &lt;html&gt; adds that much of cluttering.  I think most of tests that do have DOCTYPE also has html, and I&apos;d rather conform to that trend.  Are you strongly inclined to remove this before landing?

&gt; &gt; LayoutTests/editing/execCommand/remove-format-image.html:3
&gt; &gt; +&lt;body onload=&quot;runTests();&quot;&gt;
&gt; 
&gt; Do you need to run this onload? Can&apos;t you just run the script inline? If you do that, you won&apos;t need the body tag in the test.

Yes.  Images aren&apos;t necessarily loaded by the time the script is ran, and we get a different result when that happens.  Or otherwise we&apos;ll make this test flaky.

&gt; &gt; LayoutTests/editing/execCommand/remove-format-image.html:5
&gt; &gt; +&lt;div id=&quot;test1&quot; contenteditable&gt;&lt;storng&gt;hello&lt;/strong&gt; &lt;img src=&quot;../resources/abe.png&quot;&gt; world&lt;/div&gt;
&gt; 
&gt; typo:storng

Oops, thanks.  Will fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299122</commentid>
    <comment_count>7</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2010-10-25 15:08:34 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; &gt; LayoutTests/editing/execCommand/remove-format-image.html:2
&gt; &gt; &gt; +&lt;html&gt;
&gt; &gt; 
&gt; &gt; Don&apos;t need this tag. It just adds clutter. The doctype is useful because it forces standards mode though.
&gt; 
&gt; I don&apos;t think having &lt;html&gt; adds that much of cluttering.  I think most of tests that do have DOCTYPE also has html, and I&apos;d rather conform to that trend.  Are you strongly inclined to remove this before landing?

No. Either way is fine. While I agree that many tests have the html tag, I don&apos;t personally like it. The smaller a test is, the easier it is to make sense of and maintain.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299127</commentid>
    <comment_count>8</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-10-25 15:18:00 -0700</bug_when>
    <thetext>Committed r70493: &lt;http://trac.webkit.org/changeset/70493&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>299129</commentid>
    <comment_count>9</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-10-25 15:19:08 -0700</bug_when>
    <thetext>Thanks for the review, Ojan.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>71792</attachid>
            <date>2010-10-25 14:02:24 -0700</date>
            <delta_ts>2010-10-25 14:25:55 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-17926-20101025140223.patch</filename>
            <type>text/plain</type>
            <size>2848</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBMYXlvdXRUZXN0cy9D
aGFuZ2VMb2cJKHJldmlzaW9uIDcw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hbmQoJ1JlbW92ZUZvcm1hdCcsIGZhbHNlLCBudWxsKTsKKyAgICBkb2N1bWVudC5leGVj
Q29tbWFuZCgnSnVzdGlmeU5vbmUnLCBmYWxzZSwgbnVsbCk7CisgICAgZG9jdW1lbnQuZXhlY0Nv
bW1hbmQoJ0Zvcm1hdEJsb2NrJywgZmFsc2UsICdwJyk7CisgICAgTWFya3VwLmR1bXAoJ3Rlc3Qy
JywgJ1JlbW92ZUZvcm1hdCBvbiBhbiBpbWFnZSBmb2xsb3dlZCBieSBKdXN0aWZ5Tm9uZSBhbmQg
Rm9ybWF0QmxvY2sgd2l0aCBwLicpOworCisgICAgTWFya3VwLm5vdGlmeURvbmUoKTsKK30KKwor
TWFya3VwLndhaXRVbnRpbERvbmUoKTsKKworPC9zY3JpcHQ+Cis8L2JvZHk+Cis8L2h0bWw+Cg==
</data>
<flag name="review"
          id="61913"
          type_id="1"
          status="+"
          setter="ojan"
    />
          </attachment>
      

    </bug>

</bugzilla>