Chromium Code Reviews| 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..d4248b66276b691148725ff0efced6d826be6196 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,20 @@ void TextInputController::SetMarkedText(const std::string& text, |
| } |
|
yabinh
2016/07/08 02:42:53
I think we don't need to CHECK here, because if it
dcheng
2016/07/08 03:31:09
Right, but fundamentally, we shouldn't be calling
yabinh
2016/07/08 04:22:54
OK. It's been added to the latest patch. Please ta
|
| bool TextInputController::HasMarkedText() { |
| - return view()->mainFrame() && view()->mainFrame()->hasMarkedText(); |
| + return view()->mainFrame() && view()->mainFrame()->isWebLocalFrame() && |
| + 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 +230,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); |