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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 200283003: drawFocusRing() function in CRC2D draws invalid focus ring. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 9 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 | « ManualTests/draw-focus-if-needed-dirty-rect.html ('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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 } 2276 }
2277 } 2277 }
2278 } 2278 }
2279 2279
2280 void CanvasRenderingContext2D::drawFocusRing(const Path& path) 2280 void CanvasRenderingContext2D::drawFocusRing(const Path& path)
2281 { 2281 {
2282 GraphicsContext* c = drawingContext(); 2282 GraphicsContext* c = drawingContext();
2283 if (!c) 2283 if (!c)
2284 return; 2284 return;
2285 2285
2286 // These should match the style defined in html.css.
2287 Color focusRingColor = RenderTheme::theme().focusRingColor();
2288 const int focusRingWidth = 5;
2289 const int focusRingOutline = 0;
2290
2291 // We need to add focusRingWidth to dirtyRect.
2292 StrokeData strokeData;
2293 strokeData.setThickness(focusRingWidth);
2294
2286 FloatRect dirtyRect; 2295 FloatRect dirtyRect;
2287 if (!computeDirtyRect(path.boundingRect(), &dirtyRect)) 2296 if (!computeDirtyRect(path.strokeBoundingRect(strokeData), &dirtyRect))
2288 return; 2297 return;
2289 2298
2290 c->save(); 2299 c->save();
2291 c->setAlphaAsFloat(1.0); 2300 c->setAlphaAsFloat(1.0);
2292 c->clearShadow(); 2301 c->clearShadow();
2293 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2302 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2294
2295 // These should match the style defined in html.css.
2296 Color focusRingColor = RenderTheme::theme().focusRingColor();
2297 const int focusRingWidth = 5;
2298 const int focusRingOutline = 0;
2299 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2303 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2300
2301 c->restore(); 2304 c->restore();
2302 2305
2303 didDraw(dirtyRect); 2306 didDraw(dirtyRect);
2304 } 2307 }
2305 2308
2306 } // namespace WebCore 2309 } // namespace WebCore
OLDNEW
« no previous file with comments | « ManualTests/draw-focus-if-needed-dirty-rect.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698