Bug 141457 - cannot overwrite/delete marked text in input field of wordpress composer
Summary: cannot overwrite/delete marked text in input field of wordpress composer
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-09 21:33 UTC by Roland Wolters
Modified: 2007-09-15 00:32 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Wolters 2007-02-09 21:33:03 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Fedora RPMs

When I enter the blog article composer of my blog on wordpress.com I am faced with an input field (I use the normal one, not the WYSIWIG). I can enter text as usual. The problem is now if I mark text (with mouse or the Shift key) and then hit "delete" or or "backspace" or "enter" another char-key , the text is not removed (and maybe replaced).
Instead the text stays there and the cursor jumps to the beginning of the marked position. If I pressed another char-key to replace the marked text, the new char is in front of the marked text (where the cursor jumped).

This problem came up right after I updated KDE from v3.5.5 to 3.5.6 by the distribution packages.

I can reproduce the problem every time - but only on my wordpress.com blog. Other input fields I tested did not have this problem: Wikimedia, MoinMoin, this bug entry form and a text paste service.
Comment 1 Constantin Berzan 2007-02-11 11:02:16 UTC
This doesn't happen to me in the post composer, but it does happen in the comment editor (i.e. if you have a comment and you click to edit it - not if you create a new one).
I'm using KDE 3.5.6 from Ubuntu packages. It worked fine in 3.5.5.
Comment 2 Patrick 2007-02-13 21:34:41 UTC
I can confirm that. The WYSIWYG editor in WordPress seems to not work properly with Konqueror. I don't know since when, but I'm sure this hasn't been long, because I wrote all my earlier blog entries with Konqueror, and now it's a P.I.T.A., so I would have noticed ;)

I'm using Gentoo, KDE version 3.5.6.
Comment 3 Roland Wolters 2007-02-14 00:32:34 UTC
I tested again, this time on a fresh installed Kubuntu Test with KDE 3.5.6, and the problem appeared as well.
Comment 4 Maksim Orlovich 2007-06-08 19:00:43 UTC
Is there any publically available/demo install we could use for testing?
Comment 5 Roland Wolters 2007-06-08 19:10:07 UTC
I have only tested this with the wordpress.com-installs of the Wordpress software. The wordpress.com service is a free web service - the Wordpress software itself is free software and available in many Linux distributions  (like Fedora, Mandriva or Debian).
Comment 6 Patrick 2007-06-08 19:14:03 UTC
I just registered an account for that purpose at wordpress.com, please feel free to use it for testing:

Log in to http://konqbug.wordpress.com/wp-login.php
Username: konqbug
Password: konqbugdemo

Then write an article and try the things described in this report (write something, select it, press DEL - nothing happens... things like that)...

Cheers, Patrick.
Comment 7 Maksim Orlovich 2007-06-08 19:26:03 UTC
Thanks, can confirm... that page has wayyy too much JS, gonna need a KJS_VERBOSE build to get a clue..
Comment 8 Maksim Orlovich 2007-06-08 20:13:44 UTC
Hmm, we're somehow triggering an updateFromElement, and that overwrites the change!
Comment 9 Maksim Orlovich 2007-06-08 20:48:06 UTC
Germain: see paragraph 2 as to why you were CC'd -- I would appreciate your expert opinion here.

Subtle: we get a recalcStyle before Qt gets a chance to emit textChanged, so we think that the renderer is somehow out-of-date. I think the solution is to get rid of the wacky flags, and just consider the renderer definitive if it exists (e.g. push on destruct, setValue always keeps it synced, etc.). Might fix some of the other textarea bugs as well...

The culprit is also the mouse move event generation in KHTMLView::drawContents, r617643 (and altered in r619837). I think regardless of this problem, it's a very, very, dangerous change, as it can potentially cause all sorts of weird recursion/reentrancy issues, as it may trigger JS, recalcStyle, whatever. Wouldn't it be better to post the event through Qt, so it gets handled in the main event loop?

And to reporter: wordpress likely got broken because a bug about a wrong cursor sometimes showing got fixed. Great tradeoff, eh?

