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

Side by Side Diff: ui/views/bubble/bubble_border.h

Issue 1633403002: MacViews: Add native drop shadow to dialogs on OSX < 10.10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 #ifndef UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ 6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
13 #include "ui/views/background.h" 13 #include "ui/views/background.h"
14 #include "ui/views/border.h" 14 #include "ui/views/border.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 class Rect; 17 class Rect;
18 class Path;
18 } 19 }
19 20
21 class SkPath;
22
20 namespace views { 23 namespace views {
21 class Painter; 24 class Painter;
22 25
23 namespace internal { 26 namespace internal {
24 27
25 // A helper that combines each border image-set painter with arrows and metrics. 28 // A helper that combines each border image-set painter with arrows and metrics.
26 struct BorderImages { 29 struct BorderImages {
27 BorderImages(const int border_image_ids[], 30 BorderImages(const int border_image_ids[],
28 const int arrow_image_ids[], 31 const int arrow_image_ids[],
29 int border_interior_thickness, 32 int border_interior_thickness,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 200
198 // Get the border exterior thickness, including stroke and shadow, in pixels. 201 // Get the border exterior thickness, including stroke and shadow, in pixels.
199 int GetBorderThickness() const; 202 int GetBorderThickness() const;
200 203
201 // Returns the corner radius of the current image set. 204 // Returns the corner radius of the current image set.
202 int GetBorderCornerRadius() const; 205 int GetBorderCornerRadius() const;
203 206
204 // Gets the arrow offset to use. 207 // Gets the arrow offset to use.
205 int GetArrowOffset(const gfx::Size& border_size) const; 208 int GetArrowOffset(const gfx::Size& border_size) const;
206 209
210 // Returns the arrow mask/path given |view_bounds|. |view_bounds| should be in
211 // it's own coordinates(i.e. with origin at (0,0)). An empty mask is returned
tapted 2016/01/28 05:59:22 nit: it's -> its, `coordinates(i.e. with origin at
karandeepb 2016/02/04 03:39:27 Done.
212 // in case the border doesn't have an arrow or the arrow paint type is not
213 // PAINT_NORMAL.
214 void GetArrowMask(const gfx::Rect& view_bounds, gfx::Path* mask) const;
tapted 2016/01/28 05:59:22 I think GetArrowPath is a better name for it, sinc
karandeepb 2016/02/04 03:39:28 Done.
215
207 // Overridden from Border: 216 // Overridden from Border:
208 void Paint(const View& view, gfx::Canvas* canvas) override; 217 void Paint(const View& view, gfx::Canvas* canvas) override;
209 gfx::Insets GetInsets() const override; 218 gfx::Insets GetInsets() const override;
210 gfx::Size GetMinimumSize() const override; 219 gfx::Size GetMinimumSize() const override;
211 220
212 private: 221 private:
213 FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetSizeForContentsSizeTest); 222 FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetSizeForContentsSizeTest);
214 FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetBoundsOriginTest); 223 FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, GetBoundsOriginTest);
215 FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, ShadowTypes); 224 FRIEND_TEST_ALL_PREFIXES(BubbleBorderTest, ShadowTypes);
216 225
217 // The border and arrow stroke size used in image assets, in pixels. 226 // The border and arrow stroke size used in image assets, in pixels.
218 static const int kStroke; 227 static const int kStroke;
219 228
220 gfx::Size GetSizeForContentsSize(const gfx::Size& contents_size) const; 229 gfx::Size GetSizeForContentsSize(const gfx::Size& contents_size) const;
221 gfx::ImageSkia* GetArrowImage() const; 230 gfx::ImageSkia* GetArrowImage() const;
222 gfx::Rect GetArrowRect(const gfx::Rect& bounds) const; 231 gfx::Rect GetArrowRect(const gfx::Rect& bounds) const;
232 void GetArrowMaskFromArrowBounds(const gfx::Rect& arrow_bounds,
tapted 2016/01/28 05:59:22 Mask/mask -> Path/path
karandeepb 2016/02/04 03:39:27 Done.
233 SkPath* mask) const;
223 void DrawArrow(gfx::Canvas* canvas, const gfx::Rect& arrow_bounds) const; 234 void DrawArrow(gfx::Canvas* canvas, const gfx::Rect& arrow_bounds) const;
224 235
225 internal::BorderImages* GetImagesForTest() const; 236 internal::BorderImages* GetImagesForTest() const;
226 237
227 Arrow arrow_; 238 Arrow arrow_;
228 int arrow_offset_; 239 int arrow_offset_;
229 ArrowPaintType arrow_paint_type_; 240 ArrowPaintType arrow_paint_type_;
230 BubbleAlignment alignment_; 241 BubbleAlignment alignment_;
231 Shadow shadow_; 242 Shadow shadow_;
232 internal::BorderImages* images_; 243 internal::BorderImages* images_;
(...skipping 14 matching lines...) Expand all
247 258
248 private: 259 private:
249 BubbleBorder* border_; 260 BubbleBorder* border_;
250 261
251 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); 262 DISALLOW_COPY_AND_ASSIGN(BubbleBackground);
252 }; 263 };
253 264
254 } // namespace views 265 } // namespace views
255 266
256 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ 267 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698