Reviewed by Darin, Maciej.
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2005 02:06:19 +0000 (02:06 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2005 02:06:19 +0000 (02:06 +0000)
        <rdar://problem/4046103> REGRESSION (Mail): clicking after style change sets insertion point incorrectly

        Also fixes crash by adding nil check.

        * khtml/editing/htmlediting.cpp:
        (khtml::MoveSelectionCommand::doApply):
        Check the node for nil.

        * khtml/khtml_part.cpp:
        (KHTMLPart::khtmlMouseReleaseEvent):
        Use the node from the event rather than from the selection.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8890 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/htmlediting.cpp
WebCore/khtml/khtml_part.cpp

index 03e7f4fbe9ba44e3a35054d4fb435a4fa56ab4b6..91c0263371fae872d33678fd0d698d96034e3e00 100644 (file)
@@ -1,3 +1,19 @@
+2005-03-14  David Harrison  <harrison@apple.com>
+
+        Reviewed by Darin, Maciej.
+
+        <rdar://problem/4046103> REGRESSION (Mail): clicking after style change sets insertion point incorrectly
+        
+        Also fixes crash by adding nil check.
+
+        * khtml/editing/htmlediting.cpp:
+        (khtml::MoveSelectionCommand::doApply):
+        Check the node for nil.
+        
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::khtmlMouseReleaseEvent):
+        Use the node from the event rather than from the selection.
+
 2005-03-14  Darin Adler  <darin@apple.com>
 
         Reviewed by Harrison.
index 5fcc0a767aafd84fc525d79f382d4b46d14b0b9e..cf19d9af3331311e6f7ddfa59478e4821c746f57 100644 (file)
@@ -3939,7 +3939,9 @@ void MoveSelectionCommand::doApply()
     ASSERT(selection.isRange());
 
     Position pos = m_position;
-
+    if (pos.isNull())
+        return;
+        
     // Update the position otherwise it may become invalid after the selection is deleted.
     NodeImpl *positionNode = m_position.node();
     long positionOffset = m_position.offset();
index 029003154519c9f01e97ff50b7747c2558574981..9658ae55ea2741bf385e573304feb9517991302a 100644 (file)
@@ -4870,8 +4870,8 @@ void KHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event )
             && d->m_dragStartPos.y() == event->qmouseEvent()->y()
             && d->m_selection.isRange()) {
         Selection selection;
-        NodeImpl *node = d->m_selection.base().node();
-        if (node->isContentEditable() && node->renderer()) {
+        NodeImpl *node = event->innerNode().handle();
+        if (node && node->isContentEditable() && node->renderer()) {
             VisiblePosition pos = node->renderer()->positionForCoordinates(event->x(), event->y());
             selection.moveTo(pos);
         }