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

Side by Side Diff: Source/web/LinkHighlight.h

Issue 1119763003: Animations: Port LinkHighlight to use compositor timelines. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 5 years, 5 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
« no previous file with comments | « no previous file | Source/web/LinkHighlight.cpp » ('j') | Source/web/LinkHighlight.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #ifndef LinkHighlight_h 26 #ifndef LinkHighlight_h
27 #define LinkHighlight_h 27 #define LinkHighlight_h
28 28
29 #include "platform/geometry/FloatPoint.h" 29 #include "platform/geometry/FloatPoint.h"
30 #include "platform/geometry/IntPoint.h" 30 #include "platform/geometry/IntPoint.h"
31 #include "platform/graphics/GraphicsLayer.h" 31 #include "platform/graphics/GraphicsLayer.h"
32 #include "platform/graphics/Path.h" 32 #include "platform/graphics/Path.h"
33 #include "public/platform/WebCompositorAnimationDelegate.h" 33 #include "public/platform/WebCompositorAnimationDelegate.h"
34 #include "public/platform/WebCompositorAnimationPlayer.h"
35 #include "public/platform/WebCompositorAnimationPlayerClient.h"
34 #include "public/platform/WebContentLayer.h" 36 #include "public/platform/WebContentLayer.h"
35 #include "public/platform/WebContentLayerClient.h" 37 #include "public/platform/WebContentLayerClient.h"
36 #include "public/platform/WebLayer.h" 38 #include "public/platform/WebLayer.h"
37 #include "wtf/OwnPtr.h" 39 #include "wtf/OwnPtr.h"
38 #include "wtf/Vector.h" 40 #include "wtf/Vector.h"
39 41
40 namespace blink { 42 namespace blink {
41 43
42 class LayoutBoxModelObject; 44 class LayoutBoxModelObject;
43 class Node; 45 class Node;
44 struct WebRect; 46 struct WebRect;
45 class WebViewImpl; 47 class WebViewImpl;
46 48
47 class LinkHighlight final : public WebContentLayerClient, public WebCompositorAn imationDelegate, LinkHighlightClient { 49 class LinkHighlight final : public WebContentLayerClient, public WebCompositorAn imationDelegate, LinkHighlightClient, WebCompositorAnimationPlayerClient {
48 public: 50 public:
49 static PassOwnPtr<LinkHighlight> create(Node*, WebViewImpl*); 51 static PassOwnPtr<LinkHighlight> create(Node*, WebViewImpl*);
50 virtual ~LinkHighlight(); 52 virtual ~LinkHighlight();
51 53
52 WebContentLayer* contentLayer(); 54 WebContentLayer* contentLayer();
53 WebLayer* clipLayer(); 55 WebLayer* clipLayer();
54 void startHighlightAnimationIfNeeded(); 56 void startHighlightAnimationIfNeeded();
55 void updateGeometry(); 57 void updateGeometry();
56 58
57 // WebContentLayerClient implementation. 59 // WebContentLayerClient implementation.
58 virtual void paintContents(WebCanvas*, const WebRect& clipRect, WebContentLa yerClient::PaintingControlSetting) override; 60 virtual void paintContents(WebCanvas*, const WebRect& clipRect, WebContentLa yerClient::PaintingControlSetting) override;
59 virtual void paintContents(WebDisplayItemList*, const WebRect& clipRect, Web ContentLayerClient::PaintingControlSetting) override; 61 virtual void paintContents(WebDisplayItemList*, const WebRect& clipRect, Web ContentLayerClient::PaintingControlSetting) override;
60 62
61 // WebCompositorAnimationDelegate implementation. 63 // WebCompositorAnimationDelegate implementation.
62 virtual void notifyAnimationStarted(double monotonicTime, int group) overrid e; 64 virtual void notifyAnimationStarted(double monotonicTime, int group) overrid e;
63 virtual void notifyAnimationFinished(double monotonicTime, int group) overri de; 65 virtual void notifyAnimationFinished(double monotonicTime, int group) overri de;
64 66
65 // LinkHighlightClient implementation. 67 // LinkHighlightClient implementation.
66 virtual void invalidate() override; 68 virtual void invalidate() override;
67 virtual WebLayer* layer() override; 69 virtual WebLayer* layer() override;
68 virtual void clearCurrentGraphicsLayer() override; 70 virtual void clearCurrentGraphicsLayer() override;
69 71
72 // WebCompositorAnimationPlayerClient implementation.
73 WebCompositorAnimationPlayer* compositorPlayer() const override;
74
70 GraphicsLayer* currentGraphicsLayerForTesting() const { return m_currentGrap hicsLayer; } 75 GraphicsLayer* currentGraphicsLayerForTesting() const { return m_currentGrap hicsLayer; }
71 76
72 private: 77 private:
73 LinkHighlight(Node*, WebViewImpl*); 78 LinkHighlight(Node*, WebViewImpl*);
74 79
75 void releaseResources(); 80 void releaseResources();
76 void computeQuads(const Node&, WTF::Vector<FloatQuad>&) const; 81 void computeQuads(const Node&, WTF::Vector<FloatQuad>&) const;
77 82
78 void attachLinkHighlightToCompositingLayer(const LayoutBoxModelObject* paint InvalidationContainer); 83 void attachLinkHighlightToCompositingLayer(const LayoutBoxModelObject* paint InvalidationContainer);
79 void clearGraphicsLayerLinkHighlightPointer(); 84 void clearGraphicsLayerLinkHighlightPointer();
80 // This function computes the highlight path, and returns true if it has cha nged 85 // This function computes the highlight path, and returns true if it has cha nged
81 // size since the last call to this function. 86 // size since the last call to this function.
82 bool computeHighlightLayerPathAndPosition(const LayoutBoxModelObject*); 87 bool computeHighlightLayerPathAndPosition(const LayoutBoxModelObject*);
83 88
84 OwnPtr<WebContentLayer> m_contentLayer; 89 OwnPtr<WebContentLayer> m_contentLayer;
85 OwnPtr<WebLayer> m_clipLayer; 90 OwnPtr<WebLayer> m_clipLayer;
86 Path m_path; 91 Path m_path;
87 92
88 RefPtrWillBePersistent<Node> m_node; 93 RefPtrWillBePersistent<Node> m_node;
89 WebViewImpl* m_owningWebViewImpl; 94 WebViewImpl* m_owningWebViewImpl;
90 GraphicsLayer* m_currentGraphicsLayer; 95 GraphicsLayer* m_currentGraphicsLayer;
96 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer;
91 97
92 bool m_geometryNeedsUpdate; 98 bool m_geometryNeedsUpdate;
93 bool m_isAnimating; 99 bool m_isAnimating;
94 double m_startTime; 100 double m_startTime;
95 }; 101 };
96 102
97 } // namespace blink 103 } // namespace blink
98 104
99 #endif 105 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/web/LinkHighlight.cpp » ('j') | Source/web/LinkHighlight.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698