<?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>73967</bug_id>
          
          <creation_ts>2011-12-06 17:26:56 -0800</creation_ts>
          <short_desc>Copy/paste of the same content produces elements with verbose style</short_desc>
          <delta_ts>2012-03-29 17:29:58 -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>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          <dependson>81737</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Enrica Casucci">enrica</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>enrica</cc>
    
    <cc>max.hong.shen</cc>
    
    <cc>rniwa</cc>
    
    <cc>sullivan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>516404</commentid>
    <comment_count>0</comment_count>
    <who name="Enrica Casucci">enrica</who>
    <bug_when>2011-12-06 17:26:56 -0800</bug_when>
    <thetext>Repro steps:

1. Go to http://www-archive.mozilla.org/editor/midasdemo/
2. Switch to the View HTML Source view
3. Enter the following markup: &lt;b&gt;&lt;i style=&quot;border: solid red&quot;&gt;hello&lt;/i&gt;&lt;/b&gt;
4. Switch to the non HTML source view
5. Select All, then Copy and Paste
6. Switch back to the HTML source view

Expected:
The markup is the same.

Actual:
The markup is: &lt;b&gt;&lt;i style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: red; border-right-color: red; border-bottom-color: red; border-left-color: red; border-width: initial; &quot;&gt;hello&lt;/i&gt;&lt;/b&gt;

The border attribute is exploded in all possible border related attributes.
This seems to happen only for inline elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516406</commentid>
    <comment_count>1</comment_count>
    <who name="Enrica Casucci">enrica</who>
    <bug_when>2011-12-06 17:30:35 -0800</bug_when>
    <thetext>I&apos;ll track down where the regression occurred.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516729</commentid>
    <comment_count>2</comment_count>
    <who name="Enrica Casucci">enrica</who>
    <bug_when>2011-12-07 10:34:54 -0800</bug_when>
    <thetext>I don&apos;t think this is regression. When generating markup for block style properties we use the verbose form.
This doesn&apos;t happen when we create a new paragraph and we replicate the style. I belive this is a problem limited to the markup generation code used to great fragments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>516753</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2011-12-07 11:00:09 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; I don&apos;t think this is regression. When generating markup for block style properties we use the verbose form.
&gt; This doesn&apos;t happen when we create a new paragraph and we replicate the style. I belive this is a problem limited to the markup generation code used to great fragments.

Ah, good to know that I didn&apos;t cause yet-another regression :) We should fix this though. Annie was looking into improving cssText at some point but don&apos;t think she&apos;s working on it anymore. She might still be able to give us some insights.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>582116</commentid>
    <comment_count>4</comment_count>
    <who name="Yi Shen">max.hong.shen</who>
    <bug_when>2012-03-19 13:15:19 -0700</bug_when>
    <thetext>The issue is caused by the inconsistent contents of the inlineStyle and attributes in Element.

After step 4, an element got created with the inlineStyle like &quot;border-top-style: solid; border-right-style: solid;blabla ...&quot;,  and the attributes which is &quot;border: solid red&quot;.

In step 5, the copy operation generated a markup string by using the element&apos;s inlineStyle, however, the style information in attributes got lost. So, after the paste, the new element&apos;s inlineStyle and attributes became the same one --- &quot;&quot;border-top-style: solid; border-right-style: solid;blabla ...&quot;&quot;

If the test is valid, should we detect the inconsistence and use attributes instead to generate the markup string for copy operation? Any ideas, guys?

(In reply to comment #0)
&gt; Repro steps:
&gt; 
&gt; 1. Go to http://www-archive.mozilla.org/editor/midasdemo/
&gt; 2. Switch to the View HTML Source view
&gt; 3. Enter the following markup: &lt;b&gt;&lt;i style=&quot;border: solid red&quot;&gt;hello&lt;/i&gt;&lt;/b&gt;
&gt; 4. Switch to the non HTML source view
&gt; 5. Select All, then Copy and Paste
&gt; 6. Switch back to the HTML source view
&gt; 
&gt; Expected:
&gt; The markup is the same.
&gt; 
&gt; Actual:
&gt; The markup is: &lt;b&gt;&lt;i style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: red; border-right-color: red; border-bottom-color: red; border-left-color: red; border-width: initial; &quot;&gt;hello&lt;/i&gt;&lt;/b&gt;
&gt; 
&gt; The border attribute is exploded in all possible border related attributes.
&gt; This seems to happen only for inline elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>589060</commentid>
    <comment_count>5</comment_count>
    <who name="Yi Shen">max.hong.shen</who>
    <bug_when>2012-03-27 11:07:06 -0700</bug_when>
    <thetext>After the code change for bug 81737, the new markup (generated as a result of copy operation) is using shorthand notations as desired, but it raises a new issue for the test of this bug.  The new markup string now becomes &quot;border: initial solid red&quot;, which seems to be an invalid declaration, because the &quot;initial&quot; keyword is combined with other component values in same declaration, and the webkit wouldn&apos;t draw the border for the pasted element. I can file a new bug for it and provide a patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>589092</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-03-27 11:43:58 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; After the code change for bug 81737, the new markup (generated as a result of copy operation) is using shorthand notations as desired, but it raises a new issue for the test of this bug.  The new markup string now becomes &quot;border: initial solid red&quot;, which seems to be an invalid declaration, because the &quot;initial&quot; keyword is combined with other component values in same declaration, and the webkit wouldn&apos;t draw the border for the pasted element. I can file a new bug for it and provide a patch.

Yeah, we need to fix that bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>591752</commentid>
    <comment_count>7</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-03-29 17:29:58 -0700</bug_when>
    <thetext>ToT WebKit generates &lt;b&gt;&lt;i style=&quot;border: solid red; &quot;&gt;hello&lt;/i&gt;&lt;/b&gt;.

I call it good enough since this markup is almost identical to the original markup. Please file new bugs if you find other cases where we still generate needlessly verbose markup.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>