| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "core/accessibility/AXTable.h" | 30 #include "core/accessibility/AXTable.h" |
| 31 | 31 |
| 32 #include "core/accessibility/AXObjectCache.h" | 32 #include "core/accessibility/AXObjectCache.h" |
| 33 #include "core/accessibility/AXTableCell.h" | 33 #include "core/accessibility/AXTableCell.h" |
| 34 #include "core/accessibility/AXTableColumn.h" | 34 #include "core/accessibility/AXTableColumn.h" |
| 35 #include "core/accessibility/AXTableRow.h" | 35 #include "core/accessibility/AXTableRow.h" |
| 36 #include "core/html/HTMLTableCaptionElement.h" | 36 #include "core/html/HTMLTableCaptionElement.h" |
| 37 #include "core/html/HTMLTableCellElement.h" | 37 #include "core/html/HTMLTableCellElement.h" |
| 38 #include "core/html/HTMLTableColElement.h" |
| 38 #include "core/html/HTMLTableElement.h" | 39 #include "core/html/HTMLTableElement.h" |
| 39 #include "core/rendering/RenderTableCell.h" | 40 #include "core/rendering/RenderTableCell.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 using namespace HTMLNames; | 44 using namespace HTMLNames; |
| 44 | 45 |
| 45 AXTable::AXTable(RenderObject* renderer) | 46 AXTable::AXTable(RenderObject* renderer) |
| 46 : AXRenderObject(renderer) | 47 : AXRenderObject(renderer) |
| 47 , m_headerContainer(nullptr) | 48 , m_headerContainer(nullptr) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // if there is a caption element, summary, THEAD, or TFOOT section, it's mos
t certainly a data table | 113 // if there is a caption element, summary, THEAD, or TFOOT section, it's mos
t certainly a data table |
| 113 HTMLTableElement* tableElement = toHTMLTableElement(tableNode); | 114 HTMLTableElement* tableElement = toHTMLTableElement(tableNode); |
| 114 if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElem
ent->tFoot() || tableElement->caption()) | 115 if (!tableElement->summary().isEmpty() || tableElement->tHead() || tableElem
ent->tFoot() || tableElement->caption()) |
| 115 return true; | 116 return true; |
| 116 | 117 |
| 117 // if someone used "rules" attribute than the table should appear | 118 // if someone used "rules" attribute than the table should appear |
| 118 if (!tableElement->rules().isEmpty()) | 119 if (!tableElement->rules().isEmpty()) |
| 119 return true; | 120 return true; |
| 120 | 121 |
| 121 // if there's a colgroup or col element, it's probably a data table. | 122 // if there's a colgroup or col element, it's probably a data table. |
| 122 for (Node* child = tableElement->firstChild(); child; child = child->nextSib
ling()) { | 123 if (Traversal<HTMLTableColElement>::firstChild(*tableElement)) |
| 123 if (child->hasTagName(colTag) || child->hasTagName(colgroupTag)) | 124 return true; |
| 124 return true; | |
| 125 } | |
| 126 | 125 |
| 127 // go through the cell's and check for tell-tale signs of "data" table statu
s | 126 // go through the cell's and check for tell-tale signs of "data" table statu
s |
| 128 // cells have borders, or use attributes like headers, abbr, scope or axis | 127 // cells have borders, or use attributes like headers, abbr, scope or axis |
| 129 table->recalcSectionsIfNeeded(); | 128 table->recalcSectionsIfNeeded(); |
| 130 RenderTableSection* firstBody = table->firstBody(); | 129 RenderTableSection* firstBody = table->firstBody(); |
| 131 if (!firstBody) | 130 if (!firstBody) |
| 132 return false; | 131 return false; |
| 133 | 132 |
| 134 int numCols = firstBody->numColumns(); | 133 int numCols = firstBody->numColumns(); |
| 135 int numRows = firstBody->numRows(); | 134 int numRows = firstBody->numRows(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 bool isTHCell = cellNode->hasTagName(thTag); | 183 bool isTHCell = cellNode->hasTagName(thTag); |
| 185 // If the first row is comprised of all <th> tags, assume it is a da
ta table. | 184 // If the first row is comprised of all <th> tags, assume it is a da
ta table. |
| 186 if (!row && isTHCell) | 185 if (!row && isTHCell) |
| 187 headersInFirstRowCount++; | 186 headersInFirstRowCount++; |
| 188 | 187 |
| 189 // If the first column is comprised of all <th> tags, assume it is a
data table. | 188 // If the first column is comprised of all <th> tags, assume it is a
data table. |
| 190 if (!col && isTHCell) | 189 if (!col && isTHCell) |
| 191 headersInFirstColumnCount++; | 190 headersInFirstColumnCount++; |
| 192 | 191 |
| 193 // in this case, the developer explicitly assigned a "data" table at
tribute | 192 // in this case, the developer explicitly assigned a "data" table at
tribute |
| 194 if (cellNode->hasTagName(tdTag) || cellNode->hasTagName(thTag)) { | 193 if (isHTMLTableCellElement(*cellNode)) { |
| 195 HTMLTableCellElement* cellElement = toHTMLTableCellElement(cellN
ode); | 194 HTMLTableCellElement& cellElement = toHTMLTableCellElement(*cell
Node); |
| 196 if (!cellElement->headers().isEmpty() || !cellElement->abbr().is
Empty() | 195 if (!cellElement.headers().isEmpty() || !cellElement.abbr().isEm
pty() |
| 197 || !cellElement->axis().isEmpty() || !cellElement->scope().i
sEmpty()) | 196 || !cellElement.axis().isEmpty() || !cellElement.scope().isE
mpty()) |
| 198 return true; | 197 return true; |
| 199 } | 198 } |
| 200 | 199 |
| 201 RenderStyle* renderStyle = cell->style(); | 200 RenderStyle* renderStyle = cell->style(); |
| 202 if (!renderStyle) | 201 if (!renderStyle) |
| 203 continue; | 202 continue; |
| 204 | 203 |
| 205 // If the empty-cells style is set, we'll call it a data table. | 204 // If the empty-cells style is set, we'll call it a data table. |
| 206 if (renderStyle->emptyCells() == HIDE) | 205 if (renderStyle->emptyCells() == HIDE) |
| 207 return true; | 206 return true; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } | 541 } |
| 543 | 542 |
| 544 // try the standard | 543 // try the standard |
| 545 if (title.isEmpty()) | 544 if (title.isEmpty()) |
| 546 title = AXRenderObject::title(); | 545 title = AXRenderObject::title(); |
| 547 | 546 |
| 548 return title; | 547 return title; |
| 549 } | 548 } |
| 550 | 549 |
| 551 } // namespace WebCore | 550 } // namespace WebCore |
| OLD | NEW |