0: /opt/kde3.5/lib/libkdecore.so.4(kdBacktrace(int)+0x39) [0xb7581e69]
1: /opt/kde3.5/lib/libkhtml.so.4(khtml::RenderTextArea::updateFromElement()+0x28) [0xb55ad828]
2: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x3b) [0xb552860b]
3: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
4: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
5: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
6: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
7: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
8: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
9: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
10: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
11: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
12: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
13: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
14: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
15: /opt/kde3.5/lib/libkhtml.so.4(DOM::ElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x19f) [0xb54fd50f]
16: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLElementImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x29) [0xb55285f9]
17: /opt/kde3.5/lib/libkhtml.so.4(DOM::DocumentImpl::recalcStyle(DOM::NodeImpl::StyleChange)+0x2c2) [0xb54e7f92]
18: /opt/kde3.5/lib/libkhtml.so.4(DOM::DocumentImpl::updateRendering()+0x3a) [0xb54e2c7a]
19: /opt/kde3.5/lib/libkhtml.so.4(DOM::DocumentImpl::prepareMouseEvent(bool, int, int, DOM::NodeImpl::MouseEvent*)+0x26c) [0xb54e6c5c]
20: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::viewportMouseMoveEvent(QMouseEvent*)+0x3b6) [0xb5481936]
21: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::drawContents(QPainter*, int, int, int, int)+0xec7) [0xb5487b97]
22: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QScrollView::drawContentsOffset(QPainter*, int, int, int, int, int, int)+0x73) [0xb7094d63]
23: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QScrollView::viewportPaintEvent(QPaintEvent*)+0x237) [0xb7096847]
24: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QScrollView::eventFilter(QObject*, QEvent*)+0xff) [0xb70983af]
25: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::eventFilter(QObject*, QEvent*)+0x6e1) [0xb5480061]
26: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QObject::activate_filters(QEvent*)+0x5c) [0xb6f854ac]
27: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QObject::event(QEvent*)+0x3b) [0xb6f8551b]
28: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QWidget::event(QEvent*)+0x2c) [0xb6fbe65c]
29: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::internalNotify(QObject*, QEvent*)+0x97) [0xb6f27887]
30: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::notify(QObject*, QEvent*)+0xa9) [0xb6f285a9]
31: /opt/kde3.5/lib/libkdecore.so.4(KApplication::notify(QObject*, QEvent*)+0x629) [0xb757b709]
32: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QWidget::repaint(int, int, int, int, bool)+0x1bf) [0xb6efa7bf]
33: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QScrollView::repaintContents(int, int, int, int, bool)+0xf6) [0xb7095a96]
34: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::eventFilter(QObject*, QEvent*)+0x779) [0xb54800f9]
35: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QObject::activate_filters(QEvent*)+0x5c) [0xb6f854ac]
36: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QObject::event(QEvent*)+0x3b) [0xb6f8551b]
37: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QWidget::event(QEvent*)+0x2c) [0xb6fbe65c]
38: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::internalNotify(QObject*, QEvent*)+0x97) [0xb6f27887]
39: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::notify(QObject*, QEvent*)+0xa9) [0xb6f285a9]
40: /opt/kde3.5/lib/libkdecore.so.4(KApplication::notify(QObject*, QEvent*)+0x629) [0xb757b709]
41: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QWidget::repaint(int, int, int, int, bool)+0x1bf) [0xb6efa7bf]
42: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QScrollView::repaintContents(int, int, int, int, bool)+0xf6) [0xb7095a96]
43: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QScrollView::repaintContents(bool)+0x6d) [0xb7095b4d]
44: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QTextEdit::removeSelectedText(int)+0x37c) [0xb70ee79c]
45: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QTextEdit::keyPressEvent(QKeyEvent*)+0xf27) [0xb70e78d7]
46: /opt/kde3.5/lib/libkdeui.so.4(KTextEdit::keyPressEvent(QKeyEvent*)+0x483) [0xb799ee13]
47: /opt/kde3.5/lib/libkhtml.so.4(khtml::RenderWidget::EventPropagator::sendEvent(QEvent*)+0x8b) [0xb55a0b9b]
48: /opt/kde3.5/lib/libkhtml.so.4(khtml::RenderWidget::handleEvent(DOM::EventImpl const&)+0x3cf) [0xb55a15bf]
49: /opt/kde3.5/lib/libkhtml.so.4(DOM::HTMLGenericFormElementImpl::defaultEventHandler(DOM::EventImpl*)+0x8c) [0xb553c58c]
50: /opt/kde3.5/lib/libkhtml.so.4(DOM::NodeImpl::dispatchGenericEvent(DOM::EventImpl*, int&)+0x25e) [0xb54f8ece]
51: /opt/kde3.5/lib/libkhtml.so.4(DOM::NodeImpl::dispatchEvent(DOM::EventImpl*, int&, bool)+0x5b) [0xb54f79db]
52: /opt/kde3.5/lib/libkhtml.so.4(DOM::NodeImpl::dispatchKeyEvent(QKeyEvent*, bool)+0xc0) [0xb54f8110]
53: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::dispatchKeyEventHelper(QKeyEvent*, bool)+0x57) [0xb5480bb7]
54: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::dispatchKeyEvent(QKeyEvent*)+0x99) [0xb5480c99]
55: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::keyPressEvent(QKeyEvent*)+0x377) [0xb5485527]
56: /opt/kde3.5/lib/libkhtml.so.4(KHTMLView::eventFilter(QObject*, QEvent*)+0x69c) [0xb548001c]
57: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QObject::activate_filters(QEvent*)+0x5c) [0xb6f854ac]
58: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QObject::event(QEvent*)+0x3b) [0xb6f8551b]
59: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QWidget::event(QEvent*)+0x2c) [0xb6fbe65c]
60: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QTextEdit::event(QEvent*)+0x38) [0xb70d91f8]
61: /opt/kde3.5/lib/libkhtml.so.4(khtml::TextAreaWidget::event(QEvent*)+0x6c) [0xb55a82fc]
62: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::internalNotify(QObject*, QEvent*)+0x97) [0xb6f27887]
63: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::notify(QObject*, QEvent*)+0x568) [0xb6f28a68]
64: /opt/kde3.5/lib/libkdecore.so.4(KApplication::notify(QObject*, QEvent*)+0x629) [0xb757b709]
65: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QETWidget::translateKeyEvent(_XEvent const*, bool)+0x260) [0xb6ec5200]
66: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::x11ProcessEvent(_XEvent*)+0x129a) [0xb6ec6c3a]
67: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QEventLoop::processEvents(unsigned int)+0x4aa) [0xb6ed69ea]
68: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QEventLoop::enterLoop()+0x50) [0xb6f3e0a0]
69: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QEventLoop::exec()+0x26) [0xb6f3df66]
70: /home/maksim/kde3/build/qt-copy/lib/libqt-mt.so.3(QApplication::exec()+0x1f) [0xb6f274ef]
Comment 10 Maksim Orlovich 2007-06-09 21:13:37 UTC
http://lists.kde.org/?l=kfm-devel&m=118141580921767&w=2, but if anyone is building from the source I can provide a simpler revert patch as well.
Comment 11 Patrick 2007-06-10 02:25:34 UTC
Maksim, thanks a lot for the time you invested in this :) Of course a "quickfix" for the wordpress breakage would be appreciated, if it doesn't break anything else, and doesn't cost too much time. I'd be willing to test it and then submit it to the maintainers of my distribution (Gentoo). This way at least some Konqueror users could use Wordpress again ;)
Comment 12 Germain Garand 2007-06-10 20:29:41 UTC
> The culprit is also the mouse move event generation in 
> KHTMLView::drawContents, r617643 (and altered in r619837). I think regardless
> of this problem, it's a very, very, dangerous change, as it can potentially 
> cause all sorts of weird recursion/reentrancy issues, as it may trigger JS,
> recalcStyle, whatever. 

