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

Side by Side Diff: content/renderer/render_widget.cc

Issue 1516723003: [Element / Autofill] Add boundsInViewportFloat() to fix <input> popup misalignment. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refator to use boundsInViewportFloat() eventually, but keep boundsInViewportInt(). Created 5 years 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 | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "content/renderer/render_process.h" 52 #include "content/renderer/render_process.h"
53 #include "content/renderer/render_thread_impl.h" 53 #include "content/renderer/render_thread_impl.h"
54 #include "content/renderer/render_view_impl.h" 54 #include "content/renderer/render_view_impl.h"
55 #include "content/renderer/renderer_blink_platform_impl.h" 55 #include "content/renderer/renderer_blink_platform_impl.h"
56 #include "content/renderer/resizing_mode_selector.h" 56 #include "content/renderer/resizing_mode_selector.h"
57 #include "ipc/ipc_sync_message.h" 57 #include "ipc/ipc_sync_message.h"
58 #include "skia/ext/platform_canvas.h" 58 #include "skia/ext/platform_canvas.h"
59 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 59 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
60 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 60 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
61 #include "third_party/WebKit/public/platform/WebPoint.h" 61 #include "third_party/WebKit/public/platform/WebPoint.h"
62 #include "third_party/WebKit/public/platform/WebRect.h"
63 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 62 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
64 #include "third_party/WebKit/public/platform/WebSize.h" 63 #include "third_party/WebKit/public/platform/WebSize.h"
65 #include "third_party/WebKit/public/platform/WebString.h" 64 #include "third_party/WebKit/public/platform/WebString.h"
66 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" 65 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
67 #include "third_party/WebKit/public/web/WebFrameWidget.h" 66 #include "third_party/WebKit/public/web/WebFrameWidget.h"
68 #include "third_party/WebKit/public/web/WebLocalFrame.h" 67 #include "third_party/WebKit/public/web/WebLocalFrame.h"
69 #include "third_party/WebKit/public/web/WebNode.h" 68 #include "third_party/WebKit/public/web/WebNode.h"
70 #include "third_party/WebKit/public/web/WebPagePopup.h" 69 #include "third_party/WebKit/public/web/WebPagePopup.h"
71 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h" 70 #include "third_party/WebKit/public/web/WebPopupMenuInfo.h"
72 #include "third_party/WebKit/public/web/WebRange.h" 71 #include "third_party/WebKit/public/web/WebRange.h"
73 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 72 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
74 #include "third_party/WebKit/public/web/WebView.h" 73 #include "third_party/WebKit/public/web/WebView.h"
75 #include "third_party/skia/include/core/SkShader.h" 74 #include "third_party/skia/include/core/SkShader.h"
76 #include "ui/base/ui_base_switches.h" 75 #include "ui/base/ui_base_switches.h"
77 #include "ui/gfx/geometry/point_conversions.h" 76 #include "ui/gfx/geometry/point_conversions.h"
78 #include "ui/gfx/geometry/rect_conversions.h" 77 #include "ui/gfx/geometry/rect_conversions.h"
78 #include "ui/gfx/geometry/rect_f.h"
79 #include "ui/gfx/geometry/size_conversions.h" 79 #include "ui/gfx/geometry/size_conversions.h"
80 #include "ui/gfx/skia_util.h" 80 #include "ui/gfx/skia_util.h"
81 #include "ui/gl/gl_switches.h" 81 #include "ui/gl/gl_switches.h"
82 #include "ui/surface/transport_dib.h" 82 #include "ui/surface/transport_dib.h"
83 83
84 #if defined(OS_ANDROID) 84 #if defined(OS_ANDROID)
85 #include <android/keycodes.h> 85 #include <android/keycodes.h>
86 #include "content/renderer/android/synchronous_compositor_factory.h" 86 #include "content/renderer/android/synchronous_compositor_factory.h"
87 #include "content/renderer/android/synchronous_compositor_filter.h" 87 #include "content/renderer/android/synchronous_compositor_filter.h"
88 #include "content/renderer/android/synchronous_compositor_output_surface.h" 88 #include "content/renderer/android/synchronous_compositor_output_surface.h"
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 if (compositor_) 1842 if (compositor_)
1843 compositor_->OnHandleCompositorProto(proto); 1843 compositor_->OnHandleCompositorProto(proto);
1844 } 1844 }
1845 1845
1846 void RenderWidget::showImeIfNeeded() { 1846 void RenderWidget::showImeIfNeeded() {
1847 OnShowImeIfNeeded(); 1847 OnShowImeIfNeeded();
1848 } 1848 }
1849 1849
1850 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { 1850 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) {
1851 if (IsUseZoomForDSFEnabled()) { 1851 if (IsUseZoomForDSFEnabled()) {
1852 float reverse = 1 / device_scale_factor_;
1853 // TODO(oshima): We may wait to allow pixel precision here as the the 1852 // TODO(oshima): We may wait to allow pixel precision here as the the
1854 // anchor element can be placed at half pixel. 1853 // anchor element can be placed at half pixel.
1855 gfx::Rect window_rect = 1854 gfx::Rect window_rect =
1856 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); 1855 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), 1 / device_scale_factor_);
1857 rect->x = window_rect.x(); 1856 *rect = window_rect;
1858 rect->y = window_rect.y();
1859 rect->width = window_rect.width();
1860 rect->height = window_rect.height();
1861 } 1857 }
1862 } 1858 }
1863 1859
1860 void RenderWidget::convertViewportToWindow(blink::WebFloatRect* rect) {
1861 if (IsUseZoomForDSFEnabled()) {
1862 gfx::RectF window_rect = gfx::RectF(*rect);
1863 window_rect.Scale(1 / device_scale_factor_);
1864 *rect = window_rect;
1865 }
1866 }
1867
1864 void RenderWidget::OnShowImeIfNeeded() { 1868 void RenderWidget::OnShowImeIfNeeded() {
1865 #if defined(OS_ANDROID) || defined(USE_AURA) 1869 #if defined(OS_ANDROID) || defined(USE_AURA)
1866 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME); 1870 UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_NON_IME);
1867 #endif 1871 #endif
1868 1872
1869 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with 1873 // TODO(rouslan): Fix ChromeOS and Windows 8 behavior of autofill popup with
1870 // virtual keyboard. 1874 // virtual keyboard.
1871 #if !defined(OS_ANDROID) 1875 #if !defined(OS_ANDROID)
1872 FocusChangeComplete(); 1876 FocusChangeComplete();
1873 #endif 1877 #endif
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2547 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2544 video_hole_frames_.AddObserver(frame); 2548 video_hole_frames_.AddObserver(frame);
2545 } 2549 }
2546 2550
2547 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2551 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2548 video_hole_frames_.RemoveObserver(frame); 2552 video_hole_frames_.RemoveObserver(frame);
2549 } 2553 }
2550 #endif // defined(VIDEO_HOLE) 2554 #endif // defined(VIDEO_HOLE)
2551 2555
2552 } // namespace content 2556 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698