OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 Length AnimatableLength::length(float zoom, ValueRange range) const | 61 Length AnimatableLength::length(float zoom, ValueRange range) const |
62 { | 62 { |
63 if (!m_hasPercent) | 63 if (!m_hasPercent) |
64 return Length(clampNumber(m_pixels, range) * zoom, Fixed); | 64 return Length(clampNumber(m_pixels, range) * zoom, Fixed); |
65 if (!m_hasPixels) | 65 if (!m_hasPixels) |
66 return Length(clampNumber(m_percent, range), Percent); | 66 return Length(clampNumber(m_percent, range), Percent); |
67 return Length(CalculationValue::create(PixelsAndPercent(m_pixels * zoom, m_p
ercent), range)); | 67 return Length(CalculationValue::create(PixelsAndPercent(m_pixels * zoom, m_p
ercent), range)); |
68 } | 68 } |
69 | 69 |
70 PassRefPtrWillBeRawPtr<AnimatableValue> AnimatableLength::interpolateTo(const An
imatableValue* value, double fraction) const | 70 AnimatableValue* AnimatableLength::interpolateTo(const AnimatableValue* value, d
ouble fraction) const |
71 { | 71 { |
72 const AnimatableLength* length = toAnimatableLength(value); | 72 const AnimatableLength* length = toAnimatableLength(value); |
73 return create(blend(m_pixels, length->m_pixels, fraction), blend(m_percent,
length->m_percent, fraction), | 73 return create(blend(m_pixels, length->m_pixels, fraction), blend(m_percent,
length->m_percent, fraction), |
74 m_hasPixels || length->m_hasPixels, m_hasPercent || length->m_hasPercent
); | 74 m_hasPixels || length->m_hasPixels, m_hasPercent || length->m_hasPercent
); |
75 } | 75 } |
76 | 76 |
77 bool AnimatableLength::equalTo(const AnimatableValue* value) const | 77 bool AnimatableLength::equalTo(const AnimatableValue* value) const |
78 { | 78 { |
79 const AnimatableLength* length = toAnimatableLength(value); | 79 const AnimatableLength* length = toAnimatableLength(value); |
80 return m_pixels == length->m_pixels && m_percent == length->m_percent && m_h
asPixels == length->m_hasPixels && m_hasPercent == length->m_hasPercent; | 80 return m_pixels == length->m_pixels && m_percent == length->m_percent && m_h
asPixels == length->m_hasPixels && m_hasPercent == length->m_hasPercent; |
81 } | 81 } |
82 | 82 |
83 } // namespace blink | 83 } // namespace blink |
OLD | NEW |