<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>48879</bug_id>
          
          <creation_ts>2002-10-08 17:02:52 +0000</creation_ts>
          <short_desc>(testcase) value of textarea not shown after insert by dom functions</short_desc>
          <delta_ts>2004-09-07 12:14:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml forms</component>
          <version>unspecified</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="T Zachmann">t.zachmann</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>98561</commentid>
    <comment_count>0</comment_count>
    <who name="T Zachmann">t.zachmann</who>
    <bug_when>2002-10-08 17:02:52 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.0.3)
Installed from:    SuSE RPMs
OS:          Linux

Hello all

Have a look at the script at the end of the report. I create a input tag by the dom functions. The value of the input tag get not shown. In the Tool &quot;Show DOM tree&quot; the attribute is shown. This is also a problem on input type=&quot;text&quot;.

Thorsten Zachmann

---------------------
&lt;html&gt;
&lt;head&gt;
&lt;script&gt;

function start() {
  input = document.createElement( &quot;input&quot; );
  input.setAttribute(&quot;name&quot;, &quot;new&quot;);
  input.setAttribute(&quot;value&quot;, &quot;hugo&quot; );
  input.setAttribute(&quot;type&quot;, &quot;button&quot; );
  //input.setAttribute(&quot;type&quot;, &quot;text&quot; );
  node = document.createElement( &quot;form&quot; );
  node.appendChild( input ) ;
  document.body.appendChild( node );
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name=&quot;Formular&quot;&gt;
&lt;input type=&quot;button&quot; value=&quot;Start&quot; onClick=&quot;start()&quot;&gt;&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98722</commentid>
    <comment_count>1</comment_count>
    <who name="T Zachmann">t.zachmann</who>
    <bug_when>2002-10-09 08:43:51 +0000</bug_when>
    <thetext>Nearly the same problem exists for textarea. The text in the textarea is not shown. It is shown however in the DOM tree.  Thorsten   &lt;html&gt; &lt;head&gt; &lt;script&gt;  function start() {   text = document.createTextNode( &quot;Hallo das ist die Vorbelegung&quot; );   input = document.createElement( &quot;textarea&quot; );   input.setAttribute(&quot;name&quot;, &quot;new&quot;);   input.appendChild( text );    node = document.createElement( &quot;form&quot; );   node.appendChild( input ) ;   document.body.appendChild( node ); }  &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name=&quot;Formular&quot;&gt; &lt;input type=&quot;button&quot; value=&quot;Start&quot; onClick=&quot;start()&quot;&gt;&lt;br&gt; &lt;/body&gt; &lt;/html&gt;  </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102523</commentid>
    <comment_count>2</comment_count>
    <who name="David Faure">faure</who>
    <bug_when>2002-10-28 17:21:04 +0000</bug_when>
    <thetext>The testcase in the initial report works now, with the current Konqueror (CVS,     
soon 3.1-rc1). I see a button with &quot;hugo&quot; on it when pressing Start.     
     
The testcase in the comment still doesn&apos;t work though, the textarea doesn&apos;t get the     
text, indeed. KHTML bug (I think in HTMLTextAreaElementImpl but I&apos;m not sure 
where), reassigning to khtml. 
    
     </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>204784</commentid>
    <comment_count>3</comment_count>
      <attachid>4647</attachid>
    <who name="Luis Carvalho">lpassos</who>
    <bug_when>2004-02-11 22:42:52 +0000</bug_when>
    <thetext>Created attachment 4647
Test case 1

First testcase of this bug report</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>204786</commentid>
    <comment_count>4</comment_count>
      <attachid>4648</attachid>
    <who name="Luis Carvalho">lpassos</who>
    <bug_when>2004-02-11 22:47:46 +0000</bug_when>
    <thetext>Created attachment 4648
Test case 2

Second test case specified in the bug report.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>262697</commentid>
    <comment_count>5</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2004-08-26 12:36:21 +0000</bug_when>
    <thetext>The patch for bug 86916 fixes this one, too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>265155</commentid>
    <comment_count>6</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2004-09-02 11:51:39 +0000</bug_when>
    <thetext>CVS commit by savernik: 

Fixed spurious deletion of textarea contents. Original patch by me, improved patch
by Germain Garand.

CCMAIL: 49828-done@bugs.kde.org, 48879-done@bugs.kde.org, 86916-done@bugs.kde.org


  M +12 -0     ChangeLog   1.283
  M +7 -3      html/html_formimpl.cpp   1.383
  M +4 -3      html/html_formimpl.h   1.155
  M +3 -1      rendering/render_form.cpp   1.271


--- kdelibs/khtml/html/html_formimpl.cpp  #1.382:1.383
@@ -2204,4 +2204,5 @@ HTMLTextAreaElementImpl::HTMLTextAreaEle
     m_wrap = ta_Virtual;
     m_dirtyvalue = true;
+    m_initialized = false;
     m_unsubmittedFormChange = false;
 }
