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