| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. 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 Loading... |
| 46 public: | 46 public: |
| 47 GridLength(const Length& length) | 47 GridLength(const Length& length) |
| 48 : m_length(length), m_flex(0), m_type(LengthType) {} | 48 : m_length(length), m_flex(0), m_type(LengthType) {} |
| 49 | 49 |
| 50 explicit GridLength(double flex) : m_flex(flex), m_type(FlexType) {} | 50 explicit GridLength(double flex) : m_flex(flex), m_type(FlexType) {} |
| 51 | 51 |
| 52 bool isLength() const { return m_type == LengthType; } | 52 bool isLength() const { return m_type == LengthType; } |
| 53 bool isFlex() const { return m_type == FlexType; } | 53 bool isFlex() const { return m_type == FlexType; } |
| 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 | 59 |
| 60 double flex() const { | 60 double flex() const { |
| 61 ASSERT(isFlex()); | 61 DCHECK(isFlex()); |
| 62 return m_flex; | 62 return m_flex; |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool hasPercentage() const { | 65 bool hasPercentage() const { |
| 66 return m_type == LengthType && m_length.isPercentOrCalc(); | 66 return m_type == LengthType && m_length.isPercentOrCalc(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool operator==(const GridLength& o) const { | 69 bool operator==(const GridLength& o) const { |
| 70 return m_length == o.m_length && m_flex == o.m_flex && m_type == o.m_type; | 70 return m_length == o.m_length && m_flex == o.m_flex && m_type == o.m_type; |
| 71 } | 71 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 // constructor, a destructor and a copy assignment which isn't allowed. | 83 // constructor, a destructor and a copy assignment which isn't allowed. |
| 84 Length m_length; | 84 Length m_length; |
| 85 double m_flex; | 85 double m_flex; |
| 86 enum GridLengthType { LengthType, FlexType }; | 86 enum GridLengthType { LengthType, FlexType }; |
| 87 GridLengthType m_type; | 87 GridLengthType m_type; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| 91 | 91 |
| 92 #endif // GridLength_h | 92 #endif // GridLength_h |
| OLD | NEW |