| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 // Case 4: node is an inline with a continuation. Next sibling is the next s
ibling of the end | 337 // Case 4: node is an inline with a continuation. Next sibling is the next s
ibling of the end |
| 338 // of the continuation chain. | 338 // of the continuation chain. |
| 339 else if (isInlineWithContinuation(m_renderer)) | 339 else if (isInlineWithContinuation(m_renderer)) |
| 340 nextSibling = endOfContinuations(m_renderer)->nextSibling(); | 340 nextSibling = endOfContinuations(m_renderer)->nextSibling(); |
| 341 | 341 |
| 342 // Case 5: node has no next sibling, and its parent is an inline with a cont
inuation. | 342 // Case 5: node has no next sibling, and its parent is an inline with a cont
inuation. |
| 343 else if (isInlineWithContinuation(m_renderer->parent())) { | 343 else if (isInlineWithContinuation(m_renderer->parent())) { |
| 344 RenderObject* continuation = toRenderInline(m_renderer->parent())->conti
nuation(); | 344 RenderObject* continuation = toRenderInline(m_renderer->parent())->conti
nuation(); |
| 345 | 345 |
| 346 // Case 4a: continuation is a block - in this case the block itself is t
he next sibling. | 346 // Case 5a: continuation is a block - in this case the block itself is t
he next sibling. |
| 347 if (continuation->isRenderBlock()) | 347 if (continuation->isRenderBlock()) |
| 348 nextSibling = continuation; | 348 nextSibling = continuation; |
| 349 // Case 4b: continuation is an inline - in this case the inline's first
child is the next sibling | 349 // Case 5b: continuation is an inline - in this case the inline's first
child is the next sibling |
| 350 else | 350 else |
| 351 nextSibling = firstChildConsideringContinuation(continuation); | 351 nextSibling = firstChildConsideringContinuation(continuation); |
| 352 } | 352 } |
| 353 | 353 |
| 354 if (!nextSibling) | 354 if (!nextSibling) |
| 355 return 0; | 355 return 0; |
| 356 | 356 |
| 357 return m_renderer->document()->axObjectCache()->getOrCreate(nextSibling); | 357 return m_renderer->document()->axObjectCache()->getOrCreate(nextSibling); |
| 358 } | 358 } |
| 359 | 359 |
| 360 static RenderBoxModelObject* nextContinuation(RenderObject* renderer) |
| 361 { |
| 362 if (renderer->isInline() && !renderer->isReplaced()) |
| 363 return toRenderInline(renderer)->continuation(); |
| 364 return toRenderBlock(renderer)->inlineElementContinuation(); |
| 365 } |
| 366 |
| 360 AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const | 367 AccessibilityObject* AccessibilityRenderObject::parentObjectIfExists() const |
| 361 { | 368 { |
| 362 if (!m_renderer) | 369 if (!m_renderer) |
| 363 return 0; | 370 return 0; |
| 364 | 371 |
| 365 RenderObject* parent = m_renderer->parent(); | 372 RenderObject* parent = m_renderer->parent(); |
| 366 | 373 |
| 367 // Case 1: node is a block and is an inline's continuation. Parent | 374 // Case 1: node is a block and is an inline's continuation. Parent |
| 368 // is the start of the continuation chain. | 375 // is the start of the continuation chain. |
| 369 RenderInline* startOfConts = 0; | 376 RenderInline* startOfConts = 0; |
| 377 RenderObject* firstChild = 0; |
| 370 if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_re
nderer))) | 378 if (m_renderer->isRenderBlock() && (startOfConts = startOfContinuations(m_re
nderer))) |
| 371 parent = startOfConts; | 379 parent = startOfConts; |
| 372 | 380 |
| 373 // Case 2: node's parent is an inline which is some node's continuation; par
ent is | 381 // Case 2: node's parent is an inline which is some node's continuation; par
ent is |
| 374 // the earliest node in the continuation chain. | 382 // the earliest node in the continuation chain. |
| 375 else if (parent && parent->isRenderInline() && (startOfConts = startOfContin
uations(parent))) | 383 else if (parent && parent->isRenderInline() && (startOfConts = startOfContin
uations(parent))) |
| 376 parent = startOfConts; | 384 parent = startOfConts; |
| 377 | 385 |
| 386 // Case 3: The first sibling is the beginning of a continuation chain. Find
the origin of that continuation. |
| 387 else if (parent && (firstChild = parent->firstChild()) && firstChild->node()
) { |
| 388 // Get the node's renderer and follow that continuation chain until the
first child is found |
| 389 RenderObject* nodeRenderFirstChild = firstChild->node()->renderer(); |
| 390 if (nodeRenderFirstChild != firstChild) { |
| 391 for (RenderObject* contsTest = nodeRenderFirstChild; contsTest; cont
sTest = nextContinuation(contsTest)) { |
| 392 if (contsTest == firstChild) { |
| 393 parent = nodeRenderFirstChild->parent(); |
| 394 break; |
| 395 } |
| 396 } |
| 397 } |
| 398 } |
| 399 |
| 378 if (!parent) | 400 if (!parent) |
| 379 return 0; | 401 return 0; |
| 380 | 402 |
| 381 return m_renderer->document()->axObjectCache()->get(parent); | 403 return m_renderer->document()->axObjectCache()->get(parent); |
| 382 } | 404 } |
| 383 | 405 |
| 384 AccessibilityObject* AccessibilityRenderObject::parentObject() const | 406 AccessibilityObject* AccessibilityRenderObject::parentObject() const |
| 385 { | 407 { |
| 386 if (!m_renderer) | 408 if (!m_renderer) |
| 387 return 0; | 409 return 0; |
| (...skipping 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3279 return; | 3301 return; |
| 3280 | 3302 |
| 3281 // add all unignored acc children | 3303 // add all unignored acc children |
| 3282 for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSib
ling()) { | 3304 for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSib
ling()) { |
| 3283 if (obj->accessibilityIsIgnored()) { | 3305 if (obj->accessibilityIsIgnored()) { |
| 3284 obj->updateChildrenIfNecessary(); | 3306 obj->updateChildrenIfNecessary(); |
| 3285 AccessibilityChildrenVector children = obj->children(); | 3307 AccessibilityChildrenVector children = obj->children(); |
| 3286 unsigned length = children.size(); | 3308 unsigned length = children.size(); |
| 3287 for (unsigned i = 0; i < length; ++i) | 3309 for (unsigned i = 0; i < length; ++i) |
| 3288 m_children.append(children[i]); | 3310 m_children.append(children[i]); |
| 3289 } else | 3311 } else { |
| 3312 ASSERT(obj->renderParentObject() == this); |
| 3290 m_children.append(obj); | 3313 m_children.append(obj); |
| 3314 } |
| 3291 } | 3315 } |
| 3292 | 3316 |
| 3293 // for a RenderImage, add the <area> elements as individual accessibility ob
jects | 3317 // for a RenderImage, add the <area> elements as individual accessibility ob
jects |
| 3294 if (m_renderer->isRenderImage()) { | 3318 if (m_renderer->isRenderImage()) { |
| 3295 HTMLMapElement* map = toRenderImage(m_renderer)->imageMap(); | 3319 HTMLMapElement* map = toRenderImage(m_renderer)->imageMap(); |
| 3296 if (map) { | 3320 if (map) { |
| 3297 for (Node* current = map->firstChild(); current; current = current->
traverseNextNode(map)) { | 3321 for (Node* current = map->firstChild(); current; current = current->
traverseNextNode(map)) { |
| 3298 | 3322 |
| 3299 // add an <area> element for this child if it has a link | 3323 // add an <area> element for this child if it has a link |
| 3300 if (current->hasTagName(areaTag) && current->isLink()) { | 3324 if (current->hasTagName(areaTag) && current->isLink()) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3622 | 3646 |
| 3623 m_roleForMSAA = msaaRoleForRenderer(m_renderer); | 3647 m_roleForMSAA = msaaRoleForRenderer(m_renderer); |
| 3624 | 3648 |
| 3625 if (m_roleForMSAA == UnknownRole) | 3649 if (m_roleForMSAA == UnknownRole) |
| 3626 m_roleForMSAA = roleValue(); | 3650 m_roleForMSAA = roleValue(); |
| 3627 | 3651 |
| 3628 return m_roleForMSAA; | 3652 return m_roleForMSAA; |
| 3629 } | 3653 } |
| 3630 | 3654 |
| 3631 } // namespace WebCore | 3655 } // namespace WebCore |
| OLD | NEW |