Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: third_party/WebKit/Source/core/style/GridLength.h

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('k') | third_party/WebKit/Source/core/svg/SVGLengthContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698