[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:40:42 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 9da87d26dcdedc44abf28bdb54322407afa2a8de
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed May 19 18:21:40 2004 +0000
Reviewed by John
Fix for this bug:
<rdar://problem/3655601>: "deleting characters is much slower than inserting them"
Cleaned up the way selections are set in edit commands, and how KHTMLPart is
notified of these changes. This clears up a number of inefficiencies, including unnecessary repaints
which were causing the performace problem.
* khtml/editing/htmlediting.cpp: Removed moveToStartingSelection and moveToEndingSelection functions.
This work is going to be done using another pre-existing communication facility shared by edit commands
and the part.
* khtml/editing/htmlediting.h: Ditto.
* khtml/editing/htmlediting_impl.cpp:
(khtml::EditCommandImpl::setStartingSelection): Fix coding mistake which caused double recursion while setting
ancestor values.
(khtml::EditCommandImpl::setEndingSelection): Ditto.
(khtml::CompositeEditCommandImpl::doUnapply): No longer calls moveToStartingSelection. Work done in the part now.
(khtml::CompositeEditCommandImpl::doReapply): No longer calls moveToEndingSelection. Work done in the part now.
(khtml::TypingCommandImpl::typingAddedToOpenCommand): New function. Provides a hook for
typing commands to tell the part about additional typing that has been done.
(khtml::TypingCommandImpl::insertText): Now calls typingAddedToOpenCommand.
(khtml::TypingCommandImpl::insertNewline): Ditto.
(khtml::TypingCommandImpl::issueCommandForDeleteKey): Ditto.
(khtml::TypingCommandImpl::deleteKeyPressed): Ditto.
* khtml/editing/htmlediting_impl.h: Removed moveToStartingSelection and moveToEndingSelection functions.
* khtml/khtml_part.cpp:
(KHTMLPart::setSelection): Modified to take an argument which tells whether the set closes an active
typing command.
(KHTMLPart::notifySelectionChanged): Changed endTyping variable to be consistent with "close typing"
terminology used elsewhere.
(KHTMLPart::appliedEditing): Now sets the selection using the value of the passed-in command. Added
an assert for typing cases. Fixed problem where didChangeNotification was not being posted for typing
changes after the first one.
(KHTMLPart::unappliedEditing): Now sets the selection using the value of the passed-in command.
(KHTMLPart::reappliedEditing): Now sets the selection using the value of the passed-in command.
* khtml/khtml_part.h:
* khtml/rendering/render_canvas.cpp:
(RenderCanvas::clearSelection): Do not call repaint when the selection is a caret.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6641 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b072ef3..bc3b2e7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,48 @@
2004-05-19 Ken Kocienda <kocienda at apple.com>
+ Reviewed by John
+
+ Fix for this bug:
+
+ <rdar://problem/3655601>: "deleting characters is much slower than inserting them"
+
+ Cleaned up the way selections are set in edit commands, and how KHTMLPart is
+ notified of these changes. This clears up a number of inefficiencies, including unnecessary repaints
+ which were causing the performace problem.
+
+ * khtml/editing/htmlediting.cpp: Removed moveToStartingSelection and moveToEndingSelection functions.
+ This work is going to be done using another pre-existing communication facility shared by edit commands
+ and the part.
+ * khtml/editing/htmlediting.h: Ditto.
+ * khtml/editing/htmlediting_impl.cpp:
+ (khtml::EditCommandImpl::setStartingSelection): Fix coding mistake which caused double recursion while setting
+ ancestor values.
+ (khtml::EditCommandImpl::setEndingSelection): Ditto.
+ (khtml::CompositeEditCommandImpl::doUnapply): No longer calls moveToStartingSelection. Work done in the part now.
+ (khtml::CompositeEditCommandImpl::doReapply): No longer calls moveToEndingSelection. Work done in the part now.
+ (khtml::TypingCommandImpl::typingAddedToOpenCommand): New function. Provides a hook for
+ typing commands to tell the part about additional typing that has been done.
+ (khtml::TypingCommandImpl::insertText): Now calls typingAddedToOpenCommand.
+ (khtml::TypingCommandImpl::insertNewline): Ditto.
+ (khtml::TypingCommandImpl::issueCommandForDeleteKey): Ditto.
+ (khtml::TypingCommandImpl::deleteKeyPressed): Ditto.
+ * khtml/editing/htmlediting_impl.h: Removed moveToStartingSelection and moveToEndingSelection functions.
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::setSelection): Modified to take an argument which tells whether the set closes an active
+ typing command.
+ (KHTMLPart::notifySelectionChanged): Changed endTyping variable to be consistent with "close typing"
+ terminology used elsewhere.
+ (KHTMLPart::appliedEditing): Now sets the selection using the value of the passed-in command. Added
+ an assert for typing cases. Fixed problem where didChangeNotification was not being posted for typing
+ changes after the first one.
+ (KHTMLPart::unappliedEditing): Now sets the selection using the value of the passed-in command.
+ (KHTMLPart::reappliedEditing): Now sets the selection using the value of the passed-in command.
+ * khtml/khtml_part.h:
+ * khtml/rendering/render_canvas.cpp:
+ (RenderCanvas::clearSelection): Do not call repaint when the selection is a caret.
+
+2004-05-19 Ken Kocienda <kocienda at apple.com>
+
Reviewed by Hyatt
* khtml/html/html_elementimpl.cpp:
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index ab1f400..70f1a9b 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -865,7 +865,7 @@
isa = PBXShellScriptBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ -f ../Tools/Scripts/embed-into-alex ]; then sh ../Tools/Scripts/embed-into-alex; fi";
+ shellScript = "#if [ -f ../Tools/Scripts/embed-into-alex ]; then sh ../Tools/Scripts/embed-into-alex; fi";
};
//250
//251
diff --git a/WebCore/khtml/editing/htmlediting.cpp b/WebCore/khtml/editing/htmlediting.cpp
index ef263f5..f0f958a 100644
--- a/WebCore/khtml/editing/htmlediting.cpp
+++ b/WebCore/khtml/editing/htmlediting.cpp
@@ -157,18 +157,6 @@ void EditCommand::setEndingSelection(const Selection &s)
get()->setEndingSelection(s);
}
-void EditCommand::moveToStartingSelection()
-{
- IF_IMPL_NULL_RETURN;
- get()->moveToStartingSelection();
-}
-
-void EditCommand::moveToEndingSelection()
-{
- IF_IMPL_NULL_RETURN;
- get()->moveToEndingSelection();
-}
-
EditCommand EditCommand::parent() const
{
IF_IMPL_NULL_RETURN_ARG(0);
diff --git a/WebCore/khtml/editing/htmlediting.h b/WebCore/khtml/editing/htmlediting.h
index 389dc3c..d503964 100644
--- a/WebCore/khtml/editing/htmlediting.h
+++ b/WebCore/khtml/editing/htmlediting.h
@@ -119,9 +119,6 @@ public:
virtual void setStartingSelection(const DOM::Selection &s) = 0;
virtual void setEndingSelection(const DOM::Selection &s) = 0;
- virtual void moveToStartingSelection() = 0;
- virtual void moveToEndingSelection() = 0;
-
virtual EditCommand parent() const = 0;
virtual void setParent(const EditCommand &) = 0;
};
@@ -154,9 +151,6 @@ public:
void setStartingSelection(const DOM::Selection &s);
void setEndingSelection(const DOM::Selection &s);
- void moveToStartingSelection();
- void moveToEndingSelection();
-
EditCommand parent() const;
void setParent(const EditCommand &);
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index 47a4a22..bc769af 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -295,10 +295,9 @@ void EditCommandImpl::setStartingSelection(const Selection &s)
m_startingSelection = s;
EditCommand cmd = parent();
while (cmd.notNull()) {
- cmd.setStartingSelection(s);
+ cmd.handle()->m_startingSelection = s;
cmd = cmd.parent();
}
- moveToStartingSelection();
}
void EditCommandImpl::setEndingSelection(const Selection &s)
@@ -306,24 +305,9 @@ void EditCommandImpl::setEndingSelection(const Selection &s)
m_endingSelection = s;
EditCommand cmd = parent();
while (cmd.notNull()) {
- cmd.setEndingSelection(s);
+ cmd.handle()->m_endingSelection = s;
cmd = cmd.parent();
}
- moveToEndingSelection();
-}
-
-void EditCommandImpl::moveToStartingSelection()
-{
- ASSERT(m_document);
- ASSERT(m_document->part());
- m_document->part()->takeSelectionFrom(this, false);
-}
-
-void EditCommandImpl::moveToEndingSelection()
-{
- ASSERT(m_document);
- ASSERT(m_document->part());
- m_document->part()->takeSelectionFrom(this, true);
}
EditCommand EditCommandImpl::parent() const
@@ -362,7 +346,6 @@ void CompositeEditCommandImpl::doUnapply()
for (int i = m_cmds.count() - 1; i >= 0; --i)
m_cmds[i]->unapply();
- moveToStartingSelection();
setState(NotApplied);
}
@@ -375,7 +358,6 @@ void CompositeEditCommandImpl::doReapply()
for (QValueList<EditCommand>::ConstIterator it = m_cmds.begin(); it != m_cmds.end(); ++it)
(*it)->reapply();
- moveToEndingSelection();
setState(Applied);
}
@@ -2358,6 +2340,14 @@ void TypingCommandImpl::doApply()
{
}
+void TypingCommandImpl::typingAddedToOpenCommand()
+{
+ ASSERT(document());
+ ASSERT(document()->part());
+ EditCommand cmd(this);
+ document()->part()->appliedEditing(cmd);
+}
+
void TypingCommandImpl::insertText(const DOMString &text)
{
if (m_cmds.count() == 0) {
@@ -2376,12 +2366,14 @@ void TypingCommandImpl::insertText(const DOMString &text)
cmd.input(text);
}
}
+ typingAddedToOpenCommand();
}
void TypingCommandImpl::insertNewline()
{
InputNewlineCommand cmd(document());
applyCommandToComposite(cmd);
+ typingAddedToOpenCommand();
}
void TypingCommandImpl::issueCommandForDeleteKey()
@@ -2398,6 +2390,7 @@ void TypingCommandImpl::issueCommandForDeleteKey()
selectionToDelete = Selection(pos.previousCharacterPosition(), pos);
}
deleteSelection(selectionToDelete);
+ typingAddedToOpenCommand();
}
void TypingCommandImpl::deleteKeyPressed()
@@ -2411,6 +2404,7 @@ void TypingCommandImpl::deleteKeyPressed()
// right thing, but less efficiently and with the cost of more
// objects.
issueCommandForDeleteKey();
+ typingAddedToOpenCommand();
#if 0
if (m_cmds.count() == 0) {
issueCommandForDeleteKey();
diff --git a/WebCore/khtml/editing/htmlediting_impl.h b/WebCore/khtml/editing/htmlediting_impl.h
index 3a12d71..0279a97 100644
--- a/WebCore/khtml/editing/htmlediting_impl.h
+++ b/WebCore/khtml/editing/htmlediting_impl.h
@@ -88,9 +88,6 @@ public:
void setStartingSelection(const DOM::Selection &s);
void setEndingSelection(const DOM::Selection &s);
- void moveToStartingSelection();
- void moveToEndingSelection();
-
private:
DOM::DocumentImpl *m_document;
ECommandState m_state;
@@ -600,6 +597,7 @@ public:
private:
void issueCommandForDeleteKey();
void removeCommand(const EditCommand &);
+ void typingAddedToOpenCommand();
bool m_openForMoreTyping;
};
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index f4dc98f..a100278 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -2272,29 +2272,13 @@ const Selection &KHTMLPart::selection() const
return d->m_selection;
}
-void KHTMLPart::setSelection(const Selection &s)
+void KHTMLPart::setSelection(const Selection &s, bool closeTyping)
{
if (d->m_selection != s) {
clearCaretRectIfNeeded();
setFocusNodeIfNeeded(s);
d->m_selection = s;
- notifySelectionChanged();
- }
-}
-
-void KHTMLPart::takeSelectionFrom(const EditCommand &cmd, bool useEndingSelection)
-{
- Selection s;
- if (useEndingSelection)
- s = cmd.endingSelection();
- else
- s = cmd.startingSelection();
-
- if (d->m_selection != s) {
- clearCaretRectIfNeeded();
- setFocusNodeIfNeeded(s);
- d->m_selection = s;
- notifySelectionChanged(false);
+ notifySelectionChanged(closeTyping);
}
}
@@ -2369,7 +2353,7 @@ void KHTMLPart::setFocusNodeIfNeeded(const Selection &s)
}
}
-void KHTMLPart::notifySelectionChanged(bool endTyping)
+void KHTMLPart::notifySelectionChanged(bool closeTyping)
{
// kill any caret blink timer now running
if (d->m_caretBlinkTimer >= 0) {
@@ -2388,7 +2372,7 @@ void KHTMLPart::notifySelectionChanged(bool endTyping)
if (d->m_doc)
d->m_doc->updateSelection();
- if (endTyping)
+ if (closeTyping)
TypingCommand::closeTyping(lastEditCommand());
// Always clear the x position used for vertical arrow navigation.
@@ -4905,19 +4889,27 @@ EditCommand KHTMLPart::lastEditCommand()
void KHTMLPart::appliedEditing(EditCommand &cmd)
{
- if (d->m_lastEditCommand != cmd) {
+ setSelection(cmd.endingSelection(), false);
+ // Command will be equal to last edit command only in the case of typing
+ if (d->m_lastEditCommand == cmd) {
+ assert(cmd.commandID() == khtml::TypingCommandID);
+ }
+ else {
#if APPLE_CHANGES
+ // Only register a new undo command if the command passed in is
+ // different from the last command
KWQ(this)->registerCommandForUndo(cmd);
- KWQ(this)->postDidChangeNotification();
#endif
+ d->m_lastEditCommand = cmd;
}
- d->m_lastEditCommand = cmd;
+#if APPLE_CHANGES
+ KWQ(this)->postDidChangeNotification();
+#endif
}
void KHTMLPart::unappliedEditing(EditCommand &cmd)
{
- TypingCommand::closeTyping(lastEditCommand());
-
+ setSelection(cmd.startingSelection());
#if APPLE_CHANGES
KWQ(this)->registerCommandForRedo(cmd);
KWQ(this)->postDidChangeNotification();
@@ -4927,6 +4919,7 @@ void KHTMLPart::unappliedEditing(EditCommand &cmd)
void KHTMLPart::reappliedEditing(EditCommand &cmd)
{
+ setSelection(cmd.endingSelection());
#if APPLE_CHANGES
KWQ(this)->registerCommandForUndo(cmd);
KWQ(this)->postDidChangeNotification();
diff --git a/WebCore/khtml/khtml_part.h b/WebCore/khtml/khtml_part.h
index 155b6b5..3dc270e 100644
--- a/WebCore/khtml/khtml_part.h
+++ b/WebCore/khtml/khtml_part.h
@@ -571,12 +571,7 @@ public:
/**
* Sets the current selection.
*/
- void setSelection(const DOM::Selection &);
-
- /**
- * Sets the current selection, using the given edit command.
- */
- void takeSelectionFrom(const khtml::EditCommand &, bool useEndingSelection=true);
+ void setSelection(const DOM::Selection &, bool closeTyping=true);
/**
* Clears the current selection.
@@ -1100,7 +1095,7 @@ private:
/**
* @internal
*/
- void notifySelectionChanged(bool endTyping=true);
+ void notifySelectionChanged(bool closeTyping=true);
/**
* @internal
diff --git a/WebCore/khtml/rendering/render_canvas.cpp b/WebCore/khtml/rendering/render_canvas.cpp
index 0dc9f3f..8d27d10 100644
--- a/WebCore/khtml/rendering/render_canvas.cpp
+++ b/WebCore/khtml/rendering/render_canvas.cpp
@@ -566,10 +566,12 @@ void RenderCanvas::clearSelection()
if (m_selectionEnd)
{
m_selectionEnd->setSelectionState(SelectionNone);
+ // check if selection is collapsed
+ if (m_selectionStart != m_selectionEnd || m_selectionStartPos != m_selectionEndPos)
#if APPLE_CHANGES
- if (doRepaint)
+ if (doRepaint)
#endif
- m_selectionEnd->repaint();
+ m_selectionEnd->repaint();
}
// set selection start & end to 0
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list