| 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 reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "platform/Length.h" | 26 #include "platform/Length.h" |
| 27 | 27 |
| 28 #include "platform/CalculationValue.h" | 28 #include "platform/CalculationValue.h" |
| 29 #include "platform/animation/AnimationUtilities.h" | 29 #include "platform/animation/AnimationUtilities.h" |
| 30 #include "wtf/ASCIICType.h" | 30 #include "wtf/ASCIICType.h" |
| 31 #include "wtf/text/StringBuffer.h" | 31 #include "wtf/text/StringBuffer.h" |
| 32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
| 33 | 33 |
| 34 using namespace WTF; | 34 using namespace WTF; |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace blink { |
| 37 | 37 |
| 38 template<typename CharType> | 38 template<typename CharType> |
| 39 static unsigned splitLength(const CharType* data, unsigned length, unsigned& int
Length, unsigned& doubleLength) | 39 static unsigned splitLength(const CharType* data, unsigned length, unsigned& int
Length, unsigned& doubleLength) |
| 40 { | 40 { |
| 41 ASSERT(length); | 41 ASSERT(length); |
| 42 | 42 |
| 43 unsigned i = 0; | 43 unsigned i = 0; |
| 44 while (i < length && isSpaceOrNewline(data[i])) | 44 while (i < length && isSpaceOrNewline(data[i])) |
| 45 ++i; | 45 ++i; |
| 46 if (i < length && (data[i] == '+' || data[i] == '-')) | 46 if (i < length && (data[i] == '+' || data[i] == '-')) |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 { | 175 { |
| 176 m_intValue = calcHandles().insert(calc); | 176 m_intValue = calcHandles().insert(calc); |
| 177 } | 177 } |
| 178 | 178 |
| 179 Length Length::blendMixedTypes(const Length& from, double progress, ValueRange r
ange) const | 179 Length Length::blendMixedTypes(const Length& from, double progress, ValueRange r
ange) const |
| 180 { | 180 { |
| 181 ASSERT(from.isSpecified()); | 181 ASSERT(from.isSpecified()); |
| 182 ASSERT(isSpecified()); | 182 ASSERT(isSpecified()); |
| 183 PixelsAndPercent fromPixelsAndPercent = from.pixelsAndPercent(); | 183 PixelsAndPercent fromPixelsAndPercent = from.pixelsAndPercent(); |
| 184 PixelsAndPercent toPixelsAndPercent = pixelsAndPercent(); | 184 PixelsAndPercent toPixelsAndPercent = pixelsAndPercent(); |
| 185 const float pixels = WebCore::blend(fromPixelsAndPercent.pixels, toPixelsAnd
Percent.pixels, progress); | 185 const float pixels = blink::blend(fromPixelsAndPercent.pixels, toPixelsAndPe
rcent.pixels, progress); |
| 186 const float percent = WebCore::blend(fromPixelsAndPercent.percent, toPixelsA
ndPercent.percent, progress); | 186 const float percent = blink::blend(fromPixelsAndPercent.percent, toPixelsAnd
Percent.percent, progress); |
| 187 return Length(CalculationValue::create(PixelsAndPercent(pixels, percent), ra
nge)); | 187 return Length(CalculationValue::create(PixelsAndPercent(pixels, percent), ra
nge)); |
| 188 } | 188 } |
| 189 | 189 |
| 190 PixelsAndPercent Length::pixelsAndPercent() const | 190 PixelsAndPercent Length::pixelsAndPercent() const |
| 191 { | 191 { |
| 192 switch (type()) { | 192 switch (type()) { |
| 193 case Fixed: | 193 case Fixed: |
| 194 return PixelsAndPercent(value(), 0); | 194 return PixelsAndPercent(value(), 0); |
| 195 case Percent: | 195 case Percent: |
| 196 return PixelsAndPercent(0, value()); | 196 return PixelsAndPercent(0, value()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 { | 245 { |
| 246 return isCalculated() && (&calculationValue() == &o.calculationValue() || ca
lculationValue() == o.calculationValue()); | 246 return isCalculated() && (&calculationValue() == &o.calculationValue() || ca
lculationValue() == o.calculationValue()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 struct SameSizeAsLength { | 249 struct SameSizeAsLength { |
| 250 int32_t value; | 250 int32_t value; |
| 251 int32_t metaData; | 251 int32_t metaData; |
| 252 }; | 252 }; |
| 253 COMPILE_ASSERT(sizeof(Length) == sizeof(SameSizeAsLength), length_should_stay_sm
all); | 253 COMPILE_ASSERT(sizeof(Length) == sizeof(SameSizeAsLength), length_should_stay_sm
all); |
| 254 | 254 |
| 255 } // namespace WebCore | 255 } // namespace blink |
| OLD | NEW |