Version: (using KDE KDE 3.0.1) Installed from: Unspecified Linux If for some table which contains textarea set style with display:none and after that change the display to block the content of the textarea is missing So here is the code: ======================================== <style> .myStyle{ display:none; } </style> <table cellsapcing=0 cellpadding=0 border=1 class=myStyle id=myTable> <tr> <td><textarea name=textarea>Here is the content of the textarea</textarea></td> </tr> </table> <script> document.all.myTable.style.display = "block"; </script> ======================================= So as you can see there is some text in textarea but when open this in Konqueror the content is missing
I have prepared a little test for this bug. I'm using kde-3.0.8 from gentoo. http://www.preciso.net/~gianpaolo/bugs/textarea.html I think the content is loose only when initial display is set to none
Still present in KDE-3.1 (Dec 20)
still present in kde 3.1.2 (27 jul )
Looks like it's been fixed in KDE 3.2a2. The text displays fine.
I can't reproduce a problem with KDE CVS either
If you try my test case you will see that after 2 display switch the text in textarea element disappear. The test is here: http://www.preciso.net/~gianpaolo/bugs/textarea.html
in KDE 3.2.2 it is still broken here. The link that gianpaolo gave (http://www.preciso.net/~gianpaolo/bugs/textarea.html) still breaks in konqueror when toggle visibility is clicked more then once. It displays the first time for me and then the textarea is blank after that.
Created attachment 6700 [details] A simple test case This attatchment is a very simple test-case of this bug. When the "Hide/Unhide textarea" is clicked, the textarea is hidden, and when the link is clicked again, the text disappears. I'm using KDE 3.2.2 from Gentoo (which should be newer than the 3.2a2, where the bug could not be reproduced).
Any chance of getting this bug reopened, or should I post a new bug?
This bug is also present in KDE 3.3beta2 from gentoo.
you're right, the bug was closed too soon
This is a dataloss bug -> major.
Created attachment 7257 [details] hacky fix This patch fixes the bug in relying on the flaky behaviour that QTextEdit always emits a textChanged signal just after begin constructed.
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 && m_initialized ) m_value = static_cast<RenderTextArea*>( m_render )->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( '\r', '\n' ); 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()->blockSignals(true); widget()->setAlignment( _style->direction() == RTL ? Qt::AlignRight : Qt::AlignLeft ); + widget()->blockSignals(false); scrollbarsStyled = false; --- kdelibs/khtml/ChangeLog #1.282:1.283 @@ -1,2 +1,14 @@ +2004-09-02 Leo Savernik <l.savernik@aon.at> + + * 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 <germain@ebooksfrance.org>
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 && m_initialized ) m_value = static_cast<RenderTextArea*>( m_render )->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( '\r', '\n' ); 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()->blockSignals(true); widget()->setAlignment( _style->direction() == RTL ? Qt::AlignRight : Qt::AlignLeft ); + widget()->blockSignals(false); scrollbarsStyled = false;