<?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>35935</bug_id>
          
          <creation_ts>2010-03-09 11:30:20 -0800</creation_ts>
          <short_desc>contentEditable with &lt;PRE&gt; not wrapping correctly</short_desc>
          <delta_ts>2022-02-19 16:07:31 -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>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://www.milonic.com/bugreports/safari-content-edit.php</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Andy">andy</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
    
    <cc>enrica</cc>
    
    <cc>justin.garcia</cc>
    
    <cc>leviw</cc>
    
    <cc>per</cc>
    
    <cc>pravind.2k4</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>197693</commentid>
    <comment_count>0</comment_count>
    <who name="Andy">andy</who>
    <bug_when>2010-03-09 11:30:20 -0800</bug_when>
    <thetext>Hi,

When I enable contenteditable on a div that contains a &lt;PRE&gt; tag it disable word wrapping. Doesn&apos;t do this on any other browser. This is Chrome and Safari on Windows and Macs.

Would really like to see this working as I can only use it with an iframe which is horrible.

Cheers,
Andy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>197959</commentid>
    <comment_count>1</comment_count>
    <who name="Andy">andy</who>
    <bug_when>2010-03-10 03:33:05 -0800</bug_when>
    <thetext>Can somebody please at least tell me if I&apos;m wasting my time chasing this bug fix?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>198965</commentid>
    <comment_count>2</comment_count>
    <who name="Andy">andy</who>
    <bug_when>2010-03-12 02:14:52 -0800</bug_when>
    <thetext>Oh well, I&apos;ll take the lack of response as a &quot;YES I AM WASTING MY GOD DAMN TIME TRYING TO MAKE THIS BROWSER BETTER - FOR FREE FFS&quot;

