OLD | NEW |
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 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 if (!focusRingCallIsValid(path, element)) | 2296 if (!focusRingCallIsValid(path, element)) |
2297 return; | 2297 return; |
2298 | 2298 |
2299 // Note: we need to check document->focusedElement() rather than just callin
g | 2299 // Note: we need to check document->focusedElement() rather than just callin
g |
2300 // element->focused(), because element->focused() isn't updated until after | 2300 // element->focused(), because element->focused() isn't updated until after |
2301 // focus events fire. | 2301 // focus events fire. |
2302 if (element->document().focusedElement() == element) | 2302 if (element->document().focusedElement() == element) |
2303 drawFocusRing(path); | 2303 drawFocusRing(path); |
2304 } | 2304 } |
2305 | 2305 |
2306 bool CanvasRenderingContext2D::drawCustomFocusRing(Element* element) | |
2307 { | |
2308 if (!focusRingCallIsValid(m_path, element)) | |
2309 return false; | |
2310 | |
2311 // Return true if the application should draw the focus ring. The spec allow
s us to | |
2312 // override this for accessibility, but currently Blink doesn't take advanta
ge of this. | |
2313 return element->focused(); | |
2314 } | |
2315 | |
2316 bool CanvasRenderingContext2D::focusRingCallIsValid(const Path& path, Element* e
lement) | 2306 bool CanvasRenderingContext2D::focusRingCallIsValid(const Path& path, Element* e
lement) |
2317 { | 2307 { |
2318 ASSERT(element); | 2308 ASSERT(element); |
2319 if (!state().m_invertibleCTM) | 2309 if (!state().m_invertibleCTM) |
2320 return false; | 2310 return false; |
2321 if (path.isEmpty()) | 2311 if (path.isEmpty()) |
2322 return false; | 2312 return false; |
2323 if (!element->isDescendantOf(canvas())) | 2313 if (!element->isDescendantOf(canvas())) |
2324 return false; | 2314 return false; |
2325 | 2315 |
(...skipping 23 matching lines...) Expand all Loading... |
2349 c->setAlphaAsFloat(1.0); | 2339 c->setAlphaAsFloat(1.0); |
2350 c->clearShadow(); | 2340 c->clearShadow(); |
2351 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); | 2341 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); |
2352 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2342 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
2353 c->restore(); | 2343 c->restore(); |
2354 | 2344 |
2355 didDraw(dirtyRect); | 2345 didDraw(dirtyRect); |
2356 } | 2346 } |
2357 | 2347 |
2358 } // namespace WebCore | 2348 } // namespace WebCore |
OLD | NEW |