[AX] Clean up static_cast<> to cast from AccessibilityObject
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Nov 2013 16:59:55 +0000 (16:59 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Nov 2013 16:59:55 +0000 (16:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124032

Reviewed by Mario Sanchez Prada.

Source/WebCore:

ACCESSIBILITY_OBJECT_TYPE_CASTS can support more helpful casting functions.
So, we need to use them as much as possible. This patch cleans up all static_cast<> in accessibility.

This patch generates toAccessibilityFoo() in order to replace static_cast<> with it. Below toAccessibilityFoo()
are generated.

- toAccessibilityARIAGridRow()
- toAccessibilityImageMapLink()
- toAccessibilityListBox()
- toAccessibilityListBoxOption()
- toAccessibilityMenuListOption()
- toAccessibilityMenuListPopup()
- toAccessibilityScrollbar()
- toAccessibilitySlider()

No new tests, no behavior changes.

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::focusedImageMapUIElement):
* accessibility/AccessibilityARIAGridRow.h:
* accessibility/AccessibilityImageMapLink.h:
* accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::setSelectedChildren):
(WebCore::AccessibilityListBox::selectedChildren):
(WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject):
* accessibility/AccessibilityListBox.h:
* accessibility/AccessibilityListBoxOption.h:
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::addChildren):
(WebCore::AccessibilityMenuList::didUpdateActiveOption):
* accessibility/AccessibilityMenuListOption.h:
* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject):
* accessibility/AccessibilityMenuListPopup.h:
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isListBoxOption):
(WebCore::AccessibilityObject::isSliderThumb):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::getDocumentLinks):
(WebCore::AccessibilityRenderObject::addImageMapChildren):
(WebCore::AccessibilityRenderObject::addTextFieldChildren):
* accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::addChildScrollbar):
* accessibility/AccessibilityScrollbar.h:
* accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::addChildren):
* accessibility/AccessibilitySlider.h:
* accessibility/AccessibilitySpinButton.cpp:
(WebCore::AccessibilitySpinButton::addChildren):
* accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
(webkitAccessibleSelectionClearSelection):
(webkitAccessibleSelectionSelectAllSelection):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::didUpdateActiveOption):

Source/WebKit/win:

Use toAccessibilityListBox instead of using static_cast<AccessibilityListBox*>.

* AccessibleBase.cpp:
(AccessibleBase::accSelect):

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

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AccessibilityARIAGridRow.h
Source/WebCore/accessibility/AccessibilityImageMapLink.h
Source/WebCore/accessibility/AccessibilityListBox.cpp
Source/WebCore/accessibility/AccessibilityListBox.h
Source/WebCore/accessibility/AccessibilityListBoxOption.h
Source/WebCore/accessibility/AccessibilityMenuList.cpp
Source/WebCore/accessibility/AccessibilityMenuListOption.h
Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
Source/WebCore/accessibility/AccessibilityMenuListPopup.h
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityScrollView.cpp
Source/WebCore/accessibility/AccessibilityScrollbar.h
Source/WebCore/accessibility/AccessibilitySlider.cpp
Source/WebCore/accessibility/AccessibilitySlider.h
Source/WebCore/accessibility/AccessibilitySpinButton.cpp
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceSelection.cpp
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebKit/win/AccessibleBase.cpp
Source/WebKit/win/ChangeLog

