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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 1417213006: Switch all LayoutTests to use new AX name calculation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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, 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
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"
aboxhall 2015/11/05 17:49:21 Unused?
dmazzoni 2015/11/06 00:21:17 It's where we get isHTMLSpace
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 { 673 {
673 updateCachedAttributeValuesIfNeeded(); 674 updateCachedAttributeValuesIfNeeded();
674 return m_cachedIsPresentationalChild; 675 return m_cachedIsPresentationalChild;
675 } 676 }
676 677
677 String AXObject::name(AXNameFrom& nameFrom, AXObject::AXObjectVector* nameObject s) const 678 String AXObject::name(AXNameFrom& nameFrom, AXObject::AXObjectVector* nameObject s) const
678 { 679 {
679 HeapHashSet<Member<const AXObject>> visited; 680 HeapHashSet<Member<const AXObject>> visited;
680 AXRelatedObjectVector relatedObjects; 681 AXRelatedObjectVector relatedObjects;
681 String text = textAlternative(false, false, visited, nameFrom, &relatedObjec ts, nullptr); 682 String text = textAlternative(false, false, visited, nameFrom, &relatedObjec ts, nullptr);
683
684 if (!node() || !isHTMLBRElement(node()))
685 text = text.simplifyWhiteSpace(isHTMLSpace<UChar>);
686
682 if (nameObjects) { 687 if (nameObjects) {
683 nameObjects->clear(); 688 nameObjects->clear();
684 for (size_t i = 0; i < relatedObjects.size(); i++) 689 for (size_t i = 0; i < relatedObjects.size(); i++)
685 nameObjects->append(relatedObjects[i]->object); 690 nameObjects->append(relatedObjects[i]->object);
686 } 691 }
687 return text; 692 return text;
688 } 693 }
689 694
690 String AXObject::name(NameSources* nameSources) const 695 String AXObject::name(NameSources* nameSources) const
691 { 696 {
692 AXObjectSet visited; 697 AXObjectSet visited;
693 AXNameFrom tmpNameFrom; 698 AXNameFrom tmpNameFrom;
694 AXRelatedObjectVector tmpRelatedObjects; 699 AXRelatedObjectVector tmpRelatedObjects;
695 return textAlternative(false, false, visited, tmpNameFrom, &tmpRelatedObject s, nameSources); 700 String text = textAlternative(false, false, visited, tmpNameFrom, &tmpRelate dObjects, nameSources);
701 text = text.simplifyWhiteSpace(isHTMLSpace<UChar>);
702 return text;
696 } 703 }
697 704
698 String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabe lledByTraversal, AXObjectSet& visited) 705 String AXObject::recursiveTextAlternative(const AXObject& axObj, bool inAriaLabe lledByTraversal, AXObjectSet& visited)
699 { 706 {
700 AXNameFrom tmpNameFrom; 707 AXNameFrom tmpNameFrom;
701 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa meFrom, nullptr, nullptr); 708 return axObj.textAlternative(true, inAriaLabelledByTraversal, visited, tmpNa meFrom, nullptr, nullptr);
702 } 709 }
703 710
704 AccessibilityOrientation AXObject::orientation() const 711 AccessibilityOrientation AXObject::orientation() const
705 { 712 {
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 return true; 1460 return true;
1454 } 1461 }
1455 return false; 1462 return false;
1456 } 1463 }
1457 1464
1458 bool AXObject::nameFromContents() const 1465 bool AXObject::nameFromContents() const
1459 { 1466 {
1460 switch (roleValue()) { 1467 switch (roleValue()) {
1461 case ButtonRole: 1468 case ButtonRole:
1462 case CheckBoxRole: 1469 case CheckBoxRole:
1463 case CellRole:
1464 case ColumnHeaderRole:
1465 case DirectoryRole: 1470 case DirectoryRole:
1466 case DisclosureTriangleRole: 1471 case DisclosureTriangleRole:
1472 case HeadingRole:
1473 case LineBreakRole:
1467 case LinkRole: 1474 case LinkRole:
1475 case ListBoxOptionRole:
1468 case ListItemRole: 1476 case ListItemRole:
1469 case MenuItemRole: 1477 case MenuItemRole:
1470 case MenuItemCheckBoxRole: 1478 case MenuItemCheckBoxRole:
1471 case MenuItemRadioRole: 1479 case MenuItemRadioRole:
1472 case MenuListOptionRole: 1480 case MenuListOptionRole:
1473 case RadioButtonRole: 1481 case RadioButtonRole:
1474 case RowHeaderRole:
1475 case StaticTextRole: 1482 case StaticTextRole:
1476 case StatusRole: 1483 case StatusRole:
1477 case SwitchRole: 1484 case SwitchRole:
1485 case TabRole:
1486 case ToggleButtonRole:
1478 case TreeItemRole: 1487 case TreeItemRole:
1479 return true; 1488 return true;
1480 default: 1489 default:
1481 return false; 1490 return false;
1482 } 1491 }
1483 } 1492 }
1484 1493
1485 AccessibilityRole AXObject::buttonRoleType() const 1494 AccessibilityRole AXObject::buttonRoleType() const
1486 { 1495 {
1487 // If aria-pressed is present, then it should be exposed as a toggle button. 1496 // If aria-pressed is present, then it should be exposed as a toggle button.
(...skipping 24 matching lines...) Expand all
1512 1521
1513 DEFINE_TRACE(AXObject) 1522 DEFINE_TRACE(AXObject)
1514 { 1523 {
1515 visitor->trace(m_children); 1524 visitor->trace(m_children);
1516 visitor->trace(m_parent); 1525 visitor->trace(m_parent);
1517 visitor->trace(m_cachedLiveRegionRoot); 1526 visitor->trace(m_cachedLiveRegionRoot);
1518 visitor->trace(m_axObjectCache); 1527 visitor->trace(m_axObjectCache);
1519 } 1528 }
1520 1529
1521 } // namespace blink 1530 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698