[AX] Use toAccessibilityTable() instead of using manual static_cast<>
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2013 12:10:39 +0000 (12:10 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Nov 2013 12:10:39 +0000 (12:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123982

Reviewed by Mario Sanchez Prada.

Though there is toAccessibilityTable(), static_cast<> are being used by many places.
We need to use toAccessibilityTable().

No new tests, no behavior changes.

* accessibility/AccessibilityARIAGridRow.cpp:
(WebCore::AccessibilityARIAGridRow::disclosedRows):
(WebCore::AccessibilityARIAGridRow::disclosedByRow):
* accessibility/AccessibilityTableHeaderContainer.cpp:
(WebCore::AccessibilityTableHeaderContainer::addChildren):
* accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
(cell):
(cellAtIndex):
(webkitAccessibleTableGetIndexAt):
(webkitAccessibleTableGetNColumns):
(webkitAccessibleTableGetNRows):
(webkitAccessibleTableGetColumnHeader):
(webkitAccessibleTableGetRowHeader):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper tableParent]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158843 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp
Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceTable.cpp
Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index a201582..703192d 100644 (file)
@@ -1,3 +1,35 @@
+2013-11-07  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        [AX] Use toAccessibilityTable() instead of using manual static_cast<>
+        https://bugs.webkit.org/show_bug.cgi?id=123982
+
+        Reviewed by Mario Sanchez Prada.
+
+        Though there is toAccessibilityTable(), static_cast<> are being used by many places.
+        We need to use toAccessibilityTable().
+
+        No new tests, no behavior changes.
+
+        * accessibility/AccessibilityARIAGridRow.cpp:
+        (WebCore::AccessibilityARIAGridRow::disclosedRows):
+        (WebCore::AccessibilityARIAGridRow::disclosedByRow):
+        * accessibility/AccessibilityTableHeaderContainer.cpp:
+        (WebCore::AccessibilityTableHeaderContainer::addChildren):
+        * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
+        (cell):
+        (cellAtIndex):
+        (webkitAccessibleTableGetIndexAt):
+        (webkitAccessibleTableGetNColumns):
+        (webkitAccessibleTableGetNRows):
+        (webkitAccessibleTableGetColumnHeader):
+        (webkitAccessibleTableGetRowHeader):
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper tableParent]):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+
 2013-11-07  Andreas Kling  <akling@apple.com>
 
         Use tighter InlineBox subtypes in some places.
index d08d279..d114682 100644 (file)
@@ -73,7 +73,7 @@ void AccessibilityARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclo
         return;
     
     unsigned level = hierarchicalLevel();
-    AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows();
+    AccessibilityChildrenVector& allRows = toAccessibilityTable(parent)->rows();
     int rowCount = allRows.size();
     for (int k = index + 1; k < rowCount; ++k) {
         AccessibilityObject* row = allRows[k].get();
@@ -100,7 +100,7 @@ AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const
     
     // Search for the previous row that matches the correct level.
     int index = rowIndex();
-    AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows();
+    AccessibilityChildrenVector& allRows = toAccessibilityTable(parent)->rows();
     int rowCount = allRows.size();
     if (index >= rowCount)
         return 0;
index 019f312..2375f1a 100644 (file)
@@ -73,7 +73,7 @@ void AccessibilityTableHeaderContainer::addChildren()
     if (!m_parent || !m_parent->isAccessibilityTable())
         return;
     
-    static_cast<AccessibilityTable*>(m_parent)->columnHeaders(m_children);
+    toAccessibilityTable(m_parent)->columnHeaders(m_children);
     
     unsigned length = m_children.size();
     for (unsigned k = 0; k < length; ++k)
index 7dead16..c9380c5 100644 (file)
@@ -59,7 +59,7 @@ static AccessibilityTableCell* cell(AtkTable* table, guint row, guint column)
 {
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject())
-        return static_cast<AccessibilityTable*>(accTable)->cellForColumnAndRow(column, row);
+        return toAccessibilityTable(accTable)->cellForColumnAndRow(column, row);
     return 0;
 }
 
@@ -81,7 +81,7 @@ static AccessibilityTableCell* cellAtIndex(AtkTable* table, gint index)
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject()) {
         AccessibilityObject::AccessibilityChildrenVector allCells;
-        static_cast<AccessibilityTable*>(accTable)->cells(allCells);
+        toAccessibilityTable(accTable)->cells(allCells);
         if (0 <= index && static_cast<unsigned>(index) < allCells.size()) {
             AccessibilityObject* accCell = allCells.at(index).get();
             return static_cast<AccessibilityTableCell*>(accCell);
@@ -114,7 +114,7 @@ static gint webkitAccessibleTableGetIndexAt(AtkTable* table, gint row, gint colu
     returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(table), -1);
 
     AccessibilityTableCell* axCell = cell(table, row, column);
-    AccessibilityTable* axTable = static_cast<AccessibilityTable*>(core(table));
+    AccessibilityTable* axTable = toAccessibilityTable(core(table));
     return cellIndex(axCell, axTable);
 }
 
@@ -153,7 +153,7 @@ static gint webkitAccessibleTableGetNColumns(AtkTable* table)
 
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject())
-        return static_cast<AccessibilityTable*>(accTable)->columnCount();
+        return toAccessibilityTable(accTable)->columnCount();
     return 0;
 }
 
@@ -164,7 +164,7 @@ static gint webkitAccessibleTableGetNRows(AtkTable* table)
 
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject())
-        return static_cast<AccessibilityTable*>(accTable)->rowCount();
+        return toAccessibilityTable(accTable)->rowCount();
     return 0;
 }
 