index da89cd6..1182c41 100644 (file)
@@ -1,3 +1,68 @@
+2013-11-10  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        [AX] Clean up static_cast<> to cast from AccessibilityObject 
+        https://bugs.webkit.org/show_bug.cgi?id=124032
+
+        Reviewed by Mario Sanchez Prada.
+
+        ACCESSIBILITY_OBJECT_TYPE_CASTS can support more helpful casting functions.
+        So, we need to use them as much as possible. This patch cleans up all static_cast<> in accessibility.
+
+        This patch generates toAccessibilityFoo() in order to replace static_cast<> with it. Below toAccessibilityFoo()
+        are generated.
+
+        - toAccessibilityARIAGridRow()
+        - toAccessibilityImageMapLink()
+        - toAccessibilityListBox()
+        - toAccessibilityListBoxOption()
+        - toAccessibilityMenuListOption()
+        - toAccessibilityMenuListPopup()
+        - toAccessibilityScrollbar()
+        - toAccessibilitySlider()
+
+        No new tests, no behavior changes.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::focusedImageMapUIElement):
+        * accessibility/AccessibilityARIAGridRow.h:
+        * accessibility/AccessibilityImageMapLink.h:
+        * accessibility/AccessibilityListBox.cpp:
+        (WebCore::AccessibilityListBox::setSelectedChildren):
+        (WebCore::AccessibilityListBox::selectedChildren):
+        (WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject):
+        * accessibility/AccessibilityListBox.h:
+        * accessibility/AccessibilityListBoxOption.h:
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::addChildren):
+        (WebCore::AccessibilityMenuList::didUpdateActiveOption):
+        * accessibility/AccessibilityMenuListOption.h:
+        * accessibility/AccessibilityMenuListPopup.cpp:
+        (WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject):
+        * accessibility/AccessibilityMenuListPopup.h:
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isListBoxOption):
+        (WebCore::AccessibilityObject::isSliderThumb):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::getDocumentLinks):
+        (WebCore::AccessibilityRenderObject::addImageMapChildren):
+        (WebCore::AccessibilityRenderObject::addTextFieldChildren):
+        * accessibility/AccessibilityScrollView.cpp:
+        (WebCore::AccessibilityScrollView::addChildScrollbar):
+        * accessibility/AccessibilityScrollbar.h:
+        * accessibility/AccessibilitySlider.cpp:
+        (WebCore::AccessibilitySlider::addChildren):
+        * accessibility/AccessibilitySlider.h:
+        * accessibility/AccessibilitySpinButton.cpp:
+        (WebCore::AccessibilitySpinButton::addChildren):
+        * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
+        (webkitAccessibleSelectionClearSelection):
+        (webkitAccessibleSelectionSelectAllSelection):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::didUpdateActiveOption):
+
 2013-11-10  Andreas Kling  <akling@apple.com>
 
         Rebaseline bindings tests after r158997.
index 51608d9..080ea1a 100644 (file)
@@ -149,7 +149,7 @@ AccessibilityObject* AXObjectCache::focusedImageMapUIElement(HTMLAreaElement* ar
         if (!child->isImageMapLink())
             continue;
         
-        if (static_cast<AccessibilityImageMapLink*>(child)->areaElement() == areaElement)
+        if (toAccessibilityImageMapLink(child)->areaElement() == areaElement)
             return child;
     }    
     
index 34c2177..3a2f890 100644 (file)
@@ -50,7 +50,9 @@ private:
     virtual bool isARIATreeGridRow() const OVERRIDE;
     virtual AccessibilityObject* parentTable() const OVERRIDE;
 }; 
-    
+
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityARIAGridRow, isARIATreeGridRow())
+
 } // namespace WebCore 
 
 #endif // AccessibilityARIAGridRow_h
index 3b1f7ea..1d7204f 100644 (file)
@@ -80,6 +80,8 @@ private:
     virtual bool isImageMapLink() const OVERRIDE { return true; }
     virtual bool supportsPath() const OVERRIDE { return true; }
 };
+
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityImageMapLink, isImageMapLink())
     
 } // namespace WebCore
 
