| 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" | |
| 29 #include "core/dom/LayoutTreeBuilderTraversal.h" | 28 #include "core/dom/LayoutTreeBuilderTraversal.h" |
| 30 #include "core/dom/Node.h" | 29 #include "core/dom/Node.h" |
| 31 #include "core/frame/FrameView.h" | 30 #include "core/frame/FrameView.h" |
| 32 #include "core/frame/LocalFrame.h" | 31 #include "core/frame/LocalFrame.h" |
| 33 #include "core/layout/LayoutBoxModelObject.h" | 32 #include "core/layout/LayoutBoxModelObject.h" |
| 34 #include "core/layout/LayoutObject.h" | 33 #include "core/layout/LayoutObject.h" |
| 35 #include "core/layout/compositing/CompositedLayerMapping.h" | 34 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 36 #include "core/paint/PaintLayer.h" | 35 #include "core/paint/PaintLayer.h" |
| 37 #include "platform/RuntimeEnabledFeatures.h" | 36 #include "platform/RuntimeEnabledFeatures.h" |
| 38 #include "platform/animation/CompositorAnimationCurve.h" | 37 #include "platform/animation/CompositorAnimationCurve.h" |
| 39 #include "platform/animation/CompositorFloatAnimationCurve.h" | 38 #include "platform/animation/CompositorFloatAnimationCurve.h" |
| 40 #include "platform/animation/TimingFunction.h" | 39 #include "platform/animation/TimingFunction.h" |
| 41 #include "platform/graphics/Color.h" | 40 #include "platform/graphics/Color.h" |
| 42 #include "platform/graphics/CompositorElementId.h" | |
| 43 #include "platform/graphics/CompositorFactory.h" | 41 #include "platform/graphics/CompositorFactory.h" |
| 44 #include "platform/graphics/CompositorMutableProperties.h" | |
| 45 #include "platform/graphics/GraphicsLayer.h" | 42 #include "platform/graphics/GraphicsLayer.h" |
| 46 #include "platform/graphics/paint/DrawingRecorder.h" | 43 #include "platform/graphics/paint/DrawingRecorder.h" |
| 47 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
| 48 #include "public/platform/WebCompositorSupport.h" | 45 #include "public/platform/WebCompositorSupport.h" |
| 49 #include "public/platform/WebContentLayer.h" | 46 #include "public/platform/WebContentLayer.h" |
| 50 #include "public/platform/WebDisplayItemList.h" | 47 #include "public/platform/WebDisplayItemList.h" |
| 51 #include "public/platform/WebFloatPoint.h" | 48 #include "public/platform/WebFloatPoint.h" |
| 52 #include "public/platform/WebLayer.h" | 49 #include "public/platform/WebLayer.h" |
| 53 #include "public/platform/WebRect.h" | 50 #include "public/platform/WebRect.h" |
| 54 #include "public/platform/WebSize.h" | 51 #include "public/platform/WebSize.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); | 83 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); |
| 87 m_clipLayer = adoptPtr(compositorSupport->createLayer()); | 84 m_clipLayer = adoptPtr(compositorSupport->createLayer()); |
| 88 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); | 85 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); |
| 89 m_clipLayer->addChild(m_contentLayer->layer()); | 86 m_clipLayer->addChild(m_contentLayer->layer()); |
| 90 | 87 |
| 91 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimationPl
ayer()); | 88 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimationPl
ayer()); |
| 92 DCHECK(m_compositorPlayer); | 89 DCHECK(m_compositorPlayer); |
| 93 m_compositorPlayer->setAnimationDelegate(this); | 90 m_compositorPlayer->setAnimationDelegate(this); |
| 94 if (m_owningWebViewImpl->linkHighlightsTimeline()) | 91 if (m_owningWebViewImpl->linkHighlightsTimeline()) |
| 95 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); | 92 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); |
| 93 m_compositorPlayer->attachLayer(m_contentLayer->layer()); |
| 96 | 94 |
| 97 CompositorElementId elementId = createCompositorElementId(DOMNodeIds::idForN
ode(node), CompositorSubElementId::LinkHighlight); | |
| 98 m_compositorPlayer->attachElement(elementId); | |
| 99 m_contentLayer->layer()->setDrawsContent(true); | 95 m_contentLayer->layer()->setDrawsContent(true); |
| 100 m_contentLayer->layer()->setOpacity(1); | 96 m_contentLayer->layer()->setOpacity(1); |
| 101 m_contentLayer->layer()->setElementId(elementId); | |
| 102 m_geometryNeedsUpdate = true; | 97 m_geometryNeedsUpdate = true; |
| 103 } | 98 } |
| 104 | 99 |
| 105 LinkHighlightImpl::~LinkHighlightImpl() | 100 LinkHighlightImpl::~LinkHighlightImpl() |
| 106 { | 101 { |
| 107 if (m_compositorPlayer->isElementAttached()) | 102 if (m_compositorPlayer->isLayerAttached()) |
| 108 m_compositorPlayer->detachElement(); | 103 m_compositorPlayer->detachLayer(); |
| 109 if (m_owningWebViewImpl->linkHighlightsTimeline()) | 104 if (m_owningWebViewImpl->linkHighlightsTimeline()) |
| 110 m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this); | 105 m_owningWebViewImpl->linkHighlightsTimeline()->playerDestroyed(*this); |
| 111 m_compositorPlayer->setAnimationDelegate(nullptr); | 106 m_compositorPlayer->setAnimationDelegate(nullptr); |
| 112 m_compositorPlayer.reset(); | 107 m_compositorPlayer.reset(); |
| 113 | 108 |
| 114 clearGraphicsLayerLinkHighlightPointer(); | 109 clearGraphicsLayerLinkHighlightPointer(); |
| 115 releaseResources(); | 110 releaseResources(); |
| 116 } | 111 } |
| 117 | 112 |
| 118 WebContentLayer* LinkHighlightImpl::contentLayer() | 113 WebContentLayer* LinkHighlightImpl::contentLayer() |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 { | 391 { |
| 397 return clipLayer(); | 392 return clipLayer(); |
| 398 } | 393 } |
| 399 | 394 |
| 400 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const | 395 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const |
| 401 { | 396 { |
| 402 return m_compositorPlayer.get(); | 397 return m_compositorPlayer.get(); |
| 403 } | 398 } |
| 404 | 399 |
| 405 } // namespace blink | 400 } // namespace blink |
| OLD | NEW |