| 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/disambiguation_popup_helper.h" | 5 #include "content/renderer/disambiguation_popup_helper.h" |
| 6 | 6 |
| 7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" | 7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" |
| 8 #include "ui/gfx/size_conversions.h" | 8 #include "ui/gfx/size_conversions.h" |
| 9 | 9 |
| 10 using WebKit::WebRect; | 10 using WebKit::WebRect; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 namespace content { | 86 namespace content { |
| 87 | 87 |
| 88 float DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( | 88 float DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( |
| 89 const gfx::Rect& tap_rect, | 89 const gfx::Rect& tap_rect, |
| 90 const WebVector<WebRect>& target_rects, | 90 const WebVector<WebRect>& target_rects, |
| 91 const gfx::Size& viewport_size, | 91 const gfx::Size& viewport_size, |
| 92 gfx::Rect* zoom_rect) { | 92 gfx::Rect* zoom_rect) { |
| 93 *zoom_rect = tap_rect; | 93 *zoom_rect = tap_rect; |
| 94 for (size_t i = 0; i < target_rects.size(); i++) | 94 for (size_t i = 0; i < target_rects.size(); i++) |
| 95 *zoom_rect = zoom_rect->Union(gfx::Rect(target_rects[i])); | 95 zoom_rect->Union(gfx::Rect(target_rects[i])); |
| 96 zoom_rect->Inset(-kDisambiguationPopupPadding, -kDisambiguationPopupPadding); | 96 zoom_rect->Inset(-kDisambiguationPopupPadding, -kDisambiguationPopupPadding); |
| 97 *zoom_rect = zoom_rect->Intersect(gfx::Rect(viewport_size)); | 97 zoom_rect->Intersect(gfx::Rect(viewport_size)); |
| 98 | 98 |
| 99 float scale = FindOptimalScaleFactor(target_rects); | 99 float scale = FindOptimalScaleFactor(target_rects); |
| 100 *zoom_rect = CropZoomArea( | 100 *zoom_rect = CropZoomArea( |
| 101 *zoom_rect, viewport_size, tap_rect.CenterPoint(), scale); | 101 *zoom_rect, viewport_size, tap_rect.CenterPoint(), scale); |
| 102 | 102 |
| 103 return scale; | 103 return scale; |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace content | 106 } // namespace content |
| OLD | NEW |