Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Unified Diff: sky/shell/ui/engine.cc

Issue 1139823010: Plumb display metrics into SkyView (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sky/engine/core/view/View.h ('K') | « sky/examples/raw/hello_world.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/ui/engine.cc
diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc
index e11463880d435eceb5ef099a30677dc6e7f9c19a..c0762587ab0523ffa3e21a6272983c4766f843a6 100644
--- a/sky/shell/ui/engine.cc
+++ b/sky/shell/ui/engine.cc
@@ -8,6 +8,8 @@
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/application/connect.h"
#include "sky/engine/public/platform/WebInputEvent.h"
+#include "sky/engine/public/platform/sky_display_metrics.h"
+#include "sky/engine/public/platform/sky_display_metrics.h"
#include "sky/engine/public/web/Sky.h"
#include "sky/engine/public/web/WebLocalFrame.h"
#include "sky/engine/public/web/WebSettings.h"
@@ -88,6 +90,7 @@ skia::RefPtr<SkPicture> Engine::Paint() {
if (sky_view_) {
skia::RefPtr<SkPicture> picture = sky_view_->Paint();
canvas->clear(SK_ColorBLACK);
+ canvas->scale(device_pixel_ratio_, device_pixel_ratio_);
if (picture)
canvas->drawPicture(picture.get());
}
@@ -121,6 +124,14 @@ void Engine::OnViewportMetricsChanged(int width, int height,
float device_pixel_ratio) {
physical_size_.SetSize(width, height);
device_pixel_ratio_ = device_pixel_ratio;
+
+ if (sky_view_) {
+ blink::SkyDisplayMetrics metrics;
+ metrics.physical_size = physical_size_;
+ metrics.device_pixel_ratio = device_pixel_ratio_;
+ sky_view_->SetDisplayMetrics(metrics);
+ }
+
if (web_view_)
UpdateWebViewSize();
}
@@ -150,7 +161,8 @@ void Engine::OnInputEvent(InputEventPtr event) {
ConvertEvent(event, device_pixel_ratio_);
if (!web_event)
return;
- web_view_->handleInputEvent(*web_event);
+ if (web_view_)
+ web_view_->handleInputEvent(*web_event);
}
void Engine::LoadURL(const mojo::String& url) {
« sky/engine/core/view/View.h ('K') | « sky/examples/raw/hello_world.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698