Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(737)

Unified Diff: Source/core/editing/Editor.cpp

Issue 19357002: Simplify code for getting selected text. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/Editor.cpp
diff --git a/Source/core/editing/Editor.cpp b/Source/core/editing/Editor.cpp
index aab685505819d06a020b0069f0200288b463500e..f55faceb0d38d3f57230a8ec6916eb3974f8908d 100644
--- a/Source/core/editing/Editor.cpp
+++ b/Source/core/editing/Editor.cpp
@@ -1247,13 +1247,7 @@ 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()) {
- 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));
+ target->dispatchEvent(CompositionEvent::create(eventNames().compositionstartEvent, m_frame->document()->domWindow(), selectedText()));
event = CompositionEvent::create(eventNames().compositionupdateEvent, m_frame->document()->domWindow(), text);
}
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698