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

Side by Side Diff: third_party/WebKit/Source/core/style/BorderStyle.h

Issue 2890733002: Make EBorderStyle an enum class. (Closed)
Patch Set: Build for Mac Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 19 matching lines...) Expand all
30 #include "platform/graphics/Color.h" 30 #include "platform/graphics/Color.h"
31 #include "platform/wtf/Allocator.h" 31 #include "platform/wtf/Allocator.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class BorderStyle { 35 class BorderStyle {
36 DISALLOW_NEW(); 36 DISALLOW_NEW();
37 friend class ComputedStyle; 37 friend class ComputedStyle;
38 38
39 public: 39 public:
40 BorderStyle() : style_(kBorderStyleNone), is_auto_(kOutlineIsAutoOff) {} 40 BorderStyle()
41 : style_(static_cast<unsigned>(EBorderStyle::kNone)),
42 is_auto_(kOutlineIsAutoOff) {}
41 43
42 bool NonZero() const { return (style_ != kBorderStyleNone); } 44 bool NonZero() const {
45 return (style_ != static_cast<unsigned>(EBorderStyle::kNone));
46 }
43 47
44 bool operator==(const BorderStyle& o) const { return style_ == o.style_; } 48 bool operator==(const BorderStyle& o) const { return style_ == o.style_; }
45 49
46 // The default width is 3px, but if the style is none we compute a value of 0 50 // The default width is 3px, but if the style is none we compute a value of 0
47 // (in ComputedStyle itself) 51 // (in ComputedStyle itself)
48 bool VisuallyEqual(const BorderStyle& o) const { 52 bool VisuallyEqual(const BorderStyle& o) const {
49 if (style_ == kBorderStyleNone && o.style_ == kBorderStyleNone) 53 if (style_ == static_cast<unsigned>(EBorderStyle::kNone) &&
54 o.style_ == static_cast<unsigned>(EBorderStyle::kNone))
50 return true; 55 return true;
51 if (style_ == kBorderStyleHidden && o.style_ == kBorderStyleHidden) 56 if (style_ == static_cast<unsigned>(EBorderStyle::kHidden) &&
57 o.style_ == static_cast<unsigned>(EBorderStyle::kHidden))
52 return true; 58 return true;
53 return *this == o; 59 return *this == o;
54 } 60 }
55 61
56 bool operator!=(const BorderStyle& o) const { return !(*this == o); } 62 bool operator!=(const BorderStyle& o) const { return !(*this == o); }
57 63
58 EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); } 64 EBorderStyle Style() const { return static_cast<EBorderStyle>(style_); }
59 void SetStyle(EBorderStyle style) { style_ = style; } 65 void SetStyle(EBorderStyle style) { style_ = static_cast<unsigned>(style); }
60 66
61 OutlineIsAuto IsAuto() const { return static_cast<OutlineIsAuto>(is_auto_); } 67 OutlineIsAuto IsAuto() const { return static_cast<OutlineIsAuto>(is_auto_); }
62 void SetIsAuto(OutlineIsAuto is_auto) { is_auto_ = is_auto; } 68 void SetIsAuto(OutlineIsAuto is_auto) { is_auto_ = is_auto; }
63 69
64 protected: 70 protected:
65 unsigned style_ : 4; // EBorderStyle 71 unsigned style_ : 4; // EBorderStyle
66 72
67 // This is only used by OutlineValue but moved here to keep the bits packed. 73 // This is only used by OutlineValue but moved here to keep the bits packed.
68 unsigned is_auto_ : 1; // OutlineIsAuto 74 unsigned is_auto_ : 1; // OutlineIsAuto
69 }; 75 };
70 76
71 } // namespace blink 77 } // namespace blink
72 78
73 #endif // BorderStyle_h 79 #endif // BorderStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/BorderEdge.cpp ('k') | third_party/WebKit/Source/core/style/BorderValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698