Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 |
| 11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. | 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its | 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from | 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. | 16 * this software without specific prior written permission. |
| 17 * | 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef LinkImport_h | 31 #ifndef ProgrammaticScrollAnimator_h |
|
Ian Vollick
2014/02/06 16:02:31
I think you can muck with --similarity to convince
| |
| 32 #define LinkImport_h | 32 #define ProgrammaticScrollAnimator_h |
| 33 | 33 |
| 34 #include "core/html/HTMLImportChildClient.h" | 34 #include "platform/geometry/FloatPoint.h" |
| 35 #include "core/html/LinkResource.h" | |
| 36 #include "wtf/FastAllocBase.h" | 35 #include "wtf/FastAllocBase.h" |
| 36 #include "wtf/Noncopyable.h" | |
| 37 #include "wtf/OwnPtr.h" | |
| 37 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 38 #include "wtf/RefPtr.h" | 39 |
| 40 namespace blink { | |
| 41 class WebScrollOffsetAnimationCurve; | |
| 42 } | |
| 39 | 43 |
| 40 namespace WebCore { | 44 namespace WebCore { |
| 41 | 45 |
| 42 class Document; | 46 class FloatPoint; |
| 43 class HTMLImportChild; | 47 class ScrollableArea; |
| 44 | 48 |
| 45 // | 49 class ProgrammaticScrollAnimator { |
| 46 // A LinkResource subclasss used for @rel=import. | 50 WTF_MAKE_NONCOPYABLE(ProgrammaticScrollAnimator); |
| 47 // | |
| 48 class LinkImport FINAL : public LinkResource, public HTMLImportChildClient { | |
| 49 WTF_MAKE_FAST_ALLOCATED; | 51 WTF_MAKE_FAST_ALLOCATED; |
| 50 public: | 52 public: |
| 53 static PassOwnPtr<ProgrammaticScrollAnimator> create(ScrollableArea*); | |
| 51 | 54 |
| 52 static PassOwnPtr<LinkImport> create(HTMLLinkElement* owner); | 55 ~ProgrammaticScrollAnimator(); |
| 53 | 56 |
| 54 explicit LinkImport(HTMLLinkElement* owner); | 57 void animateToOffset(FloatPoint offset); |
| 55 virtual ~LinkImport(); | 58 void cancelAnimation(); |
| 59 void tickAnimation(double monotonicTime); | |
| 56 | 60 |
| 57 // LinkResource | 61 void notifyAnimationStarted(double monotonicTime); |
| 58 virtual void process() OVERRIDE; | 62 void notifyAnimationFinished(double monotonicTime); |
| 59 virtual Type type() const OVERRIDE { return Import; } | |
| 60 virtual void ownerRemoved() OVERRIDE; | |
| 61 virtual bool hasLoaded() const OVERRIDE; | |
| 62 | 63 |
| 63 // HTMLImportChildClient | 64 void canUseCompositedScrollAnimationsDidChange(); |
| 64 virtual void didFinish() OVERRIDE; | |
| 65 virtual void importChildWasDestroyed(HTMLImportChild*) OVERRIDE; | |
| 66 virtual bool isCreatedByParser() const OVERRIDE; | |
| 67 | |
| 68 Document* importedDocument() const; | |
| 69 bool ownsLoader() const; | |
| 70 | 65 |
| 71 private: | 66 private: |
| 72 void clear(); | 67 explicit ProgrammaticScrollAnimator(ScrollableArea*); |
| 73 | 68 |
| 74 HTMLImportChild* m_child; | 69 void resetAnimationState(); |
| 70 | |
| 71 ScrollableArea* m_scrollableArea; | |
| 72 OwnPtr<blink::WebScrollOffsetAnimationCurve> m_animationCurve; | |
| 73 FloatPoint m_targetOffset; | |
| 74 int m_animationId; | |
| 75 double m_startTime; | |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace WebCore | 78 } // namespace WebCore |
| 78 | 79 |
| 79 #endif // LinkImport_h | 80 #endif // ScrollAnimator_h |
| OLD | NEW |