From d78476524d4e4bc64ee660fd4f85d7853637577e Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Mon, 18 May 2015 14:48:27 -0700 Subject: [PATCH] Sketch new SkyView interface to the engine The SkyView interface will replace WebView as the interface to the SkyEngine. The SkyView interface won't have a root level Document or Frame object but instead will implement the base layers of the framework. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1135013006 --- engine/BUILD.gn | 3 ++- engine/public/sky/BUILD.gn | 23 +++++++++++++++++ engine/public/sky/sky_display_metrics.h | 19 ++++++++++++++ engine/public/sky/sky_view.cc | 34 +++++++++++++++++++++++++ engine/public/sky/sky_view.h | 34 +++++++++++++++++++++++++ 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 engine/public/sky/BUILD.gn create mode 100644 engine/public/sky/sky_display_metrics.h create mode 100644 engine/public/sky/sky_view.cc create mode 100644 engine/public/sky/sky_view.h diff --git a/engine/BUILD.gn b/engine/BUILD.gn index b94f7d515..e78ba4ebe 100644 --- a/engine/BUILD.gn +++ b/engine/BUILD.gn @@ -69,7 +69,8 @@ config("non_test_config") { group("engine") { deps = [ - "//sky/engine/web", "//sky/engine/platform", + "//sky/engine/public/sky", + "//sky/engine/web", ] } diff --git a/engine/public/sky/BUILD.gn b/engine/public/sky/BUILD.gn new file mode 100644 index 000000000..872d2d3d8 --- /dev/null +++ b/engine/public/sky/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright 2015 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. + +source_set("sky") { + deps = [ + "//skia", + "//sky/engine/core", + "//sky/engine/platform", + ] + + configs += [ + "//sky/engine:config", + "//sky/engine:inside_blink", + "//sky/engine:non_test_config", + ] + + sources = [ + "sky_display_metrics.h", + "sky_view.cc", + "sky_view.h", + ] +} diff --git a/engine/public/sky/sky_display_metrics.h b/engine/public/sky/sky_display_metrics.h new file mode 100644 index 000000000..5bdff08f6 --- /dev/null +++ b/engine/public/sky/sky_display_metrics.h @@ -0,0 +1,19 @@ +// Copyright 2015 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 SKY_ENGINE_PUBLIC_SKY_SKY_DISPLAY_METRICS_H_ +#define SKY_ENGINE_PUBLIC_SKY_SKY_DISPLAY_METRICS_H_ + +#include "sky/engine/public/platform/WebSize.h" + +namespace blink { + +struct SkyDisplayMetrics { + WebSize size; + float device_pixel_ratio; +}; + +} // namespace blink + +#endif // SKY_ENGINE_PUBLIC_SKY_SKY_DISPLAY_METRICS_H_ diff --git a/engine/public/sky/sky_view.cc b/engine/public/sky/sky_view.cc new file mode 100644 index 000000000..694f39f92 --- /dev/null +++ b/engine/public/sky/sky_view.cc @@ -0,0 +1,34 @@ +// Copyright 2015 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. + +#include "config.h" +#include "sky/engine/public/sky/sky_view.h" + +namespace blink { + +std::unique_ptr SkyView::Create() { + return std::unique_ptr(new SkyView); +} + +SkyView::SkyView() { +} + +SkyView::~SkyView() { +} + +void SkyView::SetDisplayMetrics(const SkyDisplayMetrics& metrics) { +} + +void SkyView::Load(const WebURL& url) { +} + +skia::RefPtr SkyView::Paint() { + return skia::RefPtr(); +} + +bool SkyView::HandleInputEvent(const WebInputEvent& event) { + return false; +} + +} // namespace blink diff --git a/engine/public/sky/sky_view.h b/engine/public/sky/sky_view.h new file mode 100644 index 000000000..aef82c405 --- /dev/null +++ b/engine/public/sky/sky_view.h @@ -0,0 +1,34 @@ +// Copyright 2015 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 SKY_ENGINE_PUBLIC_SKY_SKY_VIEW_H_ +#define SKY_ENGINE_PUBLIC_SKY_SKY_VIEW_H_ + +#include +#include "skia/ext/refptr.h" +#include "sky/engine/public/platform/WebCommon.h" +#include "sky/engine/public/platform/WebURL.h" +#include "sky/engine/public/sky/sky_display_metrics.h" +#include "third_party/skia/include/core/SkPicture.h" + +namespace blink { +class WebInputEvent; + +class SkyView { + public: + static std::unique_ptr Create(); + ~SkyView(); + + void SetDisplayMetrics(const SkyDisplayMetrics& metrics); + void Load(const WebURL& url); + skia::RefPtr Paint(); + bool HandleInputEvent(const WebInputEvent& event); + + private: + SkyView(); +}; + +} // namespace blink + +#endif // SKY_ENGINE_PUBLIC_SKY_SKY_VIEW_H_