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

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 2122023002: Cross-process frames should be notified of device scale factor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Version of patch without second test. Created 4 years, 4 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
Index: content/browser/web_contents/web_contents_view_aura.cc
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index f426d94a08353978cb790a8e3a4fc122509bbdac..57b401c6aec46aebf1ab75acd067e7d25b795a47 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -45,6 +45,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/drop_data.h"
#include "net/base/filename_util.h"
+#include "third_party/WebKit/public/platform/WebScreenInfo.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/screen_position_client.h"
@@ -625,6 +626,47 @@ gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const {
return window ? window : delegate_->GetNativeWindow();
}
+namespace {
+
+void GetScreenInfoForWindow(blink::WebScreenInfo* results,
+ aura::Window* window) {
+ display::Screen* screen = display::Screen::GetScreen();
+ const display::Display display = window
+ ? screen->GetDisplayNearestWindow(window)
+ : screen->GetPrimaryDisplay();
+ results->rect = display.bounds();
+ results->availableRect = display.work_area();
+ // TODO(derat|oshima): Don't hardcode this. Get this from display object.
+ results->depth = 24;
+ results->depthPerComponent = 8;
+ results->deviceScaleFactor = display.device_scale_factor();
+
+ // The Display rotation and the WebScreenInfo orientation are not the same
+ // angle. The former is the physical display rotation while the later is the
+ // rotation required by the content to be shown properly on the screen, in
+ // other words, relative to the physical display.
+ results->orientationAngle = display.RotationAsDegree();
+ if (results->orientationAngle == 90)
+ results->orientationAngle = 270;
+ else if (results->orientationAngle == 270)
+ results->orientationAngle = 90;
+
+ results->orientationType =
+ RenderWidgetHostViewBase::GetOrientationTypeForDesktop(display);
+}
+
+} // namespace
+
+// Static.
+void WebContentsView::GetDefaultScreenInfo(blink::WebScreenInfo* results) {
+ GetScreenInfoForWindow(results, NULL);
+}
+
+void WebContentsViewAura::GetScreenInfo(
+ blink::WebScreenInfo* web_screen_info) const {
+ GetScreenInfoForWindow(web_screen_info, window_.get());
+}
+
void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const {
*out = window_->GetBoundsInScreen();
}
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | content/browser/web_contents/web_contents_view_child_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698