[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:32:38 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 492ed2dc97aef0c9c9f670c3fd9492d94fcd433b
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 7 18:52:47 2004 +0000

            Reviewed by John
    
            Removed concept of currentSelection from EditCommands and refined concept of
            startingSelection and endingSelection, making them work more sensibly in the
            system of composed editing commands.
    
            * khtml/editing/htmlediting.cpp: Removed currentSelection().
            * khtml/editing/htmlediting.h: Ditto.
            * khtml/editing/htmlediting_impl.cpp: currentSelection().
            (CompositeEditCommandImpl::applyCommandToComposite): Set the startingSelection
            and endingSelection for the command being applied to the endingSelection of
            its new parent. This is the proper starting and ending point.
            (CompositeEditCommandImpl::deleteSelection): Changed call to currentSelection
            to endingSelection.
            (DeleteCollapsibleWhitespaceCommandImpl::DeleteCollapsibleWhitespaceCommandImpl): Ditto.
            (DeleteSelectionCommandImpl::DeleteSelectionCommandImpl): Changed call from startingSelection
            to endingSelection.
            (DeleteSelectionCommandImpl::joinTextNodesWithSameStyle): Changed call to currentSelection
            to endingSelection.
            (InputNewlineCommandImpl::doApply): Ditto.
            (InputTextCommandImpl::deleteCharacter): Ditto.
            (InputTextCommandImpl::prepareForTextInsertion): Ditto.
            (InputTextCommandImpl::execute): Ditto.
            (PasteHTMLCommandImpl::doApply): Ditto.
            (TypingCommandImpl::insertText): Remove extraneous call to reset endingSelection. This has
            already been done by the helpers this command uses to do its work.
            (TypingCommandImpl::issueCommandForDeleteKey): Changed call to currentSelection
            to endingSelection.
            (TypingCommandImpl::deleteKeyPressed): Remove extraneous call to reset endingSelection. This has
            already been done by the helpers this command uses to do its work.
            * khtml/editing/htmlediting_impl.h:
            (khtml::EditCommandImpl::endingSelection): Remove extraneous call to reset endingSelection. This has
            already been done by the helpers this command uses to do its work.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6324 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f6ebd1e..eca4018 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,6 +1,42 @@
 2004-04-07  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by John
+
+        Removed concept of currentSelection from EditCommands and refined concept of
+        startingSelection and endingSelection, making them work more sensibly in the 
+        system of composed editing commands.
+
+        * khtml/editing/htmlediting.cpp: Removed currentSelection().
+        * khtml/editing/htmlediting.h: Ditto.
+        * khtml/editing/htmlediting_impl.cpp: currentSelection().
+        (CompositeEditCommandImpl::applyCommandToComposite): Set the startingSelection 
+        and endingSelection for the command being applied to the endingSelection of
+        its new parent. This is the proper starting and ending point.
+        (CompositeEditCommandImpl::deleteSelection): Changed call to currentSelection
+        to endingSelection.
+        (DeleteCollapsibleWhitespaceCommandImpl::DeleteCollapsibleWhitespaceCommandImpl): Ditto.
+        (DeleteSelectionCommandImpl::DeleteSelectionCommandImpl): Changed call from startingSelection
+        to endingSelection.
+        (DeleteSelectionCommandImpl::joinTextNodesWithSameStyle): Changed call to currentSelection
+        to endingSelection.
+        (InputNewlineCommandImpl::doApply): Ditto.
+        (InputTextCommandImpl::deleteCharacter): Ditto.
+        (InputTextCommandImpl::prepareForTextInsertion): Ditto.
+        (InputTextCommandImpl::execute): Ditto.
+        (PasteHTMLCommandImpl::doApply): Ditto.
+        (TypingCommandImpl::insertText): Remove extraneous call to reset endingSelection. This has
+        already been done by the helpers this command uses to do its work.
+        (TypingCommandImpl::issueCommandForDeleteKey): Changed call to currentSelection
+        to endingSelection.
+        (TypingCommandImpl::deleteKeyPressed): Remove extraneous call to reset endingSelection. This has
+        already been done by the helpers this command uses to do its work.
+        * khtml/editing/htmlediting_impl.h:
+        (khtml::EditCommandImpl::endingSelection): Remove extraneous call to reset endingSelection. This has
+        already been done by the helpers this command uses to do its work.
+
+2004-04-07  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
         
         Make paste work again. It has been broken for some undetermined
         period of time.
diff --git a/WebCore/khtml/editing/htmlediting.cpp b/WebCore/khtml/editing/htmlediting.cpp
index 5a6c182..ac1fa78 100644
--- a/WebCore/khtml/editing/htmlediting.cpp
+++ b/WebCore/khtml/editing/htmlediting.cpp
@@ -172,12 +172,6 @@ KHTMLSelection EditCommand::endingSelection() const
     return get()->endingSelection();
 }
 
