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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index cb0944417a612a42d4176a4e3642d324ebeeec02..38a9200265f1ec40e65a238cecb5b32c9093def2 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -59,7 +59,6 @@
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebPoint.h"
-#include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/public/platform/WebString.h"
@@ -76,6 +75,7 @@
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/rect_conversions.h"
+#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/skia_util.h"
#include "ui/gl/gl_switches.h"
@@ -1849,15 +1849,19 @@ void RenderWidget::showImeIfNeeded() {
void RenderWidget::convertViewportToWindow(blink::WebRect* rect) {
if (IsUseZoomForDSFEnabled()) {
- float reverse = 1 / device_scale_factor_;
// TODO(oshima): We may wait to allow pixel precision here as the the
// anchor element can be placed at half pixel.
gfx::Rect window_rect =
- gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse);
- rect->x = window_rect.x();
- rect->y = window_rect.y();
- rect->width = window_rect.width();
- rect->height = window_rect.height();
+ gfx::ScaleToEnclosedRect(gfx::Rect(*rect), 1 / device_scale_factor_);
+ *rect = window_rect;
+ }
+}
+
+void RenderWidget::convertViewportToWindow(blink::WebFloatRect* rect) {
+ if (IsUseZoomForDSFEnabled()) {
+ gfx::RectF window_rect = gfx::RectF(*rect);
+ window_rect.Scale(1 / device_scale_factor_);
+ *rect = window_rect;
}
}
« 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