Index: sky/shell/ui/engine.cc |
diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc |
index 5a0d62b7503a4c88de5f3ac6ea313888f859cc07..63fd90874a53da6560a0612b16eca022ef4e05bc 100644 |
--- a/sky/shell/ui/engine.cc |
+++ b/sky/shell/ui/engine.cc |
@@ -127,17 +127,22 @@ void Engine::OnViewportMetricsChanged(int width, int height, |
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 (sky_view_) |
+ UpdateSkyViewSize(); |
if (web_view_) |
UpdateWebViewSize(); |
} |
+void Engine::UpdateSkyViewSize() |
+{ |
abarth-chromium
2015/06/04 23:46:42
These two lines should be merged.
|
+ CHECK(sky_view_); |
+ blink::SkyDisplayMetrics metrics; |
+ metrics.physical_size = physical_size_; |
+ metrics.device_pixel_ratio = device_pixel_ratio_; |
+ sky_view_->SetDisplayMetrics(metrics); |
+} |
+ |
void Engine::UpdateWebViewSize() |
{ |
CHECK(web_view_); |
@@ -172,8 +177,13 @@ void Engine::OnInputEvent(InputEventPtr event) { |
void Engine::LoadURL(const mojo::String& mojo_url) { |
GURL url(mojo_url); |
if (!blink::WebView::shouldUseWebView(url)) { |
+ if (web_view_) { |
+ web_view_->close(); |
+ web_view_ = nullptr; |
+ } |
sky_view_ = blink::SkyView::Create(this); |
sky_view_->Load(url); |
+ UpdateSkyViewSize(); |
return; |
} |