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

Unified Diff: ui/views/view.cc

Issue 11359172: ui: Remove implicit flooring in skia rect conversion methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make root window transform in tests produce an integer result Created 8 years, 1 month 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 | « ui/views/controls/tree/tree_view_views.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 69fb8a064e3f03f67c94fff0432fba73b2140825..8fd3c678d44e650aa4bf205f0dbe5f1bdd8b0ca8 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -24,6 +24,7 @@
#include "ui/gfx/path.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/point3_f.h"
+#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/skia_util.h"
#include "ui/gfx/transform.h"
#include "ui/views/background.h"
@@ -354,8 +355,10 @@ gfx::Rect View::GetVisibleBounds() const {
if (vis_bounds.IsEmpty())
return vis_bounds;
// Convert back to this views coordinate system.
- transform.TransformRectReverse(&vis_bounds);
- return vis_bounds;
+ gfx::RectF views_vis_bounds(vis_bounds);
+ transform.TransformRectReverse(&views_vis_bounds);
+ // Partially visible pixels should be considered visible.
+ return gfx::ToEnclosingRect(views_vis_bounds);
}
gfx::Rect View::GetBoundsInScreen() const {
@@ -677,10 +680,11 @@ void View::ConvertPointFromScreen(const View* dst, gfx::Point* p) {
}
gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const {
- gfx::Rect x_rect = rect;
+ gfx::RectF x_rect = rect;
GetTransform().TransformRect(&x_rect);
x_rect.Offset(GetMirroredPosition().OffsetFromOrigin());
- return x_rect;
+ // Pixels we partially occupy in the parent should be included.
+ return gfx::ToEnclosingRect(x_rect);
}
gfx::Rect View::ConvertRectToWidget(const gfx::Rect& rect) const {
« no previous file with comments | « ui/views/controls/tree/tree_view_views.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698