index 7a3c971..a729453 100644 (file)
@@ -95,7 +95,7 @@ void AccessibilityListBox::setSelectedChildren(AccessibilityChildrenVector& chil
     // disable any selected options
     unsigned length = m_children.size();
     for (unsigned i = 0; i < length; i++) {
-        AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(m_children[i].get());
+        AccessibilityListBoxOption* listBoxOption = toAccessibilityListBoxOption(m_children[i].get());
         if (listBoxOption->isSelected())
             listBoxOption->setSelected(false);
     }
@@ -106,7 +106,7 @@ void AccessibilityListBox::setSelectedChildren(AccessibilityChildrenVector& chil
         if (obj->roleValue() != ListBoxOptionRole)
             continue;
                 
-        static_cast<AccessibilityListBoxOption*>(obj)->setSelected(true);
+        toAccessibilityListBoxOption(obj)->setSelected(true);
     }
 }
     
@@ -119,7 +119,7 @@ void AccessibilityListBox::selectedChildren(AccessibilityChildrenVector& result)
         
     unsigned length = m_children.size();
     for (unsigned i = 0; i < length; i++) {
-        if (static_cast<AccessibilityListBoxOption*>(m_children[i].get())->isSelected())
+        if (toAccessibilityListBoxOption(m_children[i].get())->isSelected())
             result.append(m_children[i]);
     }    
 }
@@ -145,7 +145,7 @@ AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTML
         return 0;
     
     AccessibilityObject* listBoxObject = m_renderer->document().axObjectCache()->getOrCreate(ListBoxOptionRole);
-    static_cast<AccessibilityListBoxOption*>(listBoxObject)->setHTMLElement(element);
+    toAccessibilityListBoxOption(listBoxObject)->setHTMLElement(element);
     
     return listBoxObject;
 }
index babfebb..d39683d 100644 (file)
@@ -56,6 +56,8 @@ private:
     AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement*) const;
     virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const OVERRIDE;
 };
+
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityListBox, isListBox())
     
 } // namespace WebCore
 
index 710820c..b4ed7a7 100644 (file)
@@ -62,8 +62,8 @@ public:
 
     virtual LayoutRect elementRect() const OVERRIDE;
     virtual AccessibilityObject* parentObject() const OVERRIDE;
-    bool isListBoxOption() const { return true; }
-    
+    virtual bool isListBoxOption() const OVERRIDE FINAL { return true; }
+
 private:
     HTMLElement* m_optionElement;
     
@@ -74,6 +74,8 @@ private:
     AccessibilityObject* listBoxOptionAccessibilityObject(HTMLElement*) const;
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
+
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityListBoxOption, isListBoxOption())
     
 } // namespace WebCore 
 
index bf43614..0183d38 100644 (file)
@@ -66,7 +66,7 @@ void AccessibilityMenuList::addChildren()
     if (!list)
         return;
 
-    static_cast<AccessibilityMockObject*>(list)->setParent(this);
+    toAccessibilityMockObject(list)->setParent(this);
     if (list->accessibilityIsIgnored()) {
         cache->remove(list->axObjectID());
         return;
@@ -114,7 +114,7 @@ void AccessibilityMenuList::didUpdateActiveOption(int optionIndex)
         ASSERT(childObjects[0]->isMenuListPopup());
 
         if (childObjects[0]->isMenuListPopup()) {
-            if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMenuListPopup*>(childObjects[0].get()))
+            if (AccessibilityMenuListPopup* popup = toAccessibilityMenuListPopup(childObjects[0].get()))
                 popup->didUpdateActiveOption(optionIndex);
         }
     }
index f423138..53a45a0 100644 (file)
@@ -62,6 +62,8 @@ private:
     RefPtr<HTMLElement> m_element;
 };
 
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityMenuListOption, isMenuListOption())
+
 } // namespace WebCore
 
 #endif // AccessibilityMenuListOption_h
index 8f100ca..1ef2890 100644 (file)
@@ -76,7 +76,7 @@ AccessibilityMenuListOption* AccessibilityMenuListPopup::menuListOptionAccessibi
     AccessibilityObject* object = document()->axObjectCache()->getOrCreate(MenuListOptionRole);
     ASSERT_WITH_SECURITY_IMPLICATION(object->isMenuListOption());
 
