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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 Node* node = m_layoutObject->node(); | 276 Node* node = m_layoutObject->node(); |
277 LayoutBoxModelObject* cssBox = layoutBoxModelObject(); | 277 LayoutBoxModelObject* cssBox = layoutBoxModelObject(); |
278 | 278 |
279 if ((cssBox && cssBox->isListItem()) || isHTMLLIElement(node)) | 279 if ((cssBox && cssBox->isListItem()) || isHTMLLIElement(node)) |
280 return ListItemRole; | 280 return ListItemRole; |
281 if (m_layoutObject->isListMarker()) | 281 if (m_layoutObject->isListMarker()) |
282 return ListMarkerRole; | 282 return ListMarkerRole; |
283 if (m_layoutObject->isBR()) | 283 if (m_layoutObject->isBR()) |
284 return LineBreakRole; | 284 return LineBreakRole; |
285 if (isHTMLLegendElement(node)) | |
286 return LegendRole; | |
287 if (m_layoutObject->isText()) | 285 if (m_layoutObject->isText()) |
288 return StaticTextRole; | 286 return StaticTextRole; |
289 if (cssBox && isImageOrAltText(cssBox, node)) { | 287 if (cssBox && isImageOrAltText(cssBox, node)) { |
290 if (node && node->isLink()) | 288 if (node && node->isLink()) |
291 return ImageMapRole; | 289 return ImageMapRole; |
292 if (isHTMLInputElement(node)) | 290 if (isHTMLInputElement(node)) |
293 return ariaHasPopup() ? PopUpButtonRole : ButtonRole; | 291 return ariaHasPopup() ? PopUpButtonRole : ButtonRole; |
294 if (isSVGImage()) | 292 if (isSVGImage()) |
295 return SVGRootRole; | 293 return SVGRootRole; |
296 return ImageRole; | 294 return ImageRole; |
297 } | 295 } |
298 // Note: if JavaScript is disabled, the layoutObject won't be a LayoutHTMLCa
nvas. | 296 // Note: if JavaScript is disabled, the layoutObject won't be a LayoutHTMLCa
nvas. |
299 if (isHTMLCanvasElement(node) && m_layoutObject->isCanvas()) | 297 if (isHTMLCanvasElement(node) && m_layoutObject->isCanvas()) |
300 return CanvasRole; | 298 return CanvasRole; |
301 | 299 |
302 if (cssBox && cssBox->isLayoutView()) | 300 if (cssBox && cssBox->isLayoutView()) |
303 return WebAreaRole; | 301 return WebAreaRole; |
304 | 302 |
305 if (m_layoutObject->isSVGImage()) | 303 if (m_layoutObject->isSVGImage()) |
306 return ImageRole; | 304 return ImageRole; |
307 if (m_layoutObject->isSVGRoot()) | 305 if (m_layoutObject->isSVGRoot()) |
308 return SVGRootRole; | 306 return SVGRootRole; |
309 | 307 |
310 if (node && node->hasTagName(ddTag)) | |
311 return DescriptionListDetailRole; | |
312 | |
313 if (node && node->hasTagName(dtTag)) | |
314 return DescriptionListTermRole; | |
315 | |
316 if (node && (node->nodeName() == "math")) | |
317 return MathRole; | |
318 | |
319 if (node && (node->hasTagName(rpTag) || node->hasTagName(rtTag))) | |
320 return AnnotationRole; | |
321 | |
322 // Table sections should be ignored. | 308 // Table sections should be ignored. |
323 if (m_layoutObject->isTableSection()) | 309 if (m_layoutObject->isTableSection()) |
324 return IgnoredRole; | 310 return IgnoredRole; |
325 | 311 |
326 if (m_layoutObject->isHR()) | 312 if (m_layoutObject->isHR()) |
327 return SplitterRole; | 313 return SplitterRole; |
328 | 314 |
329 if (isHTMLFormElement(node)) | |
330 return FormRole; | |
331 | |
332 if (node && node->hasTagName(articleTag)) | |
333 return ArticleRole; | |
334 | |
335 if (node && node->hasTagName(mainTag)) | |
336 return MainRole; | |
337 | |
338 if (node && node->hasTagName(navTag)) | |
339 return NavigationRole; | |
340 | |
341 if (node && node->hasTagName(asideTag)) | |
342 return ComplementaryRole; | |
343 | |
344 if (node && node->hasTagName(preTag)) | |
345 return PreRole; | |
346 | |
347 if (node && node->hasTagName(sectionTag)) | |
348 return RegionRole; | |
349 | |
350 if (node && node->hasTagName(addressTag)) | |
351 return ContentInfoRole; | |
352 | |
353 if (node && node->hasTagName(dialogTag)) | |
354 return DialogRole; | |
355 | |
356 // The HTML element should not be exposed as an element. That's what the Lay
outView element does. | |
357 if (isHTMLHtmlElement(node)) | |
358 return IgnoredRole; | |
359 | |
360 if (node && node->hasTagName(iframeTag)) { | |
361 const AtomicString& ariaRole = getAttribute(roleAttr); | |
362 if (ariaRole == "none" || ariaRole == "presentation") | |
363 return IframePresentationalRole; | |
364 return IframeRole; | |
365 } | |
366 | |
367 // There should only be one banner/contentInfo per page. If header/footer ar
e being used within an article or section | |
368 // then it should not be exposed as whole page's banner/contentInfo | |
369 if (node && node->hasTagName(headerTag) && !isDescendantOfElementType(articl
eTag) && !isDescendantOfElementType(sectionTag)) | |
370 return BannerRole; | |
371 if (node && node->hasTagName(footerTag) && !isDescendantOfElementType(articl
eTag) && !isDescendantOfElementType(sectionTag)) | |
372 return FooterRole; | |
373 | |
374 AccessibilityRole role = AXNodeObject::determineAccessibilityRoleUtil(); | 315 AccessibilityRole role = AXNodeObject::determineAccessibilityRoleUtil(); |
375 if (role != UnknownRole) | 316 if (role != UnknownRole) |
376 return role; | 317 return role; |
377 | 318 |
378 if (m_layoutObject->isLayoutBlockFlow()) | 319 if (m_layoutObject->isLayoutBlockFlow()) |
379 return GroupRole; | 320 return GroupRole; |
380 | 321 |
381 // If the element does not have role, but it has ARIA attributes, accessibil
ity should fallback to exposing it as a group. | 322 // If the element does not have role, but it has ARIA attributes, accessibil
ity should fallback to exposing it as a group. |
382 if (supportsARIAAttributes()) | 323 if (supportsARIAAttributes()) |
383 return GroupRole; | 324 return GroupRole; |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 break; | 1997 break; |
2057 firstChild = newFirstChild; | 1998 firstChild = newFirstChild; |
2058 if (!firstChild->node()) | 1999 if (!firstChild->node()) |
2059 break; | 2000 break; |
2060 } | 2001 } |
2061 } | 2002 } |
2062 | 2003 |
2063 return parent; | 2004 return parent; |
2064 } | 2005 } |
2065 | 2006 |
2066 bool AXLayoutObject::isDescendantOfElementType(const HTMLQualifiedName& tagName)
const | |
2067 { | |
2068 for (LayoutObject* parent = m_layoutObject->parent(); parent; parent = paren
t->parent()) { | |
2069 if (parent->node() && parent->node()->hasTagName(tagName)) | |
2070 return true; | |
2071 } | |
2072 return false; | |
2073 } | |
2074 | |
2075 bool AXLayoutObject::isSVGImage() const | 2007 bool AXLayoutObject::isSVGImage() const |
2076 { | 2008 { |
2077 return remoteSVGRootElement(); | 2009 return remoteSVGRootElement(); |
2078 } | 2010 } |
2079 | 2011 |
2080 void AXLayoutObject::detachRemoteSVGRoot() | 2012 void AXLayoutObject::detachRemoteSVGRoot() |
2081 { | 2013 { |
2082 if (AXSVGRoot* root = remoteSVGRootElement()) | 2014 if (AXSVGRoot* root = remoteSVGRootElement()) |
2083 root->setParent(0); | 2015 root->setParent(0); |
2084 } | 2016 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 if (label && label->layoutObject()) { | 2268 if (label && label->layoutObject()) { |
2337 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2269 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
2338 result.unite(labelRect); | 2270 result.unite(labelRect); |
2339 } | 2271 } |
2340 } | 2272 } |
2341 | 2273 |
2342 return result; | 2274 return result; |
2343 } | 2275 } |
2344 | 2276 |
2345 } // namespace blink | 2277 } // namespace blink |
OLD | NEW |