OLD | NEW |
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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 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 | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 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 | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "web/LinkHighlightImpl.h" | 26 #include "web/LinkHighlightImpl.h" |
27 | 27 |
| 28 #include "core/dom/DOMNodeIds.h" |
28 #include "core/dom/LayoutTreeBuilderTraversal.h" | 29 #include "core/dom/LayoutTreeBuilderTraversal.h" |
29 #include "core/dom/Node.h" | 30 #include "core/dom/Node.h" |
30 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
31 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
32 #include "core/layout/LayoutBoxModelObject.h" | 33 #include "core/layout/LayoutBoxModelObject.h" |
33 #include "core/layout/LayoutObject.h" | 34 #include "core/layout/LayoutObject.h" |
34 #include "core/layout/compositing/CompositedLayerMapping.h" | 35 #include "core/layout/compositing/CompositedLayerMapping.h" |
35 #include "core/paint/PaintLayer.h" | 36 #include "core/paint/PaintLayer.h" |
36 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
37 #include "platform/animation/CompositorAnimationCurve.h" | 38 #include "platform/animation/CompositorAnimationCurve.h" |
38 #include "platform/animation/CompositorFloatAnimationCurve.h" | 39 #include "platform/animation/CompositorFloatAnimationCurve.h" |
39 #include "platform/animation/TimingFunction.h" | 40 #include "platform/animation/TimingFunction.h" |
40 #include "platform/graphics/Color.h" | 41 #include "platform/graphics/Color.h" |
| 42 #include "platform/graphics/CompositorElementId.h" |
41 #include "platform/graphics/CompositorFactory.h" | 43 #include "platform/graphics/CompositorFactory.h" |
| 44 #include "platform/graphics/CompositorMutableProperties.h" |
42 #include "platform/graphics/GraphicsLayer.h" | 45 #include "platform/graphics/GraphicsLayer.h" |
43 #include "platform/graphics/paint/DrawingRecorder.h" | 46 #include "platform/graphics/paint/DrawingRecorder.h" |
44 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
45 #include "public/platform/WebCompositorSupport.h" | 48 #include "public/platform/WebCompositorSupport.h" |
46 #include "public/platform/WebContentLayer.h" | 49 #include "public/platform/WebContentLayer.h" |
47 #include "public/platform/WebDisplayItemList.h" | 50 #include "public/platform/WebDisplayItemList.h" |
48 #include "public/platform/WebFloatPoint.h" | 51 #include "public/platform/WebFloatPoint.h" |
49 #include "public/platform/WebLayer.h" | 52 #include "public/platform/WebLayer.h" |
50 #include "public/platform/WebRect.h" | 53 #include "public/platform/WebRect.h" |
51 #include "public/platform/WebSize.h" | 54 #include "public/platform/WebSize.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); | 86 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); |
84 m_clipLayer = adoptPtr(compositorSupport->createLayer()); | 87 m_clipLayer = adoptPtr(compositorSupport->createLayer()); |
85 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); | 88 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); |
86 m_clipLayer->addChild(m_contentLayer->layer()); | 89 m_clipLayer->addChild(m_contentLayer->layer()); |
87 | 90 |
88 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimationPl
ayer()); | 91 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimationPl
ayer()); |
89 DCHECK(m_compositorPlayer); | 92 DCHECK(m_compositorPlayer); |
90 m_compositorPlayer->setAnimationDelegate(this); | 93 m_compositorPlayer->setAnimationDelegate(this); |
91 if (m_owningWebViewImpl->linkHighlightsTimeline()) | 94 if (m_owningWebViewImpl->linkHighlightsTimeline()) |
92 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); | 95 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); |
93 m_compositorPlayer->attachLayer(m_contentLayer->layer()); | |
94 | 96 |
| 97 CompositorElementId elementId = createCompositorElementId(DOMNodeIds::idForN
ode(node), CompositorSubElementId::LinkHighlight); |
| 98 m_compositorPlayer->attachElement(elementId); |
95 m_contentLayer->layer()->setDrawsContent(true); | 99 m_contentLayer->layer()->setDrawsContent(true); |
96 m_contentLayer->layer()->setOpacity(1); | 100 m_contentLayer->layer()->setOpacity(1); |
| 101 m_contentLayer->layer()->setElementId(elementId); |
97 m_geometryNeedsUpdate = true; | 102 m_geometryNeedsUpdate = true; |
98 } | 103 } |
99 | 104 |
100 LinkHighlightImpl::~LinkHighlightImpl() | 105 LinkHighlightImpl::~LinkHighlightImpl() |
101 { | 106 { |
102 if (m_compositorPlayer->isLayerAttached()) | 107 if (m_compositorPlayer->isElementAttached()) |
103 m_compositorPlayer->detachLayer(); | 108 m_compositorPlayer->detachElement(); |
104 if (m_owningWebViewImpl->linkHighlightsTimeline()) | 109 if (m_owningWebViewImpl->linkHighlightsTimeline()) |
105 m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this); | 110 m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this); |
106 m_compositorPlayer->setAnimationDelegate(nullptr); | 111 m_compositorPlayer->setAnimationDelegate(nullptr); |
107 m_compositorPlayer.reset(); | 112 m_compositorPlayer.reset(); |
108 | 113 |
109 clearGraphicsLayerLinkHighlightPointer(); | 114 clearGraphicsLayerLinkHighlightPointer(); |
110 releaseResources(); | 115 releaseResources(); |
111 } | 116 } |
112 | 117 |
113 WebContentLayer* LinkHighlightImpl::contentLayer() | 118 WebContentLayer* LinkHighlightImpl::contentLayer() |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 { | 396 { |
392 return clipLayer(); | 397 return clipLayer(); |
393 } | 398 } |
394 | 399 |
395 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const | 400 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const |
396 { | 401 { |
397 return m_compositorPlayer.get(); | 402 return m_compositorPlayer.get(); |
398 } | 403 } |
399 | 404 |
400 } // namespace blink | 405 } // namespace blink |
OLD | NEW |