-KHTMLSelection EditCommand::currentSelection() const
-{
-    IF_IMPL_NULL_RETURN_ARG(KHTMLSelection());
-    return get()->currentSelection();
-}
-
 void EditCommand::setStartingSelection(const KHTMLSelection &s)
 {
     IF_IMPL_NULL_RETURN;
diff --git a/WebCore/khtml/editing/htmlediting.h b/WebCore/khtml/editing/htmlediting.h
index 19cfb30..1324fef 100644
--- a/WebCore/khtml/editing/htmlediting.h
+++ b/WebCore/khtml/editing/htmlediting.h
@@ -105,7 +105,6 @@ public:
 
     virtual KHTMLSelection startingSelection() const = 0;
     virtual KHTMLSelection endingSelection() const = 0;
-    virtual KHTMLSelection currentSelection() const = 0;
 
     virtual void setStartingSelection(const KHTMLSelection &s) = 0;
     virtual void setEndingSelection(const KHTMLSelection &s) = 0;
@@ -141,7 +140,6 @@ public:
 
     KHTMLSelection startingSelection() const;
     KHTMLSelection endingSelection() const;
-    KHTMLSelection currentSelection() const;
 
     void setStartingSelection(const KHTMLSelection &s);
     void setEndingSelection(const KHTMLSelection &s);
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index ae93bcf..b7454ad 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -314,13 +314,6 @@ void EditCommandImpl::doReapply()
     doApply();
 }
 
