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

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

Issue 21643002: Canvas focus outline should match style in html.css. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compile Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.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) 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 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 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 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 return attributes.release(); 2338 return attributes.release();
2339 } 2339 }
2340 2340
2341 void CanvasRenderingContext2D::drawSystemFocusRing(Element* element) 2341 void CanvasRenderingContext2D::drawSystemFocusRing(Element* element)
2342 { 2342 {
2343 if (!focusRingCallIsValid(m_path, element)) 2343 if (!focusRingCallIsValid(m_path, element))
2344 return; 2344 return;
2345 2345
2346 updateFocusRingAccessibility(m_path, element); 2346 updateFocusRingAccessibility(m_path, element);
2347 if (element->focused()) 2347 if (element->focused())
2348 drawFocusRing(m_path, element); 2348 drawFocusRing(m_path);
2349 } 2349 }
2350 2350
2351 bool CanvasRenderingContext2D::drawCustomFocusRing(Element* element) 2351 bool CanvasRenderingContext2D::drawCustomFocusRing(Element* element)
2352 { 2352 {
2353 if (!focusRingCallIsValid(m_path, element)) 2353 if (!focusRingCallIsValid(m_path, element))
2354 return false; 2354 return false;
2355 2355
2356 updateFocusRingAccessibility(m_path, element); 2356 updateFocusRingAccessibility(m_path, element);
2357 2357
2358 // Return true if the application should draw the focus ring. The spec allow s us to 2358 // Return true if the application should draw the focus ring. The spec allow s us to
(...skipping 22 matching lines...) Expand all
2381 if (AXObjectCache* axObjectCache = element->document()->existingAXObjectCach e()) { 2381 if (AXObjectCache* axObjectCache = element->document()->existingAXObjectCach e()) {
2382 if (AccessibilityObject* obj = axObjectCache->getOrCreate(element)) { 2382 if (AccessibilityObject* obj = axObjectCache->getOrCreate(element)) {
2383 IntRect canvasRect = canvas()->renderer()->absoluteBoundingBoxRect() ; 2383 IntRect canvasRect = canvas()->renderer()->absoluteBoundingBoxRect() ;
2384 LayoutRect rect = LayoutRect(path.boundingRect()); 2384 LayoutRect rect = LayoutRect(path.boundingRect());
2385 rect.moveBy(canvasRect.location()); 2385 rect.moveBy(canvasRect.location());
2386 obj->setElementRect(rect); 2386 obj->setElementRect(rect);
2387 } 2387 }
2388 } 2388 }
2389 } 2389 }
2390 2390
2391 void CanvasRenderingContext2D::drawFocusRing(const Path& path, Element* element) 2391 void CanvasRenderingContext2D::drawFocusRing(const Path& path)
2392 { 2392 {
2393 GraphicsContext* c = drawingContext(); 2393 GraphicsContext* c = drawingContext();
2394 if (!c) 2394 if (!c)
2395 return; 2395 return;
2396 2396
2397 c->save(); 2397 c->save();
2398 c->setAlpha(1.0); 2398 c->setAlpha(1.0);
2399 c->clearShadow(); 2399 c->clearShadow();
2400 c->setCompositeOperation(CompositeSourceOver, BlendModeNormal); 2400 c->setCompositeOperation(CompositeSourceOver, BlendModeNormal);
2401 2401
2402 RefPtr<RenderStyle> style(RenderStyle::createDefaultStyle()); 2402 // These should match the style defined in html.css.
2403 Color focusRingColor = RenderTheme::focusRingColor(); 2403 Color focusRingColor = RenderTheme::focusRingColor();
2404 c->drawFocusRing(path, style->outlineWidth(), style->outlineOffset(), focusR ingColor); 2404 const int focusRingWidth = 5;
2405 const int focusRingOutline = 0;
2406 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2405 didDraw(path.boundingRect()); 2407 didDraw(path.boundingRect());
2406 2408
2407 c->restore(); 2409 c->restore();
2408 } 2410 }
2409 2411
2410 } // namespace WebCore 2412 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698