| 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 30 matching lines...) Expand all Loading... |
| 41 #include "core/layout/LayoutTableCell.h" | 41 #include "core/layout/LayoutTableCell.h" |
| 42 #include "modules/accessibility/AXObjectCacheImpl.h" | 42 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 43 #include "modules/accessibility/AXTableCell.h" | 43 #include "modules/accessibility/AXTableCell.h" |
| 44 #include "modules/accessibility/AXTableColumn.h" | 44 #include "modules/accessibility/AXTableColumn.h" |
| 45 #include "modules/accessibility/AXTableRow.h" | 45 #include "modules/accessibility/AXTableRow.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 using namespace HTMLNames; | 49 using namespace HTMLNames; |
| 50 | 50 |
| 51 AXTable::AXTable(RenderObject* renderer, AXObjectCacheImpl* axObjectCache) | 51 AXTable::AXTable(LayoutObject* renderer, AXObjectCacheImpl* axObjectCache) |
| 52 : AXRenderObject(renderer, axObjectCache) | 52 : AXRenderObject(renderer, axObjectCache) |
| 53 , m_headerContainer(nullptr) | 53 , m_headerContainer(nullptr) |
| 54 , m_isAXTable(true) | 54 , m_isAXTable(true) |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 AXTable::~AXTable() | 58 AXTable::~AXTable() |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 void AXTable::init() | 62 void AXTable::init() |
| 63 { | 63 { |
| 64 AXRenderObject::init(); | 64 AXRenderObject::init(); |
| 65 m_isAXTable = isTableExposableThroughAccessibility(); | 65 m_isAXTable = isTableExposableThroughAccessibility(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 PassRefPtr<AXTable> AXTable::create(RenderObject* renderer, AXObjectCacheImpl* a
xObjectCache) | 68 PassRefPtr<AXTable> AXTable::create(LayoutObject* renderer, AXObjectCacheImpl* a
xObjectCache) |
| 69 { | 69 { |
| 70 return adoptRef(new AXTable(renderer, axObjectCache)); | 70 return adoptRef(new AXTable(renderer, axObjectCache)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool AXTable::hasARIARole() const | 73 bool AXTable::hasARIARole() const |
| 74 { | 74 { |
| 75 if (!m_renderer) | 75 if (!m_renderer) |
| 76 return false; | 76 return false; |
| 77 | 77 |
| 78 AccessibilityRole ariaRole = ariaRoleAttribute(); | 78 AccessibilityRole ariaRole = ariaRoleAttribute(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (table->hBorderSpacing() > 0 && table->vBorderSpacing() > 0 | 267 if (table->hBorderSpacing() > 0 && table->vBorderSpacing() > 0 |
| 268 && tableBGColor != cellColor && cellColor.alpha() != 1) | 268 && tableBGColor != cellColor && cellColor.alpha() != 1) |
| 269 backgroundDifferenceCellCount++; | 269 backgroundDifferenceCellCount++; |
| 270 | 270 |
| 271 // If we've found 10 "good" cells, we don't need to keep searching. | 271 // If we've found 10 "good" cells, we don't need to keep searching. |
| 272 if (borderedCellCount >= 10 || backgroundDifferenceCellCount >= 10) | 272 if (borderedCellCount >= 10 || backgroundDifferenceCellCount >= 10) |
| 273 return true; | 273 return true; |
| 274 | 274 |
| 275 // For the first 5 rows, cache the background color so we can check
if this table has zebra-striped rows. | 275 // For the first 5 rows, cache the background color so we can check
if this table has zebra-striped rows. |
| 276 if (row < 5 && row == alternatingRowColorCount) { | 276 if (row < 5 && row == alternatingRowColorCount) { |
| 277 RenderObject* layoutRow = cell->parent(); | 277 LayoutObject* layoutRow = cell->parent(); |
| 278 if (!layoutRow || !layoutRow->isBoxModelObject() || !toRenderBox
ModelObject(layoutRow)->isTableRow()) | 278 if (!layoutRow || !layoutRow->isBoxModelObject() || !toRenderBox
ModelObject(layoutRow)->isTableRow()) |
| 279 continue; | 279 continue; |
| 280 RenderStyle* rowRenderStyle = layoutRow->style(); | 280 RenderStyle* rowRenderStyle = layoutRow->style(); |
| 281 if (!rowRenderStyle) | 281 if (!rowRenderStyle) |
| 282 continue; | 282 continue; |
| 283 Color rowColor = rowRenderStyle->visitedDependentColor(CSSProper
tyBackgroundColor); | 283 Color rowColor = rowRenderStyle->visitedDependentColor(CSSProper
tyBackgroundColor); |
| 284 alternatingRowColors[alternatingRowColorCount] = rowColor; | 284 alternatingRowColors[alternatingRowColorCount] = rowColor; |
| 285 alternatingRowColorCount++; | 285 alternatingRowColorCount++; |
| 286 } | 286 } |
| 287 } | 287 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 587 } |
| 588 | 588 |
| 589 // try the standard | 589 // try the standard |
| 590 if (title.isEmpty()) | 590 if (title.isEmpty()) |
| 591 title = AXRenderObject::title(); | 591 title = AXRenderObject::title(); |
| 592 | 592 |
| 593 return title; | 593 return title; |
| 594 } | 594 } |
| 595 | 595 |
| 596 } // namespace blink | 596 } // namespace blink |
| OLD | NEW |