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