| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool isLength() const { return m_type == LengthType; } | 58 bool isLength() const { return m_type == LengthType; } |
| 59 bool isFlex() const { return m_type == FlexType; } | 59 bool isFlex() const { return m_type == FlexType; } |
| 60 | 60 |
| 61 const Length& length() const { ASSERT(isLength()); return m_length; } | 61 const Length& length() const { ASSERT(isLength()); return m_length; } |
| 62 | 62 |
| 63 double flex() const { ASSERT(isFlex()); return m_flex; } | 63 double flex() const { ASSERT(isFlex()); return m_flex; } |
| 64 | 64 |
| 65 bool hasPercentage() const { return m_type == LengthType && m_length.hasPerc
ent(); } | 65 bool hasPercentage() const { return m_type == LengthType && m_length.isPerce
ntOrCalc(); } |
| 66 | 66 |
| 67 bool operator==(const GridLength& o) const | 67 bool operator==(const GridLength& o) const |
| 68 { | 68 { |
| 69 return m_length == o.m_length && m_flex == o.m_flex && m_type == o.m_typ
e; | 69 return m_length == o.m_length && m_flex == o.m_flex && m_type == o.m_typ
e; |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool isContentSized() const { return m_type == LengthType && (m_length.isAut
o() || m_length.isMinContent() || m_length.isMaxContent()); } | 72 bool isContentSized() const { return m_type == LengthType && (m_length.isAut
o() || m_length.isMinContent() || m_length.isMaxContent()); } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 // Ideally we would put the 2 following fields in a union, but Length has a
constructor, | 75 // Ideally we would put the 2 following fields in a union, but Length has a
constructor, |
| 76 // a destructor and a copy assignment which isn't allowed. | 76 // a destructor and a copy assignment which isn't allowed. |
| 77 Length m_length; | 77 Length m_length; |
| 78 double m_flex; | 78 double m_flex; |
| 79 enum GridLengthType { | 79 enum GridLengthType { |
| 80 LengthType, | 80 LengthType, |
| 81 FlexType | 81 FlexType |
| 82 }; | 82 }; |
| 83 GridLengthType m_type; | 83 GridLengthType m_type; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace blink | 86 } // namespace blink |
| 87 | 87 |
| 88 #endif // GridLength_h | 88 #endif // GridLength_h |
| OLD | NEW |