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

Side by Side Diff: Source/modules/accessibility/AXObjectCacheImpl.cpp

Issue 1153723008: Don't create an AXScrollView for a FrameView that's about to be deleted. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add more comments based on review Created 5 years, 6 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 | « LayoutTests/accessibility/event-on-deleted-iframe-causes-crash-expected.txt ('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) 2014, Google Inc. All rights reserved. 2 * Copyright (C) 2014, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 AXObject* AXObjectCacheImpl::getOrCreate(Widget* widget) 339 AXObject* AXObjectCacheImpl::getOrCreate(Widget* widget)
340 { 340 {
341 if (!widget) 341 if (!widget)
342 return 0; 342 return 0;
343 343
344 if (AXObject* obj = get(widget)) 344 if (AXObject* obj = get(widget))
345 return obj; 345 return obj;
346 346
347 RefPtr<AXObject> newObj = nullptr; 347 RefPtr<AXObject> newObj = nullptr;
348 if (widget->isFrameView()) 348 if (widget->isFrameView()) {
349 FrameView* frameView = toFrameView(widget);
350
351 // Don't create an AXScrollView for a FrameView that isn't attached to a frame,
352 // for example if it's in the process of being disposed.
353 if (frameView->frame().view() != frameView || !frameView->layoutView())
354 return 0;
355
349 newObj = AXScrollView::create(toFrameView(widget), this); 356 newObj = AXScrollView::create(toFrameView(widget), this);
350 else if (widget->isScrollbar()) 357 } else if (widget->isScrollbar())
351 newObj = AXScrollbar::create(toScrollbar(widget), this); 358 newObj = AXScrollbar::create(toScrollbar(widget), this);
352 359
353 // Will crash later if we have two objects for the same widget. 360 // Will crash later if we have two objects for the same widget.
354 ASSERT(!get(widget)); 361 ASSERT(!get(widget));
355 362
356 // Catch the case if an (unsupported) widget type is used. Only FrameView an d ScrollBar are supported now. 363 // Catch the case if an (unsupported) widget type is used. Only FrameView an d ScrollBar are supported now.
357 ASSERT(newObj); 364 ASSERT(newObj);
358 if (!newObj) 365 if (!newObj)
359 return 0; 366 return 0;
360 367
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect) 1150 void AXObjectCacheImpl::setCanvasObjectBounds(Element* element, const LayoutRect & rect)
1144 { 1151 {
1145 AXObject* obj = getOrCreate(element); 1152 AXObject* obj = getOrCreate(element);
1146 if (!obj) 1153 if (!obj)
1147 return; 1154 return;
1148 1155
1149 obj->setElementRect(rect); 1156 obj->setElementRect(rect);
1150 } 1157 }
1151 1158
1152 } // namespace blink 1159 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/accessibility/event-on-deleted-iframe-causes-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698