Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / accessibility / AXScrollView.cpp
index 392ac4b..9c4c416 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "core/accessibility/AXScrollView.h"
 
-#include "core/accessibility/AXObjectCache.h"
+#include "core/accessibility/AXObjectCacheImpl.h"
 #include "core/accessibility/AXScrollbar.h"
 #include "core/frame/FrameView.h"
 #include "core/frame/LocalFrame.h"
@@ -34,7 +34,7 @@
 
 namespace blink {
 
-AXScrollView::AXScrollView(ScrollView* view)
+AXScrollView::AXScrollView(FrameView* view)
     : m_scrollView(view)
     , m_childrenDirty(false)
 {
@@ -51,7 +51,7 @@ void AXScrollView::detach()
     m_scrollView = 0;
 }
 
-PassRefPtr<AXScrollView> AXScrollView::create(ScrollView* view)
+PassRefPtr<AXScrollView> AXScrollView::create(FrameView* view)
 {
     return adoptRef(new AXScrollView(view));
 }
@@ -71,8 +71,8 @@ AXObject* AXScrollView::scrollBar(AccessibilityOrientation orientation)
 }
 
 // If this is WebKit1 then the native scroll view needs to return the
-// AX information (because there are no scroll bar children in the ScrollView object in WK1).
-// In WebKit2, the ScrollView object will return the AX information (because there are no platform widgets).
+// AX information (because there are no scroll bar children in the FrameView object in WK1).
+// In WebKit2, the FrameView object will return the AX information (because there are no platform widgets).
 bool AXScrollView::isAttachment() const
 {
     return false;
@@ -143,11 +143,21 @@ void AXScrollView::clearChildren()
 
 bool AXScrollView::computeAccessibilityIsIgnored() const
 {
+    // We just want to match whatever's returned by our web area, which is a child of this
+    // object. Normally cached attribute values may only search up the tree. We can't just
+    // call accessibilityIsIgnored on the web area, because the web area may search up its
+    // ancestors and call this function recursively, and we'd loop until a stack overflow.
+
+    // Instead, we first update the cached accessibilityIsIgnored value for this node to
+    // false, call accessibilityIsIgnored on the web area, then return the mathcing value.
+    m_cachedIsIgnored = false;
+    m_lastModificationCount = axObjectCache()->modificationCount();
+
     AXObject* webArea = webAreaObject();
-    if (!webArea)
-        return true;
+    if (webArea)
+        return webArea->accessibilityIsIgnored();
 
-    return webArea->accessibilityIsIgnored();
+    return true;
 }
 
 void AXScrollView::addChildren()
@@ -167,7 +177,7 @@ AXObject* AXScrollView::webAreaObject() const
     if (!m_scrollView || !m_scrollView->isFrameView())
         return 0;
 
-    Document* doc = toFrameView(m_scrollView)->frame().document();
+    Document* doc = m_scrollView->frame().document();
     if (!doc || !doc->renderView())
         return 0;
 
@@ -201,32 +211,32 @@ FrameView* AXScrollView::documentFrameView() const
     if (!m_scrollView || !m_scrollView->isFrameView())
         return 0;
 
-    return toFrameView(m_scrollView);
+    return m_scrollView;
 }
 
-AXObject* AXScrollView::parentObject() const
+AXObject* AXScrollView::computeParent() const
 {
     if (!m_scrollView || !m_scrollView->isFrameView())
         return 0;
 
     // FIXME: Broken for OOPI.
-    HTMLFrameOwnerElement* owner = toFrameView(m_scrollView)->frame().deprecatedLocalOwner();
+    HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner();
     if (owner && owner->renderer())
         return axObjectCache()->getOrCreate(owner);
 
-    return axObjectCache()->getOrCreate(toFrameView(m_scrollView)->frame().pagePopupOwner());
+    return axObjectCache()->getOrCreate(m_scrollView->frame().pagePopupOwner());
 }
 
-AXObject* AXScrollView::parentObjectIfExists() const
+AXObject* AXScrollView::computeParentIfExists() const
 {
     if (!m_scrollView || !m_scrollView->isFrameView())
         return 0;
 
-    HTMLFrameOwnerElement* owner = toFrameView(m_scrollView)->frame().deprecatedLocalOwner();
+    HTMLFrameOwnerElement* owner = m_scrollView->frame().deprecatedLocalOwner();
     if (owner && owner->renderer())
         return axObjectCache()->get(owner);
 
-    return axObjectCache()->get(toFrameView(m_scrollView)->frame().pagePopupOwner());
+    return axObjectCache()->get(m_scrollView->frame().pagePopupOwner());
 }
 
 ScrollableArea* AXScrollView::getScrollableAreaIfScrollable() const