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

Side by Side Diff: ui/gfx/rect_f.h

Issue 24883002: Uses and returns the fractional width in text eliding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win bots Created 7 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 | Annotate | Revision Log
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 #ifndef UI_GFX_RECT_F_H_ 5 #ifndef UI_GFX_RECT_F_H_
6 #define UI_GFX_RECT_F_H_ 6 #define UI_GFX_RECT_F_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ui/gfx/point_f.h" 10 #include "ui/gfx/point_f.h"
11 #include "ui/gfx/rect_base.h" 11 #include "ui/gfx/rect_base.h"
12 #include "ui/gfx/size_f.h" 12 #include "ui/gfx/size_f.h"
13 #include "ui/gfx/vector2d_f.h" 13 #include "ui/gfx/vector2d_f.h"
14 14
15 #if defined(OS_IOS)
16 #include <CoreGraphics/CoreGraphics.h>
17 #elif defined(OS_MACOSX)
18 #include <ApplicationServices/ApplicationServices.h>
19 #endif
20
15 namespace gfx { 21 namespace gfx {
16 22
17 class InsetsF; 23 class InsetsF;
18 24
19 // A floating version of gfx::Rect. 25 // A floating version of gfx::Rect.
20 class GFX_EXPORT RectF 26 class GFX_EXPORT RectF
21 : public RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> { 27 : public RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> {
22 public: 28 public:
23 RectF() 29 RectF()
24 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> 30 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
(...skipping 10 matching lines...) Expand all
35 explicit RectF(const SizeF& size) 41 explicit RectF(const SizeF& size)
36 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> 42 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
37 (size) {} 43 (size) {}
38 44
39 RectF(const PointF& origin, const SizeF& size) 45 RectF(const PointF& origin, const SizeF& size)
40 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> 46 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
41 (origin, size) {} 47 (origin, size) {}
42 48
43 ~RectF() {} 49 ~RectF() {}
44 50
51 #if defined(OS_MACOSX)
52 // Construct an equivalent CoreGraphics object.
53 CGRect ToCGRect() const;
msw 2013/10/01 02:42:48 I don't see this used anywhere in your patch; remo
jianli 2013/10/01 18:56:50 Indeed it is needed in autofill_popup_view_cocoa.m
54 #endif
55
45 // Scales the rectangle by |scale|. 56 // Scales the rectangle by |scale|.
46 void Scale(float scale) { 57 void Scale(float scale) {
47 Scale(scale, scale); 58 Scale(scale, scale);
48 } 59 }
49 60
50 void Scale(float x_scale, float y_scale) { 61 void Scale(float x_scale, float y_scale) {
51 set_origin(ScalePoint(origin(), x_scale, y_scale)); 62 set_origin(ScalePoint(origin(), x_scale, y_scale));
52 set_size(ScaleSize(size(), x_scale, y_scale)); 63 set_size(ScaleSize(size(), x_scale, y_scale));
53 } 64 }
54 65
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // contained within the rect, because they will appear on one of these edges. 115 // contained within the rect, because they will appear on one of these edges.
105 GFX_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); 116 GFX_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2);
106 117
107 #if !defined(COMPILER_MSVC) 118 #if !defined(COMPILER_MSVC)
108 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; 119 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>;
109 #endif 120 #endif
110 121
111 } // namespace gfx 122 } // namespace gfx
112 123
113 #endif // UI_GFX_RECT_F_H_ 124 #endif // UI_GFX_RECT_F_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698