| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |