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

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

Issue 12328080: Plumb physical backing size from RWHV to renderer CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust for call renamed to GetViewportSizePix() Created 7 years, 9 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
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_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/accessibility/browser_accessibility_manager.h" 8 #include "content/browser/accessibility/browser_accessibility_manager.h"
9 #include "content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture. h" 9 #include "content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture. h"
10 #include "content/browser/renderer_host/render_widget_host_impl.h" 10 #include "content/browser/renderer_host/render_widget_host_impl.h"
11 #include "content/port/browser/smooth_scroll_gesture.h" 11 #include "content/port/browser/smooth_scroll_gesture.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
13 #include "ui/gfx/display.h" 13 #include "ui/gfx/display.h"
14 #include "ui/gfx/screen.h" 14 #include "ui/gfx/screen.h"
15 #include "ui/gfx/size_conversions.h"
16 #include "ui/gfx/size_f.h"
15 17
16 #if defined(OS_WIN) 18 #if defined(OS_WIN)
17 #include "base/command_line.h" 19 #include "base/command_line.h"
18 #include "base/message_loop.h" 20 #include "base/message_loop.h"
19 #include "base/win/wrapped_window_proc.h" 21 #include "base/win/wrapped_window_proc.h"
20 #include "content/browser/plugin_process_host.h" 22 #include "content/browser/plugin_process_host.h"
21 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/child_process_data.h" 24 #include "content/public/browser/child_process_data.h"
23 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
24 #include "ui/base/win/hwnd_util.h" 26 #include "ui/base/win/hwnd_util.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 360 }
359 361
360 void RenderWidgetHostViewBase::SetBackground(const SkBitmap& background) { 362 void RenderWidgetHostViewBase::SetBackground(const SkBitmap& background) {
361 background_ = background; 363 background_ = background;
362 } 364 }
363 365
364 const SkBitmap& RenderWidgetHostViewBase::GetBackground() { 366 const SkBitmap& RenderWidgetHostViewBase::GetBackground() {
365 return background_; 367 return background_;
366 } 368 }
367 369
370 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const {
371 gfx::Display display =
372 gfx::Screen::GetNativeScreen()->GetDisplayNearestPoint(
373 GetViewBounds().origin());
374 return gfx::ToCeiledSize(gfx::ScaleSize(GetViewBounds().size(),
375 display.device_scale_factor()));
376 }
377
368 void RenderWidgetHostViewBase::SelectionChanged(const string16& text, 378 void RenderWidgetHostViewBase::SelectionChanged(const string16& text,
369 size_t offset, 379 size_t offset,
370 const ui::Range& range) { 380 const ui::Range& range) {
371 selection_text_ = text; 381 selection_text_ = text;
372 selection_text_offset_ = offset; 382 selection_text_offset_ = offset;
373 selection_range_.set_start(range.start()); 383 selection_range_.set_start(range.start());
374 selection_range_.set_end(range.end()); 384 selection_range_.set_end(range.end());
375 } 385 }
376 386
377 bool RenderWidgetHostViewBase::IsShowingContextMenu() const { 387 bool RenderWidgetHostViewBase::IsShowingContextMenu() const {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 435
426 if (impl) 436 if (impl)
427 impl->SendScreenRects(); 437 impl->SendScreenRects();
428 438
429 gfx::Display display = 439 gfx::Display display =
430 gfx::Screen::GetScreenFor(view)->GetDisplayNearestPoint( 440 gfx::Screen::GetScreenFor(view)->GetDisplayNearestPoint(
431 GetViewBounds().origin()); 441 GetViewBounds().origin());
432 if (current_display_area_ == display.work_area() && 442 if (current_display_area_ == display.work_area() &&
433 current_device_scale_factor_ == display.device_scale_factor()) 443 current_device_scale_factor_ == display.device_scale_factor())
434 return; 444 return;
445
446 bool device_scale_factor_changed =
447 current_device_scale_factor_ != display.device_scale_factor();
435 current_display_area_ = display.work_area(); 448 current_display_area_ = display.work_area();
436 current_device_scale_factor_ = display.device_scale_factor(); 449 current_device_scale_factor_ = display.device_scale_factor();
437 if (impl) 450 if (impl) {
451 if (device_scale_factor_changed)
452 impl->WasResized();
438 impl->NotifyScreenInfoChanged(); 453 impl->NotifyScreenInfoChanged();
439 } 454 }
455 }
440 456
441 SmoothScrollGesture* RenderWidgetHostViewBase::CreateSmoothScrollGesture( 457 SmoothScrollGesture* RenderWidgetHostViewBase::CreateSmoothScrollGesture(
442 bool scroll_down, int pixels_to_scroll, int mouse_event_x, 458 bool scroll_down, int pixels_to_scroll, int mouse_event_x,
443 int mouse_event_y) { 459 int mouse_event_y) {
444 return new BasicMouseWheelSmoothScrollGesture(scroll_down, pixels_to_scroll, 460 return new BasicMouseWheelSmoothScrollGesture(scroll_down, pixels_to_scroll,
445 mouse_event_x, mouse_event_y); 461 mouse_event_x, mouse_event_y);
446 } 462 }
447 463
448 void RenderWidgetHostViewBase::ProcessAckedTouchEvent( 464 void RenderWidgetHostViewBase::ProcessAckedTouchEvent(
449 const WebKit::WebTouchEvent& touch, InputEventAckState ack_result) { 465 const WebKit::WebTouchEvent& touch, InputEventAckState ack_result) {
450 } 466 }
451 467
452 } // namespace content 468 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_base.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698