Commit 660e8283 authored by slangley's avatar slangley Committed by Commit bot

Move WebViewFrameWidget to use WebViewBase rather than WebViewImpl.

We WebViewFrameWidget keeps a RefPtr to WebViewImpl we need to make WebViewBase
ref counted. Removed the ref counted from WebViewImpl when moving it to
WebViewBase.

BUG=712963

Review-Url: https://codereview.chromium.org/2850113002
Cr-Commit-Position: refs/heads/master@{#468310}
parent 51b20818
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define WebViewBase_h #define WebViewBase_h
#include "platform/transforms/TransformationMatrix.h" #include "platform/transforms/TransformationMatrix.h"
#include "platform/wtf/RefCounted.h"
#include "public/platform/WebDisplayMode.h" #include "public/platform/WebDisplayMode.h"
#include "public/platform/WebInputEventResult.h" #include "public/platform/WebInputEventResult.h"
#include "public/web/WebElement.h" #include "public/web/WebElement.h"
...@@ -13,18 +14,24 @@ ...@@ -13,18 +14,24 @@
namespace blink { namespace blink {
class AnimationWorkletProxyClient;
class CompositorAnimationHost;
class CompositorWorkerProxyClient;
class CompositorAnimationTimeline; class CompositorAnimationTimeline;
class ContextMenuProvider; class ContextMenuProvider;
class DevToolsEmulator; class DevToolsEmulator;
class Frame; class Frame;
class GraphicsLayer; class GraphicsLayer;
class HitTestResult;
class Page; class Page;
class PaintLayerCompositor; class PaintLayerCompositor;
class PagePopup; class PagePopup;
class PagePopupClient; class PagePopupClient;
class PageScaleConstraintsSet; class PageScaleConstraintsSet;
class WebInputEvent; class WebInputEvent;
class WebInputMethodControllerImpl;
class WebKeyboardEvent; class WebKeyboardEvent;
class WebLayer;
class WebLocalFrameImpl; class WebLocalFrameImpl;
class WebLayerTreeView; class WebLayerTreeView;
class WebPagePopupImpl; class WebPagePopupImpl;
...@@ -38,8 +45,10 @@ struct WebRect; ...@@ -38,8 +45,10 @@ struct WebRect;
// //
// Once WebViewImpl is moved from web to core/exported then this class should be // Once WebViewImpl is moved from web to core/exported then this class should be
// removed and clients can once again depend on WebViewImpl. // removed and clients can once again depend on WebViewImpl.
class WebViewBase : public WebView { class WebViewBase : public WebView, public RefCounted<WebViewBase> {
public: public:
virtual ~WebViewBase() {}
virtual void SetBaseBackgroundColor(WebColor) = 0; virtual void SetBaseBackgroundColor(WebColor) = 0;
virtual void SetBaseBackgroundColorOverride(WebColor) = 0; virtual void SetBaseBackgroundColorOverride(WebColor) = 0;
virtual void ClearBaseBackgroundColorOverride() = 0; virtual void ClearBaseBackgroundColorOverride() = 0;
...@@ -146,6 +155,24 @@ class WebViewBase : public WebView { ...@@ -146,6 +155,24 @@ class WebViewBase : public WebView {
virtual double LastFrameTimeMonotonic() const = 0; virtual double LastFrameTimeMonotonic() const = 0;
static const WebInputEvent* CurrentInputEvent(); static const WebInputEvent* CurrentInputEvent();
virtual void SetCompositorVisibility(bool) = 0;
using WebWidget::SetSuppressFrameRequestsWorkaroundFor704763Only;
using WebWidget::RecordWheelAndTouchScrollingCount;
using WebWidget::GetCompositionCharacterBounds;
// Returns the currently active WebInputMethodController which is the one
// corresponding to the focused frame. It will return nullptr if there is no
// focused frame, or if there is one but it belongs to a different local
// root.
virtual WebInputMethodControllerImpl* GetActiveWebInputMethodController()
const = 0;
virtual void ScheduleAnimationForWidget() = 0;
virtual CompositorWorkerProxyClient* CreateCompositorWorkerProxyClient() = 0;
virtual AnimationWorkletProxyClient* CreateAnimationWorkletProxyClient() = 0;
virtual void SetRootGraphicsLayer(GraphicsLayer*) = 0;
virtual void SetRootLayer(WebLayer*) = 0;
virtual CompositorAnimationHost* AnimationHost() const = 0;
virtual HitTestResult CoreHitTestResultAt(const WebPoint&) = 0;
}; };
} }
......
...@@ -4,14 +4,15 @@ ...@@ -4,14 +4,15 @@
#include "web/WebViewFrameWidget.h" #include "web/WebViewFrameWidget.h"
#include "core/exported/WebViewBase.h"
#include "core/layout/HitTestResult.h"
#include "web/WebInputMethodControllerImpl.h" #include "web/WebInputMethodControllerImpl.h"
#include "web/WebLocalFrameImpl.h" #include "web/WebLocalFrameImpl.h"
#include "web/WebViewImpl.h"
namespace blink { namespace blink {
WebViewFrameWidget::WebViewFrameWidget(WebWidgetClient& client, WebViewFrameWidget::WebViewFrameWidget(WebWidgetClient& client,
WebViewImpl& web_view, WebViewBase& web_view,
WebLocalFrameImpl& main_frame) WebLocalFrameImpl& main_frame)
: client_(&client), web_view_(&web_view), main_frame_(&main_frame) { : client_(&client), web_view_(&web_view), main_frame_(&main_frame) {
main_frame_->SetFrameWidget(this); main_frame_->SetFrameWidget(this);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace blink { namespace blink {
class WebViewImpl; class WebViewBase;
class WebWidgetClient; class WebWidgetClient;
// Shim class to help normalize the widget interfaces in the Blink public API. // Shim class to help normalize the widget interfaces in the Blink public API.
...@@ -28,7 +28,7 @@ class WebWidgetClient; ...@@ -28,7 +28,7 @@ class WebWidgetClient;
// and just forwards almost everything to it. // and just forwards almost everything to it.
// After the embedder starts using a WebFrameWidget for the main frame, // After the embedder starts using a WebFrameWidget for the main frame,
// WebView will be updated to no longer inherit WebWidget. The eventual goal is // WebView will be updated to no longer inherit WebWidget. The eventual goal is
// to unfork the widget code duplicated in WebFrameWidgetImpl and WebViewImpl // to unfork the widget code duplicated in WebFrameWidgetImpl and WebViewBase
// into one class. // into one class.
// A more detailed writeup of this transition can be read at // A more detailed writeup of this transition can be read at
// https://goo.gl/7yVrnb. // https://goo.gl/7yVrnb.
...@@ -37,7 +37,7 @@ class WebViewFrameWidget : public WebFrameWidgetBase { ...@@ -37,7 +37,7 @@ class WebViewFrameWidget : public WebFrameWidgetBase {
public: public:
explicit WebViewFrameWidget(WebWidgetClient&, explicit WebViewFrameWidget(WebWidgetClient&,
WebViewImpl&, WebViewBase&,
WebLocalFrameImpl&); WebLocalFrameImpl&);
virtual ~WebViewFrameWidget(); virtual ~WebViewFrameWidget();
...@@ -109,7 +109,7 @@ class WebViewFrameWidget : public WebFrameWidgetBase { ...@@ -109,7 +109,7 @@ class WebViewFrameWidget : public WebFrameWidgetBase {
private: private:
WebWidgetClient* client_; WebWidgetClient* client_;
RefPtr<WebViewImpl> web_view_; RefPtr<WebViewBase> web_view_;
Persistent<WebLocalFrameImpl> main_frame_; Persistent<WebLocalFrameImpl> main_frame_;
}; };
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include "platform/scheduler/child/web_scheduler.h" #include "platform/scheduler/child/web_scheduler.h"
#include "platform/wtf/Compiler.h" #include "platform/wtf/Compiler.h"
#include "platform/wtf/HashSet.h" #include "platform/wtf/HashSet.h"
#include "platform/wtf/RefCounted.h"
#include "platform/wtf/Vector.h" #include "platform/wtf/Vector.h"
#include "public/platform/WebDisplayMode.h" #include "public/platform/WebDisplayMode.h"
#include "public/platform/WebFloatSize.h" #include "public/platform/WebFloatSize.h"
...@@ -98,7 +97,6 @@ class WebViewScheduler; ...@@ -98,7 +97,6 @@ class WebViewScheduler;
class WEB_EXPORT WebViewImpl final class WEB_EXPORT WebViewImpl final
: NON_EXPORTED_BASE(public WebViewBase), : NON_EXPORTED_BASE(public WebViewBase),
public RefCounted<WebViewImpl>,
NON_EXPORTED_BASE(public WebGestureCurveTarget), NON_EXPORTED_BASE(public WebGestureCurveTarget),
public PageWidgetEventHandler, public PageWidgetEventHandler,
public WebScheduler::InterventionReporter, public WebScheduler::InterventionReporter,
...@@ -267,7 +265,7 @@ class WEB_EXPORT WebViewImpl final ...@@ -267,7 +265,7 @@ class WEB_EXPORT WebViewImpl final
float ClampPageScaleFactorToLimits(float) const override; float ClampPageScaleFactorToLimits(float) const override;
void ResetScaleStateImmediately() override; void ResetScaleStateImmediately() override;
HitTestResult CoreHitTestResultAt(const WebPoint&); HitTestResult CoreHitTestResultAt(const WebPoint&) override;
void InvalidateRect(const IntRect&) override; void InvalidateRect(const IntRect&) override;
void SetBaseBackgroundColor(WebColor) override; void SetBaseBackgroundColor(WebColor) override;
...@@ -462,7 +460,7 @@ class WEB_EXPORT WebViewImpl final ...@@ -462,7 +460,7 @@ class WEB_EXPORT WebViewImpl final
WebRect ComputeBlockBound(const WebPoint&, bool ignore_clipping); WebRect ComputeBlockBound(const WebPoint&, bool ignore_clipping);
WebLayerTreeView* LayerTreeView() const override { return layer_tree_view_; } WebLayerTreeView* LayerTreeView() const override { return layer_tree_view_; }
CompositorAnimationHost* AnimationHost() const { CompositorAnimationHost* AnimationHost() const override {
return animation_host_.get(); return animation_host_.get();
} }
...@@ -482,8 +480,8 @@ class WEB_EXPORT WebViewImpl final ...@@ -482,8 +480,8 @@ class WEB_EXPORT WebViewImpl final
void ForceNextWebGLContextCreationToFail() override; void ForceNextWebGLContextCreationToFail() override;
void ForceNextDrawingBufferCreationToFail() override; void ForceNextDrawingBufferCreationToFail() override;
CompositorWorkerProxyClient* CreateCompositorWorkerProxyClient(); CompositorWorkerProxyClient* CreateCompositorWorkerProxyClient() override;
AnimationWorkletProxyClient* CreateAnimationWorkletProxyClient(); AnimationWorkletProxyClient* CreateAnimationWorkletProxyClient() override;
IntSize MainFrameSize() override; IntSize MainFrameSize() override;
WebDisplayMode DisplayMode() const override { return display_mode_; } WebDisplayMode DisplayMode() const override { return display_mode_; }
...@@ -529,10 +527,10 @@ class WEB_EXPORT WebViewImpl final ...@@ -529,10 +527,10 @@ class WEB_EXPORT WebViewImpl final
// Overrides the compositor visibility. See the description of // Overrides the compositor visibility. See the description of
// m_overrideCompositorVisibility for more details. // m_overrideCompositorVisibility for more details.
void SetCompositorVisibility(bool); void SetCompositorVisibility(bool) override;
// TODO(lfg): Remove once WebViewFrameWidget is deleted. // TODO(lfg): Remove once WebViewFrameWidget is deleted.
void ScheduleAnimationForWidget(); void ScheduleAnimationForWidget() override;
bool GetCompositionCharacterBounds(WebVector<WebRect>&) override; bool GetCompositionCharacterBounds(WebVector<WebRect>&) override;
void UpdateBaseBackgroundColor(); void UpdateBaseBackgroundColor();
...@@ -594,8 +592,8 @@ class WEB_EXPORT WebViewImpl final ...@@ -594,8 +592,8 @@ class WEB_EXPORT WebViewImpl final
float DeviceScaleFactor() const; float DeviceScaleFactor() const;
void SetRootGraphicsLayer(GraphicsLayer*); void SetRootGraphicsLayer(GraphicsLayer*) override;
void SetRootLayer(WebLayer*); void SetRootLayer(WebLayer*) override;
void AttachCompositorAnimationTimeline(CompositorAnimationTimeline*); void AttachCompositorAnimationTimeline(CompositorAnimationTimeline*);
void DetachCompositorAnimationTimeline(CompositorAnimationTimeline*); void DetachCompositorAnimationTimeline(CompositorAnimationTimeline*);
......
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