diff options
author | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 23:42:44 +0000 |
---|---|---|
committer | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 23:42:44 +0000 |
commit | 60d47acb4b8835090cf37a7b84302710f461eeb7 (patch) | |
tree | 5cb6c917816f0f5165946f385ba45738d277b0cf /content/browser/renderer_host/render_widget_host_view_base.cc | |
parent | 8e93668ff0e6c68f9bc665763f8a589372e7437b (diff) | |
download | chromium_src-60d47acb4b8835090cf37a7b84302710f461eeb7.zip chromium_src-60d47acb4b8835090cf37a7b84302710f461eeb7.tar.gz chromium_src-60d47acb4b8835090cf37a7b84302710f461eeb7.tar.bz2 |
Plumb physical backing size from RWHV to renderer CC.
This patch introduces a concept of "physical backing size" which is plumbed
down from port-specific browser code to the renderer compositor.
This is distinct from the usual concept of view size on high-DPI screens
with >1 dpi scale. Physical backing size represents the size of the
texture CC draws to, whereas the view size is given to WebKit and
specifies the CSS width/height.
Before this patch, physical backing size was recalculated in the
renderer by multiplying the view size by DPI scale. There are two problems
with this:
- This introduces off-by-one errors when DPI scale is non-integral.
Values such as 1.5 and 1.33125 are common on Android devices.
- The Android port would like to more efficiently implement features like
on-screen-keyboard bringup and URL-bar hiding without needing to
resize the backing texture. Separating the value given to CC and to
WebKit is the first step towards this.
WebKit counterpart at https://bugs.webkit.org/show_bug.cgi?id=110727
NOTRY=true
BUG=152502
Review URL: https://chromiumcodereview.appspot.com/12328080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/render_widget_host_view_base.cc')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_base.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc index a2cb5a4..f56413e 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -12,6 +12,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "ui/gfx/display.h" #include "ui/gfx/screen.h" +#include "ui/gfx/size_conversions.h" +#include "ui/gfx/size_f.h" #if defined(OS_WIN) #include "base/command_line.h" @@ -365,6 +367,14 @@ const SkBitmap& RenderWidgetHostViewBase::GetBackground() { return background_; } +gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { + gfx::Display display = + gfx::Screen::GetNativeScreen()->GetDisplayNearestPoint( + GetViewBounds().origin()); + return gfx::ToCeiledSize(gfx::ScaleSize(GetViewBounds().size(), + display.device_scale_factor())); +} + void RenderWidgetHostViewBase::SelectionChanged(const string16& text, size_t offset, const ui::Range& range) { @@ -432,11 +442,17 @@ void RenderWidgetHostViewBase::UpdateScreenInfo(gfx::NativeView view) { if (current_display_area_ == display.work_area() && current_device_scale_factor_ == display.device_scale_factor()) return; + + bool device_scale_factor_changed = + current_device_scale_factor_ != display.device_scale_factor(); current_display_area_ = display.work_area(); current_device_scale_factor_ = display.device_scale_factor(); - if (impl) + if (impl) { + if (device_scale_factor_changed) + impl->WasResized(); impl->NotifyScreenInfoChanged(); } +} SmoothScrollGesture* RenderWidgetHostViewBase::CreateSmoothScrollGesture( bool scroll_down, int pixels_to_scroll, int mouse_event_x, |