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

Side by Side Diff: sky/engine/web/LinkHighlight.h

Issue 762993003: Remove GraphicsLayer family of classes. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
(Empty)
1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef SKY_ENGINE_WEB_LINKHIGHLIGHT_H_
27 #define SKY_ENGINE_WEB_LINKHIGHLIGHT_H_
28
29 #include "sky/engine/platform/geometry/FloatPoint.h"
30 #include "sky/engine/platform/geometry/IntPoint.h"
31 #include "sky/engine/platform/graphics/GraphicsLayer.h"
32 #include "sky/engine/platform/graphics/Path.h"
33 #include "sky/engine/public/platform/WebCompositorAnimationDelegate.h"
34 #include "sky/engine/public/platform/WebContentLayer.h"
35 #include "sky/engine/public/platform/WebContentLayerClient.h"
36 #include "sky/engine/public/platform/WebLayer.h"
37 #include "sky/engine/wtf/OwnPtr.h"
38 #include "sky/engine/wtf/Vector.h"
39
40 namespace blink {
41
42 class RenderLayer;
43 class RenderObject;
44 class Node;
45 struct WebFloatRect;
46 struct WebRect;
47 class WebViewImpl;
48
49 class LinkHighlight final : public WebContentLayerClient, public WebCompositorAn imationDelegate, blink::LinkHighlightClient {
50 public:
51 static PassOwnPtr<LinkHighlight> create(Node*, WebViewImpl*);
52 virtual ~LinkHighlight();
53
54 WebContentLayer* contentLayer();
55 WebLayer* clipLayer();
56 void startHighlightAnimationIfNeeded();
57 void updateGeometry();
58
59 // WebContentLayerClient implementation.
60 virtual void paintContents(WebCanvas*, const WebRect& clipRect, bool canPain tLCDText, WebFloatRect& opaque,
61 WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) o verride;
62
63 // WebCompositorAnimationDelegate implementation.
64 virtual void notifyAnimationStarted(double monotonicTime, blink::WebComposit orAnimation::TargetProperty) override;
65 virtual void notifyAnimationFinished(double monotonicTime, blink::WebComposi torAnimation::TargetProperty) override;
66
67 // LinkHighlightClient inplementation.
68 virtual void invalidate() override;
69 virtual WebLayer* layer() override;
70 virtual void clearCurrentGraphicsLayer() override;
71
72 GraphicsLayer* currentGraphicsLayerForTesting() const { return m_currentGrap hicsLayer; }
73
74 private:
75 LinkHighlight(Node*, WebViewImpl*);
76
77 void releaseResources();
78 void computeQuads(RenderObject&, WTF::Vector<FloatQuad>&) const;
79
80 RenderLayer* computeEnclosingCompositingLayer();
81 void clearGraphicsLayerLinkHighlightPointer();
82 // This function computes the highlight path, and returns true if it has cha nged
83 // size since the last call to this function.
84 bool computeHighlightLayerPathAndPosition(RenderLayer*);
85
86 OwnPtr<WebContentLayer> m_contentLayer;
87 OwnPtr<WebLayer> m_clipLayer;
88 Path m_path;
89
90 RefPtr<Node> m_node;
91 WebViewImpl* m_owningWebViewImpl;
92 GraphicsLayer* m_currentGraphicsLayer;
93
94 bool m_geometryNeedsUpdate;
95 bool m_isAnimating;
96 double m_startTime;
97 };
98
99 } // namespace blink
100
101 #endif // SKY_ENGINE_WEB_LINKHIGHLIGHT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698