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

Unified Diff: content/renderer/render_view_impl.cc

Issue 1455143004: Use the window coordinate for the autofill bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo 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_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 57b3ecfa1ed0a27a115f6c7614ce6a97fc9d21d7..e8d580b0f09260950427648508755252d7502f09 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1941,7 +1941,9 @@ void RenderViewImpl::focusedNodeChanged(const WebNode& fromNode,
bool is_editable = false;
if (!toNode.isNull() && toNode.isElementNode()) {
WebElement element = const_cast<WebNode&>(toNode).to<WebElement>();
- node_bounds = gfx::Rect(element.boundsInViewport());
+ blink::WebRect rect = element.boundsInViewport();
+ convertViewportToWindow(&rect);
+ node_bounds = gfx::Rect(rect);
is_editable = element.isEditable();
}
Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, is_editable,
@@ -2136,6 +2138,20 @@ const std::string& RenderViewImpl::GetAcceptLanguages() const {
return renderer_preferences_.accept_languages;
}
+void RenderViewImpl::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();
+ }
+}
+
void RenderViewImpl::didChangeIcon(WebLocalFrame* frame,
WebIconURL::Type icon_type) {
if (frame->parent())
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698