Commit 13560dc4 authored by sahel's avatar sahel Committed by Commit Bot

Fling_Scheduler_mac returns proper compositor in oopif

This cl changes the fling scheduler mac to get the root view for oopifs so
that it has BrowserCompositor. Without this change fling|autoscroll inside
an oopif on mac would not work when viz is enabled.

On Non-mac platforms GetNativeView() in GetCompositor() takes care of going
through the nested oopifs.

The added browsertests will fail without this patch when viz is enabled.

Bug: 249063
Test: BrowserSideFlingBrowserTest.(Touchpad|Touchscreen)FlingInOOPIF
Change-Id: I3ccf3fc4356c6c467bb5714110e88d284b0d559a
Reviewed-on: https://chromium-review.googlesource.com/1195655
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587646}
parent 152b082f
......@@ -5,6 +5,7 @@
#include "content/browser/renderer_host/input/fling_scheduler_mac.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "ui/compositor/compositor.h"
......@@ -15,16 +16,20 @@ FlingSchedulerMac::FlingSchedulerMac(RenderWidgetHostImpl* host)
FlingSchedulerMac::~FlingSchedulerMac() = default;
ui::Compositor* FlingSchedulerMac::GetCompositor() {
if (!host_->GetView())
RenderWidgetHostViewBase* view = host_->GetView();
if (!view)
return nullptr;
// RWHV_child_frame doesn't have DelegatedFrameHost with ui::Compositor.
if (host_->GetView()->IsRenderWidgetHostViewChildFrame())
return nullptr;
RenderWidgetHostViewMac* view =
static_cast<RenderWidgetHostViewMac*>(host_->GetView());
if (view->BrowserCompositor())
return view->BrowserCompositor()->GetCompositor();
if (view->IsRenderWidgetHostViewChildFrame()) {
view = view->GetRootView();
if (!view)
return nullptr;
}
RenderWidgetHostViewMac* mac_view =
static_cast<RenderWidgetHostViewMac*>(view);
if (mac_view->BrowserCompositor())
return mac_view->BrowserCompositor()->GetCompositor();
return nullptr;
}
......
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