summaryrefslogtreecommitdiff
path: root/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/browser/renderer_host/render_widget_host_view_aura.cc')
-rw-r--r--chromium/content/browser/renderer_host/render_widget_host_view_aura.cc262
1 files changed, 161 insertions, 101 deletions
diff --git a/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc b/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc
index ebf2d257e64..861122e9908 100644
--- a/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -14,7 +14,6 @@
#include "base/debug/stack_trace.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -91,6 +90,7 @@
#include "ui/events/event_utils.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
#include "ui/events/gestures/gesture_recognizer.h"
+#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -107,8 +107,8 @@
#include "content/browser/accessibility/browser_accessibility_manager_win.h"
#include "content/browser/accessibility/browser_accessibility_win.h"
#include "content/browser/renderer_host/legacy_render_widget_host_win.h"
-#include "ui/base/ime/win/osk_display_manager.h"
-#include "ui/base/ime/win/osk_display_observer.h"
+#include "ui/base/ime/input_method_keyboard_controller.h"
+#include "ui/base/ime/input_method_keyboard_controller_observer.h"
#include "ui/base/win/hidden_window.h"
#include "ui/display/win/screen_win.h"
#include "ui/gfx/gdi_util.h"
@@ -138,26 +138,37 @@ namespace content {
namespace {
+// Callback from embedding the renderer.
+void EmbedCallback(bool result) {
+ if (!result)
+ DVLOG(1) << "embed failed";
+}
+
+} // namespace
+
#if defined(OS_WIN)
-// This class implements the ui::OnScreenKeyboardObserver interface
+// This class implements the ui::InputMethodKeyboardControllerObserver interface
// which provides notifications about the on screen keyboard on Windows getting
// displayed or hidden in response to taps on editable fields.
// It provides functionality to request blink to scroll the input field if it
// is obscured by the on screen keyboard.
-class WinScreenKeyboardObserver : public ui::OnScreenKeyboardObserver {
+class WinScreenKeyboardObserver
+ : public ui::InputMethodKeyboardControllerObserver {
public:
WinScreenKeyboardObserver(RenderWidgetHostViewAura* host_view)
: host_view_(host_view) {
host_view_->SetInsets(gfx::Insets());
+ if (auto* input_method = host_view_->GetInputMethod())
+ input_method->GetInputMethodKeyboardController()->AddObserver(this);
}
~WinScreenKeyboardObserver() override {
- if (auto* instance = ui::OnScreenKeyboardDisplayManager::GetInstance())
- instance->RemoveObserver(this);
+ if (auto* input_method = host_view_->GetInputMethod())
+ input_method->GetInputMethodKeyboardController()->RemoveObserver(this);
}
- // base::win::OnScreenKeyboardObserver overrides.
+ // InputMethodKeyboardControllerObserver overrides.
void OnKeyboardVisible(const gfx::Rect& keyboard_rect) override {
host_view_->SetInsets(gfx::Insets(
0, 0, keyboard_rect.IsEmpty() ? 0 : keyboard_rect.height(), 0));
@@ -175,14 +186,6 @@ class WinScreenKeyboardObserver : public ui::OnScreenKeyboardObserver {
};
#endif // defined(OS_WIN)
-// Callback from embedding the renderer.
-void EmbedCallback(bool result) {
- if (!result)
- DVLOG(1) << "embed failed";
-}
-
-} // namespace
-
// We need to watch for mouse events outside a Web Popup or its parent
// and dismiss the popup for certain events.
class RenderWidgetHostViewAura::EventFilterForPopupExit
@@ -349,7 +352,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(
popup_child_host_view_(nullptr),
is_loading_(false),
has_composition_text_(false),
- background_color_(SK_ColorWHITE),
needs_begin_frames_(false),
added_frame_observer_(false),
cursor_visibility_state_in_renderer_(UNKNOWN),
@@ -578,7 +580,7 @@ void RenderWidgetHostViewAura::SetWantsAnimateOnlyBeginFrames() {
}
void RenderWidgetHostViewAura::OnBeginFrame(base::TimeTicks frame_time) {
- host()->ProgressFling(frame_time);
+ host()->ProgressFlingIfNeeded(frame_time);
UpdateNeedsBeginFramesInternal();
}
@@ -637,6 +639,12 @@ bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const {
return delegated_frame_host_->CanCopyFromCompositingSurface();
}
+void RenderWidgetHostViewAura::EnsureSurfaceSynchronizedForLayoutTest() {
+ ++latest_capture_sequence_number_;
+ SynchronizeVisualProperties(cc::DeadlinePolicy::UseInfiniteDeadline(),
+ base::nullopt);
+}
+
bool RenderWidgetHostViewAura::IsShowing() {
return window_->IsVisible();
}
@@ -650,18 +658,19 @@ void RenderWidgetHostViewAura::WasUnOccluded() {
ui::LatencyInfo renderer_latency_info, browser_latency_info;
if (has_saved_frame) {
browser_latency_info.AddLatencyNumber(ui::TAB_SHOW_COMPONENT,
- host()->GetLatencyComponentId(), 0);
+ host()->GetLatencyComponentId());
browser_latency_info.set_trace_id(++tab_show_sequence_);
} else {
renderer_latency_info.AddLatencyNumber(ui::TAB_SHOW_COMPONENT,
- host()->GetLatencyComponentId(), 0);
+ host()->GetLatencyComponentId());
renderer_latency_info.set_trace_id(++tab_show_sequence_);
}
// If the primary surface was evicted, we should create a new primary.
- if (features::IsSurfaceSynchronizationEnabled() && delegated_frame_host_ &&
+ if (delegated_frame_host_ &&
delegated_frame_host_->IsPrimarySurfaceEvicted()) {
- WasResized(cc::DeadlinePolicy::UseDefaultDeadline());
+ SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
+ base::nullopt);
}
TRACE_EVENT_ASYNC_BEGIN0("latency", "TabSwitching::Latency",
@@ -714,26 +723,10 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const {
return window_->GetBoundsInScreen();
}
-void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) {
- // The renderer will feed its color back to us with the first CompositorFrame.
- // We short-cut here to show a sensible color before that happens.
- UpdateBackgroundColorFromRenderer(color);
-
- DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
- SkColorGetA(color) == SK_AlphaTRANSPARENT);
- host()->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE);
-}
-
-SkColor RenderWidgetHostViewAura::background_color() const {
- return background_color_;
-}
-
-void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer(
- SkColor color) {
- if (color == background_color())
- return;
- background_color_ = color;
+void RenderWidgetHostViewAura::UpdateBackgroundColor() {
+ DCHECK(GetBackgroundColor());
+ SkColor color = *GetBackgroundColor();
bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
window_->layer()->SetFillsBoundsOpaquely(opaque);
window_->layer()->SetColor(color);
@@ -759,24 +752,24 @@ gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() const {
void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) {
if (insets != insets_) {
insets_ = insets;
- host()->WasResized(!insets_.IsEmpty());
+ host()->SynchronizeVisualProperties(!insets_.IsEmpty());
}
}
-void RenderWidgetHostViewAura::FocusedNodeTouched(
- bool editable) {
+void RenderWidgetHostViewAura::FocusedNodeTouched(bool editable) {
#if defined(OS_WIN)
- ui::OnScreenKeyboardDisplayManager* osk_display_manager =
- ui::OnScreenKeyboardDisplayManager::GetInstance();
- DCHECK(osk_display_manager);
+ auto* input_method = GetInputMethod();
+ if (!input_method)
+ return;
+ auto* controller = input_method->GetInputMethodKeyboardController();
if (editable && host()->GetView() && host()->delegate()) {
keyboard_observer_.reset(new WinScreenKeyboardObserver(this));
- if (!osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()))
+ if (!controller->DisplayVirtualKeyboard())
keyboard_observer_.reset(nullptr);
virtual_keyboard_requested_ = keyboard_observer_.get();
} else {
virtual_keyboard_requested_ = false;
- osk_display_manager->DismissVirtualKeyboard();
+ controller->DismissVirtualKeyboard();
}
#endif
}
@@ -844,6 +837,10 @@ gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const {
: RenderWidgetHostViewBase::GetRequestedRendererSize();
}
+uint32_t RenderWidgetHostViewAura::GetCaptureSequenceNumber() const {
+ return latest_capture_sequence_number_;
+}
+
void RenderWidgetHostViewAura::CopyFromSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
@@ -883,17 +880,10 @@ void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink(
void RenderWidgetHostViewAura::SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
- viz::mojom::HitTestRegionListPtr hit_test_region_list) {
+ base::Optional<viz::HitTestRegionList> hit_test_region_list) {
DCHECK(delegated_frame_host_);
TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame");
- // Override the background color to the current compositor background.
- // This allows us to, when navigating to a new page, transfer this color to
- // that page. This allows us to pass this background color to new views on
- // navigation.
- // TODO(yiyix): Remove this line when https://crbug.com/830540 is fixed.
- UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color);
-
delegated_frame_host_->SubmitCompositorFrame(
local_surface_id, std::move(frame), std::move(hit_test_region_list));
}
@@ -909,12 +899,18 @@ void RenderWidgetHostViewAura::ClearCompositorFrame() {
delegated_frame_host_->ClearDelegatedFrame();
}
+bool RenderWidgetHostViewAura::RequestRepaintForTesting() {
+ return SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
+ base::nullopt);
+}
+
void RenderWidgetHostViewAura::DidStopFlinging() {
selection_controller_client_->OnScrollCompleted();
}
-gfx::Vector2d RenderWidgetHostViewAura::GetOffsetFromRootSurface() {
- return window_->GetBoundsInRootWindow().OffsetFromOrigin();
+void RenderWidgetHostViewAura::TransformPointToRootSurface(gfx::PointF* point) {
+ aura::Window::ConvertPointToTarget(window_, window_->GetRootWindow(), point);
+ window_->GetRootWindow()->transform().TransformPoint(point);
}
gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
@@ -1150,8 +1146,8 @@ void RenderWidgetHostViewAura::UnlockMouse() {
}
bool RenderWidgetHostViewAura::LockKeyboard(
- base::Optional<base::flat_set<int>> keys) {
- return event_handler_->LockKeyboard(std::move(keys));
+ base::Optional<base::flat_set<ui::DomCode>> codes) {
+ return event_handler_->LockKeyboard(std::move(codes));
}
void RenderWidgetHostViewAura::UnlockKeyboard() {
@@ -1162,6 +1158,14 @@ bool RenderWidgetHostViewAura::IsKeyboardLocked() {
return event_handler_->IsKeyboardLocked();
}
+base::flat_map<std::string, std::string>
+RenderWidgetHostViewAura::GetKeyboardLayoutMap() {
+ aura::WindowTreeHost* host = window_->GetHost();
+ if (host)
+ return host->GetKeyboardLayoutMap();
+ return {};
+}
+
////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostViewAura, ui::TextInputClient implementation:
void RenderWidgetHostViewAura::SetCompositionText(
@@ -1311,6 +1315,23 @@ bool RenderWidgetHostViewAura::HasCompositionText() const {
return has_composition_text_;
}
+ui::TextInputClient::FocusReason RenderWidgetHostViewAura::GetFocusReason()
+ const {
+ if (!HasFocus())
+ return ui::TextInputClient::FOCUS_REASON_NONE;
+
+ switch (last_pointer_type_before_focus_) {
+ case ui::EventPointerType::POINTER_TYPE_MOUSE:
+ return ui::TextInputClient::FOCUS_REASON_MOUSE;
+ case ui::EventPointerType::POINTER_TYPE_PEN:
+ return ui::TextInputClient::FOCUS_REASON_PEN;
+ case ui::EventPointerType::POINTER_TYPE_TOUCH:
+ return ui::TextInputClient::FOCUS_REASON_TOUCH;
+ default:
+ return ui::TextInputClient::FOCUS_REASON_OTHER;
+ }
+}
+
bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const {
if (!text_input_manager_ || !GetFocusedWidget())
return false;
@@ -1440,7 +1461,15 @@ void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent(
ui::TextEditCommand command) {}
const std::string& RenderWidgetHostViewAura::GetClientSourceInfo() const {
- return GetFocusedFrame()->GetLastCommittedURL().spec();
+ RenderFrameHostImpl* frame = GetFocusedFrame();
+ if (frame) {
+ return frame->GetLastCommittedURL().spec();
+ }
+ return base::EmptyString();
+}
+
+bool RenderWidgetHostViewAura::ShouldDoLearning() {
+ return GetTextInputManager() && GetTextInputManager()->should_do_learning();
}
////////////////////////////////////////////////////////////////////////////////
@@ -1580,6 +1609,7 @@ void RenderWidgetHostViewAura::GetHitTestMask(gfx::Path* mask) const {
// RenderWidgetHostViewAura, ui::EventHandler implementation:
void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
+ last_pointer_type_ = ui::EventPointerType::POINTER_TYPE_UNKNOWN;
event_handler_->OnKeyEvent(event);
}
@@ -1593,10 +1623,11 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
last_mouse_move_location_ = event->location();
}
#endif
+ last_pointer_type_ = ui::EventPointerType::POINTER_TYPE_MOUSE;
event_handler_->OnMouseEvent(event);
}
-bool RenderWidgetHostViewAura::TransformPointToLocalCoordSpace(
+bool RenderWidgetHostViewAura::TransformPointToLocalCoordSpaceLegacy(
const gfx::PointF& point,
const viz::SurfaceId& original_surface,
gfx::PointF* transformed_point) {
@@ -1607,7 +1638,7 @@ bool RenderWidgetHostViewAura::TransformPointToLocalCoordSpace(
// TODO: this shouldn't be used with aura-mus, so that the null check so
// go away and become a DCHECK.
if (delegated_frame_host_ &&
- !delegated_frame_host_->TransformPointToLocalCoordSpace(
+ !delegated_frame_host_->TransformPointToLocalCoordSpaceLegacy(
point_in_pixels, original_surface, transformed_point))
return false;
*transformed_point =
@@ -1618,7 +1649,8 @@ bool RenderWidgetHostViewAura::TransformPointToLocalCoordSpace(
bool RenderWidgetHostViewAura::TransformPointToCoordSpaceForView(
const gfx::PointF& point,
RenderWidgetHostViewBase* target_view,
- gfx::PointF* transformed_point) {
+ gfx::PointF* transformed_point,
+ viz::EventSource source) {
if (target_view == this || !delegated_frame_host_) {
*transformed_point = point;
return true;
@@ -1628,11 +1660,11 @@ bool RenderWidgetHostViewAura::TransformPointToCoordSpaceForView(
// but it is not necessary here because the final target view is responsible
// for converting before computing the final transform.
return delegated_frame_host_->TransformPointToCoordSpaceForView(
- point, target_view, transformed_point);
+ point, target_view, transformed_point, source);
}
viz::FrameSinkId RenderWidgetHostViewAura::GetRootFrameSinkId() {
- if (window_->GetHost()->compositor())
+ if (window_ && window_->GetHost() && window_->GetHost()->compositor())
return window_->GetHost()->compositor()->frame_sink_id();
return viz::FrameSinkId();
}
@@ -1645,16 +1677,25 @@ viz::SurfaceId RenderWidgetHostViewAura::GetCurrentSurfaceId() const {
void RenderWidgetHostViewAura::FocusedNodeChanged(
bool editable,
const gfx::Rect& node_bounds_in_screen) {
- if (GetInputMethod())
- GetInputMethod()->CancelComposition(this);
+ // The last gesture most likely caused the focus change. The focus reason will
+ // be incorrect if the focus was triggered without a user gesture.
+ // TODO(https://crbug.com/824604): Get the focus reason from the renderer
+ // process instead to get the true focus reason.
+ last_pointer_type_before_focus_ = last_pointer_type_;
+
+ auto* input_method = GetInputMethod();
+ if (input_method)
+ input_method->CancelComposition(this);
has_composition_text_ = false;
#if defined(OS_WIN)
- if (!editable && virtual_keyboard_requested_) {
+ if (!editable && virtual_keyboard_requested_ && window_) {
virtual_keyboard_requested_ = false;
- DCHECK(ui::OnScreenKeyboardDisplayManager::GetInstance());
- ui::OnScreenKeyboardDisplayManager::GetInstance()->DismissVirtualKeyboard();
+ if (input_method) {
+ input_method->GetInputMethodKeyboardController()
+ ->DismissVirtualKeyboard();
+ }
}
#endif
}
@@ -1662,7 +1703,7 @@ void RenderWidgetHostViewAura::FocusedNodeChanged(
void RenderWidgetHostViewAura::ScheduleEmbed(
ui::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)> callback) {
- DCHECK(features::IsMusEnabled());
+ DCHECK(features::IsMashEnabled());
aura::Env::GetInstance()->ScheduleEmbed(std::move(client),
std::move(callback));
}
@@ -1672,10 +1713,12 @@ void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
}
void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
+ last_pointer_type_ = event->pointer_details().pointer_type;
event_handler_->OnTouchEvent(event);
}
void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
+ last_pointer_type_ = event->details().primary_pointer_type();
event_handler_->OnGestureEvent(event);
}
@@ -1797,7 +1840,7 @@ void RenderWidgetHostViewAura::OnRenderFrameMetadataChanged() {
RenderWidgetHostViewBase::OnRenderFrameMetadataChanged();
const cc::RenderFrameMetadata& metadata =
host()->render_frame_metadata_provider()->LastRenderFrameMetadata();
- UpdateBackgroundColorFromRenderer(metadata.root_background_color);
+ SetContentBackgroundColor(metadata.root_background_color);
if (metadata.selection.start != selection_start_ ||
metadata.selection.end != selection_end_) {
@@ -1875,13 +1918,14 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
window_->SetType(type);
window_->Init(ui::LAYER_SOLID_COLOR);
- window_->layer()->SetColor(background_color_);
+ window_->layer()->SetColor(GetBackgroundColor() ? *GetBackgroundColor()
+ : SK_ColorWHITE);
// This needs to happen only after |window_| has been initialized using
// Init(), because it needs to have the layer.
if (frame_sink_id_.is_valid())
window_->SetEmbedFrameSinkId(frame_sink_id_);
- if (!features::IsMusEnabled())
+ if (!features::IsMashEnabled())
return;
// Embed the renderer into the Window.
@@ -1903,8 +1947,7 @@ void RenderWidgetHostViewAura::CreateDelegatedFrameHostClient() {
const bool enable_viz =
base::FeatureList::IsEnabled(features::kVizDisplayCompositor);
delegated_frame_host_ = std::make_unique<DelegatedFrameHost>(
- frame_sink_id_, delegated_frame_host_client_.get(),
- features::IsSurfaceSynchronizationEnabled(), enable_viz,
+ frame_sink_id_, delegated_frame_host_client_.get(), enable_viz,
false /* should_register_frame_sink_id */);
// Let the page-level input event router know about our surface ID
@@ -1981,10 +2024,14 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
}
}
-void RenderWidgetHostViewAura::WasResized(
- const cc::DeadlinePolicy& deadline_policy) {
- window_->AllocateLocalSurfaceId();
- SyncSurfaceProperties(deadline_policy);
+bool RenderWidgetHostViewAura::SynchronizeVisualProperties(
+ const cc::DeadlinePolicy& deadline_policy,
+ const base::Optional<viz::LocalSurfaceId>&
+ child_allocated_local_surface_id) {
+ DCHECK(window_);
+ window_->UpdateLocalSurfaceIdFromEmbeddedClient(
+ child_allocated_local_surface_id);
+ return SyncSurfaceProperties(deadline_policy);
}
ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const {
@@ -2122,23 +2169,20 @@ void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) {
#endif
}
-void RenderWidgetHostViewAura::SyncSurfaceProperties(
+bool RenderWidgetHostViewAura::SyncSurfaceProperties(
const cc::DeadlinePolicy& deadline_policy) {
if (IsLocalSurfaceIdAllocationSuppressed())
- return;
+ return false;
if (delegated_frame_host_) {
- delegated_frame_host_->WasResized(window_->GetLocalSurfaceId(),
- window_->bounds().size(),
- deadline_policy);
+ delegated_frame_host_->SynchronizeVisualProperties(
+ window_->GetLocalSurfaceId(), window_->bounds().size(),
+ deadline_policy);
}
// Note that |host_| will retrieve resize parameters from
- // |delegated_frame_host_|, so it must have WasResized called after.
- host()->WasResized();
- if (host()->auto_resize_enabled()) {
- host()->DidAllocateLocalSurfaceIdForAutoResize(
- host()->last_auto_resize_request_number());
- }
+ // |delegated_frame_host_|, so it must have SynchronizeVisualProperties called
+ // after.
+ return host()->SynchronizeVisualProperties();
}
#if defined(OS_WIN)
@@ -2230,6 +2274,11 @@ void RenderWidgetHostViewAura::DetachFromInputMethod() {
wm::RestoreWindowBoundsOnClientFocusLost(window_->GetToplevelWindow());
#endif // defined(OS_CHROMEOS)
}
+
+#if defined(OS_WIN)
+ // Reset the keyboard observer because it attaches to the input method.
+ keyboard_observer_.reset();
+#endif // defined(OS_WIN)
}
void RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo(
@@ -2420,15 +2469,18 @@ void RenderWidgetHostViewAura::ScrollFocusedEditableNodeIntoRect(
}
void RenderWidgetHostViewAura::OnSynchronizedDisplayPropertiesChanged() {
- WasResized(cc::DeadlinePolicy::UseDefaultDeadline());
+ SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
+ base::nullopt);
}
-viz::ScopedSurfaceIdAllocator RenderWidgetHostViewAura::ResizeDueToAutoResize(
- const gfx::Size& new_size,
- uint64_t sequence_number) {
+viz::ScopedSurfaceIdAllocator
+RenderWidgetHostViewAura::DidUpdateVisualProperties(
+ const cc::RenderFrameMetadata& metadata) {
base::OnceCallback<void()> allocation_task = base::BindOnce(
- &RenderWidgetHostViewAura::WasResized, weak_ptr_factory_.GetWeakPtr(),
- cc::DeadlinePolicy::UseDefaultDeadline());
+ base::IgnoreResult(
+ &RenderWidgetHostViewAura::SynchronizeVisualProperties),
+ weak_ptr_factory_.GetWeakPtr(), cc::DeadlinePolicy::UseDefaultDeadline(),
+ metadata.local_surface_id);
return window_->GetSurfaceIdAllocator(std::move(allocation_task));
}
@@ -2443,7 +2495,8 @@ void RenderWidgetHostViewAura::DidNavigate() {
if (is_first_navigation_) {
SyncSurfaceProperties(cc::DeadlinePolicy::UseExistingDeadline());
} else {
- WasResized(cc::DeadlinePolicy::UseExistingDeadline());
+ SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
+ base::nullopt);
}
if (delegated_frame_host_)
delegated_frame_host_->DidNavigate();
@@ -2458,6 +2511,10 @@ RenderWidgetHostViewAura::AllocateFrameSinkIdForGuestViewHack() {
->AllocateFrameSinkId();
}
+MouseWheelPhaseHandler* RenderWidgetHostViewAura::GetMouseWheelPhaseHandler() {
+ return &event_handler_->mouse_wheel_phase_handler();
+}
+
void RenderWidgetHostViewAura::TakeFallbackContentFrom(
RenderWidgetHostView* view) {
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)
@@ -2466,7 +2523,10 @@ void RenderWidgetHostViewAura::TakeFallbackContentFrom(
->IsRenderWidgetHostViewGuest());
RenderWidgetHostViewAura* view_aura =
static_cast<RenderWidgetHostViewAura*>(view);
- SetBackgroundColor(view_aura->background_color());
+ base::Optional<SkColor> color = view_aura->GetBackgroundColor();
+ if (color)
+ SetBackgroundColor(*color);
+
if (delegated_frame_host_ && view_aura->delegated_frame_host_) {
delegated_frame_host_->TakeFallbackContentFrom(
view_aura->delegated_frame_host_.get());