| OLD | NEW |
| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPagePopup.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPagePopup.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h" |
| 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" |
| 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" |
| 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
| 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" |
| 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 35 #include "third_party/skia/include/core/SkShader.h" | 35 #include "third_party/skia/include/core/SkShader.h" |
| 36 #include "ui/base/ui_base_switches.h" |
| 36 #include "ui/gfx/point.h" | 37 #include "ui/gfx/point.h" |
| 37 #include "ui/gfx/size.h" | 38 #include "ui/gfx/size.h" |
| 38 #include "ui/gfx/skia_util.h" | 39 #include "ui/gfx/skia_util.h" |
| 39 #include "ui/gl/gl_switches.h" | 40 #include "ui/gl/gl_switches.h" |
| 40 #include "ui/surface/transport_dib.h" | 41 #include "ui/surface/transport_dib.h" |
| 41 #include "webkit/glue/webkit_glue.h" | 42 #include "webkit/glue/webkit_glue.h" |
| 42 #include "webkit/plugins/npapi/webplugin.h" | 43 #include "webkit/plugins/npapi/webplugin.h" |
| 43 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 44 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 44 | 45 |
| 45 #if defined(OS_POSIX) | 46 #if defined(OS_POSIX) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 using WebKit::WebRange; | 64 using WebKit::WebRange; |
| 64 using WebKit::WebRect; | 65 using WebKit::WebRect; |
| 65 using WebKit::WebScreenInfo; | 66 using WebKit::WebScreenInfo; |
| 66 using WebKit::WebSize; | 67 using WebKit::WebSize; |
| 67 using WebKit::WebTextDirection; | 68 using WebKit::WebTextDirection; |
| 68 using WebKit::WebTouchEvent; | 69 using WebKit::WebTouchEvent; |
| 69 using WebKit::WebVector; | 70 using WebKit::WebVector; |
| 70 using WebKit::WebWidget; | 71 using WebKit::WebWidget; |
| 71 using content::RenderThread; | 72 using content::RenderThread; |
| 72 | 73 |
| 73 static const int kStandardDPI = 160; | 74 static const float kStandardDPI = 160; |
| 74 | 75 |
| 75 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, | 76 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, |
| 76 const WebKit::WebScreenInfo& screen_info, | 77 const WebKit::WebScreenInfo& screen_info, |
| 77 bool swapped_out) | 78 bool swapped_out) |
| 78 : routing_id_(MSG_ROUTING_NONE), | 79 : routing_id_(MSG_ROUTING_NONE), |
| 79 surface_id_(0), | 80 surface_id_(0), |
| 80 webwidget_(NULL), | 81 webwidget_(NULL), |
| 81 opener_id_(MSG_ROUTING_NONE), | 82 opener_id_(MSG_ROUTING_NONE), |
| 82 host_window_(0), | 83 host_window_(0), |
| 83 host_window_set_(false), | 84 host_window_set_(false), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 106 animation_update_pending_(false), | 107 animation_update_pending_(false), |
| 107 invalidation_task_posted_(false), | 108 invalidation_task_posted_(false), |
| 108 screen_info_(screen_info), | 109 screen_info_(screen_info), |
| 109 device_scale_factor_(1) { | 110 device_scale_factor_(1) { |
| 110 if (!swapped_out) | 111 if (!swapped_out) |
| 111 RenderProcess::current()->AddRefProcess(); | 112 RenderProcess::current()->AddRefProcess(); |
| 112 DCHECK(RenderThread::Get()); | 113 DCHECK(RenderThread::Get()); |
| 113 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( | 114 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 114 switches::kDisableGpuVsync); | 115 switches::kDisableGpuVsync); |
| 115 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) | 116 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) |
| 116 device_scale_factor_ = std::max(1, screen_info.verticalDPI / kStandardDPI); | 117 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; |
| 118 // Unless an explicit scale factor was provided for testing, ensure the scale |
| 119 // is integral. |
| 120 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 121 switches::kForceDeviceScaleFactor)) |
| 122 device_scale_factor_ = static_cast<int>(device_scale_factor_); |
| 123 device_scale_factor_ = std::max(1.0f, device_scale_factor_); |
| 117 #endif | 124 #endif |
| 118 } | 125 } |
| 119 | 126 |
| 120 RenderWidget::~RenderWidget() { | 127 RenderWidget::~RenderWidget() { |
| 121 DCHECK(!webwidget_) << "Leaking our WebWidget!"; | 128 DCHECK(!webwidget_) << "Leaking our WebWidget!"; |
| 122 STLDeleteElements(&updates_pending_swap_); | 129 STLDeleteElements(&updates_pending_swap_); |
| 123 if (current_paint_buf_) { | 130 if (current_paint_buf_) { |
| 124 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); | 131 RenderProcess::current()->ReleaseTransportDIB(current_paint_buf_); |
| 125 current_paint_buf_ = NULL; | 132 current_paint_buf_ = NULL; |
| 126 } | 133 } |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 } | 1765 } |
| 1759 } | 1766 } |
| 1760 | 1767 |
| 1761 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1768 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1762 return false; | 1769 return false; |
| 1763 } | 1770 } |
| 1764 | 1771 |
| 1765 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1772 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
| 1766 return false; | 1773 return false; |
| 1767 } | 1774 } |
| OLD | NEW |