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

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

Issue 541913002: Create a GraphicsContext from a DisplayList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@display-list-changes
Patch Set: Rebased. Created 6 years, 3 months 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 21 matching lines...) Expand all
32 #include "core/frame/FrameView.h" 32 #include "core/frame/FrameView.h"
33 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
34 #include "core/rendering/RenderLayer.h" 34 #include "core/rendering/RenderLayer.h"
35 #include "core/rendering/RenderLayerModelObject.h" 35 #include "core/rendering/RenderLayerModelObject.h"
36 #include "core/rendering/RenderObject.h" 36 #include "core/rendering/RenderObject.h"
37 #include "core/rendering/RenderPart.h" 37 #include "core/rendering/RenderPart.h"
38 #include "core/rendering/RenderView.h" 38 #include "core/rendering/RenderView.h"
39 #include "core/rendering/compositing/CompositedLayerMapping.h" 39 #include "core/rendering/compositing/CompositedLayerMapping.h"
40 #include "core/rendering/style/ShadowData.h" 40 #include "core/rendering/style/ShadowData.h"
41 #include "platform/graphics/Color.h" 41 #include "platform/graphics/Color.h"
42 #include "platform/graphics/DisplayList.h"
42 #include "public/platform/Platform.h" 43 #include "public/platform/Platform.h"
43 #include "public/platform/WebCompositorAnimationCurve.h" 44 #include "public/platform/WebCompositorAnimationCurve.h"
44 #include "public/platform/WebCompositorSupport.h" 45 #include "public/platform/WebCompositorSupport.h"
45 #include "public/platform/WebFloatAnimationCurve.h" 46 #include "public/platform/WebFloatAnimationCurve.h"
46 #include "public/platform/WebFloatPoint.h" 47 #include "public/platform/WebFloatPoint.h"
47 #include "public/platform/WebRect.h" 48 #include "public/platform/WebRect.h"
48 #include "public/platform/WebSize.h" 49 #include "public/platform/WebSize.h"
49 #include "public/web/WebKit.h" 50 #include "public/web/WebKit.h"
50 #include "web/WebLocalFrameImpl.h" 51 #include "web/WebLocalFrameImpl.h"
51 #include "web/WebSettingsImpl.h" 52 #include "web/WebSettingsImpl.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } else 230 } else
230 addQuadToPath(transformedQuad, newPath); 231 addQuadToPath(transformedQuad, newPath);
231 } 232 }
232 233
233 FloatRect boundingRect = newPath.boundingRect(); 234 FloatRect boundingRect = newPath.boundingRect();
234 newPath.translate(-toFloatSize(boundingRect.location())); 235 newPath.translate(-toFloatSize(boundingRect.location()));
235 236
236 bool pathHasChanged = !(newPath == m_path); 237 bool pathHasChanged = !(newPath == m_path);
237 if (pathHasChanged) { 238 if (pathHasChanged) {
238 m_path = newPath; 239 m_path = newPath;
240
241 GraphicsContext gc(0);
242 gc.beginRecording(boundingRect);
243 gc.setFillColor(m_node->renderer()->style()->tapHighlightColor());
244 gc.fillPath(m_path);
245 m_displayList = gc.endRecording();
246
239 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size() ); 247 m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size() );
240 } 248 }
241 249
242 m_contentLayer->layer()->setPosition(boundingRect.location()); 250 m_contentLayer->layer()->setPosition(boundingRect.location());
243 251
244 return pathHasChanged; 252 return pathHasChanged;
245 } 253 }
246 254
247 void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect, bool, WebFloatRect&, 255 void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect, bool, WebFloatRect&,
248 WebContentLayerClient::GraphicsContextStatus contextStatus) 256 WebContentLayerClient::GraphicsContextStatus contextStatus)
249 { 257 {
250 if (!m_node || !m_node->renderer()) 258 if (!m_node || !m_node->renderer())
251 return; 259 return;
252 260
253 GraphicsContext gc(canvas, 261 GraphicsContext gc(canvas,
254 contextStatus == WebContentLayerClient::GraphicsContextEnabled ? Graphic sContext::NothingDisabled : GraphicsContext::FullyDisabled); 262 contextStatus == WebContentLayerClient::GraphicsContextEnabled ? Graphic sContext::NothingDisabled : GraphicsContext::FullyDisabled);
255 IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect .width, webClipRect.height)); 263 IntRect clipRect(IntPoint(webClipRect.x, webClipRect.y), IntSize(webClipRect .width, webClipRect.height));
256 gc.clip(clipRect); 264 m_displayList->setClip(clipRect);
257 gc.setFillColor(m_node->renderer()->style()->tapHighlightColor()); 265 gc.drawDisplayList(m_displayList.get());
258 gc.fillPath(m_path);
259 } 266 }
260 267
261 void LinkHighlight::startHighlightAnimationIfNeeded() 268 void LinkHighlight::startHighlightAnimationIfNeeded()
262 { 269 {
263 if (m_isAnimating) 270 if (m_isAnimating)
264 return; 271 return;
265 272
266 m_isAnimating = true; 273 m_isAnimating = true;
267 const float startOpacity = 1; 274 const float startOpacity = 1;
268 // FIXME: Should duration be configurable? 275 // FIXME: Should duration be configurable?
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // Make sure we update geometry on the next callback from WebViewImpl::layou t(). 353 // Make sure we update geometry on the next callback from WebViewImpl::layou t().
347 m_geometryNeedsUpdate = true; 354 m_geometryNeedsUpdate = true;
348 } 355 }
349 356
350 WebLayer* LinkHighlight::layer() 357 WebLayer* LinkHighlight::layer()
351 { 358 {
352 return clipLayer(); 359 return clipLayer();
353 } 360 }
354 361
355 } // namespace blink 362 } // 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