-    AccessibilityMenuListOption* option = static_cast<AccessibilityMenuListOption*>(object);
+    AccessibilityMenuListOption* option = toAccessibilityMenuListOption(object);
     option->setElement(element);
 
     return option;
index 7fe3eaa..1486909 100644 (file)
@@ -62,6 +62,8 @@ private:
     AccessibilityMenuListOption* menuListOptionAccessibilityObject(HTMLElement*) const;
 };
 
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityMenuListPopup, isMenuListPopup())
+
 } // namespace WebCore
 
 #endif // AccessibilityMenuListPopup_h
index c04249b..342772d 100644 (file)
@@ -428,6 +428,7 @@ public:
     virtual bool isCheckbox() const { return roleValue() == CheckBoxRole; }
     virtual bool isRadioButton() const { return roleValue() == RadioButtonRole; }
     virtual bool isListBox() const { return roleValue() == ListBoxRole; }
+    virtual bool isListBoxOption() const { return false; }
     virtual bool isMediaTimeline() const { return false; }
     virtual bool isMenuRelated() const { return false; }
     virtual bool isMenu() const { return false; }
@@ -438,6 +439,7 @@ public:
     virtual bool isInputImage() const { return false; }
     virtual bool isProgressIndicator() const { return false; }
     virtual bool isSlider() const { return false; }
+    virtual bool isSliderThumb() const { return false; }
     virtual bool isInputSlider() const { return false; }
     virtual bool isControl() const { return false; }
     virtual bool isList() const { return false; }
index d10c1b8..68e1283 100644 (file)
@@ -1718,7 +1718,7 @@ void AccessibilityRenderObject::getDocumentLinks(AccessibilityChildrenVector& re
         } else {
             Node* parent = curr->parentNode();
             if (parent && isHTMLAreaElement(curr) && isHTMLMapElement(parent)) {
-                AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
+                AccessibilityImageMapLink* areaObject = toAccessibilityImageMapLink(axObjectCache()->getOrCreate(ImageMapLinkRole));
                 HTMLMapElement* map = toHTMLMapElement(parent);
                 areaObject->setHTMLAreaElement(toHTMLAreaElement(curr));
                 areaObject->setHTMLMapElement(map);
@@ -2727,7 +2727,7 @@ void AccessibilityRenderObject::addImageMapChildren()
         // add an <area> element for this child if it has a link
         if (!area->isLink())
             continue;
-        AccessibilityImageMapLink* areaObject = static_cast<AccessibilityImageMapLink*>(axObjectCache()->getOrCreate(ImageMapLinkRole));
+        AccessibilityImageMapLink* areaObject = toAccessibilityImageMapLink(axObjectCache()->getOrCreate(ImageMapLinkRole));
         areaObject->setHTMLAreaElement(&*area);
         areaObject->setHTMLMapElement(map);
         areaObject->setParent(this);
@@ -2757,7 +2757,7 @@ void AccessibilityRenderObject::addTextFieldChildren()
     if (!spinButtonElement || !spinButtonElement->isSpinButtonElement())
         return;
 
-    AccessibilitySpinButton* axSpinButton = static_cast<AccessibilitySpinButton*>(axObjectCache()->getOrCreate(SpinButtonRole));
+    AccessibilitySpinButton* axSpinButton = toAccessibilitySpinButton(axObjectCache()->getOrCreate(SpinButtonRole));
     axSpinButton->setSpinButtonElement(static_cast<SpinButtonElement*>(spinButtonElement));
     axSpinButton->setParent(this);
     m_children.append(axSpinButton);
index cf039d6..92e81ca 100644 (file)
@@ -149,7 +149,7 @@ AccessibilityScrollbar* AccessibilityScrollView::addChildScrollbar(Scrollbar* sc
     if (!scrollbar)
         return 0;
     
-    AccessibilityScrollbar* scrollBarObject = static_cast<AccessibilityScrollbar*>(axObjectCache()->getOrCreate(scrollbar));
+    AccessibilityScrollbar* scrollBarObject = toAccessibilityScrollbar(axObjectCache()->getOrCreate(scrollbar));
     scrollBarObject->setParent(this);
     m_children.append(scrollBarObject);
     return scrollBarObject;
index f63b3fb..4fd933c 100644 (file)
@@ -62,6 +62,8 @@ private:
     RefPtr<Scrollbar> m_scrollbar;
 };
 
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilityScrollbar, isAccessibilityScrollbar())
+
 } // namespace WebCore
 
 #endif // AccessibilityScrollbar_h
