| 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 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 | 2062 |
| 2063 // Note: we need to check document->focusedElement() rather than just callin
g | 2063 // Note: we need to check document->focusedElement() rather than just callin
g |
| 2064 // element->focused(), because element->focused() isn't updated until after | 2064 // element->focused(), because element->focused() isn't updated until after |
| 2065 // focus events fire. | 2065 // focus events fire. |
| 2066 if (element->document().focusedElement() == element) { | 2066 if (element->document().focusedElement() == element) { |
| 2067 scrollPathIntoViewInternal(path); | 2067 scrollPathIntoViewInternal(path); |
| 2068 drawFocusRing(path); | 2068 drawFocusRing(path); |
| 2069 } | 2069 } |
| 2070 | 2070 |
| 2071 // Update its accessible bounds whether it's focused or not. | 2071 // Update its accessible bounds whether it's focused or not. |
| 2072 updateFocusRingElementAccessibility(path, element); | 2072 updateElementAccessibility(path, element); |
| 2073 } | 2073 } |
| 2074 | 2074 |
| 2075 bool CanvasRenderingContext2D::focusRingCallIsValid(const Path& path, Element* e
lement) | 2075 bool CanvasRenderingContext2D::focusRingCallIsValid(const Path& path, Element* e
lement) |
| 2076 { | 2076 { |
| 2077 ASSERT(element); | 2077 ASSERT(element); |
| 2078 if (!state().isTransformInvertible()) | 2078 if (!state().isTransformInvertible()) |
| 2079 return false; | 2079 return false; |
| 2080 if (path.isEmpty()) | 2080 if (path.isEmpty()) |
| 2081 return false; | 2081 return false; |
| 2082 if (!element->isDescendantOf(canvas())) | 2082 if (!element->isDescendantOf(canvas())) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2099 StrokeData strokeData; | 2099 StrokeData strokeData; |
| 2100 strokeData.setThickness(focusRingWidth); | 2100 strokeData.setThickness(focusRingWidth); |
| 2101 | 2101 |
| 2102 SkIRect dirtyRect; | 2102 SkIRect dirtyRect; |
| 2103 if (!computeDirtyRect(path.strokeBoundingRect(strokeData), &dirtyRect)) | 2103 if (!computeDirtyRect(path.strokeBoundingRect(strokeData), &dirtyRect)) |
| 2104 return; | 2104 return; |
| 2105 | 2105 |
| 2106 didDraw(dirtyRect); | 2106 didDraw(dirtyRect); |
| 2107 } | 2107 } |
| 2108 | 2108 |
| 2109 void CanvasRenderingContext2D::updateFocusRingElementAccessibility(const Path& p
ath, Element* element) | 2109 void CanvasRenderingContext2D::updateElementAccessibility(const Path& path, Elem
ent* element) |
| 2110 { | 2110 { |
| 2111 AXObjectCache* axObjectCache = element->document().existingAXObjectCache(); | 2111 AXObjectCache* axObjectCache = element->document().existingAXObjectCache(); |
| 2112 LayoutBoxModelObject* lbmo = canvas()->layoutBoxModelObject(); | 2112 LayoutBoxModelObject* lbmo = canvas()->layoutBoxModelObject(); |
| 2113 LayoutObject* renderer = canvas()->layoutObject(); | 2113 LayoutObject* renderer = canvas()->layoutObject(); |
| 2114 if (!axObjectCache || !lbmo || !renderer) | 2114 if (!axObjectCache || !lbmo || !renderer) |
| 2115 return; | 2115 return; |
| 2116 | 2116 |
| 2117 // Get the transformed path. | 2117 // Get the transformed path. |
| 2118 Path transformedPath = path; | 2118 Path transformedPath = path; |
| 2119 transformedPath.transform(state().transform()); | 2119 transformedPath.transform(state().transform()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 } | 2154 } |
| 2155 | 2155 |
| 2156 if (!m_hitRegionManager) | 2156 if (!m_hitRegionManager) |
| 2157 m_hitRegionManager = HitRegionManager::create(); | 2157 m_hitRegionManager = HitRegionManager::create(); |
| 2158 | 2158 |
| 2159 // Remove previous region (with id or control) | 2159 // Remove previous region (with id or control) |
| 2160 m_hitRegionManager->removeHitRegionById(options.id()); | 2160 m_hitRegionManager->removeHitRegionById(options.id()); |
| 2161 m_hitRegionManager->removeHitRegionByControl(options.control().get()); | 2161 m_hitRegionManager->removeHitRegionByControl(options.control().get()); |
| 2162 | 2162 |
| 2163 RefPtrWillBeRawPtr<HitRegion> hitRegion = HitRegion::create(hitRegionPath, o
ptions); | 2163 RefPtrWillBeRawPtr<HitRegion> hitRegion = HitRegion::create(hitRegionPath, o
ptions); |
| 2164 hitRegion->updateAccessibility(canvas()); | 2164 Element* element = hitRegion->control(); |
| 2165 if (element && element->isDescendantOf(canvas())) |
| 2166 updateElementAccessibility(hitRegion->path(), hitRegion->control()); |
| 2165 m_hitRegionManager->addHitRegion(hitRegion.release()); | 2167 m_hitRegionManager->addHitRegion(hitRegion.release()); |
| 2166 } | 2168 } |
| 2167 | 2169 |
| 2168 void CanvasRenderingContext2D::removeHitRegion(const String& id) | 2170 void CanvasRenderingContext2D::removeHitRegion(const String& id) |
| 2169 { | 2171 { |
| 2170 if (m_hitRegionManager) | 2172 if (m_hitRegionManager) |
| 2171 m_hitRegionManager->removeHitRegionById(id); | 2173 m_hitRegionManager->removeHitRegionById(id); |
| 2172 } | 2174 } |
| 2173 | 2175 |
| 2174 void CanvasRenderingContext2D::clearHitRegions() | 2176 void CanvasRenderingContext2D::clearHitRegions() |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2254 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) | 2256 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) |
| 2255 return; | 2257 return; |
| 2256 if (alpha < 0xFF) | 2258 if (alpha < 0xFF) |
| 2257 return; | 2259 return; |
| 2258 } | 2260 } |
| 2259 | 2261 |
| 2260 canvas()->buffer()->willOverwriteCanvas(); | 2262 canvas()->buffer()->willOverwriteCanvas(); |
| 2261 } | 2263 } |
| 2262 | 2264 |
| 2263 } // namespace blink | 2265 } // namespace blink |
| OLD | NEW |