Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1455)

Unified Diff: Source/modules/accessibility/AXObject.cpp

Issue 1121473004: Expose scroll containers via accessibility APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add remaining asserts to test Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/accessibility/AXObject.h ('k') | Source/modules/accessibility/AXScrollView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXObject.cpp
diff --git a/Source/modules/accessibility/AXObject.cpp b/Source/modules/accessibility/AXObject.cpp
index 6c614bc316af40c592fb7ac80277f6d05df46665..11b3285c06ee5235122eecfe6d0eae4623becff4 100644
--- a/Source/modules/accessibility/AXObject.cpp
+++ b/Source/modules/accessibility/AXObject.cpp
@@ -1008,6 +1008,59 @@ const AtomicString& AXObject::getAttribute(const QualifiedName& attribute) const
return element->fastGetAttribute(attribute);
}
+//
+// Scrollable containers.
+//
+
+//
+// Scrollable containers.
aboxhall 2015/05/01 23:05:42 Double comment?
+//
+
+bool AXObject::isScrollableContainer() const
+{
+ return !!getScrollableAreaIfScrollable();
aboxhall 2015/05/01 23:05:42 Ugh, I don't like !! but it seems to be the de fac
+}
+
+IntPoint AXObject::scrollOffset() const
+{
+ ScrollableArea* area = getScrollableAreaIfScrollable();
+ if (!area)
+ return IntPoint();
+
+ return IntPoint(area->scrollPosition().x(), area->scrollPosition().y());
+}
+
+IntPoint AXObject::minimumScrollOffset() const
+{
+ ScrollableArea* area = getScrollableAreaIfScrollable();
+ if (!area)
+ return IntPoint();
+
+ return IntPoint(area->minimumScrollPosition().x(), area->minimumScrollPosition().y());
+}
+
+IntPoint AXObject::maximumScrollOffset() const
+{
+ ScrollableArea* area = getScrollableAreaIfScrollable();
+ if (!area)
+ return IntPoint();
+
+ return IntPoint(area->maximumScrollPosition().x(), area->maximumScrollPosition().y());
+}
+
+void AXObject::setScrollOffset(const IntPoint& offset) const
+{
+ ScrollableArea* area = getScrollableAreaIfScrollable();
+ if (!area)
+ return;
+
+ area->setScrollPosition(DoublePoint(offset.x(), offset.y()));
+}
+
+//
+// Modify or take an action on an object.
+//
+
bool AXObject::press() const
{
Element* actionElem = actionElement();
@@ -1145,7 +1198,7 @@ void AXObject::scrollToMakeVisibleWithSubFocus(const IntRect& subfocus) const
objectRect.y(), objectRect.maxY(),
0, scrollVisibleRect.height());
- scrollParent->scrollTo(IntPoint(desiredX, desiredY));
+ scrollParent->setScrollOffset(IntPoint(desiredX, desiredY));
// Convert the subfocus into the coordinates of the scroll parent.
IntRect newSubfocus = subfocus;
@@ -1201,7 +1254,7 @@ void AXObject::scrollToGlobalPoint(const IntPoint& globalPoint) const
objectRect.y(), objectRect.maxY(),
objectRect.y(), objectRect.maxY(),
point.y(), point.y());
- outer->scrollTo(IntPoint(desiredX, desiredY));
+ outer->setScrollOffset(IntPoint(desiredX, desiredY));
if (outer->isAXScrollView() && !inner->isAXScrollView()) {
// If outer object we just scrolled is a scroll view (main window or iframe) but the
« no previous file with comments | « Source/modules/accessibility/AXObject.h ('k') | Source/modules/accessibility/AXScrollView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698