index 0cadd8d..6450bfd 100644 (file)
@@ -84,7 +84,7 @@ void AccessibilitySlider::addChildren()
 
     AXObjectCache* cache = m_renderer->document().axObjectCache();
 
-    AccessibilitySliderThumb* thumb = static_cast<AccessibilitySliderThumb*>(cache->getOrCreate(SliderThumbRole));
+    AccessibilitySliderThumb* thumb = toAccessibilitySliderThumb(cache->getOrCreate(SliderThumbRole));
     thumb->setParent(this);
 
     // Before actually adding the value indicator to the hierarchy,
index 54c5c37..a4c7a93 100644 (file)
@@ -72,6 +72,8 @@ public:
     static PassRefPtr<AccessibilitySliderThumb> create();
     virtual ~AccessibilitySliderThumb() { }
 
+    virtual bool isSliderThumb() const OVERRIDE FINAL { return true; }
+
     virtual AccessibilityRole roleValue() const OVERRIDE { return SliderThumbRole; }
 
     virtual LayoutRect elementRect() const OVERRIDE;
@@ -82,6 +84,7 @@ private:
     virtual bool computeAccessibilityIsIgnored() const OVERRIDE;
 };
 
+ACCESSIBILITY_OBJECT_TYPE_CASTS(AccessibilitySliderThumb, isSliderThumb())
 
 } // namespace WebCore
 
