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

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

Issue 2751653003: Replace ASSERT and ASSERT_NOT_REACHED in core/style/ (Closed)
Patch Set: Replace ASSERT and ASSERT_NOT_REACHED in core/style/ Created 3 years, 9 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) 2013, Opera Software ASA. All rights reserved. 2 * Copyright (c) 2013, Opera Software ASA. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 public: 46 public:
47 BorderImageLength(double number) : m_number(number), m_type(NumberType) {} 47 BorderImageLength(double number) : m_number(number), m_type(NumberType) {}
48 48
49 BorderImageLength(const Length& length) 49 BorderImageLength(const Length& length)
50 : m_length(length), m_number(0), m_type(LengthType) {} 50 : m_length(length), m_number(0), m_type(LengthType) {}
51 51
52 bool isNumber() const { return m_type == NumberType; } 52 bool isNumber() const { return m_type == NumberType; }
53 bool isLength() const { return m_type == LengthType; } 53 bool isLength() const { return m_type == LengthType; }
54 54
55 const Length& length() const { 55 const Length& length() const {
56 ASSERT(isLength()); 56 DCHECK(isLength());
57 return m_length; 57 return m_length;
58 } 58 }
59 Length& length() { 59 Length& length() {
60 ASSERT(isLength()); 60 DCHECK(isLength());
61 return m_length; 61 return m_length;
62 } 62 }
63 63
64 double number() const { 64 double number() const {
65 ASSERT(isNumber()); 65 DCHECK(isNumber());
66 return m_number; 66 return m_number;
67 } 67 }
68 68
69 bool operator==(const BorderImageLength& other) const { 69 bool operator==(const BorderImageLength& other) const {
70 return m_type == other.m_type && m_length == other.m_length && 70 return m_type == other.m_type && m_length == other.m_length &&
71 m_number == other.m_number; 71 m_number == other.m_number;
72 } 72 }
73 73
74 bool isZero() const { 74 bool isZero() const {
75 if (isLength()) 75 if (isLength())
76 return m_length.isZero(); 76 return m_length.isZero();
77 77
78 ASSERT(isNumber()); 78 DCHECK(isNumber());
79 return !m_number; 79 return !m_number;
80 } 80 }
81 81
82 private: 82 private:
83 // Ideally we would put the 2 following fields in a union, but Length has a 83 // Ideally we would put the 2 following fields in a union, but Length has a
84 // constructor, a destructor and a copy assignment which isn't allowed. 84 // constructor, a destructor and a copy assignment which isn't allowed.
85 Length m_length; 85 Length m_length;
86 double m_number; 86 double m_number;
87 enum { LengthType, NumberType } m_type; 87 enum { LengthType, NumberType } m_type;
88 }; 88 };
89 89
90 } // namespace blink 90 } // namespace blink
91 91
92 #endif // BorderImageLength_h 92 #endif // BorderImageLength_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/BorderEdge.cpp ('k') | third_party/WebKit/Source/core/style/ClipPathOperation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698