Commit 75acd20e authored by Marshall Greenblatt's avatar Marshall Greenblatt

Fix OSR PDF mouse events after keyboard input (issue #2078)

parent 8e69e3dc
......@@ -935,6 +935,12 @@ void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
}
}
void CefRenderWidgetHostViewOSR::ProcessKeyboardEvent(
const content::NativeWebKeyboardEvent& event,
const ui::LatencyInfo& latency) {
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(event, latency);
}
void CefRenderWidgetHostViewOSR::ProcessMouseEvent(
const blink::WebMouseEvent& event,
const ui::LatencyInfo& latency) {
......@@ -1159,9 +1165,15 @@ void CefRenderWidgetHostViewOSR::Invalidate(
void CefRenderWidgetHostViewOSR::SendKeyEvent(
const content::NativeWebKeyboardEvent& event) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
if (!render_widget_host_)
return;
render_widget_host_->ForwardKeyboardEvent(event);
if (render_widget_host_ && render_widget_host_->GetView()) {
// Direct routing requires that events go directly to the View.
render_widget_host_->GetView()->ProcessKeyboardEvent(
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
event.GetType() ==
blink::WebInputEvent::kRawKeyDown
? ui::SourceEventType::KEY_PRESS
: ui::SourceEventType::OTHER));
}
}
void CefRenderWidgetHostViewOSR::SendMouseEvent(
......@@ -1422,12 +1434,13 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
// Notify the guest hosts if any.
for (auto guest_host_view : guest_host_views_) {
if (guest_host_view->render_widget_host() &&
guest_host_view->render_widget_host()->delegate()) {
guest_host_view->render_widget_host()
->delegate()
->UpdateDeviceScaleFactor(new_scale_factor);
}
content::RenderWidgetHostImpl* rwhi = guest_host_view->render_widget_host();
if (!rwhi)
continue;
if (rwhi->delegate())
rwhi->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
if (rwhi->GetView())
rwhi->GetView()->set_current_device_scale_factor(new_scale_factor);
}
}
......@@ -1558,6 +1571,8 @@ void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback(
base::MakeUnique<base::Closure>(base::Bind(
&CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped,
weak_ptr_factory_.GetWeakPtr(), base::Unretained(guest_host_view))));
guest_host_view->set_current_device_scale_factor(
current_device_scale_factor_);
}
void CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped(
......
......@@ -178,6 +178,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void SetNeedsBeginFrames(bool enabled) override;
void ProcessKeyboardEvent(const content::NativeWebKeyboardEvent& event,
const ui::LatencyInfo& latency) override;
void ProcessMouseEvent(const blink::WebMouseEvent& event,
const ui::LatencyInfo& latency) override;
void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event,
......
......@@ -69,6 +69,9 @@ patches = [
#
# Support creation of captionless windows with resizable borders.
# https://bitbucket.org/chromiumembedded/cef/issues/1749
#
# Support configuration of RWHVGuest device scale factor.
# https://bitbucket.org/chromiumembedded/cef/issues/2078
'name': 'views_widget_180_1481_1565_1677_1749',
},
{
......
......@@ -18,7 +18,7 @@ index 527e5ea..de52a1e 100644
return renderer_frame_number_;
}
diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h
index 904897a..38f6e28 100644
index 904897a..4454205 100644
--- content/browser/renderer_host/render_widget_host_view_base.h
+++ content/browser/renderer_host/render_widget_host_view_base.h
@@ -72,6 +72,7 @@ class BrowserAccessibilityDelegate;
......@@ -29,7 +29,17 @@ index 904897a..38f6e28 100644
class SyntheticGestureTarget;
class TextInputManager;
class TouchSelectionControllerClientManager;
@@ -119,6 +120,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
@@ -88,6 +89,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
float current_device_scale_factor() const {
return current_device_scale_factor_;
}
+ void set_current_device_scale_factor(float scale_factor) {
+ current_device_scale_factor_ = scale_factor;
+ }
// Returns the focused RenderWidgetHost inside this |view|'s RWH.
RenderWidgetHostImpl* GetFocusedWidget() const;
@@ -119,6 +123,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
void EndFrameSubscription() override;
void FocusedNodeTouched(const gfx::Point& location_dips_screen,
bool editable) override;
......@@ -38,7 +48,7 @@ index 904897a..38f6e28 100644
// This only needs to be overridden by RenderWidgetHostViewBase subclasses
// that handle content embedded within other RenderWidgetHostViews.
@@ -355,6 +358,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
@@ -355,6 +361,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// helps to position the full screen widget on the correct monitor.
virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0;
......@@ -51,7 +61,7 @@ index 904897a..38f6e28 100644
// Sets the cursor to the one associated with the specified cursor_type
virtual void UpdateCursor(const WebCursor& cursor) = 0;
@@ -469,6 +478,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
@@ -469,6 +481,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
const bool wheel_scroll_latching_enabled_;
......
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