Commit 525249c4 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move ShouldHandleImeEvents into WebFrameWidgetBase

Collapse into a single implementation.

BUG=1097816

Change-Id: Idae56771c51bc475aef708a7cfe616cd5598540e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543688
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829287}
parent 2c4a576a
......@@ -2769,6 +2769,21 @@ uint64_t WebFrameWidgetBase::GetScrollableContainerIdAt(
return HitTestResultAt(point).GetScrollableContainerId();
}
bool WebFrameWidgetBase::ShouldHandleImeEvents() {
if (ForMainFrame()) {
return HasFocus();
} else {
// TODO(ekaramad): main frame widget returns true only if it has focus.
// We track page focus in all WebViews on the page but the WebFrameWidgets
// corresponding to child local roots do not get the update. For now, this
// method returns true when the WebFrameWidget is for a child local frame,
// i.e., IME events will be processed regardless of page focus. We should
// revisit this after page focus for OOPIFs has been fully resolved
// (https://crbug.com/689777).
return LocalRootImpl();
}
}
void WebFrameWidgetBase::SetEditCommandsForNextKeyEvent(
Vector<mojom::blink::EditCommandPtr> edit_commands) {
edit_commands_ = std::move(edit_commands);
......
......@@ -206,6 +206,7 @@ class CORE_EXPORT WebFrameWidgetBase
bool IsProvisional() override;
uint64_t GetScrollableContainerIdAt(
const gfx::PointF& point_in_dips) override;
bool ShouldHandleImeEvents() override;
void SetEditCommandsForNextKeyEvent(
Vector<mojom::blink::EditCommandPtr> edit_commands) override;
......
......@@ -307,17 +307,6 @@ void WebFrameWidgetImpl::UpdateMainFrameLayoutSize() {
view->SetLayoutSize(WebSize(layout_size));
}
bool WebFrameWidgetImpl::ShouldHandleImeEvents() {
// TODO(ekaramad): WebViewWidgetImpl returns true only if it has focus.
// We track page focus in all RenderViews on the page but
// the RenderWidgets corresponding to child local roots do not get the
// update. For now, this method returns true when the RenderWidget is for a
// child local frame, i.e., IME events will be processed regardless of page
// focus. We should revisit this after page focus for OOPIFs has been fully
// resolved (https://crbug.com/689777).
return LocalRootImpl();
}
bool WebFrameWidgetImpl::ScrollFocusedEditableElementIntoView() {
Element* element = FocusedElement();
if (!element || !WebElement(element).IsEditable())
......
......@@ -94,9 +94,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase {
// WebFrameWidgetBase overrides:
void DidCreateLocalRootView() override;
// FrameWidget overrides:
bool ShouldHandleImeEvents() override;
void UpdateMainFrameLayoutSize();
private:
......
......@@ -92,10 +92,6 @@ void WebViewFrameWidget::Resize(const gfx::Size& size) {
web_view_->Resize(size);
}
bool WebViewFrameWidget::ShouldHandleImeEvents() {
return HasFocus();
}
bool WebViewFrameWidget::ScrollFocusedEditableElementIntoView() {
return web_view_->ScrollFocusedEditableElementIntoView();
}
......
......@@ -68,9 +68,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
// WebFrameWidget overrides:
bool ScrollFocusedEditableElementIntoView() override;
// FrameWidget overrides:
bool ShouldHandleImeEvents() override;
private:
// PageWidgetEventHandler overrides:
WebInputEventResult HandleGestureEvent(const WebGestureEvent&) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment