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

Unified Diff: components/test_runner/text_input_controller.cc

Issue 2012823003: Move IME related functions from WebFrame to WebLocalFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CHECK in TextInputController::HasMarkedText() Created 4 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 | « components/test_runner/test_runner_for_specific_view.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/text_input_controller.cc
diff --git a/components/test_runner/text_input_controller.cc b/components/test_runner/text_input_controller.cc
index 041eff98c8ac2a543b1279c406917d0c5468d73b..a10d84962d81da8aafeef0139a49305bf42a98fd 100644
--- a/components/test_runner/text_input_controller.cc
+++ b/components/test_runner/text_input_controller.cc
@@ -166,8 +166,14 @@ void TextInputController::UnmarkText() {
}
void TextInputController::DoCommand(const std::string& text) {
- if (view()->mainFrame())
- view()->mainFrame()->executeCommand(blink::WebString::fromUTF8(text));
+ if (view()->mainFrame()) {
+ if (!view()->mainFrame()->toWebLocalFrame()) {
+ CHECK(false) << "This function cannot be called if the main frame is not"
+ "a local frame.";
+ }
+ view()->mainFrame()->toWebLocalFrame()->executeCommand(
+ blink::WebString::fromUTF8(text));
+ }
}
void TextInputController::SetMarkedText(const std::string& text,
@@ -199,14 +205,27 @@ void TextInputController::SetMarkedText(const std::string& text,
}
bool TextInputController::HasMarkedText() {
- return view()->mainFrame() && view()->mainFrame()->hasMarkedText();
+ if (!view()->mainFrame())
+ return false;
+
+ if (!view()->mainFrame()->toWebLocalFrame()) {
+ CHECK(false) << "This function cannot be called if the main frame is not"
+ "a local frame.";
+ }
+
+ return view()->mainFrame()->toWebLocalFrame()->hasMarkedText();
}
std::vector<int> TextInputController::MarkedRange() {
if (!view()->mainFrame())
return std::vector<int>();
- blink::WebRange range = view()->mainFrame()->markedRange();
+ if (!view()->mainFrame()->toWebLocalFrame()) {
+ CHECK(false) << "This function cannot be called if the main frame is not"
+ "a local frame.";
+ }
+
+ blink::WebRange range = view()->mainFrame()->toWebLocalFrame()->markedRange();
std::vector<int> int_array(2);
int_array[0] = range.startOffset();
int_array[1] = range.endOffset();
@@ -218,7 +237,13 @@ std::vector<int> TextInputController::SelectedRange() {
if (!view()->mainFrame())
return std::vector<int>();
- blink::WebRange range = view()->mainFrame()->selectionRange();
+ if (!view()->mainFrame()->toWebLocalFrame()) {
+ CHECK(false) << "This function cannot be called if the main frame is not"
+ "a local frame.";
+ }
+
+ blink::WebRange range =
+ view()->mainFrame()->toWebLocalFrame()->selectionRange();
if (range.isNull())
return std::vector<int>();
std::vector<int> int_array(2);
« no previous file with comments | « components/test_runner/test_runner_for_specific_view.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698