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

Unified Diff: content/browser/renderer_host/render_widget_host_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/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 0c313ec4e7b2ad07b267cb3627fcfdb3e04f9421..678f519a67a4fd12154592f58bea15e016b24e96 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -57,7 +57,6 @@
#include "content/public/common/child_process_host.h"
#include "content/public/common/content_switches.h"
#include "gpu/ipc/common/gpu_messages.h"
-#include "third_party/WebKit/public/platform/WebScreenInfo.h"
#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/aura/client/aura_constants.h"
@@ -116,7 +115,6 @@
using gfx::RectToSkIRect;
using gfx::SkIRectToRect;
-using blink::WebScreenInfo;
using blink::WebInputEvent;
using blink::WebGestureEvent;
using blink::WebTouchEvent;
@@ -170,32 +168,6 @@ bool IsXButtonUpEvent(const ui::MouseEvent* event) {
return false;
}
-void GetScreenInfoForWindow(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);
-}
-
bool IsFractionalScaleFactor(float scale_factor) {
return (scale_factor - static_cast<int>(scale_factor)) > 0;
}
@@ -1119,10 +1091,6 @@ bool RenderWidgetHostViewAura::HasAcceleratedSurface(
return false;
}
-void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
- GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL);
-}
-
gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
aura::Window* top_level = window_->GetToplevelWindow();
gfx::Rect bounds(top_level->GetBoundsInScreen());
@@ -1734,11 +1702,13 @@ void RenderWidgetHostViewAura::OnPaint(const ui::PaintContext& context) {
void RenderWidgetHostViewAura::OnDeviceScaleFactorChanged(
float device_scale_factor) {
- // TODO(wjmaclean): can host_ ever be null?
- if (!host_ || !window_->GetRootWindow())
+ if (!window_->GetRootWindow())
return;
- UpdateScreenInfo(window_);
+ RenderWidgetHostImpl* host =
+ RenderWidgetHostImpl::From(GetRenderWidgetHost());
+ if (host && host->delegate())
+ host->delegate()->UpdateDeviceScaleFactor(device_scale_factor);
device_scale_factor_ = device_scale_factor;
const display::Display display =
@@ -3088,12 +3058,4 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged(
#endif // defined(USE_X11) && !defined(OS_CHROMEOS)
}
-////////////////////////////////////////////////////////////////////////////////
-// RenderWidgetHostViewBase, public:
-
-// static
-void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
- GetScreenInfoForWindow(results, NULL);
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698