[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
jorlow at chromium.org
jorlow at chromium.org
Sun Feb 20 23:25:19 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 6230e750c0be0049431d0bbeee950548c6433285
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 20 12:36:22 2011 +0000
2011-01-20 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r76215.
http://trac.webkit.org/changeset/76215
https://bugs.webkit.org/show_bug.cgi?id=52799
Caused regressions in Chromium; morrita is going to look at it
tomrorow (Requested by jorlow on #webkit).
* editing/inserting/insert-composition-whitespace-expected.txt: Removed.
* editing/inserting/insert-composition-whitespace.html: Removed.
2011-01-20 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r76215.
http://trac.webkit.org/changeset/76215
https://bugs.webkit.org/show_bug.cgi?id=52799
Caused regressions in Chromium; morrita is going to look at it
tomrorow (Requested by jorlow on #webkit).
* dom/TextEvent.h:
* dom/TextEventInputType.h:
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
* editing/CompositeEditCommand.h:
* editing/Editor.cpp:
(WebCore::Editor::insertTextWithoutSendingTextEvent):
(WebCore::Editor::confirmComposition):
(WebCore::Editor::setComposition):
* editing/Editor.h:
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::input):
* editing/InsertTextCommand.h:
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::TypingCommand):
(WebCore::TypingCommand::insertText):
(WebCore::TypingCommand::insertTextRunWithoutNewlines):
* editing/TypingCommand.h:
(WebCore::TypingCommand::create):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76226 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d5e85a8..d99c8b8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-20 Sheriff Bot <webkit.review.bot at gmail.com>
+
+ Unreviewed, rolling out r76215.
+ http://trac.webkit.org/changeset/76215
+ https://bugs.webkit.org/show_bug.cgi?id=52799
+
+ Caused regressions in Chromium; morrita is going to look at it
+ tomrorow (Requested by jorlow on #webkit).
+
+ * editing/inserting/insert-composition-whitespace-expected.txt: Removed.
+ * editing/inserting/insert-composition-whitespace.html: Removed.
+
2011-01-19 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Eric Seidel.
diff --git a/LayoutTests/editing/inserting/insert-composition-whitespace-expected.txt b/LayoutTests/editing/inserting/insert-composition-whitespace-expected.txt
deleted file mode 100644
index 4087ca4..0000000
--- a/LayoutTests/editing/inserting/insert-composition-whitespace-expected.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-PASS compositingText is 'AB'
-PASS compositingText is 'A B'
-PASS compositingText is 'A B'
-PASS compositingText is 'A B'
-PASS compositingText is 'A B'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is ' A B '
-PASS compositingText is ' A B '
-PASS compositingText is ' '
-PASS compositingText is ' '
-PASS compositingText is ' '
-PASS compositingText is 'AB'
-PASS compositingText is 'A B'
-PASS compositingText is 'A B'
-PASS compositingText is 'A B'
-PASS compositingText is 'A B'
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is 'AB '
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' AB'
-PASS compositingText is ' A B '
-PASS compositingText is ' A B '
-PASS compositingText is ' '
-PASS compositingText is ' '
-PASS compositingText is ' '
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/editing/inserting/insert-composition-whitespace.html b/LayoutTests/editing/inserting/insert-composition-whitespace.html
deleted file mode 100644
index a5f2d8f..0000000
--- a/LayoutTests/editing/inserting/insert-composition-whitespace.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
-<script src="../../fast/js/resources/js-test-pre.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script>
-
-var sel = document.getSelection();
-var root = document.createElement("root");
-document.body.appendChild(root);
-
-
-function createEditable(tagName, text) {
- var node = document.createElement(tagName);
- node.contentEditable = true;
- node.innerHTML = text;
- return node;
-}
-
-function test(tagName, compositionText, expected) {
- var node = createEditable(tagName, "X");
- root.appendChild(node);
-
- var textNode = node.firstChild;
- sel.setBaseAndExtent(textNode, 0, textNode, textNode.data.length);
- document.execCommand("Delete", false);
-
- textInputController.setMarkedText(compositionText, 0, compositionText);
- compositingText = node.innerText;
- textInputController.unmarkText();
- confirmedText = node.innerText;
-
- shouldBe("compositingText", "'" + expected + "'");
-}
-
-test("div", "AB", "AB");
-test("div", "A B", "A B");
-test("div", "A B", "A \xA0B");
-test("div", "A B", "A \xA0 B");
-test("div", "A B", "A \xA0 \xA0B");
-
-test("div", " AB", "\xA0AB");
-test("div", " AB", "\xA0\xA0AB");
-test("div", " AB", "\xA0\xA0 AB");
-test("div", " AB", "\xA0\xA0 \xA0AB");
-test("div", " AB", "\xA0\xA0 \xA0 AB");
-test("div", " AB", "\xA0\xA0 \xA0 \xA0AB");
-test("div", " AB", "\xA0\xA0 \xA0 \xA0 AB");
-test("div", "AB ", "AB \xA0");
-test("div", "AB ", "AB \xA0\xA0");
-test("div", "AB ", "AB \xA0 \xA0");
-test("div", "AB ", "AB \xA0 \xA0\xA0");
-test("div", "AB ", "AB \xA0 \xA0 \xA0");
-test("div", "AB ", "AB \xA0 \xA0 \xA0\xA0");
-
-test("div", " A B ", "\xA0\xA0A \xA0B \xA0");
-test("div", "\t\tA\t\tB\t\t", "\xA0\xA0A \xA0B \xA0");
-
-test("div", " ", "\xA0");
-test("div", " ", "\xA0\xA0");
-// This is wrong. This should insert interleaved nbsp and whitespace. See https://bugs.webkit.org/show_bug.cgi?id=52781.
-test("div", " ", "\xA0\xA0\xA0");
-
-test("pre", "AB", "AB");
-test("pre", "A B", "A B");
-test("pre", "A B", "A B");
-test("pre", "A B", "A B");
-test("pre", "A B", "A B");
-test("pre", "AB ", "AB ");
-test("pre", "AB ", "AB ");
-test("pre", "AB ", "AB ");
-test("pre", "AB ", "AB ");
-test("pre", "AB ", "AB ");
-test("pre", "AB ", "AB ");
-test("pre", " AB", " AB");
-test("pre", " AB", " AB");
-test("pre", " AB", " AB");
-test("pre", " AB", " AB");
-test("pre", " AB", " AB");
-test("pre", " AB", " AB");
-
-test("pre", " A B ", " A B ");
-test("pre", "\t\tA\t\tB\t\t", "\t\tA\t\tB\t\t");
-test("pre", " ", " ");
-test("pre", " ", " ");
-test("pre", " ", " ");
-
-root.style.display = "none";
-successfullyParsed = true;
-
-</script>
-<script src="../../fast/js/resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index fb63894..82470af 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2011-01-20 Sheriff Bot <webkit.review.bot at gmail.com>
+
+ Unreviewed, rolling out r76215.
+ http://trac.webkit.org/changeset/76215
+ https://bugs.webkit.org/show_bug.cgi?id=52799
+
+ Caused regressions in Chromium; morrita is going to look at it
+ tomrorow (Requested by jorlow on #webkit).
+
+ * dom/TextEvent.h:
+ * dom/TextEventInputType.h:
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
+ * editing/CompositeEditCommand.h:
+ * editing/Editor.cpp:
+ (WebCore::Editor::insertTextWithoutSendingTextEvent):
+ (WebCore::Editor::confirmComposition):
+ (WebCore::Editor::setComposition):
+ * editing/Editor.h:
+ * editing/InsertTextCommand.cpp:
+ (WebCore::InsertTextCommand::input):
+ * editing/InsertTextCommand.h:
+ * editing/TypingCommand.cpp:
+ (WebCore::TypingCommand::TypingCommand):
+ (WebCore::TypingCommand::insertText):
+ (WebCore::TypingCommand::insertTextRunWithoutNewlines):
+ * editing/TypingCommand.h:
+ (WebCore::TypingCommand::create):
+
2010-12-14 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Adam Barth.
diff --git a/Source/WebCore/dom/TextEvent.h b/Source/WebCore/dom/TextEvent.h
index 26c8b93..d770d38 100644
--- a/Source/WebCore/dom/TextEvent.h
+++ b/Source/WebCore/dom/TextEvent.h
@@ -51,7 +51,6 @@ namespace WebCore {
virtual bool isTextEvent() const;
bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
- bool isComposition() const { return m_inputType == TextEventInputComposition; }
bool isBackTab() const { return m_inputType == TextEventInputBackTab; }
bool isPaste() const { return m_inputType == TextEventInputPaste; }
bool isDrop() const { return m_inputType == TextEventInputDrop; }
diff --git a/Source/WebCore/dom/TextEventInputType.h b/Source/WebCore/dom/TextEventInputType.h
index f5a05eb..2522ec4 100644
--- a/Source/WebCore/dom/TextEventInputType.h
+++ b/Source/WebCore/dom/TextEventInputType.h
@@ -31,7 +31,6 @@ namespace WebCore {
enum TextEventInputType {
TextEventInputKeyboard, // any newline characters in the text are line breaks only, not paragraph separators.
TextEventInputLineBreak, // any tab characters in the text are backtabs.
- TextEventInputComposition,
TextEventInputBackTab,
TextEventInputPaste,
TextEventInputDrop,
diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp
index 39280d4..552ed79 100644
--- a/Source/WebCore/editing/CompositeEditCommand.cpp
+++ b/Source/WebCore/editing/CompositeEditCommand.cpp
@@ -395,84 +395,52 @@ static inline bool isWhitespace(UChar c)
return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
}
-static inline bool containsOnlyWhitespace(const String& text)
-{
- for (unsigned i = 0; i < text.length(); ++i) {
- if (!isWhitespace(text.characters()[i]))
- return false;
- }
-
- return true;
-}
-
-bool CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor(const String& text) const
-{
- return containsOnlyWhitespace(text);
-}
-
-bool CompositeEditCommand::canRebalance(const Position& position) const
+// FIXME: Doesn't go into text nodes that contribute adjacent text (siblings, cousins, etc).
+void CompositeEditCommand::rebalanceWhitespaceAt(const Position& position)
{
Node* node = position.containerNode();
if (position.anchorType() != Position::PositionIsOffsetInAnchor || !node || !node->isTextNode())
- return false;
-
+ return;
Text* textNode = static_cast<Text*>(node);
- if (textNode->length() == 0)
- return false;
+ if (textNode->length() == 0)
+ return;
RenderObject* renderer = textNode->renderer();
if (renderer && !renderer->style()->collapseWhiteSpace())
- return false;
-
- return true;
-}
-
-// FIXME: Doesn't go into text nodes that contribute adjacent text (siblings, cousins, etc).
-void CompositeEditCommand::rebalanceWhitespaceAt(const Position& position)
-{
- Node* node = position.containerNode();
- if (!canRebalance(position))
return;
- // If the rebalance is for the single offset, and neither text[offset] nor text[offset - 1] are some form of whitespace, do nothing.
+ String text = textNode->data();
+ ASSERT(!text.isEmpty());
+
int offset = position.deprecatedEditingOffset();
- String text = static_cast<Text*>(node)->data();
+ // If neither text[offset] nor text[offset - 1] are some form of whitespace, do nothing.
if (!isWhitespace(text[offset])) {
offset--;
if (offset < 0 || !isWhitespace(text[offset]))
return;
}
-
- rebalanceWhitespaceOnTextSubstring(static_cast<Text*>(node), position.offsetInContainerNode(), position.offsetInContainerNode());
-}
-
-void CompositeEditCommand::rebalanceWhitespaceOnTextSubstring(RefPtr<Text> textNode, int startOffset, int endOffset)
-{
- String text = textNode->data();
- ASSERT(!text.isEmpty());
-
+
// Set upstream and downstream to define the extent of the whitespace surrounding text[offset].
- int upstream = startOffset;
+ int upstream = offset;
while (upstream > 0 && isWhitespace(text[upstream - 1]))
upstream--;
- int downstream = endOffset;
- while ((unsigned)downstream < text.length() && isWhitespace(text[downstream]))
+ int downstream = offset;
+ while ((unsigned)downstream + 1 < text.length() && isWhitespace(text[downstream + 1]))
downstream++;
- int length = downstream - upstream;
- if (!length)
- return;
-
- VisiblePosition visibleUpstreamPos(Position(textNode, upstream, Position::PositionIsOffsetInAnchor));
- VisiblePosition visibleDownstreamPos(Position(textNode, downstream, Position::PositionIsOffsetInAnchor));
+ int length = downstream - upstream + 1;
+ ASSERT(length > 0);
+
+ VisiblePosition visibleUpstreamPos(Position(position.containerNode(), upstream, Position::PositionIsOffsetInAnchor));
+ VisiblePosition visibleDownstreamPos(Position(position.containerNode(), downstream + 1, Position::PositionIsOffsetInAnchor));
String string = text.substring(upstream, length);
String rebalancedString = stringWithRebalancedWhitespace(string,
// FIXME: Because of the problem mentioned at the top of this function, we must also use nbsps at the start/end of the string because
// this function doesn't get all surrounding whitespace, just the whitespace in the current text node.
isStartOfParagraph(visibleUpstreamPos) || upstream == 0,
- isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.length());
+ isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.length() - 1);
if (string != rebalancedString)
replaceTextInNode(textNode, upstream, length, rebalancedString);
diff --git a/Source/WebCore/editing/CompositeEditCommand.h b/Source/WebCore/editing/CompositeEditCommand.h
index 9066b65..6db4eb1 100644
--- a/Source/WebCore/editing/CompositeEditCommand.h
+++ b/Source/WebCore/editing/CompositeEditCommand.h
@@ -71,10 +71,7 @@ protected:
void mergeIdenticalElements(PassRefPtr<Element>, PassRefPtr<Element>);
void rebalanceWhitespace();
void rebalanceWhitespaceAt(const Position&);
- void rebalanceWhitespaceOnTextSubstring(RefPtr<Text>, int startOffset, int endOffset);
void prepareWhitespaceAtPositionForSplit(Position&);
- bool canRebalance(const Position&) const;
- bool shouldRebalanceLeadingWhitespaceFor(const String&) const;
void removeCSSProperty(PassRefPtr<StyledElement>, CSSPropertyID);
void removeNodeAttribute(PassRefPtr<Element>, const QualifiedName& attribute);
void removeChildrenInRange(PassRefPtr<Node>, unsigned from, unsigned to);
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index 3acec27..23b41ce 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -1173,12 +1173,7 @@ bool Editor::insertText(const String& text, Event* triggeringEvent)
return m_frame->eventHandler()->handleTextInputEvent(text, triggeringEvent);
}
-bool Editor::insertTextForConfirmedComposition(const String& text)
-{
- return m_frame->eventHandler()->handleTextInputEvent(text, 0, TextEventInputComposition);
-}
-
-bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectInsertedText, TextEvent* triggeringEvent)
+bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectInsertedText, Event* triggeringEvent)
{
if (text.isEmpty())
return false;
@@ -1200,8 +1195,7 @@ bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectIn
RefPtr<Document> document = selectionStart->document();
// Insert the text
- TypingCommand::insertText(document.get(), text, selection, selectInsertedText,
- triggeringEvent && triggeringEvent->isComposition() ? TypingCommand::TextCompositionConfirm : TypingCommand::TextCompositionNone);
+ TypingCommand::insertText(document.get(), text, selection, selectInsertedText);
// Reveal the current selection
if (Frame* editedFrame = document->frame())
@@ -1624,7 +1618,7 @@ void Editor::confirmComposition(const String& text, bool preserveSelection)
m_compositionNode = 0;
m_customCompositionUnderlines.clear();
- insertTextForConfirmedComposition(text);
+ insertText(text, 0);
if (preserveSelection) {
m_frame->selection()->setSelection(oldSelection, false, false);
@@ -1693,7 +1687,7 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
m_customCompositionUnderlines.clear();
if (!text.isEmpty()) {
- TypingCommand::insertText(m_frame->document(), text, true, TypingCommand::TextCompositionUpdate);
+ TypingCommand::insertText(m_frame->document(), text, true, true);
// Find out what node has the composition now.
Position base = m_frame->selection()->base().downstream();
diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h
index 1e6e387..2e61ce6 100644
--- a/Source/WebCore/editing/Editor.h
+++ b/Source/WebCore/editing/Editor.h
@@ -198,8 +198,7 @@ public:
static bool commandIsSupportedFromMenuOrKeyBinding(const String& commandName); // Works without a frame.
bool insertText(const String&, Event* triggeringEvent);
- bool insertTextForConfirmedComposition(const String& text);
- bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, TextEvent* triggeringEvent);
+ bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, Event* triggeringEvent);
bool insertLineBreak();
bool insertParagraphSeparator();
diff --git a/Source/WebCore/editing/InsertTextCommand.cpp b/Source/WebCore/editing/InsertTextCommand.cpp
index 74a111a..fc18e91 100644
--- a/Source/WebCore/editing/InsertTextCommand.cpp
+++ b/Source/WebCore/editing/InsertTextCommand.cpp
@@ -106,7 +106,7 @@ bool InsertTextCommand::performTrivialReplace(const String& text, bool selectIns
return true;
}
-void InsertTextCommand::input(const String& text, bool selectInsertedText, RebalanceType whitespaceRebalance)
+void InsertTextCommand::input(const String& text, bool selectInsertedText)
{
ASSERT(text.find('\n') == notFound);
@@ -172,17 +172,11 @@ void InsertTextCommand::input(const String& text, bool selectInsertedText, Rebal
insertTextIntoNode(textNode, offset, text);
endPosition = Position(textNode, offset + text.length());
- if (whitespaceRebalance == RebalanceLeadingAndTrailingWhitespaces) {
- // The insertion may require adjusting adjacent whitespace, if it is present.
- rebalanceWhitespaceAt(endPosition);
- // Rebalancing on both sides isn't necessary if we've inserted only spaces.
- if (!shouldRebalanceLeadingWhitespaceFor(text))
- rebalanceWhitespaceAt(startPosition);
- } else {
- ASSERT(whitespaceRebalance == RebalanceAllWhitespaces);
- if (canRebalance(startPosition) && canRebalance(endPosition))
- rebalanceWhitespaceOnTextSubstring(textNode, startPosition.deprecatedEditingOffset(), endPosition.deprecatedEditingOffset());
- }
+ // The insertion may require adjusting adjacent whitespace, if it is present.
+ rebalanceWhitespaceAt(endPosition);
+ // Rebalancing on both sides isn't necessary if we've inserted a space.
+ if (text != " ")
+ rebalanceWhitespaceAt(startPosition);
}
// We could have inserted a part of composed character sequence,
diff --git a/Source/WebCore/editing/InsertTextCommand.h b/Source/WebCore/editing/InsertTextCommand.h
index 672e576..77ae016 100644
--- a/Source/WebCore/editing/InsertTextCommand.h
+++ b/Source/WebCore/editing/InsertTextCommand.h
@@ -32,20 +32,14 @@ namespace WebCore {
class InsertTextCommand : public CompositeEditCommand {
public:
- enum RebalanceType {
- RebalanceLeadingAndTrailingWhitespaces,
- RebalanceAllWhitespaces
- };
-
static PassRefPtr<InsertTextCommand> create(Document* document)
{
return adoptRef(new InsertTextCommand(document));
}
- void input(const String& text, bool selectInsertedText = false, RebalanceType = RebalanceLeadingAndTrailingWhitespaces);
+ void input(const String& text, bool selectInsertedText = false);
private:
-
InsertTextCommand(Document*);
void deleteCharacter();
diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp
index 21d4314..d54b388 100644
--- a/Source/WebCore/editing/TypingCommand.cpp
+++ b/Source/WebCore/editing/TypingCommand.cpp
@@ -47,8 +47,7 @@ namespace WebCore {
using namespace HTMLNames;
-TypingCommand::TypingCommand(Document *document, ETypingCommand commandType, const String &textToInsert, bool selectInsertedText, TextGranularity granularity, TextCompositionType compositionType,
- bool killRing)
+TypingCommand::TypingCommand(Document *document, ETypingCommand commandType, const String &textToInsert, bool selectInsertedText, TextGranularity granularity, bool killRing)
: CompositeEditCommand(document),
m_commandType(commandType),
m_textToInsert(textToInsert),
@@ -56,7 +55,6 @@ TypingCommand::TypingCommand(Document *document, ETypingCommand commandType, con
m_selectInsertedText(selectInsertedText),
m_smartDelete(false),
m_granularity(granularity),
- m_compositionType(compositionType),
m_killRing(killRing),
m_openedByBackwardDelete(false)
{
@@ -135,18 +133,18 @@ void TypingCommand::updateSelectionIfDifferentFromCurrentSelection(TypingCommand
}
-void TypingCommand::insertText(Document* document, const String& text, bool selectInsertedText, TextCompositionType composition)
+void TypingCommand::insertText(Document* document, const String& text, bool selectInsertedText, bool insertedTextIsComposition)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
- insertText(document, text, frame->selection()->selection(), selectInsertedText, composition);
+ insertText(document, text, frame->selection()->selection(), selectInsertedText, insertedTextIsComposition);
}
// FIXME: We shouldn't need to take selectionForInsertion. It should be identical to SelectionController's current selection.
-void TypingCommand::insertText(Document* document, const String& text, const VisibleSelection& selectionForInsertion, bool selectInsertedText, TextCompositionType compositionType)
+void TypingCommand::insertText(Document* document, const String& text, const VisibleSelection& selectionForInsertion, bool selectInsertedText, bool insertedTextIsComposition)
{
#if REMOVE_MARKERS_UPON_EDITING
if (!text.isEmpty())
@@ -163,7 +161,7 @@ void TypingCommand::insertText(Document* document, const String& text, const Vis
String newText = text;
Node* startNode = selectionForInsertion.start().node();
- if (startNode && startNode->rootEditableElement() && compositionType != TextCompositionUpdate) {
+ if (startNode && startNode->rootEditableElement() && !insertedTextIsComposition) {
// Send BeforeTextInsertedEvent. The event handler will update text if necessary.
ExceptionCode ec = 0;
RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
@@ -184,13 +182,11 @@ void TypingCommand::insertText(Document* document, const String& text, const Vis
lastTypingCommand->setStartingSelection(selectionForInsertion);
lastTypingCommand->setEndingSelection(selectionForInsertion);
}
-
- lastTypingCommand->setCompositionType(compositionType);
lastTypingCommand->insertText(newText, selectInsertedText);
return;
}
- RefPtr<TypingCommand> cmd = TypingCommand::create(document, InsertText, newText, selectInsertedText, compositionType);
+ RefPtr<TypingCommand> cmd = TypingCommand::create(document, InsertText, newText, selectInsertedText);
if (changeSelection) {
cmd->setStartingSelection(selectionForInsertion);
cmd->setEndingSelection(selectionForInsertion);
@@ -390,8 +386,7 @@ void TypingCommand::insertTextRunWithoutNewlines(const String &text, bool select
command->setStartingSelection(endingSelection());
command->setEndingSelection(endingSelection());
}
- command->input(text, selectInsertedText,
- m_compositionType == TextCompositionNone ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces : InsertTextCommand::RebalanceAllWhitespaces);
+ command->input(text, selectInsertedText);
typingAddedToOpenCommand(InsertText);
}
diff --git a/Source/WebCore/editing/TypingCommand.h b/Source/WebCore/editing/TypingCommand.h
index b34bdc1..284ebc0 100644
--- a/Source/WebCore/editing/TypingCommand.h
+++ b/Source/WebCore/editing/TypingCommand.h
@@ -42,17 +42,11 @@ public:
InsertParagraphSeparatorInQuotedContent
};
- enum TextCompositionType {
- TextCompositionNone,
- TextCompositionUpdate,
- TextCompositionConfirm
- };
-
static void deleteSelection(Document*, bool smartDelete = false);
static void deleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity, bool killRing = false);
static void forwardDeleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity, bool killRing = false);
- static void insertText(Document*, const String&, bool selectInsertedText = false, TextCompositionType = TextCompositionNone);
- static void insertText(Document*, const String&, const VisibleSelection&, bool selectInsertedText = false, TextCompositionType = TextCompositionNone);
+ static void insertText(Document*, const String&, bool selectInsertedText = false, bool insertedTextIsComposition = false);
+ static void insertText(Document*, const String&, const VisibleSelection&, bool selectInsertedText = false, bool insertedTextIsComposition = false);
static void insertLineBreak(Document*);
static void insertParagraphSeparator(Document*);
static void insertParagraphSeparatorInQuotedContent(Document*);
@@ -70,20 +64,14 @@ public:
void deleteKeyPressed(TextGranularity, bool killRing);
void forwardDeleteKeyPressed(TextGranularity, bool killRing);
void deleteSelection(bool smartDelete);
- void setCompositionType(TextCompositionType type) { m_compositionType = type; }
private:
static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand command, const String& text = "", bool selectInsertedText = false, TextGranularity granularity = CharacterGranularity, bool killRing = false)
{
- return adoptRef(new TypingCommand(document, command, text, selectInsertedText, granularity, TextCompositionNone, killRing));
- }
-
- static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand command, const String& text, bool selectInsertedText, TextCompositionType compositionType)
- {
- return adoptRef(new TypingCommand(document, command, text, selectInsertedText, CharacterGranularity, compositionType, false));
+ return adoptRef(new TypingCommand(document, command, text, selectInsertedText, granularity, killRing));
}
- TypingCommand(Document*, ETypingCommand, const String& text, bool selectInsertedText, TextGranularity, TextCompositionType, bool killRing);
+ TypingCommand(Document*, ETypingCommand, const String& text, bool selectInsertedText, TextGranularity, bool killRing);
bool smartDelete() const { return m_smartDelete; }
void setSmartDelete(bool smartDelete) { m_smartDelete = smartDelete; }
@@ -106,7 +94,6 @@ private:
bool m_selectInsertedText;
bool m_smartDelete;
TextGranularity m_granularity;
- TextCompositionType m_compositionType;
bool m_killRing;
bool m_preservesTypingStyle;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list