Add PlatformFrameView class.
PlatformFrameView is used in PlatformChromeClient as the platform
base class for core/frame/FrameView.
This removes a reference to FrameViewBase which is being deleted
in http://crrev.com/2855523002.
BUG=637460
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Review-Url: https://codereview.chromium.org/2873213002
Cr-Commit-Position: refs/heads/master@{#470849}
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index ae3818d..4c78203 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -2783,7 +2783,7 @@
bool FrameView::ScheduleAnimation() {
if (PlatformChromeClient* client = GetChromeClient()) {
- client->ScheduleAnimation(frame_);
+ client->ScheduleAnimation(this);
return true;
}
return false;
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h
index a1d552cb..92309bd 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.h
+++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -42,6 +42,7 @@
#include "core/paint/ScrollbarManager.h"
#include "core/plugins/PluginView.h"
#include "platform/FrameViewBase.h"
+#include "platform/PlatformFrameView.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/animation/CompositorAnimationHost.h"
#include "platform/animation/CompositorAnimationTimeline.h"
@@ -103,6 +104,7 @@
class CORE_EXPORT FrameView final
: public GarbageCollectedFinalized<FrameView>,
+ public PlatformFrameView,
public FrameViewBase,
public FrameOrPlugin,
public PaintInvalidationCapableScrollableArea {
@@ -1268,6 +1270,11 @@
}
DEFINE_TYPE_CASTS(FrameView,
+ PlatformFrameView,
+ platform_frame_view,
+ platform_frame_view->IsFrameView(),
+ platform_frame_view.IsFrameView());
+DEFINE_TYPE_CASTS(FrameView,
FrameViewBase,
frameViewBase,
frameViewBase->IsFrameView(),
diff --git a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
index 93495bb..680109f8 100644
--- a/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameViewTest.cpp
@@ -43,7 +43,7 @@
MockSetToolTip(&frame, tooltip_text, dir);
}
- void ScheduleAnimation(LocalFrame*) override {
+ void ScheduleAnimation(const PlatformFrameView*) override {
has_scheduled_animation_ = true;
}
bool has_scheduled_animation_;
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
index 615977da..df88ee8 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -680,7 +680,7 @@
bool VisualViewport::ScheduleAnimation() {
if (PlatformChromeClient* client = GetChromeClient()) {
- client->ScheduleAnimation(MainFrame());
+ client->ScheduleAnimation(MainFrame()->View());
return true;
}
return false;
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h
index 2cc4874..12cef19 100644
--- a/third_party/WebKit/Source/core/loader/EmptyClients.h
+++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -169,10 +169,10 @@
bool TabsToLinks() override { return false; }
void InvalidateRect(const IntRect&) override {}
- void ScheduleAnimation(LocalFrame*) override {}
+ void ScheduleAnimation(const PlatformFrameView*) override {}
IntRect ViewportToScreen(const IntRect& r,
- const FrameViewBase*) const override {
+ const PlatformFrameView*) const override {
return r;
}
float WindowToViewportScalar(const float s) const override { return s; }
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.cpp b/third_party/WebKit/Source/core/page/AutoscrollController.cpp
index ab94c72..42228126 100644
--- a/third_party/WebKit/Source/core/page/AutoscrollController.cpp
+++ b/third_party/WebKit/Source/core/page/AutoscrollController.cpp
@@ -366,13 +366,13 @@
}
if (autoscroll_type_ != kNoAutoscroll && autoscroll_layout_object_) {
page_->GetChromeClient().ScheduleAnimation(
- autoscroll_layout_object_->GetFrame());
+ autoscroll_layout_object_->GetFrame()->View());
}
}
void AutoscrollController::StartAutoscroll() {
page_->GetChromeClient().ScheduleAnimation(
- autoscroll_layout_object_->GetFrame());
+ autoscroll_layout_object_->GetFrame()->View());
}
void AutoscrollController::UpdateMiddleClickAutoscrollState(
diff --git a/third_party/WebKit/Source/core/page/PageAnimator.cpp b/third_party/WebKit/Source/core/page/PageAnimator.cpp
index ffc541c5..9386312 100644
--- a/third_party/WebKit/Source/core/page/PageAnimator.cpp
+++ b/third_party/WebKit/Source/core/page/PageAnimator.cpp
@@ -91,7 +91,7 @@
suppress_frame_requests_workaround_for704763_only_) {
return;
}
- page_->GetChromeClient().ScheduleAnimation(frame);
+ page_->GetChromeClient().ScheduleAnimation(frame->View());
}
void PageAnimator::UpdateAllLifecyclePhases(LocalFrame& root_frame) {
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index c3dcf5fc..fef30af 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -1943,7 +1943,7 @@
bool PaintLayerScrollableArea::ScheduleAnimation() {
if (PlatformChromeClient* client = GetChromeClient()) {
- client->ScheduleAnimation(Box().GetFrame());
+ client->ScheduleAnimation(Box().GetFrame()->View());
return true;
}
return false;
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp
index 62dbd29..de6e9ec 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp
@@ -83,7 +83,7 @@
ScheduleAnimation(nullptr);
}
-void SVGImageChromeClient::ScheduleAnimation(LocalFrame*) {
+void SVGImageChromeClient::ScheduleAnimation(const PlatformFrameView*) {
// Because a single SVGImage can be shared by multiple pages, we can't key
// our svg image layout on the page's real animation frame. Therefore, we
// run this fake animation timer to trigger layout in SVGImages. The name,
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
index 672e9e4..4dbd685c 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h
@@ -56,7 +56,7 @@
void ChromeDestroyed() override;
void InvalidateRect(const IntRect&) override;
- void ScheduleAnimation(LocalFrame*) override;
+ void ScheduleAnimation(const PlatformFrameView*) override;
void SetTimer(std::unique_ptr<TimerBase>);
void AnimationTimerFired(TimerBase*);
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn
index 12a4ef67..28ce7df 100644
--- a/third_party/WebKit/Source/platform/BUILD.gn
+++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -297,6 +297,7 @@
"PasteMode.h",
"PlatformChromeClient.h",
"PlatformExport.h",
+ "PlatformFrameView.h",
"PlatformResourceLoader.cpp",
"PlatformResourceLoader.h",
"PluginScriptForbiddenScope.cpp",
diff --git a/third_party/WebKit/Source/platform/PlatformChromeClient.h b/third_party/WebKit/Source/platform/PlatformChromeClient.h
index 3f939b8..f3d99db 100644
--- a/third_party/WebKit/Source/platform/PlatformChromeClient.h
+++ b/third_party/WebKit/Source/platform/PlatformChromeClient.h
@@ -27,14 +27,13 @@
#define PlatformChromeClient_h
#include "platform/PlatformExport.h"
+#include "platform/PlatformFrameView.h"
#include "platform/heap/Handle.h"
#include "platform/wtf/Allocator.h"
#include "platform/wtf/Noncopyable.h"
namespace blink {
class IntRect;
-class FrameViewBase;
-class LocalFrame;
class PLATFORM_EXPORT PlatformChromeClient
: public GarbageCollectedFinalized<PlatformChromeClient> {
@@ -50,13 +49,13 @@
// Converts the rect from the viewport coordinates to screen coordinates.
virtual IntRect ViewportToScreen(const IntRect&,
- const FrameViewBase*) const = 0;
+ const PlatformFrameView*) const = 0;
// Converts the scalar value from the window coordinates to the viewport
// scale.
virtual float WindowToViewportScalar(const float) const = 0;
- virtual void ScheduleAnimation(LocalFrame*) = 0;
+ virtual void ScheduleAnimation(const PlatformFrameView*) = 0;
};
} // namespace blink
diff --git a/third_party/WebKit/Source/platform/PlatformFrameView.h b/third_party/WebKit/Source/platform/PlatformFrameView.h
new file mode 100644
index 0000000..a2b0f76
--- /dev/null
+++ b/third_party/WebKit/Source/platform/PlatformFrameView.h
@@ -0,0 +1,24 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PlatformFrameView_h
+#define PlatformFrameView_h
+
+#include "platform/PlatformExport.h"
+
+namespace blink {
+
+// PlatformFrameView is a base class for core/frame/FrameView. PlatformFrameView
+// is needed to let the platform/ layer access functionalities of FrameView.
+class PLATFORM_EXPORT PlatformFrameView {
+ public:
+ PlatformFrameView() {}
+ virtual ~PlatformFrameView() {}
+
+ virtual bool IsFrameView() const { return false; }
+};
+
+} // namespace blink
+
+#endif // PlatformFrameView_h
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
index 34e37bb1..c557bf4 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -556,24 +556,27 @@
web_view_->InvalidateRect(update_rect);
}
-void ChromeClientImpl::ScheduleAnimation(LocalFrame* frame) {
- frame = &frame->LocalFrameRoot();
+void ChromeClientImpl::ScheduleAnimation(
+ const PlatformFrameView* platform_frame_view) {
+ DCHECK(platform_frame_view->IsFrameView());
+ LocalFrame& frame =
+ ToFrameView(platform_frame_view)->GetFrame().LocalFrameRoot();
// If the frame is still being created, it might not yet have a WebWidget.
// FIXME: Is this the right thing to do? Is there a way to avoid having
// a local frame root that doesn't have a WebWidget? During initialization
// there is no content to draw so this call serves no purpose.
- if (WebLocalFrameImpl::FromFrame(frame) &&
- WebLocalFrameImpl::FromFrame(frame)->FrameWidget())
- WebLocalFrameImpl::FromFrame(frame)->FrameWidget()->ScheduleAnimation();
+ if (WebLocalFrameImpl::FromFrame(&frame) &&
+ WebLocalFrameImpl::FromFrame(&frame)->FrameWidget())
+ WebLocalFrameImpl::FromFrame(&frame)->FrameWidget()->ScheduleAnimation();
}
IntRect ChromeClientImpl::ViewportToScreen(
const IntRect& rect_in_viewport,
- const FrameViewBase* frame_view_base) const {
+ const PlatformFrameView* platform_frame_view) const {
WebRect screen_rect(rect_in_viewport);
- DCHECK(frame_view_base->IsFrameView());
- const FrameView* view = ToFrameView(frame_view_base);
+ DCHECK(platform_frame_view->IsFrameView());
+ const FrameView* view = ToFrameView(platform_frame_view);
LocalFrame& frame = view->GetFrame().LocalFrameRoot();
WebWidgetClient* client =
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.h b/third_party/WebKit/Source/web/ChromeClientImpl.h
index cf0cecf..9db76e7 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.h
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.h
@@ -110,8 +110,9 @@
void SetStatusbarText(const String& message) override;
bool TabsToLinks() override;
void InvalidateRect(const IntRect&) override;
- void ScheduleAnimation(LocalFrame*) override;
- IntRect ViewportToScreen(const IntRect&, const FrameViewBase*) const override;
+ void ScheduleAnimation(const PlatformFrameView*) override;
+ IntRect ViewportToScreen(const IntRect&,
+ const PlatformFrameView*) const override;
float WindowToViewportScalar(const float) const override;
WebScreenInfo GetScreenInfo() const override;
WTF::Optional<IntRect> VisibleContentRectForPainting() const override;
diff --git a/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp b/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp
index ab47f9c9..ad3a919 100644
--- a/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp
+++ b/third_party/WebKit/Source/web/InspectorOverlayAgent.cpp
@@ -196,11 +196,11 @@
void InvalidateRect(const IntRect&) override { overlay_->Invalidate(); }
- void ScheduleAnimation(LocalFrame* frame) override {
+ void ScheduleAnimation(const PlatformFrameView* frame_view) override {
if (overlay_->in_layout_)
return;
- client_->ScheduleAnimation(frame);
+ client_->ScheduleAnimation(frame_view);
}
private:
@@ -678,7 +678,7 @@
needs_update_ = true;
LocalFrame* frame = frame_impl_->GetFrame();
if (frame) {
- frame->GetPage()->GetChromeClient().ScheduleAnimation(frame);
+ frame->GetPage()->GetChromeClient().ScheduleAnimation(frame->View());
}
}
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
index 27fd14f..46cf53e 100644
--- a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
@@ -89,9 +89,8 @@
IntRect RootWindowRect() override { return popup_->WindowRectInScreen(); }
- IntRect ViewportToScreen(
- const IntRect& rect,
- const FrameViewBase* frame_view_base) const override {
+ IntRect ViewportToScreen(const IntRect& rect,
+ const PlatformFrameView* frame_view) const override {
WebRect rect_in_screen(rect);
WebRect window_rect = popup_->WindowRectInScreen();
popup_->WidgetClient()->ConvertViewportToWindow(&rect_in_screen);
@@ -124,7 +123,7 @@
popup_->WidgetClient()->DidInvalidateRect(paint_rect);
}
- void ScheduleAnimation(LocalFrame*) override {
+ void ScheduleAnimation(const PlatformFrameView*) override {
// Calling scheduleAnimation on m_webView so WebViewTestProxy will call
// beginFrame.
if (LayoutTestSupport::IsRunningLayoutTest())