| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 return ariaHasPopup() ? PopUpButtonRole : ButtonRole; | 294 return ariaHasPopup() ? PopUpButtonRole : ButtonRole; |
| 295 if (isSVGImage()) | 295 if (isSVGImage()) |
| 296 return SVGRootRole; | 296 return SVGRootRole; |
| 297 return ImageRole; | 297 return ImageRole; |
| 298 } | 298 } |
| 299 | 299 |
| 300 // Note: if JavaScript is disabled, the renderer won't be a RenderHTMLCanvas
. | 300 // Note: if JavaScript is disabled, the renderer won't be a RenderHTMLCanvas
. |
| 301 if (node && node->hasTagName(canvasTag) && m_renderer->isCanvas()) | 301 if (node && node->hasTagName(canvasTag) && m_renderer->isCanvas()) |
| 302 return CanvasRole; | 302 return CanvasRole; |
| 303 | 303 |
| 304 if (cssBox && cssBox->isRenderView()) { | 304 if (cssBox && cssBox->isRenderView()) |
| 305 // If the iframe is seamless, it should not be announced as a web area t
o AT clients. | |
| 306 if (document() && document()->shouldDisplaySeamlesslyWithParent()) | |
| 307 return SeamlessWebAreaRole; | |
| 308 return WebAreaRole; | 305 return WebAreaRole; |
| 309 } | |
| 310 | 306 |
| 311 if (cssBox && cssBox->isTextField()) | 307 if (cssBox && cssBox->isTextField()) |
| 312 return TextFieldRole; | 308 return TextFieldRole; |
| 313 | 309 |
| 314 if (cssBox && cssBox->isTextArea()) | 310 if (cssBox && cssBox->isTextArea()) |
| 315 return TextAreaRole; | 311 return TextAreaRole; |
| 316 | 312 |
| 317 if (node && node->hasTagName(inputTag)) { | 313 if (node && node->hasTagName(inputTag)) { |
| 318 HTMLInputElement* input = toHTMLInputElement(node); | 314 HTMLInputElement* input = toHTMLInputElement(node); |
| 319 if (input->isCheckbox()) | 315 if (input->isCheckbox()) |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 729 |
| 734 if (isCanvas()) { | 730 if (isCanvas()) { |
| 735 if (canvasHasFallbackContent()) | 731 if (canvasHasFallbackContent()) |
| 736 return false; | 732 return false; |
| 737 RenderHTMLCanvas* canvas = toRenderHTMLCanvas(m_renderer); | 733 RenderHTMLCanvas* canvas = toRenderHTMLCanvas(m_renderer); |
| 738 if (canvas->height() <= 1 || canvas->width() <= 1) | 734 if (canvas->height() <= 1 || canvas->width() <= 1) |
| 739 return true; | 735 return true; |
| 740 // Otherwise fall through; use presence of help text, title, or descript
ion to decide. | 736 // Otherwise fall through; use presence of help text, title, or descript
ion to decide. |
| 741 } | 737 } |
| 742 | 738 |
| 743 if (isWebArea() || isSeamlessWebArea() || m_renderer->isListMarker()) | 739 if (isWebArea() || m_renderer->isListMarker()) |
| 744 return false; | 740 return false; |
| 745 | 741 |
| 746 // Using the help text, title or accessibility description (so we | 742 // Using the help text, title or accessibility description (so we |
| 747 // check if there's some kind of accessible name for the element) | 743 // check if there's some kind of accessible name for the element) |
| 748 // to decide an element's visibility is not as definitive as | 744 // to decide an element's visibility is not as definitive as |
| 749 // previous checks, so this should remain as one of the last. | 745 // previous checks, so this should remain as one of the last. |
| 750 // | 746 // |
| 751 // These checks are simplified in the interest of execution speed; | 747 // These checks are simplified in the interest of execution speed; |
| 752 // for example, any element having an alt attribute will make it | 748 // for example, any element having an alt attribute will make it |
| 753 // not ignored, rather than just images. | 749 // not ignored, rather than just images. |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 AXObject* parent = menuButtonForMenu(); | 1319 AXObject* parent = menuButtonForMenu(); |
| 1324 if (parent) | 1320 if (parent) |
| 1325 return parent; | 1321 return parent; |
| 1326 } | 1322 } |
| 1327 | 1323 |
| 1328 RenderObject* parentObj = renderParentObject(); | 1324 RenderObject* parentObj = renderParentObject(); |
| 1329 if (parentObj) | 1325 if (parentObj) |
| 1330 return axObjectCache()->getOrCreate(parentObj); | 1326 return axObjectCache()->getOrCreate(parentObj); |
| 1331 | 1327 |
| 1332 // WebArea's parent should be the scroll view containing it. | 1328 // WebArea's parent should be the scroll view containing it. |
| 1333 if (isWebArea() || isSeamlessWebArea()) | 1329 if (isWebArea()) |
| 1334 return axObjectCache()->getOrCreate(m_renderer->frame()->view()); | 1330 return axObjectCache()->getOrCreate(m_renderer->frame()->view()); |
| 1335 | 1331 |
| 1336 return 0; | 1332 return 0; |
| 1337 } | 1333 } |
| 1338 | 1334 |
| 1339 AXObject* AXRenderObject::parentObjectIfExists() const | 1335 AXObject* AXRenderObject::parentObjectIfExists() const |
| 1340 { | 1336 { |
| 1341 // WebArea's parent should be the scroll view containing it. | 1337 // WebArea's parent should be the scroll view containing it. |
| 1342 if (isWebArea() || isSeamlessWebArea()) | 1338 if (isWebArea()) |
| 1343 return axObjectCache()->get(m_renderer->frame()->view()); | 1339 return axObjectCache()->get(m_renderer->frame()->view()); |
| 1344 | 1340 |
| 1345 return axObjectCache()->get(renderParentObject()); | 1341 return axObjectCache()->get(renderParentObject()); |
| 1346 } | 1342 } |
| 1347 | 1343 |
| 1348 // | 1344 // |
| 1349 // Low-level accessibility tree exploration, only for use within the accessibili
ty module. | 1345 // Low-level accessibility tree exploration, only for use within the accessibili
ty module. |
| 1350 // | 1346 // |
| 1351 | 1347 |
| 1352 AXObject* AXRenderObject::firstChild() const | 1348 AXObject* AXRenderObject::firstChild() const |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 if (obj->node()) // If we are a continuation, we want to make sure to use th
e primary renderer. | 2295 if (obj->node()) // If we are a continuation, we want to make sure to use th
e primary renderer. |
| 2300 obj = obj->node()->renderer(); | 2296 obj = obj->node()->renderer(); |
| 2301 | 2297 |
| 2302 // absoluteFocusRingQuads will query the hierarchy below this element, which
for large webpages can be very slow. | 2298 // absoluteFocusRingQuads will query the hierarchy below this element, which
for large webpages can be very slow. |
| 2303 // For a web area, which will have the most elements of any element, absolut
eQuads should be used. | 2299 // For a web area, which will have the most elements of any element, absolut
eQuads should be used. |
| 2304 // We should also use absoluteQuads for SVG elements, otherwise transforms w
on't be applied. | 2300 // We should also use absoluteQuads for SVG elements, otherwise transforms w
on't be applied. |
| 2305 Vector<FloatQuad> quads; | 2301 Vector<FloatQuad> quads; |
| 2306 | 2302 |
| 2307 if (obj->isText()) | 2303 if (obj->isText()) |
| 2308 toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis); | 2304 toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis); |
| 2309 else if (isWebArea() || isSeamlessWebArea() || obj->isSVGRoot()) | 2305 else if (isWebArea() || obj->isSVGRoot()) |
| 2310 obj->absoluteQuads(quads); | 2306 obj->absoluteQuads(quads); |
| 2311 else | 2307 else |
| 2312 obj->absoluteFocusRingQuads(quads); | 2308 obj->absoluteFocusRingQuads(quads); |
| 2313 | 2309 |
| 2314 LayoutRect result = boundingBoxForQuads(obj, quads); | 2310 LayoutRect result = boundingBoxForQuads(obj, quads); |
| 2315 | 2311 |
| 2316 Document* document = this->document(); | 2312 Document* document = this->document(); |
| 2317 if (document && document->isSVGDocument()) | 2313 if (document && document->isSVGDocument()) |
| 2318 offsetBoundingBoxForRemoteSVGElement(result); | 2314 offsetBoundingBoxForRemoteSVGElement(result); |
| 2319 | 2315 |
| 2320 // The size of the web area should be the content size, not the clipped size
. | 2316 // The size of the web area should be the content size, not the clipped size
. |
| 2321 if ((isWebArea() || isSeamlessWebArea()) && obj->frame()->view()) | 2317 if (isWebArea() && obj->frame()->view()) |
| 2322 result.setSize(obj->frame()->view()->contentsSize()); | 2318 result.setSize(obj->frame()->view()->contentsSize()); |
| 2323 | 2319 |
| 2324 // Checkboxes and radio buttons include their label as part of their rect. | 2320 // Checkboxes and radio buttons include their label as part of their rect. |
| 2325 if (isCheckboxOrRadio()) { | 2321 if (isCheckboxOrRadio()) { |
| 2326 HTMLLabelElement* label = labelForElement(toElement(m_renderer->node()))
; | 2322 HTMLLabelElement* label = labelForElement(toElement(m_renderer->node()))
; |
| 2327 if (label && label->renderer()) { | 2323 if (label && label->renderer()) { |
| 2328 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2324 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
| 2329 result.unite(labelRect); | 2325 result.unite(labelRect); |
| 2330 } | 2326 } |
| 2331 } | 2327 } |
| 2332 | 2328 |
| 2333 return result; | 2329 return result; |
| 2334 } | 2330 } |
| 2335 | 2331 |
| 2336 } // namespace WebCore | 2332 } // namespace WebCore |
| OLD | NEW |