-KHTMLSelection EditCommandImpl::currentSelection() const
-{
-    ASSERT(m_document);
-    ASSERT(m_document->part());
-    return m_document->part()->selection();
-}
-
 void EditCommandImpl::setStartingSelection(const KHTMLSelection &s)
 {
     m_startingSelection = s;
@@ -415,6 +408,8 @@ void CompositeEditCommandImpl::doReapply()
 //
 void CompositeEditCommandImpl::applyCommandToComposite(EditCommand &cmd)
 {
+    cmd.setStartingSelection(endingSelection());
+    cmd.setEndingSelection(endingSelection());
     cmd.setParent(this);
     cmd.apply();
     m_cmds.append(cmd);
@@ -519,7 +514,7 @@ void CompositeEditCommandImpl::replaceText(DOM::TextImpl *node, long offset, lon
 
 void CompositeEditCommandImpl::deleteSelection()
 {
-    if (currentSelection().state() == KHTMLSelection::RANGE) {
+    if (endingSelection().state() == KHTMLSelection::RANGE) {
         DeleteSelectionCommand cmd(document());
         applyCommandToComposite(cmd);
     }
@@ -598,7 +593,7 @@ void AppendNodeCommandImpl::doUnapply()
 // DeleteCollapsibleWhitespaceCommandImpl
 
 DeleteCollapsibleWhitespaceCommandImpl::DeleteCollapsibleWhitespaceCommandImpl(DocumentImpl *document)
-    : CompositeEditCommandImpl(document), m_selectionToCollapse(currentSelection()), m_charactersDeleted(0)
+    : CompositeEditCommandImpl(document), m_selectionToCollapse(endingSelection()), m_charactersDeleted(0)
 {
 }
 
@@ -755,7 +750,7 @@ void DeleteCollapsibleWhitespaceCommandImpl::doApply()
 DeleteSelectionCommandImpl::DeleteSelectionCommandImpl(DOM::DocumentImpl *document)
     : CompositeEditCommandImpl(document)
 {
-    m_selectionToDelete = startingSelection();
+    m_selectionToDelete = endingSelection();
 }
 
 DeleteSelectionCommandImpl::DeleteSelectionCommandImpl(DOM::DocumentImpl *document, const KHTMLSelection &selection)
@@ -775,7 +770,7 @@ int DeleteSelectionCommandImpl::commandID() const
 
 void DeleteSelectionCommandImpl::joinTextNodesWithSameStyle()
 {
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
 
     if (selection.state() != KHTMLSelection::CARET)
         return;
@@ -1038,7 +1033,7 @@ int InputNewlineCommandImpl::commandID() const
 
 void InputNewlineCommandImpl::doApply()
 {
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
 
     if (!selection.startNode()->isTextNode())
         return;
@@ -1046,8 +1041,8 @@ void InputNewlineCommandImpl::doApply()
     // Delete the current selection
     deleteSelection();
     
-    // reset the current selection since it may have changed due to the delete
-    selection = currentSelection();
+    // reset the selection since it may have changed due to the delete
+    selection = endingSelection();
 
     int exceptionCode = 0;
     ElementImpl *breakNode = document()->createHTMLElement("BR", exceptionCode);
@@ -1114,7 +1109,7 @@ void InputTextCommandImpl::deleteCharacter()
 {
     ASSERT(state() == Applied);
 
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
 
     if (!selection.startNode()->isTextNode())
         return;
@@ -1135,7 +1130,7 @@ DOMPosition InputTextCommandImpl::prepareForTextInsertion()
 {
     // Prepare for text input by looking at the current position.
     // It may be necessary to insert a text node to receive characters.
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
     ASSERT(selection.state() == KHTMLSelection::CARET);
     
     DOMPosition pos = selection.startPosition().equivalentUpstreamPosition();
@@ -1170,7 +1165,7 @@ DOMPosition InputTextCommandImpl::prepareForTextInsertion()
 
 void InputTextCommandImpl::execute(const DOMString &text)
 {
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
 
     // Delete the current selection, or collapse whitespace, as needed
     if (selection.state() == KHTMLSelection::RANGE)
@@ -1424,7 +1419,7 @@ void PasteHTMLCommandImpl::doApply()
     ASSERT(firstChild);
     ASSERT(lastChild);
     
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
 
     // Delete the current selection, or collapse whitespace, as needed
     if (selection.state() == KHTMLSelection::RANGE)
@@ -1704,19 +1699,16 @@ void TypingCommandImpl::insertText(const DOM::DOMString &text)
         InputTextCommand cmd(document());
         applyCommandToComposite(cmd);
         cmd.input(text);
-        setEndingSelection(cmd.endingSelection());
     }
     else {
         EditCommand lastCommand = m_cmds.last();
         if (lastCommand.commandID() == InputTextCommandID) {
             static_cast<InputTextCommand &>(lastCommand).input(text);
-            setEndingSelection(lastCommand.endingSelection());
         }
         else {
             InputTextCommand cmd(document());
             applyCommandToComposite(cmd);
             cmd.input(text);
-            setEndingSelection(cmd.endingSelection());
         }
     }
 }
@@ -1729,7 +1721,7 @@ void TypingCommandImpl::insertNewline()
 
 void TypingCommandImpl::issueCommandForDeleteKey()
 {
-    KHTMLSelection selection = currentSelection();
+    KHTMLSelection selection = endingSelection();
     ASSERT(selection.state() != KHTMLSelection::NONE);
     
     if (selection.state() == KHTMLSelection::CARET) {
@@ -1755,9 +1747,6 @@ void TypingCommandImpl::deleteKeyPressed()
             if (cmd.charactersAdded() == 0) {
                 removeCommand(cmd);
             }
-            else {
-                setEndingSelection(cmd.endingSelection());
-            }
         }
         else if (lastCommand.commandID() == InputNewlineCommandID) {
             lastCommand.unapply();
diff --git a/WebCore/khtml/editing/htmlediting_impl.h b/WebCore/khtml/editing/htmlediting_impl.h
index 693d737..6a87061 100644
--- a/WebCore/khtml/editing/htmlediting_impl.h
+++ b/WebCore/khtml/editing/htmlediting_impl.h
@@ -75,7 +75,6 @@ public:
 
     KHTMLSelection startingSelection() const { return m_startingSelection; }
     KHTMLSelection endingSelection() const { return m_endingSelection; }
-    KHTMLSelection currentSelection() const;
         
     ECommandState state() const { return m_state; }
     void setState(ECommandState state) { m_state = state; }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list