Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: Source/web/LinkHighlight.cpp

Issue 719053004: Partially revert r181835 to fix link highlighting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/LinkHighlight.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 #include "core/frame/FrameView.h" 33 #include "core/frame/FrameView.h"
34 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
35 #include "core/rendering/RenderLayer.h" 35 #include "core/rendering/RenderLayer.h"
36 #include "core/rendering/RenderLayerModelObject.h" 36 #include "core/rendering/RenderLayerModelObject.h"
37 #include "core/rendering/RenderObject.h" 37 #include "core/rendering/RenderObject.h"
38 #include "core/rendering/RenderPart.h" 38 #include "core/rendering/RenderPart.h"
39 #include "core/rendering/RenderView.h" 39 #include "core/rendering/RenderView.h"
40 #include "core/rendering/compositing/CompositedLayerMapping.h" 40 #include "core/rendering/compositing/CompositedLayerMapping.h"
41 #include "core/rendering/style/ShadowData.h" 41 #include "core/rendering/style/ShadowData.h"
42 #include "platform/graphics/Color.h" 42 #include "platform/graphics/Color.h"
43 #include "platform/graphics/DisplayList.h"
44 #include "public/platform/Platform.h" 43 #include "public/platform/Platform.h"
45 #include "public/platform/WebCompositorAnimationCurve.h" 44 #include "public/platform/WebCompositorAnimationCurve.h"
46 #include "public/platform/WebCompositorSupport.h" 45 #include "public/platform/WebCompositorSupport.h"
47 #include "public/platform/WebFloatAnimationCurve.h" 46 #include "public/platform/WebFloatAnimationCurve.h"
48 #include "public/platform/WebFloatPoint.h" 47 #include "public/platform/WebFloatPoint.h"
49 #include "public/platform/WebRect.h" 48 #include "public/platform/WebRect.h"
50 #include "public/platform/WebSize.h" 49 #include "public/platform/WebSize.h"
51 #include "public/web/WebKit.h" 50 #include "public/web/WebKit.h"
52 #include "web/WebLocalFrameImpl.h" 51 #include "web/WebLocalFrameImpl.h"
53 #include "web/WebSettingsImpl.h" 52 #include "web/WebSettingsImpl.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } else 220 } else
222 addQuadToPath(transformedQuad, newPath); 221 addQuadToPath(transformedQuad, newPath);
223 } 222 }
224 223
225 FloatRect boundingRect = newPath.boundingRect(); 224 FloatRect boundingRect = newPath.boundingRect();
226 newPath.translate(-toFloatSize(boundingRect.location())); 225 newPath.translate(-toFloatSize(boundingRect.location()));
227 226
228 bool pathHasChanged = !(newPath == m_path); 227 bool pathHasChanged = !(newPath == m_path);
229 if (pathHasChanged) { 228 if (pathHasChanged) {
230 m_path = newPath; 229 m_path = newPath;
231
232 GraphicsContext gc(0);
233 gc.beginRecording(boundingRect);
234 gc.setFillColor(m_node->renderer()->style()->tapHighlightColor());
235 gc.fillPath(m_path);
236 m_displayList = gc.endRecording();
237
238 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size() ); 230 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size() );
239 } 231 }
240 232
241 m_contentLayer->layer()->setPosition(boundingRect.location()); 233 m_contentLayer->layer()->setPosition(boundingRect.location());
242 234
243 return pathHasChanged; 235 return pathHasChanged;
244 } 236 }
245 237
246 void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect, bool, WebContentLayerClient::GraphicsContextStatus contextStatus) 238 void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect, bool, WebContentLayerClient::GraphicsContextStatus contextStatus)
247 { 239 {
248 if (!m_node || !m_node->renderer()) 240 if (!m_node || !m_node->renderer())
249 return; 241 return;
250 242
251 GraphicsContext gc(canvas, 243 GraphicsContext gc(canvas,
252 contextStatus == WebContentLayerClient::GraphicsContextEnabled ? Graphic sContext::NothingDisabled : GraphicsContext::FullyDisabled); 244 contextStatus == WebContentLayerClient::GraphicsContextEnabled ? Graphic sContext::NothingDisabled : GraphicsContext::FullyDisabled);
253 IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect .width, webClipRect.height)); 245 IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect .width, webClipRect.height));
254 m_displayList->setClip(clipRect); 246 gc.clip(clipRect);
255 gc.drawDisplayList(m_displayList.get()); 247 gc.setFillColor(m_node->renderer()->style()->tapHighlightColor());
248 gc.fillPath(m_path);
256 } 249 }
257 250
258 void LinkHighlight::startHighlightAnimationIfNeeded() 251 void LinkHighlight::startHighlightAnimationIfNeeded()
259 { 252 {
260 if (m_isAnimating) 253 if (m_isAnimating)
261 return; 254 return;
262 255
263 m_isAnimating = true; 256 m_isAnimating = true;
264 const float startOpacity = 1; 257 const float startOpacity = 1;
265 // FIXME: Should duration be configurable? 258 // FIXME: Should duration be configurable?
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // Make sure we update geometry on the next callback from WebViewImpl::layou t(). 339 // Make sure we update geometry on the next callback from WebViewImpl::layou t().
347 m_geometryNeedsUpdate = true; 340 m_geometryNeedsUpdate = true;
348 } 341 }
349 342
350 WebLayer* LinkHighlight::layer() 343 WebLayer* LinkHighlight::layer()
351 { 344 {
352 return clipLayer(); 345 return clipLayer();
353 } 346 }
354 347
355 } // namespace blink 348 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/LinkHighlight.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698