branches/KDE/4.3/kdelibs/khtml/editing

View: New views
1 Messages — Rating Filter:   Alert me  

branches/KDE/4.3/kdelibs/khtml/editing

by Bugzilla from maksim@kde.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

SVN commit 1042044 by orlovich:

Better handling of the case where we get editting input events w/o a proper
caret set --- such as when facebook apparently rewrites textareas into
content-editable divs in a middle of handling of a click.... Either
grab the caret, or drop the event. Should hopefully finally fix
the prepareForTextInsertion crasher on facebook

BUG:189173    
BUG:211449
BUG:212138
BUG:212175



 M  +16 -2     editor.cpp  


--- branches/KDE/4.3/kdelibs/khtml/editing/editor.cpp #1042043:1042044
@@ -245,7 +245,7 @@
 
 static void updateState(CSSStyleDeclarationImpl *desiredStyle, CSSStyleDeclarationImpl *computedStyle, bool &atStart, Editor::TriState &state)
 {
-  QListIterator<CSSProperty*> it(*desiredStyle->values());
+  QListIterator<CSSProperty*> it(*desiredStyle->values());
   while (it.hasNext()) {
     int propertyID = it.next()->id();
     DOMString desiredProperty = desiredStyle->getPropertyValue(propertyID);
@@ -521,9 +521,23 @@
       // FIXME implement me
       handled = true;
       break;
-    
+
     default:
 // handle_input:
+      if (m_part->caret().state() != Selection::CARET) {
+        // We didn't get a chance to grab the caret, likely because
+        // a script messed with contentEditable in the middle of events
+        // acquire it now if there isn't a selection
+        kDebug(6200) << "Editable node w/o caret!";
+        DOM::NodeImpl* focus = m_part->xmlDocImpl()->focusNode();
+        if (m_part->caret().state() == Selection::NONE) {
+            if (focus)
+                m_part->setCaret(Position(focus, focus->caretMinOffset()));
+            else
+                break;
+        }
+      }
+
       if (!_ke->text().isEmpty()) {
         TypingCommand::insertText(m_part->xmlDocImpl(), _ke->text());
         handled = true;
_______________________________________________
Khtml-cvs mailing list
Khtml-cvs@...
https://mail.kde.org/mailman/listinfo/khtml-cvs