mmh, no, there are not many possibilities of rentrancy/recursion in drawContents. It's guarded, rarely called synchronously, and it's not as sensitive as layout(). 
But the problem you point out about the short circuiting of the event loop is largely enough indeed.

> Wouldn't it be better to post the event through Qt, so it gets handled in the
> main event loop? 
 
yes, it looks like the sensible fix
Comment 13 Maksim Orlovich 2007-09-15 00:32:36 UTC
r712586 is the 3.5.x fix for this -- a straightforward revert of r617643, r619837. (commit should have been CC'd here, though... Weird).

4.x is getting the big textarea patch, but I think it's too risky for 3.5.8
Comment 14 Maksim Orlovich 2007-09-15 00:32:55 UTC
SVN commit 712622 by orlovich:

Rework how we sync textarea contents between the DOM and the Renderer, fixing 
multiple bugs (losing contents on display:none, the can't-do-anything-with-selection-
in-wordpress bug). 

This also improves compatibility with IE on handling of innerText somewhat, and that 
with other browsers in how we handle changes to the default value/child nodes.
Unfortunately, no one does it the same way, so I chose to follow Safari since its 
behavior makes the most sense to me. 

More specifically:
1. Simplify the syncing logic by making the renderer always be definitive when 
it exists.

2. Change how we  initialize from the defaultValue --- instead of doing it in 
the renderer's close (which is what causes the disappearing text bug), we 
update value to defaultValue when the children change. That also makes 
innerText work sensibly on textareas.

BUG: 132844
BUG: 120607
BUG: 141457



 M  +27 -10    html/html_formimpl.cpp  
 M  +1 -1      html/html_formimpl.h  
 M  +16 -22    rendering/render_form.cpp  
 M  +2 -1      rendering/render_form.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=712622