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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 return false; | 224 return false; |
225 LayoutObject* layoutObject = select->layoutObject(); | 225 LayoutObject* layoutObject = select->layoutObject(); |
226 return layoutObject && layoutObject->isMenuList(); | 226 return layoutObject && layoutObject->isMenuList(); |
227 } | 227 } |
228 | 228 |
229 AXObject* AXObjectCacheImpl::get(Node* node) | 229 AXObject* AXObjectCacheImpl::get(Node* node) |
230 { | 230 { |
231 if (!node) | 231 if (!node) |
232 return 0; | 232 return 0; |
233 | 233 |
234 AXID layoutID = node->layoutObject() ? m_layoutObjectMapping.get(node->layou tObject()) : 0; | 234 LayoutObject* layoutObject = node->layoutObject(); |
235 if (isMenuListOption(node) || isHTMLAreaElement(node)) | |
aboxhall
2015/11/05 17:49:21
Add a comment to explain this?
dmazzoni
2015/11/06 00:21:17
Done.
| |
236 layoutObject = nullptr; | |
237 | |
238 AXID layoutID = layoutObject ? m_layoutObjectMapping.get(layoutObject) : 0; | |
235 ASSERT(!HashTraits<AXID>::isDeletedValue(layoutID)); | 239 ASSERT(!HashTraits<AXID>::isDeletedValue(layoutID)); |
236 | 240 |
237 AXID nodeID = m_nodeObjectMapping.get(node); | 241 AXID nodeID = m_nodeObjectMapping.get(node); |
238 ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID)); | 242 ASSERT(!HashTraits<AXID>::isDeletedValue(nodeID)); |
239 | 243 |
240 if (node->layoutObject() && nodeID && !layoutID && !isMenuListOption(node)) { | 244 if (layoutObject && nodeID && !layoutID) { |
241 // This can happen if an AXNodeObject is created for a node that's not | 245 // This can happen if an AXNodeObject is created for a node that's not |
242 // laid out, but later something changes and it gets a layoutObject (lik e if it's | 246 // laid out, but later something changes and it gets a layoutObject (lik e if it's |
243 // reparented). | 247 // reparented). |
244 remove(nodeID); | 248 remove(nodeID); |
245 return 0; | 249 return 0; |
246 } | 250 } |
247 | 251 |
248 if (layoutID) | 252 if (layoutID) |
249 return m_objects.get(layoutID); | 253 return m_objects.get(layoutID); |
250 | 254 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 } | 335 } |
332 | 336 |
333 return AXLayoutObject::create(layoutObject, *this); | 337 return AXLayoutObject::create(layoutObject, *this); |
334 } | 338 } |
335 | 339 |
336 AXObject* AXObjectCacheImpl::createFromNode(Node* node) | 340 AXObject* AXObjectCacheImpl::createFromNode(Node* node) |
337 { | 341 { |
338 if (isMenuListOption(node)) | 342 if (isMenuListOption(node)) |
339 return AXMenuListOption::create(toHTMLOptionElement(node), *this); | 343 return AXMenuListOption::create(toHTMLOptionElement(node), *this); |
340 | 344 |
345 if (isHTMLAreaElement(node)) | |
346 return AXImageMapLink::create(toHTMLAreaElement(node), *this); | |
347 | |
341 return AXNodeObject::create(node, *this); | 348 return AXNodeObject::create(node, *this); |
342 } | 349 } |
343 | 350 |
344 AXObject* AXObjectCacheImpl::createFromInlineTextBox(AbstractInlineTextBox* inli neTextBox) | 351 AXObject* AXObjectCacheImpl::createFromInlineTextBox(AbstractInlineTextBox* inli neTextBox) |
345 { | 352 { |
346 return AXInlineTextBox::create(inlineTextBox, *this); | 353 return AXInlineTextBox::create(inlineTextBox, *this); |
347 } | 354 } |
348 | 355 |
349 AXObject* AXObjectCacheImpl::getOrCreate(Widget* widget) | 356 AXObject* AXObjectCacheImpl::getOrCreate(Widget* widget) |
350 { | 357 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 } | 392 } |
386 | 393 |
387 AXObject* AXObjectCacheImpl::getOrCreate(Node* node) | 394 AXObject* AXObjectCacheImpl::getOrCreate(Node* node) |
388 { | 395 { |
389 if (!node) | 396 if (!node) |
390 return 0; | 397 return 0; |
391 | 398 |
392 if (AXObject* obj = get(node)) | 399 if (AXObject* obj = get(node)) |
393 return obj; | 400 return obj; |
394 | 401 |
395 if (node->layoutObject()) | 402 if (node->layoutObject() && !isHTMLAreaElement(node)) |
aboxhall
2015/11/05 17:49:21
And a comment for this too?
dmazzoni
2015/11/06 00:21:17
Done.
| |
396 return getOrCreate(node->layoutObject()); | 403 return getOrCreate(node->layoutObject()); |
397 | 404 |
398 if (!node->parentElement()) | 405 if (!node->parentElement()) |
399 return 0; | 406 return 0; |
400 | 407 |
401 if (isHTMLHeadElement(node)) | 408 if (isHTMLHeadElement(node)) |
402 return 0; | 409 return 0; |
403 | 410 |
404 AXObject* newObj = createFromNode(node); | 411 AXObject* newObj = createFromNode(node); |
405 | 412 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 | 479 |
473 return getOrCreate(m_document->view()); | 480 return getOrCreate(m_document->view()); |
474 } | 481 } |
475 | 482 |
476 AXObject* AXObjectCacheImpl::getOrCreate(AccessibilityRole role) | 483 AXObject* AXObjectCacheImpl::getOrCreate(AccessibilityRole role) |
477 { | 484 { |
478 AXObject* obj = nullptr; | 485 AXObject* obj = nullptr; |
479 | 486 |
480 // will be filled in... | 487 // will be filled in... |
481 switch (role) { | 488 switch (role) { |
482 case ImageMapLinkRole: | |
483 obj = AXImageMapLink::create(*this); | |
484 break; | |
485 case ColumnRole: | 489 case ColumnRole: |
486 obj = AXTableColumn::create(*this); | 490 obj = AXTableColumn::create(*this); |
487 break; | 491 break; |
488 case TableHeaderContainerRole: | 492 case TableHeaderContainerRole: |
489 obj = AXTableHeaderContainer::create(*this); | 493 obj = AXTableHeaderContainer::create(*this); |
490 break; | 494 break; |
491 case SliderThumbRole: | 495 case SliderThumbRole: |
492 obj = AXSliderThumb::create(*this); | 496 obj = AXSliderThumb::create(*this); |
493 break; | 497 break; |
494 case MenuListPopupRole: | 498 case MenuListPopupRole: |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1360 visitor->trace(m_nodeObjectMapping); | 1364 visitor->trace(m_nodeObjectMapping); |
1361 #endif | 1365 #endif |
1362 | 1366 |
1363 visitor->trace(m_objects); | 1367 visitor->trace(m_objects); |
1364 visitor->trace(m_notificationsToPost); | 1368 visitor->trace(m_notificationsToPost); |
1365 | 1369 |
1366 AXObjectCache::trace(visitor); | 1370 AXObjectCache::trace(visitor); |
1367 } | 1371 } |
1368 | 1372 |
1369 } // namespace blink | 1373 } // namespace blink |
OLD | NEW |