OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 PixelsAndPercent Length::GetPixelsAndPercent() const { | 106 PixelsAndPercent Length::GetPixelsAndPercent() const { |
107 switch (GetType()) { | 107 switch (GetType()) { |
108 case kFixed: | 108 case kFixed: |
109 return PixelsAndPercent(Value(), 0); | 109 return PixelsAndPercent(Value(), 0); |
110 case kPercent: | 110 case kPercent: |
111 return PixelsAndPercent(0, Value()); | 111 return PixelsAndPercent(0, Value()); |
112 case kCalculated: | 112 case kCalculated: |
113 return GetCalculationValue().GetPixelsAndPercent(); | 113 return GetCalculationValue().GetPixelsAndPercent(); |
114 default: | 114 default: |
115 ASSERT_NOT_REACHED(); | 115 NOTREACHED(); |
116 return PixelsAndPercent(0, 0); | 116 return PixelsAndPercent(0, 0); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 Length Length::SubtractFromOneHundredPercent() const { | 120 Length Length::SubtractFromOneHundredPercent() const { |
121 PixelsAndPercent result = GetPixelsAndPercent(); | 121 PixelsAndPercent result = GetPixelsAndPercent(); |
122 result.pixels = -result.pixels; | 122 result.pixels = -result.pixels; |
123 result.percent = 100 - result.percent; | 123 result.percent = 100 - result.percent; |
124 if (result.pixels && result.percent) | 124 if (result.pixels && result.percent) |
125 return Length(CalculationValue::Create(result, kValueRangeAll)); | 125 return Length(CalculationValue::Create(result, kValueRangeAll)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 struct SameSizeAsLength { | 175 struct SameSizeAsLength { |
176 int32_t value; | 176 int32_t value; |
177 int32_t meta_data; | 177 int32_t meta_data; |
178 }; | 178 }; |
179 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), | 179 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), |
180 "length should stay small"); | 180 "length should stay small"); |
181 | 181 |
182 } // namespace blink | 182 } // namespace blink |
OLD | NEW |