| 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 19 matching lines...) Expand all Loading... |
| 30 #include "modules/accessibility/AXTableCell.h" | 30 #include "modules/accessibility/AXTableCell.h" |
| 31 | 31 |
| 32 #include "core/layout/LayoutTableCell.h" | 32 #include "core/layout/LayoutTableCell.h" |
| 33 #include "modules/accessibility/AXObjectCacheImpl.h" | 33 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 34 | 34 |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 using namespace HTMLNames; | 38 using namespace HTMLNames; |
| 39 | 39 |
| 40 AXTableCell::AXTableCell(LayoutObject* layoutObject, AXObjectCacheImpl* axObject
Cache) | 40 AXTableCell::AXTableCell(LayoutObject* layoutObject, AXObjectCacheImpl& axObject
Cache) |
| 41 : AXLayoutObject(layoutObject, axObjectCache) | 41 : AXLayoutObject(layoutObject, axObjectCache) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 AXTableCell::~AXTableCell() | 45 AXTableCell::~AXTableCell() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 PassRefPtr<AXTableCell> AXTableCell::create(LayoutObject* layoutObject, AXObject
CacheImpl* axObjectCache) | 49 PassRefPtr<AXTableCell> AXTableCell::create(LayoutObject* layoutObject, AXObject
CacheImpl& axObjectCache) |
| 50 { | 50 { |
| 51 return adoptRef(new AXTableCell(layoutObject, axObjectCache)); | 51 return adoptRef(new AXTableCell(layoutObject, axObjectCache)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool AXTableCell::isTableHeaderCell() const | 54 bool AXTableCell::isTableHeaderCell() const |
| 55 { | 55 { |
| 56 return node() && node()->hasTagName(thTag); | 56 return node() && node()->hasTagName(thTag); |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool AXTableCell::isRowHeaderCell() const | 59 bool AXTableCell::isRowHeaderCell() const |
| (...skipping 21 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 return false; | 82 return false; |
| 83 } | 83 } |
| 84 | 84 |
| 85 AXObject* AXTableCell::parentTable() const | 85 AXObject* AXTableCell::parentTable() const |
| 86 { | 86 { |
| 87 if (!m_layoutObject || !m_layoutObject->isTableCell()) | 87 if (!m_layoutObject || !m_layoutObject->isTableCell()) |
| 88 return 0; | 88 return 0; |
| 89 | 89 |
| 90 // If the document no longer exists, we might not have an axObjectCache. | 90 // If the document no longer exists, we might not have an axObjectCache. |
| 91 if (!axObjectCache()) | 91 if (isDetached()) |
| 92 return 0; | 92 return 0; |
| 93 | 93 |
| 94 // Do not use getOrCreate. parentTable() can be called while the layout tree
is being modified | 94 // Do not use getOrCreate. parentTable() can be called while the layout tree
is being modified |
| 95 // by javascript, and creating a table element may try to access the layout
tree while in a bad state. | 95 // by javascript, and creating a table element may try to access the layout
tree while in a bad state. |
| 96 // By using only get() implies that the AXTable must be created before AXTab
leCells. This should | 96 // By using only get() implies that the AXTable must be created before AXTab
leCells. This should |
| 97 // always be the case when AT clients access a table. | 97 // always be the case when AT clients access a table. |
| 98 // https://bugs.webkit.org/show_bug.cgi?id=42652 | 98 // https://bugs.webkit.org/show_bug.cgi?id=42652 |
| 99 return axObjectCache()->get(toLayoutTableCell(m_layoutObject)->table()); | 99 return axObjectCache().get(toLayoutTableCell(m_layoutObject)->table()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool AXTableCell::isTableCell() const | 102 bool AXTableCell::isTableCell() const |
| 103 { | 103 { |
| 104 AXObject* parent = parentObjectUnignored(); | 104 AXObject* parent = parentObjectUnignored(); |
| 105 if (!parent || !parent->isTableRow()) | 105 if (!parent || !parent->isTableRow()) |
| 106 return false; | 106 return false; |
| 107 | 107 |
| 108 return true; | 108 return true; |
| 109 } | 109 } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 return 0; | 245 return 0; |
| 246 | 246 |
| 247 LayoutTableCell* headerCell = section->primaryCellAt(row, 0); | 247 LayoutTableCell* headerCell = section->primaryCellAt(row, 0); |
| 248 if (!headerCell || headerCell == layoutCell) | 248 if (!headerCell || headerCell == layoutCell) |
| 249 return 0; | 249 return 0; |
| 250 | 250 |
| 251 Node* cellElement = headerCell->node(); | 251 Node* cellElement = headerCell->node(); |
| 252 if (!cellElement || !cellElement->hasTagName(thTag)) | 252 if (!cellElement || !cellElement->hasTagName(thTag)) |
| 253 return 0; | 253 return 0; |
| 254 | 254 |
| 255 return axObjectCache()->getOrCreate(headerCell); | 255 return axObjectCache().getOrCreate(headerCell); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace blink | 258 } // namespace blink |
| OLD | NEW |