@@ -204,7 +204,7 @@ static AtkObject* webkitAccessibleTableGetColumnHeader(AtkTable* table, gint col
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject()) {
         AccessibilityObject::AccessibilityChildrenVector allColumnHeaders;
-        static_cast<AccessibilityTable*>(accTable)->columnHeaders(allColumnHeaders);
+        toAccessibilityTable(accTable)->columnHeaders(allColumnHeaders);
         unsigned columnCount = allColumnHeaders.size();
         for (unsigned k = 0; k < columnCount; ++k) {
             pair<unsigned, unsigned> columnRange;
@@ -225,7 +225,7 @@ static AtkObject* webkitAccessibleTableGetRowHeader(AtkTable* table, gint row)
     AccessibilityObject* accTable = core(table);
     if (accTable->isAccessibilityRenderObject()) {
         AccessibilityObject::AccessibilityChildrenVector allRowHeaders;
-        static_cast<AccessibilityTable*>(accTable)->rowHeaders(allRowHeaders);
+        toAccessibilityTable(accTable)->rowHeaders(allRowHeaders);
         unsigned rowCount = allRowHeaders.size();
         for (unsigned k = 0; k < rowCount; ++k) {
             pair<unsigned, unsigned> rowRange;
index 3927e39..1071449 100644 (file)
@@ -783,7 +783,7 @@ static void appendStringToResult(NSMutableString *result, NSString *string)
     if (!parentTable)
         return 0;
     
-    return static_cast<AccessibilityTable*>(parentTable);
+    return toAccessibilityTable(parentTable);
 }
 
 - (id)accessibilityTitleElement
index ec2c32b..7392df5 100644 (file)
@@ -1019,7 +1019,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, VisiblePosit
     if (m_object->supportsARIADropping())
         [additional addObject:NSAccessibilityDropEffectsAttribute];
     
-    if (m_object->isAccessibilityTable() && static_cast<AccessibilityTable*>(m_object)->supportsSelectedRows())
+    if (m_object->isAccessibilityTable() && toAccessibilityTable(m_object)->supportsSelectedRows())
         [additional addObject:NSAccessibilitySelectedRowsAttribute];
     
     if (m_object->supportsARIALiveRegion()) {
@@ -2354,12 +2354,12 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         // TODO: distinguish between visible and non-visible rows
         if ([attributeName isEqualToString:NSAccessibilityRowsAttribute] ||
             [attributeName isEqualToString:NSAccessibilityVisibleRowsAttribute]) {
-            return convertToNSArray(static_cast<AccessibilityTable*>(m_object)->rows());
+            return convertToNSArray(toAccessibilityTable(m_object)->rows());
         }
         // TODO: distinguish between visible and non-visible columns
         if ([attributeName isEqualToString:NSAccessibilityColumnsAttribute] ||
             [attributeName isEqualToString:NSAccessibilityVisibleColumnsAttribute]) {
-            return convertToNSArray(static_cast<AccessibilityTable*>(m_object)->columns());
+            return convertToNSArray(toAccessibilityTable(m_object)->columns());
         }
         
         if ([attributeName isEqualToString:NSAccessibilitySelectedRowsAttribute]) {
@@ -2375,12 +2375,12 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         
         if ([attributeName isEqualToString:(NSString *)kAXColumnHeaderUIElementsAttribute]) {
             AccessibilityObject::AccessibilityChildrenVector columnHeaders;
-            static_cast<AccessibilityTable*>(m_object)->columnHeaders(columnHeaders);
+            toAccessibilityTable(m_object)->columnHeaders(columnHeaders);
             return convertToNSArray(columnHeaders);
         }
         
         if ([attributeName isEqualToString:NSAccessibilityHeaderAttribute]) {
-            AccessibilityObject* headerContainer = static_cast<AccessibilityTable*>(m_object)->headerContainer();
+            AccessibilityObject* headerContainer = toAccessibilityTable(m_object)->headerContainer();
             if (headerContainer)
                 return headerContainer->wrapper();
             return nil;
@@ -2388,13 +2388,13 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         
         if ([attributeName isEqualToString:NSAccessibilityRowHeaderUIElementsAttribute]) {
             AccessibilityObject::AccessibilityChildrenVector rowHeaders;
-            static_cast<AccessibilityTable*>(m_object)->rowHeaders(rowHeaders);
+            toAccessibilityTable(m_object)->rowHeaders(rowHeaders);
             return convertToNSArray(rowHeaders);
         }
         
         if ([attributeName isEqualToString:NSAccessibilityVisibleCellsAttribute]) {
             AccessibilityObject::AccessibilityChildrenVector cells;
-            static_cast<AccessibilityTable*>(m_object)->cells(cells);
+            toAccessibilityTable(m_object)->cells(cells);
             return convertToNSArray(cells);
         }
     }
@@ -3493,7 +3493,7 @@ static RenderObject* rendererForView(NSView* view)
         if ([attribute isEqualToString:NSAccessibilityCellForColumnAndRowParameterizedAttribute]) {
             if (array == nil || [array count] != 2)
                 return nil;
-            AccessibilityTableCell* cell = static_cast<AccessibilityTable*>(m_object)->cellForColumnAndRow([[array objectAtIndex:0] unsignedIntValue], [[array objectAtIndex:1] unsignedIntValue]);
+            AccessibilityTableCell* cell = toAccessibilityTable(m_object)->cellForColumnAndRow([[array objectAtIndex:0] unsignedIntValue], [[array objectAtIndex:1] unsignedIntValue]);
             if (!cell)
                 return nil;