OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 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 18 matching lines...) Expand all Loading... |
29 #include "config.h" | 29 #include "config.h" |
30 #include "modules/accessibility/AXObject.h" | 30 #include "modules/accessibility/AXObject.h" |
31 | 31 |
32 #include "core/editing/EditingUtilities.h" | 32 #include "core/editing/EditingUtilities.h" |
33 #include "core/editing/VisibleUnits.h" | 33 #include "core/editing/VisibleUnits.h" |
34 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
37 #include "core/html/HTMLDialogElement.h" | 37 #include "core/html/HTMLDialogElement.h" |
38 #include "core/html/HTMLFrameOwnerElement.h" | 38 #include "core/html/HTMLFrameOwnerElement.h" |
| 39 #include "core/html/parser/HTMLParserIdioms.h" |
39 #include "core/layout/LayoutListItem.h" | 40 #include "core/layout/LayoutListItem.h" |
40 #include "core/layout/LayoutTheme.h" | 41 #include "core/layout/LayoutTheme.h" |
41 #include "core/layout/LayoutView.h" | 42 #include "core/layout/LayoutView.h" |
42 #include "modules/accessibility/AXObjectCacheImpl.h" | 43 #include "modules/accessibility/AXObjectCacheImpl.h" |
43 #include "platform/UserGestureIndicator.h" | 44 #include "platform/UserGestureIndicator.h" |
44 #include "platform/text/PlatformLocale.h" | 45 #include "platform/text/PlatformLocale.h" |
45 #include "wtf/HashSet.h" | 46 #include "wtf/HashSet.h" |
46 #include "wtf/StdLibExtras.h" | 47 #include "wtf/StdLibExtras.h" |
47 #include "wtf/text/WTFString.h" | 48 #include "wtf/text/WTFString.h" |
48 | 49 |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 { | 674 { |
674 updateCachedAttributeValuesIfNeeded(); | 675 updateCachedAttributeValuesIfNeeded(); |
675 return m_cachedIsPresentationalChild; | 676 return m_cachedIsPresentationalChild; |
676 } | 677 } |
677 | 678 |
678 String AXObject::name(AXNameFrom& nameFrom, AXObject::AXObjectVector* nameObject
s) const | 679 String AXObject::name(AXNameFrom& nameFrom, AXObject::AXObjectVector* nameObject
s) const |
679 { | 680 { |
680 HeapHashSet<Member<const AXObject>> visited; | 681 HeapHashSet<Member<const AXObject>> visited; |
681 AXRelatedObjectVector relatedObjects; | 682 AXRelatedObjectVector relatedObjects; |
682 String text = textAlternative(false, false, visited, nameFrom, &relatedObjec
ts, nullptr); | 683 String text = textAlternative(false, false, visited, nameFrom, &relatedObjec
ts, nullptr); |
| 684 |
| 685 if (!node() || !isHTMLBRElement(node())) |
| 686 text = text.simplifyWhiteSpace(isHTMLSpace<UChar>); |
| 687 |
683 if (nameObjects) { | 688 if (nameObjects) { |
684 nameObjects->clear(); | 689 nameObjects->clear(); |
685 for (size_t i = 0; i < relatedObjects.size(); i++) | 690 for (size_t i = 0; i < relatedObjects.size(); i++) |
686 nameObjects->append(relatedObjects[i]->object); | 691 nameObjects->append(relatedObjects[i]->object); |
687 } | 692 } |
688 return text; | 693 return text; |
689 } | 694 } |
690 | 695 |
691 String AXObject::name(NameSources* nameSources) const | 696 String AXObject::name(NameSources* nameSources) const |
692 { | 697 { |
693 AXObjectSet visited; | 698 AXObjectSet visited; |
694 AXNameFrom tmpNameFrom; | 699 AXNameFrom tmpNameFrom; |
695 AXRelatedObjectVector tmpRelatedObjects; | 700 AXRelatedObjectVector tmpRelatedObjects; |
696 return textAlternative(false, false, visited, tmpNameFrom, &tmpRelatedObject
s, nameSources); | 701 String text = textAlternative(false, false, visited, tmpNameFrom, &tmpRelate
dObjects, nameSources); |
| 702 text = text.simplifyWhiteSpace(isHTMLSpace<UChar>); |
| 703 return text; |
697 } | 704 } |
698 | 705 |
699 String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabe
lledByTraversal, AXObjectSet& visited) | 706 String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabe
lledByTraversal, AXObjectSet& visited) |
700 { | 707 { |
701 AXNameFrom tmpNameFrom; | 708 AXNameFrom tmpNameFrom; |
702 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa
meFrom, nullptr, nullptr); | 709 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa
meFrom, nullptr, nullptr); |
703 } | 710 } |
704 | 711 |
705 AccessibilityOrientation AXObject::orientation() const | 712 AccessibilityOrientation AXObject::orientation() const |
706 { | 713 { |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 return true; | 1462 return true; |
1456 } | 1463 } |
1457 return false; | 1464 return false; |
1458 } | 1465 } |
1459 | 1466 |
1460 bool AXObject::nameFromContents() const | 1467 bool AXObject::nameFromContents() const |
1461 { | 1468 { |
1462 switch (roleValue()) { | 1469 switch (roleValue()) { |
1463 case ButtonRole: | 1470 case ButtonRole: |
1464 case CheckBoxRole: | 1471 case CheckBoxRole: |
1465 case CellRole: | |
1466 case ColumnHeaderRole: | |
1467 case DirectoryRole: | 1472 case DirectoryRole: |
1468 case DisclosureTriangleRole: | 1473 case DisclosureTriangleRole: |
| 1474 case HeadingRole: |
| 1475 case LineBreakRole: |
1469 case LinkRole: | 1476 case LinkRole: |
| 1477 case ListBoxOptionRole: |
1470 case ListItemRole: | 1478 case ListItemRole: |
1471 case MenuItemRole: | 1479 case MenuItemRole: |
1472 case MenuItemCheckBoxRole: | 1480 case MenuItemCheckBoxRole: |
1473 case MenuItemRadioRole: | 1481 case MenuItemRadioRole: |
1474 case MenuListOptionRole: | 1482 case MenuListOptionRole: |
1475 case RadioButtonRole: | 1483 case RadioButtonRole: |
1476 case RowHeaderRole: | |
1477 case StaticTextRole: | 1484 case StaticTextRole: |
1478 case StatusRole: | 1485 case StatusRole: |
1479 case SwitchRole: | 1486 case SwitchRole: |
| 1487 case TabRole: |
| 1488 case ToggleButtonRole: |
1480 case TreeItemRole: | 1489 case TreeItemRole: |
1481 return true; | 1490 return true; |
1482 default: | 1491 default: |
1483 return false; | 1492 return false; |
1484 } | 1493 } |
1485 } | 1494 } |
1486 | 1495 |
1487 AccessibilityRole AXObject::buttonRoleType() const | 1496 AccessibilityRole AXObject::buttonRoleType() const |
1488 { | 1497 { |
1489 // If aria-pressed is present, then it should be exposed as a toggle button. | 1498 // If aria-pressed is present, then it should be exposed as a toggle button. |
(...skipping 24 matching lines...) Expand all Loading... |
1514 | 1523 |
1515 DEFINE_TRACE(AXObject) | 1524 DEFINE_TRACE(AXObject) |
1516 { | 1525 { |
1517 visitor->trace(m_children); | 1526 visitor->trace(m_children); |
1518 visitor->trace(m_parent); | 1527 visitor->trace(m_parent); |
1519 visitor->trace(m_cachedLiveRegionRoot); | 1528 visitor->trace(m_cachedLiveRegionRoot); |
1520 visitor->trace(m_axObjectCache); | 1529 visitor->trace(m_axObjectCache); |
1521 } | 1530 } |
1522 | 1531 |
1523 } // namespace blink | 1532 } // namespace blink |
OLD | NEW |