Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
index 6c6229206f60bef3f80699470ae1c146f9b393c2..8636c12cd91ac249f1e5628ea1b1a4223cc77839 100644 |
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
@@ -118,7 +118,6 @@ WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, |
background_color_override_(Color::kTransparent), |
base_background_color_override_enabled_(false), |
base_background_color_override_(Color::kTransparent), |
- ime_accept_events_(true), |
self_keep_alive_(this) { |
DCHECK(local_root_->GetFrame()->IsLocalRoot()); |
InitializeLayerTreeView(); |
@@ -461,7 +460,7 @@ void WebFrameWidgetImpl::UpdateBaseBackgroundColor() { |
WebInputMethodController* |
WebFrameWidgetImpl::GetActiveWebInputMethodController() const { |
WebLocalFrameBase* local_frame = |
- WebLocalFrameBase::FromFrame(FocusedLocalFrameInWidget()); |
+ WebLocalFrameBase::FromFrame(FocusedLocalFrame()); |
return local_frame ? local_frame->GetInputMethodController() : nullptr; |
} |
@@ -538,7 +537,7 @@ void WebFrameWidgetImpl::SetFocus(bool enable) { |
} |
ime_accept_events_ = true; |
} else { |
- LocalFrame* focused_frame = FocusedLocalFrameInWidget(); |
+ LocalFrame* focused_frame = FocusedLocalFrame(); |
if (focused_frame) { |
// Finish an ongoing composition to delete the composition node. |
if (focused_frame->GetInputMethodController().HasComposition()) { |
@@ -559,7 +558,10 @@ void WebFrameWidgetImpl::SetFocus(bool enable) { |
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This |
// code needs to be refactored (http://crbug.com/629721). |
WebRange WebFrameWidgetImpl::CompositionRange() { |
- LocalFrame* focused = FocusedLocalFrameAvailableForIme(); |
+ if (!ime_accept_events_) |
+ return WebRange(); |
+ |
+ LocalFrame* focused = FocusedLocalFrame(); |
if (!focused) |
return WebRange(); |
@@ -592,7 +594,7 @@ WebColor WebFrameWidgetImpl::BackgroundColor() const { |
// code needs to be refactored (http://crbug.com/629721). |
bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor, |
WebRect& focus) const { |
- const LocalFrame* local_frame = FocusedLocalFrameInWidget(); |
+ const LocalFrame* local_frame = FocusedLocalFrame(); |
if (!local_frame) |
return false; |
@@ -641,7 +643,7 @@ bool WebFrameWidgetImpl::SelectionBounds(WebRect& anchor, |
// code needs to be refactored (http://crbug.com/629721). |
bool WebFrameWidgetImpl::SelectionTextDirection(WebTextDirection& start, |
WebTextDirection& end) const { |
- const LocalFrame* frame = FocusedLocalFrameInWidget(); |
+ const LocalFrame* frame = FocusedLocalFrame(); |
if (!frame) |
return false; |
@@ -667,7 +669,7 @@ bool WebFrameWidgetImpl::SelectionTextDirection(WebTextDirection& start, |
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This |
// code needs to be refactored (http://crbug.com/629721). |
bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const { |
- if (const LocalFrame* frame = FocusedLocalFrameInWidget()) { |
+ if (const LocalFrame* frame = FocusedLocalFrame()) { |
FrameSelection& selection = frame->Selection(); |
return selection.IsAvailable() && |
selection.ComputeVisibleSelectionInDOMTreeDeprecated().IsBaseFirst(); |
@@ -678,7 +680,7 @@ bool WebFrameWidgetImpl::IsSelectionAnchorFirst() const { |
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This |
// code needs to be refactored (http://crbug.com/629721). |
WebRange WebFrameWidgetImpl::CaretOrSelectionRange() { |
- LocalFrame* focused = FocusedLocalFrameInWidget(); |
+ LocalFrame* focused = FocusedLocalFrame(); |
if (!focused) |
return WebRange(); |
@@ -694,7 +696,7 @@ void WebFrameWidgetImpl::SetTextDirection(WebTextDirection direction) { |
// the text direction of the selected node and updates its DOM "dir" |
// attribute and its CSS "direction" property. |
// So, we just call the function as Safari does. |
- const LocalFrame* focused = FocusedLocalFrameInWidget(); |
+ const LocalFrame* focused = FocusedLocalFrame(); |
if (!focused) |
return; |
@@ -746,7 +748,7 @@ bool WebFrameWidgetImpl::GetCompositionCharacterBounds( |
if (range.IsEmpty()) |
return false; |
- LocalFrame* frame = FocusedLocalFrameInWidget(); |
+ LocalFrame* frame = FocusedLocalFrame(); |
if (!frame) |
return false; |
@@ -1193,17 +1195,4 @@ HitTestResult WebFrameWidgetImpl::HitTestResultForRootFramePos( |
return result; |
} |
-LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameInWidget() const { |
- LocalFrame* frame = GetPage()->GetFocusController().FocusedFrame(); |
- return (frame && frame->LocalFrameRoot() == local_root_->GetFrame()) |
- ? frame |
- : nullptr; |
-} |
- |
-LocalFrame* WebFrameWidgetImpl::FocusedLocalFrameAvailableForIme() const { |
- if (!ime_accept_events_) |
- return nullptr; |
- return FocusedLocalFrameInWidget(); |
-} |
- |
} // namespace blink |