OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef SVGImageChromeClient_h | 29 #ifndef SVGImageChromeClient_h |
30 #define SVGImageChromeClient_h | 30 #define SVGImageChromeClient_h |
31 | 31 |
32 #include "base/gtest_prod_util.h" | 32 #include "base/gtest_prod_util.h" |
33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
34 #include "core/loader/EmptyClients.h" | 34 #include "core/loader/EmptyClients.h" |
35 #include "platform/Timer.h" | 35 #include "platform/Timer.h" |
| 36 #include <memory> |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class SVGImage; | 40 class SVGImage; |
40 | 41 |
41 class CORE_EXPORT SVGImageChromeClient final : public EmptyChromeClient { | 42 class CORE_EXPORT SVGImageChromeClient final : public EmptyChromeClient { |
42 public: | 43 public: |
43 static SVGImageChromeClient* create(SVGImage*); | 44 static SVGImageChromeClient* create(SVGImage*); |
44 | 45 |
45 bool isSVGImageChromeClient() const override; | 46 bool isSVGImageChromeClient() const override; |
46 | 47 |
47 SVGImage* image() const { return m_image; } | 48 SVGImage* image() const { return m_image; } |
48 | 49 |
49 void suspendAnimation(); | 50 void suspendAnimation(); |
50 void resumeAnimation(); | 51 void resumeAnimation(); |
51 bool isSuspended() const { return m_timelineState >= Suspended; } | 52 bool isSuspended() const { return m_timelineState >= Suspended; } |
52 | 53 |
53 private: | 54 private: |
54 explicit SVGImageChromeClient(SVGImage*); | 55 explicit SVGImageChromeClient(SVGImage*); |
55 | 56 |
56 void chromeDestroyed() override; | 57 void chromeDestroyed() override; |
57 void invalidateRect(const IntRect&) override; | 58 void invalidateRect(const IntRect&) override; |
58 void scheduleAnimation(Widget*) override; | 59 void scheduleAnimation(Widget*) override; |
59 | 60 |
60 void setTimer(Timer<SVGImageChromeClient>*); | 61 void setTimer(Timer<SVGImageChromeClient>*); |
61 void animationTimerFired(Timer<SVGImageChromeClient>*); | 62 void animationTimerFired(Timer<SVGImageChromeClient>*); |
62 | 63 |
63 SVGImage* m_image; | 64 SVGImage* m_image; |
64 OwnPtr<Timer<SVGImageChromeClient>> m_animationTimer; | 65 std::unique_ptr<Timer<SVGImageChromeClient>> m_animationTimer; |
65 enum { | 66 enum { |
66 Running, | 67 Running, |
67 Suspended, | 68 Suspended, |
68 SuspendedWithAnimationPending, | 69 SuspendedWithAnimationPending, |
69 } m_timelineState; | 70 } m_timelineState; |
70 | 71 |
71 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, TimelineSuspendAndResume); | 72 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, TimelineSuspendAndResume); |
72 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, ResetAnimation); | 73 FRIEND_TEST_ALL_PREFIXES(SVGImageTest, ResetAnimation); |
73 }; | 74 }; |
74 | 75 |
75 DEFINE_TYPE_CASTS(SVGImageChromeClient, ChromeClient, client, client->isSVGImage
ChromeClient(), client.isSVGImageChromeClient()); | 76 DEFINE_TYPE_CASTS(SVGImageChromeClient, ChromeClient, client, client->isSVGImage
ChromeClient(), client.isSVGImageChromeClient()); |
76 | 77 |
77 } // namespace blink | 78 } // namespace blink |
78 | 79 |
79 #endif // SVGImageChromeClient_h | 80 #endif // SVGImageChromeClient_h |
OLD | NEW |