Fix crash when hovering buttons in OSR PDF viewer (issue #2488)

This commit is contained in:
Marshall Greenblatt 2018-09-14 11:18:10 +02:00
parent f97a241126
commit c7d187a512
2 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "content/browser/bad_message.h" #include "content/browser/bad_message.h"
#include "content/browser/compositor/image_transport_factory.h" #include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h" #include "content/browser/frame_host/render_widget_host_view_guest.h"
#include "content/browser/renderer_host/cursor_manager.h"
#include "content/browser/renderer_host/dip_util.h" #include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h"
@ -277,6 +278,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
if (browser_impl_.get()) if (browser_impl_.get())
ResizeRootLayer(false); ResizeRootLayer(false);
cursor_manager_.reset(new content::CursorManager(this));
// Do this last because it may result in a call to SetNeedsBeginFrames. // Do this last because it may result in a call to SetNeedsBeginFrames.
render_widget_host_->SetView(this); render_widget_host_->SetView(this);
} }
@ -636,6 +639,10 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
#endif #endif
} }
content::CursorManager* CefRenderWidgetHostViewOSR::GetCursorManager() {
return cursor_manager_.get();
}
void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {} void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {}
void CefRenderWidgetHostViewOSR::RenderProcessGone( void CefRenderWidgetHostViewOSR::RenderProcessGone(

View File

@ -44,6 +44,7 @@ class RenderWidgetHost;
class RenderWidgetHostImpl; class RenderWidgetHostImpl;
class RenderWidgetHostViewGuest; class RenderWidgetHostViewGuest;
class BackingStore; class BackingStore;
class CursorManager;
} // namespace content } // namespace content
class CefBeginFrameTimer; class CefBeginFrameTimer;
@ -153,6 +154,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
int error_code) override; int error_code) override;
void Destroy() override; void Destroy() override;
void SetTooltipText(const base::string16& tooltip_text) override; void SetTooltipText(const base::string16& tooltip_text) override;
content::CursorManager* GetCursorManager() override;
gfx::Size GetCompositorViewportPixelSize() const override; gfx::Size GetCompositorViewportPixelSize() const override;
void CopyFromSurface( void CopyFromSurface(
@ -346,6 +348,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
std::unique_ptr<ui::XScopedCursor> invisible_cursor_; std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
#endif #endif
std::unique_ptr<content::CursorManager> cursor_manager_;
// Used to control the VSync rate in subprocesses when BeginFrame scheduling // Used to control the VSync rate in subprocesses when BeginFrame scheduling
// is enabled. // is enabled.
std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_; std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_;