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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 2 months 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
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/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
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
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_backing_store.cc ('k') | content/renderer/paint_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698