| 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 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 LinkHighlightImpl::LinkHighlightImpl(Node* node, WebViewImpl* owningWebViewImpl) | 70 LinkHighlightImpl::LinkHighlightImpl(Node* node, WebViewImpl* owningWebViewImpl) |
| 71 : m_node(node) | 71 : m_node(node) |
| 72 , m_owningWebViewImpl(owningWebViewImpl) | 72 , m_owningWebViewImpl(owningWebViewImpl) |
| 73 , m_currentGraphicsLayer(0) | 73 , m_currentGraphicsLayer(0) |
| 74 , m_geometryNeedsUpdate(false) | 74 , m_geometryNeedsUpdate(false) |
| 75 , m_isAnimating(false) | 75 , m_isAnimating(false) |
| 76 , m_startTime(monotonicallyIncreasingTime()) | 76 , m_startTime(monotonicallyIncreasingTime()) |
| 77 { | 77 { |
| 78 ASSERT(m_node); | 78 DCHECK(m_node); |
| 79 ASSERT(owningWebViewImpl); | 79 DCHECK(owningWebViewImpl); |
| 80 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); | 80 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); |
| 81 ASSERT(compositorSupport); | 81 DCHECK(compositorSupport); |
| 82 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); | 82 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); |
| 83 m_clipLayer = adoptPtr(compositorSupport->createLayer()); | 83 m_clipLayer = adoptPtr(compositorSupport->createLayer()); |
| 84 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); | 84 m_clipLayer->setTransformOrigin(WebFloatPoint3D()); |
| 85 m_clipLayer->addChild(m_contentLayer->layer()); | 85 m_clipLayer->addChild(m_contentLayer->layer()); |
| 86 | 86 |
| 87 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimationPl
ayer()); | 87 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimationPl
ayer()); |
| 88 ASSERT(m_compositorPlayer); | 88 DCHECK(m_compositorPlayer); |
| 89 m_compositorPlayer->setAnimationDelegate(this); | 89 m_compositorPlayer->setAnimationDelegate(this); |
| 90 if (m_owningWebViewImpl->linkHighlightsTimeline()) | 90 if (m_owningWebViewImpl->linkHighlightsTimeline()) |
| 91 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); | 91 m_owningWebViewImpl->linkHighlightsTimeline()->playerAttached(*this); |
| 92 m_compositorPlayer->attachLayer(m_contentLayer->layer()); | 92 m_compositorPlayer->attachLayer(m_contentLayer->layer()); |
| 93 | 93 |
| 94 m_contentLayer->layer()->setDrawsContent(true); | 94 m_contentLayer->layer()->setDrawsContent(true); |
| 95 m_contentLayer->layer()->setOpacity(1); | 95 m_contentLayer->layer()->setOpacity(1); |
| 96 m_geometryNeedsUpdate = true; | 96 m_geometryNeedsUpdate = true; |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (m_currentGraphicsLayer) | 139 if (m_currentGraphicsLayer) |
| 140 clearGraphicsLayerLinkHighlightPointer(); | 140 clearGraphicsLayerLinkHighlightPointer(); |
| 141 | 141 |
| 142 m_currentGraphicsLayer = newGraphicsLayer; | 142 m_currentGraphicsLayer = newGraphicsLayer; |
| 143 m_currentGraphicsLayer->addLinkHighlight(this); | 143 m_currentGraphicsLayer->addLinkHighlight(this); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace
Quad, LayoutObject* targetLayoutObject, const LayoutBoxModelObject& paintInvalid
ationContainer, FloatQuad& compositedSpaceQuad) | 147 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace
Quad, LayoutObject* targetLayoutObject, const LayoutBoxModelObject& paintInvalid
ationContainer, FloatQuad& compositedSpaceQuad) |
| 148 { | 148 { |
| 149 ASSERT(targetLayoutObject); | 149 DCHECK(targetLayoutObject); |
| 150 for (unsigned i = 0; i < 4; ++i) { | 150 for (unsigned i = 0; i < 4; ++i) { |
| 151 IntPoint point; | 151 IntPoint point; |
| 152 switch (i) { | 152 switch (i) { |
| 153 case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break; | 153 case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break; |
| 154 case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break; | 154 case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break; |
| 155 case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break; | 155 case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break; |
| 156 case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break; | 156 case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break; |
| 157 } | 157 } |
| 158 | 158 |
| 159 // FIXME: this does not need to be absolute, just in the paint invalidat
ion container's space. | 159 // FIXME: this does not need to be absolute, just in the paint invalidat
ion container's space. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // FIXME: This is defensive code to avoid crashes such as those described in | 210 // FIXME: This is defensive code to avoid crashes such as those described in |
| 211 // crbug.com/440887. This should be cleaned up once we fix the root cause of | 211 // crbug.com/440887. This should be cleaned up once we fix the root cause of |
| 212 // of the paint invalidation container not being composited. | 212 // of the paint invalidation container not being composited. |
| 213 if (!paintInvalidationContainer.layer()->compositedLayerMapping() && !paintI
nvalidationContainer.layer()->groupedMapping()) | 213 if (!paintInvalidationContainer.layer()->compositedLayerMapping() && !paintI
nvalidationContainer.layer()->groupedMapping()) |
| 214 return false; | 214 return false; |
| 215 | 215 |
| 216 // Get quads for node in absolute coordinates. | 216 // Get quads for node in absolute coordinates. |
| 217 Vector<FloatQuad> quads; | 217 Vector<FloatQuad> quads; |
| 218 computeQuads(*m_node, quads); | 218 computeQuads(*m_node, quads); |
| 219 ASSERT(quads.size()); | 219 DCHECK(quads.size()); |
| 220 Path newPath; | 220 Path newPath; |
| 221 | 221 |
| 222 for (size_t quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { | 222 for (size_t quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { |
| 223 FloatQuad absoluteQuad = quads[quadIndex]; | 223 FloatQuad absoluteQuad = quads[quadIndex]; |
| 224 | 224 |
| 225 // Transform node quads in target absolute coords to local coordinates i
n the compositor layer. | 225 // Transform node quads in target absolute coords to local coordinates i
n the compositor layer. |
| 226 FloatQuad transformedQuad; | 226 FloatQuad transformedQuad; |
| 227 convertTargetSpaceQuadToCompositedLayer(absoluteQuad, m_node->layoutObje
ct(), paintInvalidationContainer, transformedQuad); | 227 convertTargetSpaceQuadToCompositedLayer(absoluteQuad, m_node->layoutObje
ct(), paintInvalidationContainer, transformedQuad); |
| 228 | 228 |
| 229 // FIXME: for now, we'll only use rounded paths if we have a single node
quad. The reason for this is that | 229 // FIXME: for now, we'll only use rounded paths if we have a single node
quad. The reason for this is that |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 { | 372 { |
| 373 return clipLayer(); | 373 return clipLayer(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const | 376 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const |
| 377 { | 377 { |
| 378 return m_compositorPlayer.get(); | 378 return m_compositorPlayer.get(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace blink | 381 } // namespace blink |
| OLD | NEW |