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

Side by Side Diff: third_party/WebKit/Source/core/animation/animatable/AnimatableLength.cpp

Issue 2750293003: Delete unused AnimatableValue code (Closed)
Patch Set: Fix unit tests Created 3 years, 9 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 Length AnimatableLength::getLength(float zoom, ValueRange range) const { 58 Length AnimatableLength::getLength(float zoom, ValueRange range) const {
59 if (!m_hasPercent) 59 if (!m_hasPercent)
60 return Length(clampNumber(m_pixels, range) * zoom, Fixed); 60 return Length(clampNumber(m_pixels, range) * zoom, Fixed);
61 if (!m_hasPixels) 61 if (!m_hasPixels)
62 return Length(clampNumber(m_percent, range), Percent); 62 return Length(clampNumber(m_percent, range), Percent);
63 return Length(CalculationValue::create( 63 return Length(CalculationValue::create(
64 PixelsAndPercent(m_pixels * zoom, m_percent), range)); 64 PixelsAndPercent(m_pixels * zoom, m_percent), range));
65 } 65 }
66 66
67 PassRefPtr<AnimatableValue> AnimatableLength::interpolateTo(
68 const AnimatableValue* value,
69 double fraction) const {
70 const AnimatableLength* length = toAnimatableLength(value);
71 return create(blend(m_pixels, length->m_pixels, fraction),
72 blend(m_percent, length->m_percent, fraction),
73 m_hasPixels || length->m_hasPixels,
74 m_hasPercent || length->m_hasPercent);
75 }
76
77 bool AnimatableLength::equalTo(const AnimatableValue* value) const { 67 bool AnimatableLength::equalTo(const AnimatableValue* value) const {
78 const AnimatableLength* length = toAnimatableLength(value); 68 const AnimatableLength* length = toAnimatableLength(value);
79 return m_pixels == length->m_pixels && m_percent == length->m_percent && 69 return m_pixels == length->m_pixels && m_percent == length->m_percent &&
80 m_hasPixels == length->m_hasPixels && 70 m_hasPixels == length->m_hasPixels &&
81 m_hasPercent == length->m_hasPercent; 71 m_hasPercent == length->m_hasPercent;
82 } 72 }
83 73
84 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698