summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/style/GridLength.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/style/GridLength.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/style/GridLength.h')
-rw-r--r--Source/WebCore/rendering/style/GridLength.h28
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