index 26af7b7..9550794 100644 (file)
@@ -82,12 +82,12 @@ void AccessibilitySpinButton::addChildren()
 {
     m_haveChildren = true;
     
-    AccessibilitySpinButtonPart* incrementor = static_cast<AccessibilitySpinButtonPart*>(axObjectCache()->getOrCreate(SpinButtonPartRole));
+    AccessibilitySpinButtonPart* incrementor = toAccessibilitySpinButtonPart(axObjectCache()->getOrCreate(SpinButtonPartRole));
     incrementor->setIsIncrementor(true);
     incrementor->setParent(this);
     m_children.append(incrementor);
 
-    AccessibilitySpinButtonPart* decrementor = static_cast<AccessibilitySpinButtonPart*>(axObjectCache()->getOrCreate(SpinButtonPartRole));
+    AccessibilitySpinButtonPart* decrementor = toAccessibilitySpinButtonPart(axObjectCache()->getOrCreate(SpinButtonPartRole));
     decrementor->setIsIncrementor(false);
     decrementor->setParent(this);
     m_children.append(decrementor);
index c1d3a11..2f317ec 100644 (file)
@@ -156,7 +156,7 @@ static gboolean webkitAccessibleSelectionClearSelection(AtkSelection* selection)
     AccessibilityObject::AccessibilityChildrenVector selectedItems;
     if (coreSelection->isListBox() || coreSelection->isMenuList()) {
         // Set the list of selected items to an empty list; then verify that it worked.
-        AccessibilityListBox* listBox = static_cast<AccessibilityListBox*>(coreSelection);
+        AccessibilityListBox* listBox = toAccessibilityListBox(coreSelection);
         listBox->setSelectedChildren(selectedItems);
         listBox->selectedChildren(selectedItems);
         return !selectedItems.size();
@@ -252,7 +252,7 @@ static gboolean webkitAccessibleSelectionSelectAllSelection(AtkSelection* select
 
     AccessibilityObject::AccessibilityChildrenVector children = coreSelection->children();
     if (coreSelection->isListBox()) {
-        AccessibilityListBox* listBox = static_cast<AccessibilityListBox*>(coreSelection);
+        AccessibilityListBox* listBox = toAccessibilityListBox(coreSelection);
         listBox->setSelectedChildren(children);
         AccessibilityObject::AccessibilityChildrenVector selectedItems;
         listBox->selectedChildren(selectedItems);
index 6716e3e..450734f 100644 (file)
@@ -2479,7 +2479,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             return convertToNSArray(rowsCopy);
         } else if (m_object->isARIATreeGridRow()) {
             AccessibilityObject::AccessibilityChildrenVector rowsCopy;
-            static_cast<AccessibilityARIAGridRow*>(m_object)->disclosedRows(rowsCopy);
+            toAccessibilityARIAGridRow(m_object)->disclosedRows(rowsCopy);
             return convertToNSArray(rowsCopy);
         }
     }
@@ -2498,7 +2498,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             }
             return nil;
         } else if (m_object->isARIATreeGridRow()) {
-            AccessibilityObject* row = static_cast<AccessibilityARIAGridRow*>(m_object)->disclosedByRow();
+            AccessibilityObject* row = toAccessibilityARIAGridRow(m_object)->disclosedByRow();
             if (!row)
                 return nil;
             return row->wrapper();
@@ -3069,7 +3069,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             return;
         AccessibilityObject::AccessibilityChildrenVector selectedChildren;
         convertToVector(array, selectedChildren);
-        static_cast<AccessibilityListBox*>(m_object)->setSelectedChildren(selectedChildren);
+        toAccessibilityListBox(m_object)->setSelectedChildren(selectedChildren);
     } else if (m_object->isTextControl()) {
         if ([attributeName isEqualToString: NSAccessibilitySelectedTextAttribute]) {
             m_object->setSelectedText(string);
index 0ae1cdf..52ef08f 100644 (file)
@@ -375,7 +375,7 @@ void RenderMenuList::didUpdateActiveOption(int optionIndex)
     HTMLElement* listItem = selectElement().listItems()[listIndex];
     ASSERT(listItem);
     if (listItem->attached()) {
-        if (AccessibilityMenuList* menuList = static_cast<AccessibilityMenuList*>(document().axObjectCache()->get(this)))
+        if (AccessibilityMenuList* menuList = toAccessibilityMenuList(document().axObjectCache()->get(this)))
             menuList->didUpdateActiveOption(optionIndex);
     }
 }
index 2201c9b..890f7d7 100644 (file)
@@ -619,7 +619,7 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::accSelect(long selectionFlags, VARIANT
         if (parentObject->isListBox()) {
             Vector<RefPtr<AccessibilityObject> > selectedChildren(1);
             selectedChildren[0] = childObject;
-            static_cast<AccessibilityListBox*>(parentObject)->setSelectedChildren(selectedChildren);
+            toAccessibilityListBox(parentObject)->setSelectedChildren(selectedChildren);
         } else { // any element may be selectable by virtue of it having the aria-selected property
             ASSERT(!parentObject->isMultiSelectable());
             childObject->setSelected(true);
index 6296d22..41ed3a9 100644 (file)
@@ -1,3 +1,15 @@
+2013-11-10  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        [AX] Clean up static_cast<> to cast from AccessibilityObject 
+        https://bugs.webkit.org/show_bug.cgi?id=124032
+
+        Reviewed by Mario Sanchez Prada.
+
+        Use toAccessibilityListBox instead of using static_cast<AccessibilityListBox*>.
+
+        * AccessibleBase.cpp:
+        (AccessibleBase::accSelect):
+
 2013-11-05  Ryosuke Niwa  <rniwa@webkit.org>
 
         Windows build fix attempt after r158704.