Commit 30454ba2 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move some subframe methods into WebFrameWidgetBase.

These methods are only called from the browser and we can assert
they are executed for subframes.

BUG=1097816

Change-Id: I152102fc55360769ebec3594aed03d3d452ccbfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537574Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828300}
parent 0a5c2755
......@@ -448,14 +448,16 @@ void RenderWidgetHostViewChildFrame::UpdateViewportIntersection(
}
void RenderWidgetHostViewChildFrame::SetIsInert() {
if (host() && frame_connector_) {
// Do not send inert to main frames.
if (host() && frame_connector_ && !host()->owner_delegate()) {
host_->GetAssociatedFrameWidget()->SetIsInertForSubFrame(
frame_connector_->IsInert());
}
}
void RenderWidgetHostViewChildFrame::UpdateInheritedEffectiveTouchAction() {
if (host_ && frame_connector_) {
// Do not send inherited touch action to main frames.
if (host_ && frame_connector_ && !host()->owner_delegate()) {
host_->GetAssociatedFrameWidget()
->SetInheritedEffectiveTouchActionForSubFrame(
frame_connector_->InheritedEffectiveTouchAction());
......@@ -463,7 +465,8 @@ void RenderWidgetHostViewChildFrame::UpdateInheritedEffectiveTouchAction() {
}
void RenderWidgetHostViewChildFrame::UpdateRenderThrottlingStatus() {
if (host() && frame_connector_) {
// Do not send throttling status to main frames.
if (host() && frame_connector_ && !host()->owner_delegate()) {
host_->GetAssociatedFrameWidget()->UpdateRenderThrottlingStatusForSubFrame(
frame_connector_->IsThrottled(),
frame_connector_->IsSubtreeThrottled());
......
......@@ -405,6 +405,20 @@ void WebFrameWidgetBase::SetTextDirection(base::i18n::TextDirection direction) {
focusedFrame->SetTextDirection(direction);
}
void WebFrameWidgetBase::SetInheritedEffectiveTouchActionForSubFrame(
TouchAction touch_action) {
DCHECK(ForSubframe());
LocalRootImpl()->GetFrame()->SetInheritedEffectiveTouchAction(touch_action);
}
void WebFrameWidgetBase::UpdateRenderThrottlingStatusForSubFrame(
bool is_throttled,
bool subtree_throttled) {
DCHECK(ForSubframe());
LocalRootImpl()->GetFrameView()->UpdateRenderThrottlingStatus(
is_throttled, subtree_throttled, true);
}
#if defined(OS_MAC)
void WebFrameWidgetBase::GetStringAtPoint(const gfx::Point& point_in_local_root,
GetStringAtPointCallback callback) {
......@@ -1309,6 +1323,11 @@ void WebFrameWidgetBase::DisableDeviceEmulation() {
device_emulator_ = nullptr;
}
void WebFrameWidgetBase::SetIsInertForSubFrame(bool inert) {
DCHECK(ForSubframe());
LocalRootImpl()->GetFrame()->SetIsInert(inert);
}
base::Optional<gfx::Point>
WebFrameWidgetBase::GetAndResetContextMenuLocation() {
return std::move(host_context_menu_location_);
......
......@@ -439,14 +439,13 @@ class CORE_EXPORT WebFrameWidgetBase
void SetTextDirection(base::i18n::TextDirection direction) override;
// Sets the inherited effective touch action on an out-of-process iframe.
void SetInheritedEffectiveTouchActionForSubFrame(
WebTouchAction touch_action) override {}
WebTouchAction touch_action) override;
// Toggles render throttling for an out-of-process iframe. Local frames are
// throttled based on their visibility in the viewport, but remote frames
// have to have throttling information propagated from parent to child
// across processes.
void UpdateRenderThrottlingStatusForSubFrame(
bool is_throttled,
bool subtree_throttled) override {}
void UpdateRenderThrottlingStatusForSubFrame(bool is_throttled,
bool subtree_throttled) override;
void ShowContextMenu(ui::mojom::MenuSourceType source_type,
const gfx::Point& location) override;
void SetViewportIntersection(
......@@ -455,7 +454,7 @@ class CORE_EXPORT WebFrameWidgetBase
void DisableDeviceEmulation() override;
// Sets the inert bit on an out-of-process iframe, causing it to ignore
// input.
void SetIsInertForSubFrame(bool inert) override {}
void SetIsInertForSubFrame(bool inert) override;
#if defined(OS_MAC)
void GetStringAtPoint(const gfx::Point& point_in_local_root,
GetStringAtPointCallback callback) override;
......
......@@ -398,28 +398,6 @@ void WebFrameWidgetImpl::FocusChanged(bool enable) {
}
}
void WebFrameWidgetImpl::SetIsInertForSubFrame(bool inert) {
DCHECK(LocalRootImpl()->Parent());
DCHECK(LocalRootImpl()->Parent()->IsWebRemoteFrame());
LocalRootImpl()->GetFrame()->SetIsInert(inert);
}
void WebFrameWidgetImpl::SetInheritedEffectiveTouchActionForSubFrame(
TouchAction touch_action) {
DCHECK(LocalRootImpl()->Parent());
DCHECK(LocalRootImpl()->Parent()->IsWebRemoteFrame());
LocalRootImpl()->GetFrame()->SetInheritedEffectiveTouchAction(touch_action);
}
void WebFrameWidgetImpl::UpdateRenderThrottlingStatusForSubFrame(
bool is_throttled,
bool subtree_throttled) {
DCHECK(LocalRootImpl()->Parent());
DCHECK(LocalRootImpl()->Parent()->IsWebRemoteFrame());
LocalRootImpl()->GetFrameView()->UpdateRenderThrottlingStatus(
is_throttled, subtree_throttled, true);
}
void WebFrameWidgetImpl::HandleMouseLeave(LocalFrame& main_frame,
const WebMouseEvent& event) {
// FIXME: WebWidget doesn't have the method below.
......
......@@ -95,10 +95,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase {
DocumentUpdateReason reason) override;
void MouseCaptureLost() override;
void SetIsInertForSubFrame(bool) override;
void SetInheritedEffectiveTouchActionForSubFrame(TouchAction) override;
void UpdateRenderThrottlingStatusForSubFrame(bool is_throttled,
bool subtree_throttled) override;
// WebFrameWidget implementation.
bool ScrollFocusedEditableElementIntoView() 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