Index: Source/core/editing/Editor.cpp |
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp |
index 7baf56420357f5d5d84106362208503a1d2470b8..f1678fe550eb71964fff83f03081a60a05ada366 100644 |
--- a/Source/core/editing/Editor.cpp |
+++ b/Source/core/editing/Editor.cpp |
@@ -1247,7 +1247,13 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin |
// We should send a compositionstart event only when the given text is not empty because this |
// function doesn't create a composition node when the text is empty. |
if (!text.isEmpty()) { |
- target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->document()->domWindow(), text)); |
+ FrameSelection* selection = m_frame->selection(); |
+ String selectionText; |
+ if (selection->isRange()) { |
+ RefPtr<Range> range = selection->toNormalizedRange(); |
+ selectionText = plainText(range.get()); |
+ } |
+ target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->document()->domWindow(), selectionText)); |
rniwa-cr
2013/07/15 21:46:52
You could have simply called selectedText() here a
kochi
2013/07/16 09:50:41
Done.
|
event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->document()->domWindow(), text); |
} |
} else { |