@@ -2313,8 +2314,10 @@ DOMString HTMLTextAreaElementImpl::value
 {
     if ( m_dirtyvalue) {
-        if ( m_render )
+        if ( m_render &amp;&amp; m_initialized )
             m_value = static_cast&lt;RenderTextArea*&gt;( m_render )-&gt;text();
-        else
+        else {
             m_value = defaultValue().string();
+            m_initialized = true;
+        }
 
         m_dirtyvalue = false;
@@ -2332,4 +2335,5 @@ void HTMLTextAreaElementImpl::setValue(D
     m_value = str.replace( &apos;\r&apos;, &apos;\n&apos; );
     m_dirtyvalue = false;
+    m_initialized = true;
     setChanged(true);
 }

--- kdelibs/khtml/html/html_formimpl.h  #1.154:1.155
@@ -537,6 +537,7 @@ protected:
     WrapMethod m_wrap;
     QString m_value;
-    bool m_dirtyvalue;
-    bool m_unsubmittedFormChange;
+    bool m_dirtyvalue: 1;
+    bool m_unsubmittedFormChange: 1;
+    bool m_initialized: 1;
 };
 

--- kdelibs/khtml/rendering/render_form.cpp  #1.270:1.271
@@ -1587,6 +1587,8 @@ void RenderTextArea::setStyle(RenderStyl
     RenderFormElement::setStyle(_style);
 
+    widget()-&gt;blockSignals(true);
     widget()-&gt;setAlignment( _style-&gt;direction() == RTL ?
                             Qt::AlignRight : Qt::AlignLeft );
+    widget()-&gt;blockSignals(false);
 
     scrollbarsStyled = false;

--- kdelibs/khtml/ChangeLog  #1.282:1.283
@@ -1,2 +1,14 @@
+2004-09-02  Leo Savernik  &lt;l.savernik@aon.at&gt;
+
+        * html_formimpl.{cpp,h} (HTMLTextAreaElementImpl::value):
+        Only take text from RenderTextArea when it has been fully initialized.
+        Mark it fully initialized when RenderTextArea has been initialized
+        from the DOM.
+        (HTMLTextAreaElementImpl::setValue): Mark element as initialized after
+        setting. 
+        * render_form.cpp (RenderTextArea::setStyle):
+        Block signals on call to QTextEdit::setAlignment. Otherwise, a bogus
+        textChanged signal is emitted. 
+
 2004-08-27  Germain Garand  &lt;germain@ebooksfrance.org&gt;
         


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>266434</commentid>
    <comment_count>7</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2004-09-07 12:14:52 +0000</bug_when>
    <thetext>CVS commit by savernik: 

Backport: Fixed spurious deletion of textarea contents.

CCMAIL: 49828@bugs.kde.org, 48879@bugs.kde.org, 86916@bugs.kde.org


  M +7 -3      html/html_formimpl.cpp   1.380.2.2
  M +4 -3      html/html_formimpl.h   1.154.2.1
  M +3 -1      rendering/render_form.cpp   1.269.2.2


--- kdelibs/khtml/html/html_formimpl.cpp  #1.380.2.1:1.380.2.2
@@ -2204,4 +2204,5 @@ HTMLTextAreaElementImpl::HTMLTextAreaEle
     m_wrap = ta_Virtual;
     m_dirtyvalue = true;
+    m_initialized = false;
     m_unsubmittedFormChange = false;
 }
@@ -2313,8 +2314,10 @@ DOMString HTMLTextAreaElementImpl::value
 {
     if ( m_dirtyvalue) {
-        if ( m_render )
+        if ( m_render &amp;&amp; m_initialized )
             m_value = static_cast&lt;RenderTextArea*&gt;( m_render )-&gt;text();
-        else
+        else {
             m_value = defaultValue().string();
+            m_initialized = true;
+        }
 
         m_dirtyvalue = false;
@@ -2332,4 +2335,5 @@ void HTMLTextAreaElementImpl::setValue(D
     m_value = str.replace( &apos;\r&apos;, &apos;\n&apos; );
     m_dirtyvalue = false;
+    m_initialized = true;
     setChanged(true);
 }

--- kdelibs/khtml/html/html_formimpl.h  #1.154:1.154.2.1
@@ -537,6 +537,7 @@ protected:
     WrapMethod m_wrap;
     QString m_value;
-    bool m_dirtyvalue;
-    bool m_unsubmittedFormChange;
+    bool m_dirtyvalue: 1;
+    bool m_unsubmittedFormChange: 1;
+    bool m_initialized: 1;
 };
 

--- kdelibs/khtml/rendering/render_form.cpp  #1.269.2.1:1.269.2.2
@@ -1587,6 +1587,8 @@ void RenderTextArea::setStyle(RenderStyl
     RenderFormElement::setStyle(_style);
 
+    widget()-&gt;blockSignals(true);
     widget()-&gt;setAlignment( _style-&gt;direction() == RTL ?
                             Qt::AlignRight : Qt::AlignLeft );
+    widget()-&gt;blockSignals(false);
 
     scrollbarsStyled = false;


</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4647</attachid>
            <date>2004-02-11 22:42:52 +0000</date>
            <delta_ts>2004-02-11 22:42:52 +0000</delta_ts>
            <desc>Test case 1</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>622</size>
            <attacher name="Luis Carvalho">lpassos</attacher>
            
              <data encoding="base64">PGh0bWw+IAogIDxoZWFkPiAKICAgIDxzY3JpcHQ+IAogICAgICAgICAgICAKICAgICAgZnVuY3Rp
b24gc3RhcnQoKSB7IAogICAgICAgIGlucHV0ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCggImlu
cHV0IiApOyAKICAgICAgICBpbnB1dC5zZXRBdHRyaWJ1dGUoIm5hbWUiLCAibmV3Iik7IAogICAg
ICAgIGlucHV0LnNldEF0dHJpYnV0ZSgidmFsdWUiLCAiaHVnbyIgKTsgCiAgICAgICAgaW5wdXQu
c2V0QXR0cmlidXRlKCJ0eXBlIiwgImJ1dHRvbiIgKTsgCiAgICAgICAgLy9pbnB1dC5zZXRBdHRy
aWJ1dGUoInR5cGUiLCAidGV4dCIgKTsgCiAgICAgICAgbm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVs
ZW1lbnQoICJmb3JtIiApOyAKICAgICAgICBub2RlLmFwcGVuZENoaWxkKCBpbnB1dCApIDsgCiAg
ICAgICAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZCggbm9kZSApOyAKICAgICAgfSAKICAgICAg
ICAgICAgICAgICAgICAgIAogICAgPC9zY3JpcHQ+IAogIDwvaGVhZD4gCiAgPGJvZHk+IAogICAg
PGZvcm0gbmFtZT0iRm9ybXVsYXIiPiAKICAgICAgPGlucHV0IHR5cGU9ImJ1dHRvbiIgdmFsdWU9
IlN0YXJ0IiBvbkNsaWNrPSJzdGFydCgpIj48YnI+IAogIDwvYm9keT4gCjwvaHRtbD4gCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4648</attachid>
            <date>2004-02-11 22:47:46 +0000</date>
            <delta_ts>2004-02-11 22:47:46 +0000</delta_ts>
            <desc>Test case 2</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>604</size>
            <attacher name="Luis Carvalho">lpassos</attacher>
            
              <data encoding="base64">PGh0bWw+IAogICA8aGVhZD4KICAgICAgPHNjcmlwdD4gCiAgICAgICAgIGZ1bmN0aW9uIHN0YXJ0
KCkgeyAKICAgICAgICAgICAgdGV4dCA9IGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKCAiSGFsbG8g
ZGFzIGlzdCBkaWUgVm9yYmVsZWd1bmciICk7IAogICAgICAgICAgICBpbnB1dCA9IGRvY3VtZW50
LmNyZWF0ZUVsZW1lbnQoICJ0ZXh0YXJlYSIgKTsgCiAgICAgICAgICAgIGlucHV0LnNldEF0dHJp
YnV0ZSgibmFtZSIsICJuZXciKTsgCiAgICAgICAgICAgIGlucHV0LmFwcGVuZENoaWxkKCB0ZXh0
ICk7IAogICAgICAgICAgICBub2RlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCggImZvcm0iICk7
IAogICAgICAgICAgICBub2RlLmFwcGVuZENoaWxkKCBpbnB1dCApIDsgCiAgICAgICAgICAgIGRv
Y3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoIG5vZGUgKTsgCiAgICAgICAgIH0gCiAgICAgIDwvc2Ny
aXB0PiAKICAgPC9oZWFkPiAKICAgPGJvZHk+IAogICAgICA8Zm9ybSBuYW1lPSJGb3JtdWxhciI+
IAogICAgICAgICA8aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0iU3RhcnQiIG9uQ2xpY2s9InN0
YXJ0KCkiPjxicj4gCiAgIDwvYm9keT4gCjwvaHRtbD4gCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>