diff options
Diffstat (limited to 'Source/WebCore/rendering/style/GridLength.h')
| -rw-r--r-- | Source/WebCore/rendering/style/GridLength.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/WebCore/rendering/style/GridLength.h b/Source/WebCore/rendering/style/GridLength.h index 3a9ec4e8c..2747007bb 100644 --- a/Source/WebCore/rendering/style/GridLength.h +++ b/Source/WebCore/rendering/style/GridLength.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2013 Google Inc. All rights reserved. - * Copyright (C) 2013 Igalia S.L. + * Copyright (C) 2013, 2014 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,6 +32,8 @@ #ifndef GridLength_h #define GridLength_h +#if ENABLE(CSS_GRID_LAYOUT) + #include "Length.h" namespace WebCore { @@ -41,17 +43,17 @@ namespace WebCore { // an new unit to Length.h. class GridLength { public: - GridLength() - : m_length(Undefined) + GridLength(const Length& length) + : m_length(length) , m_flex(0) , m_type(LengthType) { + ASSERT(!length.isUndefined()); } - GridLength(const Length& length) - : m_length(length) - , m_flex(0) - , m_type(LengthType) + explicit GridLength(double flex) + : m_flex(flex) + , m_type(FlexType) { } @@ -59,14 +61,10 @@ public: bool isFlex() const { return m_type == FlexType; } const Length& length() const { ASSERT(isLength()); return m_length; } - Length& length() { ASSERT(isLength()); return m_length; } double flex() const { ASSERT(isFlex()); return m_flex; } - void setFlex(double flex) - { - m_type = FlexType; - m_flex = flex; - } + + bool isPercentage() const { return m_type == LengthType && m_length.isPercentOrCalculated(); } bool operator==(const GridLength& o) const { @@ -89,4 +87,6 @@ private: } // namespace WebCore +#endif /* ENABLE(CSS_GRID_LAYOUT) */ + #endif // GridLength_h |
