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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 PassOwnPtr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl*
owningWebViewImpl) | 65 PassOwnPtr<LinkHighlightImpl> LinkHighlightImpl::create(Node* node, WebViewImpl*
owningWebViewImpl) |
66 { | 66 { |
67 return adoptPtr(new LinkHighlightImpl(node, owningWebViewImpl)); | 67 return adoptPtr(new LinkHighlightImpl(node, owningWebViewImpl)); |
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_isScrollingGraphicsLayer(false) | |
75 , m_geometryNeedsUpdate(false) | 74 , m_geometryNeedsUpdate(false) |
76 , m_isAnimating(false) | 75 , m_isAnimating(false) |
77 , m_startTime(monotonicallyIncreasingTime()) | 76 , m_startTime(monotonicallyIncreasingTime()) |
78 { | 77 { |
79 DCHECK(m_node); | 78 DCHECK(m_node); |
80 DCHECK(owningWebViewImpl); | 79 DCHECK(owningWebViewImpl); |
81 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); | 80 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); |
82 DCHECK(compositorSupport); | 81 DCHECK(compositorSupport); |
83 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); | 82 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); |
84 m_clipLayer = adoptPtr(compositorSupport->createLayer()); | 83 m_clipLayer = adoptPtr(compositorSupport->createLayer()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 120 } |
122 | 121 |
123 void LinkHighlightImpl::releaseResources() | 122 void LinkHighlightImpl::releaseResources() |
124 { | 123 { |
125 m_node.clear(); | 124 m_node.clear(); |
126 } | 125 } |
127 | 126 |
128 void LinkHighlightImpl::attachLinkHighlightToCompositingLayer(const LayoutBoxMod
elObject& paintInvalidationContainer) | 127 void LinkHighlightImpl::attachLinkHighlightToCompositingLayer(const LayoutBoxMod
elObject& paintInvalidationContainer) |
129 { | 128 { |
130 GraphicsLayer* newGraphicsLayer = paintInvalidationContainer.layer()->graphi
csLayerBacking(); | 129 GraphicsLayer* newGraphicsLayer = paintInvalidationContainer.layer()->graphi
csLayerBacking(); |
131 m_isScrollingGraphicsLayer = false; | |
132 // FIXME: There should always be a GraphicsLayer. See crbug.com/431961. | 130 // FIXME: There should always be a GraphicsLayer. See crbug.com/431961. |
133 if (paintInvalidationContainer.layer()->needsCompositedScrolling() && m_node
->layoutObject() != &paintInvalidationContainer) { | 131 if (newGraphicsLayer && !newGraphicsLayer->drawsContent()) |
134 newGraphicsLayer = paintInvalidationContainer.layer()->graphicsLayerBack
ingForScrolling(); | 132 newGraphicsLayer = paintInvalidationContainer.layer()->graphicsLayerBack
ingForScrolling(); |
135 m_isScrollingGraphicsLayer = true; | |
136 } | |
137 if (!newGraphicsLayer) | 133 if (!newGraphicsLayer) |
138 return; | 134 return; |
139 | 135 |
140 m_clipLayer->setTransform(SkMatrix44(SkMatrix44::kIdentity_Constructor)); | 136 m_clipLayer->setTransform(SkMatrix44(SkMatrix44::kIdentity_Constructor)); |
141 | 137 |
142 if (m_currentGraphicsLayer != newGraphicsLayer) { | 138 if (m_currentGraphicsLayer != newGraphicsLayer) { |
143 if (m_currentGraphicsLayer) | 139 if (m_currentGraphicsLayer) |
144 clearGraphicsLayerLinkHighlightPointer(); | 140 clearGraphicsLayerLinkHighlightPointer(); |
145 | 141 |
146 m_currentGraphicsLayer = newGraphicsLayer; | 142 m_currentGraphicsLayer = newGraphicsLayer; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 215 |
220 // Get quads for node in absolute coordinates. | 216 // Get quads for node in absolute coordinates. |
221 Vector<FloatQuad> quads; | 217 Vector<FloatQuad> quads; |
222 computeQuads(*m_node, quads); | 218 computeQuads(*m_node, quads); |
223 DCHECK(quads.size()); | 219 DCHECK(quads.size()); |
224 Path newPath; | 220 Path newPath; |
225 | 221 |
226 for (size_t quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { | 222 for (size_t quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { |
227 FloatQuad absoluteQuad = quads[quadIndex]; | 223 FloatQuad absoluteQuad = quads[quadIndex]; |
228 | 224 |
229 // Scrolling content layers have the same offset from layout object as t
he non-scrolling layers. Thus we need | |
230 // to adjust for their scroll offset. | |
231 if (m_isScrollingGraphicsLayer) { | |
232 DoubleSize adjustedScrollOffset = paintInvalidationContainer.layer()
->getScrollableArea()->adjustedScrollOffset(); | |
233 absoluteQuad.move(adjustedScrollOffset.width(), adjustedScrollOffset
.height()); | |
234 } | |
235 | |
236 // 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. |
237 FloatQuad transformedQuad; | 226 FloatQuad transformedQuad; |
238 convertTargetSpaceQuadToCompositedLayer(absoluteQuad, m_node->layoutObje
ct(), paintInvalidationContainer, transformedQuad); | 227 convertTargetSpaceQuadToCompositedLayer(absoluteQuad, m_node->layoutObje
ct(), paintInvalidationContainer, transformedQuad); |
239 | 228 |
240 // 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 |
241 // we may sometimes get a chain of adjacent boxes (e.g. for text nodes)
which end up looking like sausage | 230 // we may sometimes get a chain of adjacent boxes (e.g. for text nodes)
which end up looking like sausage |
242 // links: these should ideally be merged into a single rect before creat
ing the path, but that's | 231 // links: these should ideally be merged into a single rect before creat
ing the path, but that's |
243 // another CL. | 232 // another CL. |
244 if (quads.size() == 1 && transformedQuad.isRectilinear() | 233 if (quads.size() == 1 && transformedQuad.isRectilinear() |
245 && !m_owningWebViewImpl->settingsImpl()->mockGestureTapHighlightsEna
bled()) { | 234 && !m_owningWebViewImpl->settingsImpl()->mockGestureTapHighlightsEna
bled()) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 { | 380 { |
392 return clipLayer(); | 381 return clipLayer(); |
393 } | 382 } |
394 | 383 |
395 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const | 384 CompositorAnimationPlayer* LinkHighlightImpl::compositorPlayer() const |
396 { | 385 { |
397 return m_compositorPlayer.get(); | 386 return m_compositorPlayer.get(); |
398 } | 387 } |
399 | 388 |
400 } // namespace blink | 389 } // namespace blink |
OLD | NEW |