diff options
Diffstat (limited to 'Source/WebCore/rendering/style/GridLength.h')
-rw-r--r-- | Source/WebCore/rendering/style/GridLength.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/Source/WebCore/rendering/style/GridLength.h b/Source/WebCore/rendering/style/GridLength.h index 3a9ec4e8c..86acd330d 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 @@ -29,8 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GridLength_h -#define GridLength_h +#pragma once #include "Length.h" @@ -41,17 +40,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 +58,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 { @@ -74,6 +69,7 @@ public: } bool isContentSized() const { return m_type == LengthType && (m_length.isAuto() || m_length.isMinContent() || m_length.isMaxContent()); } + bool isAuto() const { return m_type == LengthType && m_length.isAuto(); } private: // Ideally we would put the 2 following fields in a union, but Length has a constructor, @@ -88,5 +84,3 @@ private: }; } // namespace WebCore - -#endif // GridLength_h |