Thanks very much for dealing with this and thanks for getting back to me, it&apos;s appreciated. Arggghhh!!!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>300739</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2010-10-27 17:42:04 -0700</bug_when>
    <thetext>(In reply to comment #0)
&gt; When I enable contenteditable on a div that contains a &lt;PRE&gt; tag it disable word wrapping. Doesn&apos;t do this on any other browser. This is Chrome and Safari on Windows and Macs.
&gt; 
&gt; Would really like to see this working as I can only use it with an iframe which is horrible.

Are you saying that the content in word-wrapping of the div doesn&apos;t work if it contains any pre?  That seems to work for me:

&lt;div style=&quot;width: 10ex; border: solid 1px black;&quot; contenteditable=&quot;&quot;&gt;&lt;pre&gt;hello world WebKit&lt;/pre&gt;&lt;/div&gt;

It&apos;ll be greatly appreciated if you can give us sample markup that demonstrates the issue.

(In reply to comment #1)
&gt; Can somebody please at least tell me if I&apos;m wasting my time chasing this bug fix?

No, you&apos;re not wasting your time.  But we have 350+ bugs just for editing, and it&apos;s hard for us to go through every one of them especially you don&apos;t cc anyone on the bug.  We have bugs that are 5+ years old and have never been fixed.  In the future, please describe detailed reproduction steps, and cc people who are familiar with the area.   http://trac.webkit.org/wiki/WebKit%20Team has a list of WebKit contributors and their area of expertise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>300963</commentid>
    <comment_count>4</comment_count>
    <who name="Andy">andy</who>
    <bug_when>2010-10-28 02:45:58 -0700</bug_when>
    <thetext>Please see http://www.milonic.com/bugreports/safari-content-edit.php

you&apos;ll see that wrapping changes when you switch contenteditable on and off. But only on webkit based browsers.

Firefox, Opera and IE seem to be ok</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>651616</commentid>
    <comment_count>5</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-06-18 12:27:30 -0700</bug_when>
    <thetext>The cause for the issue is that on webkit we always set word-wrap:break-word for all containers having the attribute contenteditable = true. This not so on FF, IE or Opera. This can be seen by running the code snippet below.

&lt;div contenteditable=&quot;true&quot; style=&quot;height:50px;overflow:auto;width:500px;&quot;&gt;
SOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERTEXT
&lt;/div&gt;


Setting the word-wrap:break-word for contenteditable=true was added in the change list : 
http://trac.webkit.org/changeset/12984/trunk/WebCore/khtml/html/HTMLElementImpl.cpp

If we are going to fix it we should either remove word-wrap:break-word for editable containers(heavy re-baseline will be req ) or just fix for the some special case.

However Ryosuke Niwa&apos;s opinion is req. on this....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>654274</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2012-06-20 23:24:02 -0700</bug_when>
    <thetext>word-break: break-word has been applied to editable content since http://trac.webkit.org/changeset/7838.

We need to first figure out what other browsers do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>654280</commentid>
    <comment_count>7</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-06-20 23:32:08 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; word-break: break-word has been applied to editable content since http://trac.webkit.org/changeset/7838.
&gt; 
&gt; We need to first figure out what other browsers do.
&gt;

Initial guess is that other browsers do not enforce any kind of word-wrap/break on editable content.


&lt;div contenteditable=&quot;true&quot; style=&quot;height:50px;overflow:auto;width:500px;&quot;&gt;
SOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERTEXTSOMEFILLERTEXT
&lt;/div&gt;

Running the above code snippet will show that the word wraps only on webkit browsers... On IE, FF and Opera its not the case...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>655276</commentid>
    <comment_count>8</comment_count>
    <who name="Pravin D">pravind.2k4</who>
    <bug_when>2012-06-21 23:58:12 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; word-break: break-word has been applied to editable content since http://trac.webkit.org/changeset/7838.
&gt; 

As per our discussion it will be very cumbersome and risky to remove the default setting word-wrap:break-word for editable content. However the author can reset this value of word-wrap using Author CSS to suit his/her purpose. 

Setting the word-wrap:normal on editable contents is buggy.. 
See bug https://bugs.webkit.org/show_bug.cgi?id=89649</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1792352</commentid>
    <comment_count>9</comment_count>
      <attachid>437873</attachid>
    <who name="Per Bothner">per</who>
    <bug_when>2021-09-10 08:31:14 -0700</bug_when>
    <thetext>Created attachment 437873
test for incorrect pre handling if contenteditable

Even with explicit style=&quot;white-space: pre&quot; the first line (contenteditable) incorrectly wraps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1843922</commentid>
    <comment_count>10</comment_count>
    <who name="Per Bothner">per</who>
    <bug_when>2022-02-19 15:38:55 -0800</bug_when>
    <thetext>This may be fixed now - I can&apos;t reproduce it on webkitgtk 2.34.5 (appleWebKit 605.1.15). I.e. a pre section with contentEditable set no longer incorrectly wraps.  (The issue title is misleading, unless it is describing something else: The problem used to be &quot;wrapping incorrectly&quot;, as opposed to &quot;not wrapping correctly&quot;.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1843926</commentid>
    <comment_count>11</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2022-02-19 16:07:31 -0800</bug_when>
    <thetext>Yes, test page seems to work now. Unclear what changed.

The HTMLElement::collectPresentationalHintsForAttribute function still sets word-wrap to break-word for contenteditable, so the distant descendant of the code that Pravin D claimed was causing this is still present. But something else changed to make this problem go away.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>437873</attachid>
            <date>2021-09-10 08:31:14 -0700</date>
            <delta_ts>2021-09-10 08:31:14 -0700</delta_ts>
            <desc>test for incorrect pre handling if contenteditable</desc>
            <filename>pre.html</filename>
            <type>text/html</type>
            <size>278</size>
            <attacher name="Per Bothner">per</attacher>
            
              <data encoding="base64">PGJvZHk+CiAgPGRpdiBjb250ZW50ZWRpdGFibGU9InRydWUiPgogICAgPHByZSBzdHlsZT0id2hp
dGUtc3BhY2U6IHByZSI+QUJDREVGR0hJSktMTU5PUFFSU1VWV1hZWmFiY2RlZmdoaWprbG1ub3Bx
cnN1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVVZXWFlaPC9wcmU+CiAgPC9kaXY+CiAgPGRpdj4K
ICAgIDxwcmU+QUJDREVGR0hJSktMTU5PUFFSU1VWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN1dnd4
eXpBQkNERUZHSElKS0xNTk9QUVJTVVZXWFlaPC9wcmU+CiAgPC9kaXY+Cjxib2R5Pgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>