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

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: 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
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..dabac82b1c476749da204b07b419b2a865f498e0 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1941,7 +1941,12 @@ 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());
+ if (IsUseZoomForDSFEnabled()) {
+ node_bounds = gfx::ScaleToEnclosedRect(
+ gfx::Rect(element.boundsInViewport()), 1 / device_scale_factor_);
bokan 2015/12/03 20:49:20 If you change convertViewportToWindow to return a
oshima 2015/12/03 21:58:17 I was going to change this during cleanup but forg
+ } else {
+ node_bounds = gfx::Rect(element.boundsInViewport());
+ }
is_editable = element.isEditable();
}
Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, is_editable,
@@ -2136,6 +2141,20 @@ const std::string& RenderViewImpl::GetAcceptLanguages() const {
return renderer_preferences_.accept_languages;
}
+void RenderViewImpl::convertViewportToWindow(blink::WebRect* rect) {
bokan 2015/12/03 20:49:20 Why not just make this return a gfx::Rect since Wi
oshima 2015/12/03 21:58:17 This was a part of larger CL, and Blink needs this
bokan 2015/12/04 00:28:52 Ah, I see. Yah, right now I think gfx::Rect is sti
+ 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())
« content/public/renderer/render_view.h ('K') | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698