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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 293033004: Make Display's rotation and WebScreenInfo rotation work together on Aura. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@randr_orientation
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { 293 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) {
294 const gfx::Display display = window ? 294 const gfx::Display display = window ?
295 gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window) : 295 gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window) :
296 gfx::Screen::GetScreenFor(window)->GetPrimaryDisplay(); 296 gfx::Screen::GetScreenFor(window)->GetPrimaryDisplay();
297 results->rect = display.bounds(); 297 results->rect = display.bounds();
298 results->availableRect = display.work_area(); 298 results->availableRect = display.work_area();
299 // TODO(derat|oshima): Don't hardcode this. Get this from display object. 299 // TODO(derat|oshima): Don't hardcode this. Get this from display object.
300 results->depth = 24; 300 results->depth = 24;
301 results->depthPerComponent = 8; 301 results->depthPerComponent = 8;
302 results->deviceScaleFactor = display.device_scale_factor(); 302 results->deviceScaleFactor = display.device_scale_factor();
303
304 // The Display rotation and the WebScreenInfo orientation are not the same
sky 2014/06/16 20:18:42 Are you saying the webkit rotation is relative to
mlamouri (slow - plz ping) 2014/06/16 20:23:27 The value is Blink is the rotation of the renderin
sky 2014/06/16 20:53:02 I got it. Can you clarify here that webscreeninfo
mlamouri (slow - plz ping) 2014/06/16 21:07:29 By the way, WebScreenInfo behaves like that becaus
305 // angle. The former is the physical display rotation while the later is the
306 // rotation required by the content to be shown properly on the screen, in
307 // other words, the opposite of the rotation as described by Display.
303 results->orientationAngle = display.RotationAsDegree(); 308 results->orientationAngle = display.RotationAsDegree();
309 if (results->orientationAngle == 90)
310 results->orientationAngle = 270;
311 else if (results->orientationAngle == 270)
312 results->orientationAngle = 90;
304 } 313 }
305 314
306 bool PointerEventActivates(const ui::Event& event) { 315 bool PointerEventActivates(const ui::Event& event) {
307 if (event.type() == ui::ET_MOUSE_PRESSED) 316 if (event.type() == ui::ET_MOUSE_PRESSED)
308 return true; 317 return true;
309 318
310 if (event.type() == ui::ET_GESTURE_BEGIN) { 319 if (event.type() == ui::ET_GESTURE_BEGIN) {
311 const ui::GestureEvent& gesture = 320 const ui::GestureEvent& gesture =
312 static_cast<const ui::GestureEvent&>(event); 321 static_cast<const ui::GestureEvent&>(event);
313 return gesture.details().touch_points() == 1; 322 return gesture.details().touch_points() == 1;
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 2389
2381 //////////////////////////////////////////////////////////////////////////////// 2390 ////////////////////////////////////////////////////////////////////////////////
2382 // RenderWidgetHostViewBase, public: 2391 // RenderWidgetHostViewBase, public:
2383 2392
2384 // static 2393 // static
2385 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2394 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2386 GetScreenInfoForWindow(results, NULL); 2395 GetScreenInfoForWindow(results, NULL);
2387 } 2396 }
2388 2397
2389 } // namespace content 2398 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698