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

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

Issue 2796553002: Revert of Initial skeleton of Accessibility Object Model Phase 1 (Closed)
Patch Set: Created 3 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, 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 12 matching lines...) Expand all
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "modules/accessibility/AXObject.h" 29 #include "modules/accessibility/AXObject.h"
30 30
31 #include "SkMatrix44.h" 31 #include "SkMatrix44.h"
32 #include "core/css/resolver/StyleResolver.h" 32 #include "core/css/resolver/StyleResolver.h"
33 #include "core/dom/AccessibleNode.h"
34 #include "core/dom/DocumentUserGestureToken.h" 33 #include "core/dom/DocumentUserGestureToken.h"
35 #include "core/editing/EditingUtilities.h" 34 #include "core/editing/EditingUtilities.h"
36 #include "core/editing/VisibleUnits.h" 35 #include "core/editing/VisibleUnits.h"
37 #include "core/frame/FrameView.h" 36 #include "core/frame/FrameView.h"
38 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
40 #include "core/html/HTMLDialogElement.h" 39 #include "core/html/HTMLDialogElement.h"
41 #include "core/html/HTMLFrameOwnerElement.h" 40 #include "core/html/HTMLFrameOwnerElement.h"
42 #include "core/html/parser/HTMLParserIdioms.h" 41 #include "core/html/parser/HTMLParserIdioms.h"
43 #include "core/layout/LayoutBoxModelObject.h" 42 #include "core/layout/LayoutBoxModelObject.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // no children are left with dangling pointers to their parent. 371 // no children are left with dangling pointers to their parent.
373 clearChildren(); 372 clearChildren();
374 373
375 m_axObjectCache = nullptr; 374 m_axObjectCache = nullptr;
376 } 375 }
377 376
378 bool AXObject::isDetached() const { 377 bool AXObject::isDetached() const {
379 return !m_axObjectCache; 378 return !m_axObjectCache;
380 } 379 }
381 380
382 const AtomicString& AXObject::getAOMPropertyOrARIAAttribute(
383 AOMStringProperty property) const {
384 Node* node = this->getNode();
385 if (!node || !node->isElementNode())
386 return nullAtom;
387
388 return AccessibleNode::getProperty(toElement(node), property);
389 }
390
391 bool AXObject::isARIATextControl() const { 381 bool AXObject::isARIATextControl() const {
392 return ariaRoleAttribute() == TextFieldRole || 382 return ariaRoleAttribute() == TextFieldRole ||
393 ariaRoleAttribute() == SearchBoxRole || 383 ariaRoleAttribute() == SearchBoxRole ||
394 ariaRoleAttribute() == ComboBoxRole; 384 ariaRoleAttribute() == ComboBoxRole;
395 } 385 }
396 386
397 bool AXObject::isButton() const { 387 bool AXObject::isButton() const {
398 AccessibilityRole role = roleValue(); 388 AccessibilityRole role = roleValue();
399 389
400 return role == ButtonRole || role == PopUpButtonRole || 390 return role == ButtonRole || role == PopUpButtonRole ||
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 796 }
807 } 797 }
808 798
809 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1 799 // Step 2C from: http://www.w3.org/TR/accname-aam-1.1
810 // If you change this logic, update AXNodeObject::nameFromLabelElement, too. 800 // If you change this logic, update AXNodeObject::nameFromLabelElement, too.
811 nameFrom = AXNameFromAttribute; 801 nameFrom = AXNameFromAttribute;
812 if (nameSources) { 802 if (nameSources) {
813 nameSources->push_back(NameSource(*foundTextAlternative, aria_labelAttr)); 803 nameSources->push_back(NameSource(*foundTextAlternative, aria_labelAttr));
814 nameSources->back().type = nameFrom; 804 nameSources->back().type = nameFrom;
815 } 805 }
816 const AtomicString& ariaLabel = 806 const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
817 getAOMPropertyOrARIAAttribute(AOMStringProperty::kLabel);
818 if (!ariaLabel.isEmpty()) { 807 if (!ariaLabel.isEmpty()) {
819 textAlternative = ariaLabel; 808 textAlternative = ariaLabel;
820 809
821 if (nameSources) { 810 if (nameSources) {
822 NameSource& source = nameSources->back(); 811 NameSource& source = nameSources->back();
823 source.text = textAlternative; 812 source.text = textAlternative;
824 source.attributeValue = ariaLabel; 813 source.attributeValue = ariaLabel;
825 *foundTextAlternative = true; 814 *foundTextAlternative = true;
826 } else { 815 } else {
827 *foundTextAlternative = true; 816 *foundTextAlternative = true;
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 } 1773 }
1785 1774
1786 DEFINE_TRACE(AXObject) { 1775 DEFINE_TRACE(AXObject) {
1787 visitor->trace(m_children); 1776 visitor->trace(m_children);
1788 visitor->trace(m_parent); 1777 visitor->trace(m_parent);
1789 visitor->trace(m_cachedLiveRegionRoot); 1778 visitor->trace(m_cachedLiveRegionRoot);
1790 visitor->trace(m_axObjectCache); 1779 visitor->trace(m_axObjectCache);
1791 } 1780 }
1792 1781
1793 } // namespace blink 1782 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698