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

Unified Diff: Source/modules/accessibility/AXTableCell.cpp

Issue 994663002: Slightly upgrade decideRoleFromSibling() in AXTableCell (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied suggestions Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXTableCell.cpp
diff --git a/Source/modules/accessibility/AXTableCell.cpp b/Source/modules/accessibility/AXTableCell.cpp
index 5ac20bceac67f4bece673306b794cc5799606b1b..c8b8966e6bb9a2654a158619105593207cecd17b 100644
--- a/Source/modules/accessibility/AXTableCell.cpp
+++ b/Source/modules/accessibility/AXTableCell.cpp
@@ -108,14 +108,18 @@ bool AXTableCell::isTableCell() const
return true;
}
-static AccessibilityRole decideRoleFromSibling(Node* siblingNode)
+static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell)
{
- if (!siblingNode)
+ if (!siblingCell)
return CellRole;
- if (siblingNode->hasTagName(thTag))
- return ColumnHeaderRole;
- if (siblingNode->hasTagName(tdTag))
- return RowHeaderRole;
+
+ if (Node* siblingNode = siblingCell->node()) {
+ if (siblingNode->hasTagName(thTag))
+ return ColumnHeaderRole;
+ if (siblingNode->hasTagName(tdTag))
+ return RowHeaderRole;
+ }
+
return CellRole;
}
@@ -137,20 +141,14 @@ AccessibilityRole AXTableCell::scanToDecideHeaderRole()
// if header is preceded by header cells on the same row, then it is a
// column header. If it is preceded by other cells then it's a row header.
- if (LayoutTableCell* cell = layoutCell->previousCell()) {
- Node* siblingNode = cell->node();
- headerRole = decideRoleFromSibling(siblingNode);
- if (headerRole != CellRole)
- return headerRole;
- }
+ if ((headerRole = decideRoleFromSibling(layoutCell->previousCell())) != CellRole)
+ return headerRole;
+
// if header is followed by header cells on the same row, then it is a
// column header. If it is followed by other cells then it's a row header.
- if (LayoutTableCell* cell = layoutCell->nextCell()) {
- Node* siblingNode = cell->node();
- headerRole = decideRoleFromSibling(siblingNode);
- if (headerRole != CellRole)
- return headerRole;
- }
+ if ((headerRole = decideRoleFromSibling(layoutCell->nextCell())) != CellRole)
+ return headerRole;
+
// If there are no other cells on that row, then it is a column header.
return ColumnHeaderRole;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698