Chromium Code Reviews| Index: Source/core/animation/InterpolationInvalidators.h |
| diff --git a/Source/core/animation/InterpolationInvalidators.h b/Source/core/animation/InterpolationInvalidators.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8146389685be7457215a08c9ff2416370f9fdcc0 |
| --- /dev/null |
| +++ b/Source/core/animation/InterpolationInvalidators.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef InterpolationInvalidators_h |
| +#define InterpolationInvalidators_h |
| + |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class StyleResolverState; |
| + |
| +class InterpolationInvalidators : public RefCountedWillBeGarbageCollectedFinalized<InterpolationInvalidators> { |
|
shans
2015/05/28 05:48:13
This needs either documentation, better names, or
alancutter (OOO until 2018)
2015/06/01 07:35:29
ConversionInvalidator is probably more accurate si
|
| +public: |
| + virtual ~InterpolationInvalidators() { } |
| + |
| + bool chainIsInvalid(const StyleResolverState& state) |
| + { |
| + return isInvalid(state) || (m_next && m_next->chainIsInvalid(state)); |
| + } |
| + |
| + static void chain(RefPtrWillBeRawPtr<InterpolationInvalidators>& prefix, PassRefPtrWillBeRawPtr<InterpolationInvalidators> suffix) |
|
Eric Willigers
2015/05/28 00:34:48
It would be nice to have a unit test that uses cha
alancutter (OOO until 2018)
2015/06/01 07:35:29
Done.
|
| + { |
| + if (!suffix) |
| + return; |
| + if (!prefix) |
| + prefix = suffix; |
| + else if (prefix != suffix) |
| + prefix->chainWith(suffix); |
| + } |
| + |
| + DEFINE_INLINE_VIRTUAL_TRACE() |
| + { |
| + visitor->trace(m_next); |
| + } |
| + |
| +protected: |
| + virtual bool isInvalid(const StyleResolverState&) = 0; |
| + |
| +private: |
| + void chainWith(PassRefPtrWillBeRawPtr<InterpolationInvalidators> suffix) |
|
shans
2015/05/28 05:48:13
Maybe use a Vector instead? This seems rather heav
alancutter (OOO until 2018)
2015/06/01 07:35:29
This is actually designed to be lightweight in the
|
| + { |
| + ASSERT(suffix); |
| + InterpolationInvalidators* current = this; |
| + while (current->m_next) { |
| + if (current == suffix) |
| + return; |
| + current = current->m_next.get(); |
| + } |
| + current->m_next = suffix; |
| + } |
| + |
| + RefPtrWillBeMember<InterpolationInvalidators> m_next; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // InterpolationInvalidators_h |