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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } else | 229 } else |
230 addQuadToPath(transformedQuad, newPath); | 230 addQuadToPath(transformedQuad, newPath); |
231 } | 231 } |
232 | 232 |
233 FloatRect boundingRect = newPath.boundingRect(); | 233 FloatRect boundingRect = newPath.boundingRect(); |
234 newPath.translate(-toFloatSize(boundingRect.location())); | 234 newPath.translate(-toFloatSize(boundingRect.location())); |
235 | 235 |
236 bool pathHasChanged = !(newPath == m_path); | 236 bool pathHasChanged = !(newPath == m_path); |
237 if (pathHasChanged) { | 237 if (pathHasChanged) { |
238 m_path = newPath; | 238 m_path = newPath; |
| 239 |
| 240 GraphicsContext gc(boundingRect); |
| 241 gc.setFillColor(m_node->renderer()->style()->tapHighlightColor()); |
| 242 gc.fillPath(m_path); |
| 243 m_displayList = gc.endRecording(); |
| 244 |
239 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size()
); | 245 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size()
); |
240 } | 246 } |
241 | 247 |
242 m_contentLayer->layer()->setPosition(boundingRect.location()); | 248 m_contentLayer->layer()->setPosition(boundingRect.location()); |
243 | 249 |
244 return pathHasChanged; | 250 return pathHasChanged; |
245 } | 251 } |
246 | 252 |
247 void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect,
bool, WebFloatRect&, | 253 void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect,
bool, WebFloatRect&, |
248 WebContentLayerClient::GraphicsContextStatus contextStatus) | 254 WebContentLayerClient::GraphicsContextStatus contextStatus) |
249 { | 255 { |
250 if (!m_node || !m_node->renderer()) | 256 if (!m_node || !m_node->renderer()) |
251 return; | 257 return; |
252 | 258 |
253 GraphicsContext gc(canvas, | 259 GraphicsContext gc(canvas, |
254 contextStatus == WebContentLayerClient::GraphicsContextEnabled ? Graphic
sContext::NothingDisabled : GraphicsContext::FullyDisabled); | 260 contextStatus == WebContentLayerClient::GraphicsContextEnabled ? Graphic
sContext::NothingDisabled : GraphicsContext::FullyDisabled); |
255 IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect
.width, webClipRect.height)); | 261 IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect
.width, webClipRect.height)); |
256 gc.clip(clipRect); | 262 m_displayList->setClip(clipRect); |
257 gc.setFillColor(m_node->renderer()->style()->tapHighlightColor()); | 263 gc.drawDisplayList(m_displayList.get()); |
258 gc.fillPath(m_path); | |
259 } | 264 } |
260 | 265 |
261 void LinkHighlight::startHighlightAnimationIfNeeded() | 266 void LinkHighlight::startHighlightAnimationIfNeeded() |
262 { | 267 { |
263 if (m_isAnimating) | 268 if (m_isAnimating) |
264 return; | 269 return; |
265 | 270 |
266 m_isAnimating = true; | 271 m_isAnimating = true; |
267 const float startOpacity = 1; | 272 const float startOpacity = 1; |
268 // FIXME: Should duration be configurable? | 273 // FIXME: Should duration be configurable? |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // Make sure we update geometry on the next callback from WebViewImpl::layou
t(). | 351 // Make sure we update geometry on the next callback from WebViewImpl::layou
t(). |
347 m_geometryNeedsUpdate = true; | 352 m_geometryNeedsUpdate = true; |
348 } | 353 } |
349 | 354 |
350 WebLayer* LinkHighlight::layer() | 355 WebLayer* LinkHighlight::layer() |
351 { | 356 { |
352 return clipLayer(); | 357 return clipLayer(); |
353 } | 358 } |
354 | 359 |
355 } // namespace blink | 360 } // namespace blink |
OLD | NEW |