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 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 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2378 } | 2378 } |
2379 | 2379 |
2380 void CanvasRenderingContext2D::updateFocusRingAccessibility(const Path& path, El ement* element) | 2380 void CanvasRenderingContext2D::updateFocusRingAccessibility(const Path& path, El ement* element) |
2381 { | 2381 { |
2382 // If accessibility is already enabled in this frame, associate this path's | 2382 // If accessibility is already enabled in this frame, associate this path's |
2383 // bounding box with the accessible object. Do this even if the element | 2383 // bounding box with the accessible object. Do this even if the element |
2384 // isn't focused because assistive technology might try to explore the objec t's | 2384 // isn't focused because assistive technology might try to explore the objec t's |
2385 // location before it gets focus. | 2385 // location before it gets focus. |
2386 if (AXObjectCache* axObjectCache = element->document()->existingAXObjectCach e()) { | 2386 if (AXObjectCache* axObjectCache = element->document()->existingAXObjectCach e()) { |
2387 if (AccessibilityObject* obj = axObjectCache->getOrCreate(element)) { | 2387 if (AccessibilityObject* obj = axObjectCache->getOrCreate(element)) { |
2388 // Get the bounding rect and apply transformations. | |
2389 FloatRect bounds = m_path.boundingRect(); | |
2390 AffineTransform ctm = state().m_transform; | |
2391 FloatRect transformedBounds = ctm.mapRect(bounds); | |
2392 LayoutRect elementRect = LayoutRect(transformedBounds); | |
2393 | |
2394 // Offset by the canvas rect and set the bounds of the accessible el ement. | |
2388 IntRect canvasRect = canvas()->renderer()->absoluteBoundingBoxRect() ; | 2395 IntRect canvasRect = canvas()->renderer()->absoluteBoundingBoxRect() ; |
2389 LayoutRect rect = LayoutRect(path.boundingRect()); | 2396 elementRect.moveBy(canvasRect.location()); |
Stephen White
2013/08/19 18:08:04
Not new to this patch, but I wonder if this handle
dmazzoni
2013/08/20 06:01:32
I wasn't sure, so I checked with a simple transfor
| |
2390 rect.moveBy(canvasRect.location()); | 2397 obj->setElementRect(elementRect); |
2391 obj->setElementRect(rect); | 2398 |
2399 // Set the bounds of any ancestor accessible elements, up to the can vas element, | |
2400 // otherwise this element will appear to not be within its parent el ement. | |
2401 obj = obj->parentObject(); | |
2402 while (obj && !obj->isCanvas()) { | |
Stephen White
2013/08/19 18:08:04
Shouldn't we actually compare against this canvas
dmazzoni
2013/08/20 06:01:32
Agreed, I wasn't thinking about those corner cases
| |
2403 obj->setElementRect(elementRect); | |
2404 obj = obj->parentObject(); | |
2405 } | |
2392 } | 2406 } |
2393 } | 2407 } |
2394 } | 2408 } |
2395 | 2409 |
2396 void CanvasRenderingContext2D::drawFocusRing(const Path& path) | 2410 void CanvasRenderingContext2D::drawFocusRing(const Path& path) |
2397 { | 2411 { |
2398 GraphicsContext* c = drawingContext(); | 2412 GraphicsContext* c = drawingContext(); |
2399 if (!c) | 2413 if (!c) |
2400 return; | 2414 return; |
2401 | 2415 |
2402 c->save(); | 2416 c->save(); |
2403 c->setAlpha(1.0); | 2417 c->setAlpha(1.0); |
2404 c->clearShadow(); | 2418 c->clearShadow(); |
2405 c->setCompositeOperation(CompositeSourceOver, BlendModeNormal); | 2419 c->setCompositeOperation(CompositeSourceOver, BlendModeNormal); |
2406 | 2420 |
2407 // These should match the style defined in html.css. | 2421 // These should match the style defined in html.css. |
2408 Color focusRingColor = RenderTheme::focusRingColor(); | 2422 Color focusRingColor = RenderTheme::focusRingColor(); |
2409 const int focusRingWidth = 5; | 2423 const int focusRingWidth = 5; |
2410 const int focusRingOutline = 0; | 2424 const int focusRingOutline = 0; |
2411 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2425 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
2412 didDraw(path.boundingRect()); | 2426 didDraw(path.boundingRect()); |
2413 | 2427 |
2414 c->restore(); | 2428 c->restore(); |
2415 } | 2429 } |
2416 | 2430 |
2417 } // namespace WebCore | 2431 } // namespace WebCore |
OLD | NEW |