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

Side by Side Diff: Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1242263002: Canvas2d: Fix a bug to update incorrect rect bounds for accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp » ('j') | 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 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::updateElementAccessibility(const Path& path, Elem ent* element) 2109 void CanvasRenderingContext2D::updateElementAccessibility(const Path& path, Elem ent* element)
2110 { 2110 {
2111 element->document().updateLayoutTreeIfNeeded();
Justin Novosad 2015/07/23 19:33:15 I recently found out that it is much preferable to
zino 2015/07/27 13:59:45 Thank you for information. BTW, I removed this li
2111 AXObjectCache* axObjectCache = element->document().existingAXObjectCache(); 2112 AXObjectCache* axObjectCache = element->document().existingAXObjectCache();
2112 LayoutBoxModelObject* lbmo = canvas()->layoutBoxModelObject(); 2113 LayoutBoxModelObject* lbmo = canvas()->layoutBoxModelObject();
2113 LayoutObject* renderer = canvas()->layoutObject(); 2114 LayoutObject* renderer = canvas()->layoutObject();
2114 if (!axObjectCache || !lbmo || !renderer) 2115 if (!axObjectCache || !lbmo || !renderer)
2115 return; 2116 return;
2116 2117
2117 // Get the transformed path. 2118 // Get the transformed path.
2118 Path transformedPath = path; 2119 Path transformedPath = path;
2119 transformedPath.transform(state().transform()); 2120 transformedPath.transform(state().transform());
2120 2121
2121 // Offset by the canvas rect, taking border and padding into account. 2122 // Offset by the canvas rect, taking border and padding into account.
2123 element->document().updateLayoutIgnorePendingStylesheets();
Justin Novosad 2015/07/23 19:33:15 We should not add new call to this function, unles
zino 2015/07/27 13:59:45 Please see the http://crbug.com/513763. We will h
2122 IntRect canvasRect = renderer->absoluteBoundingBoxRect(); 2124 IntRect canvasRect = renderer->absoluteBoundingBoxRect();
2123 canvasRect.move(lbmo->borderLeft() + lbmo->paddingLeft(), lbmo->borderTop() + lbmo->paddingTop()); 2125 canvasRect.move(lbmo->borderLeft() + lbmo->paddingLeft(), lbmo->borderTop() + lbmo->paddingTop());
2124 LayoutRect elementRect = enclosingLayoutRect(transformedPath.boundingRect()) ; 2126 LayoutRect elementRect = enclosingLayoutRect(transformedPath.boundingRect()) ;
2125 elementRect.moveBy(canvasRect.location()); 2127 elementRect.moveBy(canvasRect.location());
2126 axObjectCache->setCanvasObjectBounds(element, elementRect); 2128 axObjectCache->setCanvasObjectBounds(element, elementRect);
2127 } 2129 }
2128 2130
2129 void CanvasRenderingContext2D::addHitRegion(const HitRegionOptions& options, Exc eptionState& exceptionState) 2131 void CanvasRenderingContext2D::addHitRegion(const HitRegionOptions& options, Exc eptionState& exceptionState)
2130 { 2132 {
2131 if (options.id().isEmpty() && !options.control()) { 2133 if (options.id().isEmpty() && !options.control()) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2258 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2257 return; 2259 return;
2258 if (alpha < 0xFF) 2260 if (alpha < 0xFF)
2259 return; 2261 return;
2260 } 2262 }
2261 2263
2262 canvas()->buffer()->willOverwriteCanvas(); 2264 canvas()->buffer()->willOverwriteCanvas();
2263 } 2265 }
2264 2266
2265 } // namespace blink 2267 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/modules/canvas2d/CanvasRenderingContext2DAPITest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698