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

Side by Side Diff: third_party/WebKit/Source/web/LinkHighlightImpl.cpp

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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
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/CompositorAnimation.h" 38 #include "platform/animation/CompositorAnimation.h"
38 #include "platform/animation/CompositorAnimationCurve.h" 39 #include "platform/animation/CompositorAnimationCurve.h"
39 #include "platform/animation/CompositorFloatAnimationCurve.h" 40 #include "platform/animation/CompositorFloatAnimationCurve.h"
40 #include "platform/animation/CompositorTargetProperty.h" 41 #include "platform/animation/CompositorTargetProperty.h"
41 #include "platform/animation/TimingFunction.h" 42 #include "platform/animation/TimingFunction.h"
42 #include "platform/graphics/Color.h" 43 #include "platform/graphics/Color.h"
44 #include "platform/graphics/CompositorElementId.h"
45 #include "platform/graphics/CompositorMutableProperties.h"
43 #include "platform/graphics/GraphicsLayer.h" 46 #include "platform/graphics/GraphicsLayer.h"
44 #include "platform/graphics/paint/DrawingRecorder.h" 47 #include "platform/graphics/paint/DrawingRecorder.h"
45 #include "public/platform/Platform.h" 48 #include "public/platform/Platform.h"
46 #include "public/platform/WebCompositorSupport.h" 49 #include "public/platform/WebCompositorSupport.h"
47 #include "public/platform/WebContentLayer.h" 50 #include "public/platform/WebContentLayer.h"
48 #include "public/platform/WebDisplayItemList.h" 51 #include "public/platform/WebDisplayItemList.h"
49 #include "public/platform/WebFloatPoint.h" 52 #include "public/platform/WebFloatPoint.h"
50 #include "public/platform/WebLayer.h" 53 #include "public/platform/WebLayer.h"
51 #include "public/platform/WebRect.h" 54 #include "public/platform/WebRect.h"
52 #include "public/platform/WebSize.h" 55 #include "public/platform/WebSize.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 m_contentLayer = wrapUnique(compositorSupport->createContentLayer(this)); 89 m_contentLayer = wrapUnique(compositorSupport->createContentLayer(this));
87 m_clipLayer = wrapUnique(compositorSupport->createLayer()); 90 m_clipLayer = wrapUnique(compositorSupport->createLayer());
88 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); 91 m_clipLayer->setTransformOrigin(WebFloatPoint3D());
89 m_clipLayer->addChild(m_contentLayer->layer()); 92 m_clipLayer->addChild(m_contentLayer->layer());
90 93
91 m_compositorPlayer = CompositorAnimationPlayer::create(); 94 m_compositorPlayer = CompositorAnimationPlayer::create();
92 DCHECK(m_compositorPlayer); 95 DCHECK(m_compositorPlayer);
93 m_compositorPlayer->setAnimationDelegate(this); 96 m_compositorPlayer->setAnimationDelegate(this);
94 if (m_owningWebViewImpl->linkHighlightsTimeline()) 97 if (m_owningWebViewImpl->linkHighlightsTimeline())
95 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); 98 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this);
96 m_compositorPlayer->attachLayer(m_contentLayer->layer());
97 99
100 CompositorElementId elementId = createCompositorElementId(DOMNodeIds::idForN ode(node), CompositorSubElementId::LinkHighlight);
101 m_compositorPlayer->attachElement(elementId);
98 m_contentLayer->layer()->setDrawsContent(true); 102 m_contentLayer->layer()->setDrawsContent(true);
99 m_contentLayer->layer()->setOpacity(1); 103 m_contentLayer->layer()->setOpacity(1);
104 m_contentLayer->layer()->setElementId(elementId);
100 m_geometryNeedsUpdate = true; 105 m_geometryNeedsUpdate = true;
101 } 106 }
102 107
103 LinkHighlightImpl::~LinkHighlightImpl() 108 LinkHighlightImpl::~LinkHighlightImpl()
104 { 109 {
105 if (m_compositorPlayer->isLayerAttached()) 110 if (m_compositorPlayer->isElementAttached())
106 m_compositorPlayer->detachLayer(); 111 m_compositorPlayer->detachElement();
107 if (m_owningWebViewImpl->linkHighlightsTimeline()) 112 if (m_owningWebViewImpl->linkHighlightsTimeline())
108 m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this); 113 m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this);
109 m_compositorPlayer->setAnimationDelegate(nullptr); 114 m_compositorPlayer->setAnimationDelegate(nullptr);
110 m_compositorPlayer.reset(); 115 m_compositorPlayer.reset();
111 116
112 clearGraphicsLayerLinkHighlightPointer(); 117 clearGraphicsLayerLinkHighlightPointer();
113 releaseResources(); 118 releaseResources();
114 } 119 }
115 120
116 WebContentLayer* LinkHighlightImpl::contentLayer() 121 WebContentLayer* LinkHighlightImpl::contentLayer()
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 { 398 {
394 return clipLayer(); 399 return clipLayer();
395 } 400 }
396 401
397 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const 402 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const
398 { 403 {
399 return m_compositorPlayer.get(); 404 return m_compositorPlayer.get();
400 } 405 }
401 406
402 } // namespace blink 407 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698