Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: Source/modules/accessibility/AXLayoutObject.cpp

Issue 1039873002: AX presentation role should be inherited to its required owned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 if (decision == IgnoreObject) 556 if (decision == IgnoreObject)
557 return true; 557 return true;
558 558
559 // If this element is within a parent that cannot have children, it should n ot be exposed. 559 // If this element is within a parent that cannot have children, it should n ot be exposed.
560 if (isDescendantOfBarrenParent()) 560 if (isDescendantOfBarrenParent())
561 return true; 561 return true;
562 562
563 if (roleValue() == IgnoredRole) 563 if (roleValue() == IgnoredRole)
564 return true; 564 return true;
565 565
566 if ((roleValue() == NoneRole || roleValue() == PresentationalRole) || inheri tsPresentationalRole()) 566 if (hasInheritedPresentationalRole())
567 return true; 567 return true;
568 568
569 // An ARIA tree can only have tree items and static text as children. 569 // An ARIA tree can only have tree items and static text as children.
570 if (!isAllowedChildOfTree()) 570 if (!isAllowedChildOfTree())
571 return true; 571 return true;
572 572
573 // TODO: we should refactor this - but right now this is necessary to make 573 // TODO: we should refactor this - but right now this is necessary to make
574 // sure scroll areas stay in the tree. 574 // sure scroll areas stay in the tree.
575 if (isAttachment()) 575 if (isAttachment())
576 return false; 576 return false;
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 } 2286 }
2287 2287
2288 bool AXLayoutObject::elementAttributeValue(const QualifiedName& attributeName) c onst 2288 bool AXLayoutObject::elementAttributeValue(const QualifiedName& attributeName) c onst
2289 { 2289 {
2290 if (!m_layoutObject) 2290 if (!m_layoutObject)
2291 return false; 2291 return false;
2292 2292
2293 return equalIgnoringCase(getAttribute(attributeName), "true"); 2293 return equalIgnoringCase(getAttribute(attributeName), "true");
2294 } 2294 }
2295 2295
2296 bool AXLayoutObject::inheritsPresentationalRole() const
2297 {
2298 // ARIA states if an item can get focus, it should not be presentational.
2299 if (canSetFocusAttribute())
2300 return false;
2301
2302 // ARIA spec says that when a parent object is presentational, and it has re quired child elements,
2303 // those child elements are also presentational. For example, <li> becomes p resentational from <ul>.
2304 // http://www.w3.org/WAI/PF/aria/complete#presentation
2305 if (roleValue() != ListItemRole && roleValue() != ListMarkerRole)
2306 return false;
2307
2308 AXObject* parent = parentObject();
2309 if (!parent->isAXLayoutObject())
2310 return false;
2311
2312 Node* elementNode = toAXLayoutObject(parent)->node();
2313 if (!elementNode || !elementNode->isElementNode())
2314 return false;
2315
2316 QualifiedName tagName = toElement(elementNode)->tagQName();
2317 if (tagName != ulTag && tagName != olTag && tagName != dlTag)
2318 return false;
2319
2320 if (parent->roleValue() == NoneRole || parent->roleValue() == Presentational Role)
2321 return ariaRoleAttribute() == UnknownRole;
2322
2323 return false;
2324 }
2325
2326 LayoutRect AXLayoutObject::computeElementRect() const 2296 LayoutRect AXLayoutObject::computeElementRect() const
2327 { 2297 {
2328 LayoutObject* obj = m_layoutObject; 2298 LayoutObject* obj = m_layoutObject;
2329 2299
2330 if (!obj) 2300 if (!obj)
2331 return LayoutRect(); 2301 return LayoutRect();
2332 2302
2333 if (obj->node()) // If we are a continuation, we want to make sure to use th e primary layoutObject. 2303 if (obj->node()) // If we are a continuation, we want to make sure to use th e primary layoutObject.
2334 obj = obj->node()->layoutObject(); 2304 obj = obj->node()->layoutObject();
2335 2305
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 if (label && label->layoutObject()) { 2337 if (label && label->layoutObject()) {
2368 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2338 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2369 result.unite(labelRect); 2339 result.unite(labelRect);
2370 } 2340 }
2371 } 2341 }
2372 2342
2373 return result; 2343 return result;
2374 } 2344 }
2375 2345
2376 } // namespace blink 2346 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXLayoutObject.h ('k') | Source/modules/accessibility/AXListBoxOption.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698