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( ...@@ -2769,6 +2769,21 @@ uint64_t WebFrameWidgetBase::GetScrollableContainerIdAt(
return HitTestResultAt(point).GetScrollableContainerId(); 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( void WebFrameWidgetBase::SetEditCommandsForNextKeyEvent(
Vector<mojom::blink::EditCommandPtr> edit_commands) { Vector<mojom::blink::EditCommandPtr> edit_commands) {
edit_commands_ = std::move(edit_commands); edit_commands_ = std::move(edit_commands);
......
...@@ -206,6 +206,7 @@ class CORE_EXPORT WebFrameWidgetBase ...@@ -206,6 +206,7 @@ class CORE_EXPORT WebFrameWidgetBase
bool IsProvisional() override; bool IsProvisional() override;
uint64_t GetScrollableContainerIdAt( uint64_t GetScrollableContainerIdAt(
const gfx::PointF& point_in_dips) override; const gfx::PointF& point_in_dips) override;
bool ShouldHandleImeEvents() override;
void SetEditCommandsForNextKeyEvent( void SetEditCommandsForNextKeyEvent(
Vector<mojom::blink::EditCommandPtr> edit_commands) override; Vector<mojom::blink::EditCommandPtr> edit_commands) override;
......
...@@ -307,17 +307,6 @@ void WebFrameWidgetImpl::UpdateMainFrameLayoutSize() { ...@@ -307,17 +307,6 @@ void WebFrameWidgetImpl::UpdateMainFrameLayoutSize() {
view->SetLayoutSize(WebSize(layout_size)); 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() { bool WebFrameWidgetImpl::ScrollFocusedEditableElementIntoView() {
Element* element = FocusedElement(); Element* element = FocusedElement();
if (!element || !WebElement(element).IsEditable()) if (!element || !WebElement(element).IsEditable())
......
...@@ -94,9 +94,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase { ...@@ -94,9 +94,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase {
// WebFrameWidgetBase overrides: // WebFrameWidgetBase overrides:
void DidCreateLocalRootView() override; void DidCreateLocalRootView() override;
// FrameWidget overrides:
bool ShouldHandleImeEvents() override;
void UpdateMainFrameLayoutSize(); void UpdateMainFrameLayoutSize();
private: private:
......
...@@ -92,10 +92,6 @@ void WebViewFrameWidget::Resize(const gfx::Size& size) { ...@@ -92,10 +92,6 @@ void WebViewFrameWidget::Resize(const gfx::Size& size) {
web_view_->Resize(size); web_view_->Resize(size);
} }
bool WebViewFrameWidget::ShouldHandleImeEvents() {
return HasFocus();
}
bool WebViewFrameWidget::ScrollFocusedEditableElementIntoView() { bool WebViewFrameWidget::ScrollFocusedEditableElementIntoView() {
return web_view_->ScrollFocusedEditableElementIntoView(); return web_view_->ScrollFocusedEditableElementIntoView();
} }
......
...@@ -68,9 +68,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase { ...@@ -68,9 +68,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
// WebFrameWidget overrides: // WebFrameWidget overrides:
bool ScrollFocusedEditableElementIntoView() override; bool ScrollFocusedEditableElementIntoView() override;
// FrameWidget overrides:
bool ShouldHandleImeEvents() override;
private: private:
// PageWidgetEventHandler overrides: // PageWidgetEventHandler overrides:
WebInputEventResult HandleGestureEvent(const WebGestureEvent&) override; 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