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

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

Issue 833083012: Adding isTableHeaderCell method. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « Source/modules/accessibility/AXTableCell.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 AXTableCell::~AXTableCell() 45 AXTableCell::~AXTableCell()
46 { 46 {
47 } 47 }
48 48
49 PassRefPtr<AXTableCell> AXTableCell::create(RenderObject* renderer, AXObjectCach eImpl* axObjectCache) 49 PassRefPtr<AXTableCell> AXTableCell::create(RenderObject* renderer, AXObjectCach eImpl* axObjectCache)
50 { 50 {
51 return adoptRef(new AXTableCell(renderer, axObjectCache)); 51 return adoptRef(new AXTableCell(renderer, axObjectCache));
52 } 52 }
53 53
54 bool AXTableCell::isTableHeaderCell() const
55 {
56 return node() && node()->hasTagName(thTag);
57 }
58
54 bool AXTableCell::computeAccessibilityIsIgnored() const 59 bool AXTableCell::computeAccessibilityIsIgnored() const
55 { 60 {
56 AXObjectInclusion decision = defaultObjectInclusion(); 61 AXObjectInclusion decision = defaultObjectInclusion();
57 if (decision == IncludeObject) 62 if (decision == IncludeObject)
58 return false; 63 return false;
59 if (decision == IgnoreObject) 64 if (decision == IgnoreObject)
60 return true; 65 return true;
61 66
62 if (!isTableCell()) 67 if (!isTableCell())
63 return AXRenderObject::computeAccessibilityIsIgnored(); 68 return AXRenderObject::computeAccessibilityIsIgnored();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return CellRole; 102 return CellRole;
98 if (siblingNode->hasTagName(thTag)) 103 if (siblingNode->hasTagName(thTag))
99 return ColumnHeaderRole; 104 return ColumnHeaderRole;
100 if (siblingNode->hasTagName(tdTag)) 105 if (siblingNode->hasTagName(tdTag))
101 return RowHeaderRole; 106 return RowHeaderRole;
102 return CellRole; 107 return CellRole;
103 } 108 }
104 109
105 AccessibilityRole AXTableCell::scanToDecideHeaderRole() 110 AccessibilityRole AXTableCell::scanToDecideHeaderRole()
106 { 111 {
107 Node* node = m_renderer ? m_renderer->node() : 0; 112 if (!isTableHeaderCell())
108 if (!node || !node->hasTagName(thTag))
109 return CellRole; 113 return CellRole;
110 114
111 // Check scope attribute first. 115 // Check scope attribute first.
112 const AtomicString& scope = getAttribute(scopeAttr); 116 const AtomicString& scope = getAttribute(scopeAttr);
113 if (equalIgnoringCase(scope, "row")) 117 if (equalIgnoringCase(scope, "row"))
114 return RowHeaderRole; 118 return RowHeaderRole;
115 if (equalIgnoringCase(scope, "col")) 119 if (equalIgnoringCase(scope, "col"))
116 return ColumnHeaderRole; 120 return ColumnHeaderRole;
117 121
118 // Check the previous cell and the next cell 122 // Check the previous cell and the next cell
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return 0; 217 return 0;
214 218
215 Node* cellElement = headerCell->node(); 219 Node* cellElement = headerCell->node();
216 if (!cellElement || !cellElement->hasTagName(thTag)) 220 if (!cellElement || !cellElement->hasTagName(thTag))
217 return 0; 221 return 0;
218 222
219 return axObjectCache()->getOrCreate(headerCell); 223 return axObjectCache()->getOrCreate(headerCell);
220 } 224 }
221 225
222 } // namespace blink 226 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXTableCell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698