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

Side by Side Diff: Source/modules/accessibility/AXLayoutObject.cpp

Issue 1121473004: Expose scroll containers via accessibility APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move scrolling logic from ScrollView to WebArea Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // We want to notify that the combo box has changed its active descendant, 233 // We want to notify that the combo box has changed its active descendant,
234 // but we do not want to change the focus, because focus should remain with the combo box. 234 // but we do not want to change the focus, because focus should remain with the combo box.
235 if (isComboBox()) 235 if (isComboBox())
236 return true; 236 return true;
237 237
238 return shouldFocusActiveDescendant(); 238 return shouldFocusActiveDescendant();
239 } 239 }
240 240
241 ScrollableArea* AXLayoutObject::getScrollableAreaIfScrollable() const 241 ScrollableArea* AXLayoutObject::getScrollableAreaIfScrollable() const
242 { 242 {
243 // If the parent is a FrameView, then this object isn't really scrollable; t he parent should handle the scrolling. 243 // FIXME(dmazzoni): the plan is to get rid of AXScrollView, but until
244 // this is done, a WebArea delegates its scrolling to its parent scroll view .
245 // http://crbug.com/484878
244 if (parentObject() && parentObject()->isAXScrollView()) 246 if (parentObject() && parentObject()->isAXScrollView())
245 return 0; 247 return parentObject()->getScrollableAreaIfScrollable();
246 248
247 if (!m_layoutObject || !m_layoutObject->isBox()) 249 if (!m_layoutObject || !m_layoutObject->isBox())
248 return 0; 250 return 0;
249 251
250 LayoutBox* box = toLayoutBox(m_layoutObject); 252 LayoutBox* box = toLayoutBox(m_layoutObject);
251 if (!box->canBeScrolledAndHasScrollableArea()) 253 if (!box->canBeScrolledAndHasScrollableArea())
252 return 0; 254 return 0;
253 255
254 return box->scrollableArea(); 256 return box->scrollableArea();
255 } 257 }
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 return false; 739 return false;
738 740
739 // Don't ignore generic focusable elements like <div tabindex=0> 741 // Don't ignore generic focusable elements like <div tabindex=0>
740 // unless they're completely empty, with no children. 742 // unless they're completely empty, with no children.
741 if (isGenericFocusableElement() && node->hasChildren()) 743 if (isGenericFocusableElement() && node->hasChildren())
742 return false; 744 return false;
743 745
744 if (!ariaAccessibilityDescription().isEmpty()) 746 if (!ariaAccessibilityDescription().isEmpty())
745 return false; 747 return false;
746 748
749 if (isScrollableContainer())
750 return false;
751
747 // By default, objects should be ignored so that the AX hierarchy is not 752 // By default, objects should be ignored so that the AX hierarchy is not
748 // filled with unnecessary items. 753 // filled with unnecessary items.
749 if (ignoredReasons) 754 if (ignoredReasons)
750 ignoredReasons->append(IgnoredReason(AXUninteresting)); 755 ignoredReasons->append(IgnoredReason(AXUninteresting));
751 return true; 756 return true;
752 } 757 }
753 758
754 // 759 //
755 // Properties of static elements. 760 // Properties of static elements.
756 // 761 //
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) 1705 if (!m_layoutObject || !m_layoutObject->isBoxModelObject())
1701 return; 1706 return;
1702 1707
1703 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject); 1708 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject);
1704 if (layoutObject->isTextField() && isHTMLInputElement(*node())) 1709 if (layoutObject->isTextField() && isHTMLInputElement(*node()))
1705 toHTMLInputElement(*node()).setValue(string); 1710 toHTMLInputElement(*node()).setValue(string);
1706 else if (layoutObject->isTextArea() && isHTMLTextAreaElement(*node())) 1711 else if (layoutObject->isTextArea() && isHTMLTextAreaElement(*node()))
1707 toHTMLTextAreaElement(*node()).setValue(string); 1712 toHTMLTextAreaElement(*node()).setValue(string);
1708 } 1713 }
1709 1714
1710 // FIXME: This function should use an IntSize to avoid the conversion below.
1711 void AXLayoutObject::scrollTo(const IntPoint& point) const
1712 {
1713 if (!m_layoutObject || !m_layoutObject->isBox())
1714 return;
1715
1716 LayoutBox* box = toLayoutBox(m_layoutObject);
1717 if (!box->canBeScrolledAndHasScrollableArea())
1718 return;
1719
1720 box->scrollToOffset(IntSize(point.x(), point.y()));
1721 }
1722
1723 // 1715 //
1724 // Notifications that this object may have changed. 1716 // Notifications that this object may have changed.
1725 // 1717 //
1726 1718
1727 void AXLayoutObject::handleActiveDescendantChanged() 1719 void AXLayoutObject::handleActiveDescendantChanged()
1728 { 1720 {
1729 Element* element = toElement(layoutObject()->node()); 1721 Element* element = toElement(layoutObject()->node());
1730 if (!element) 1722 if (!element)
1731 return; 1723 return;
1732 Document& doc = layoutObject()->document(); 1724 Document& doc = layoutObject()->document();
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 if (label && label->layoutObject()) { 2329 if (label && label->layoutObject()) {
2338 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2330 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2339 result.unite(labelRect); 2331 result.unite(labelRect);
2340 } 2332 }
2341 } 2333 }
2342 2334
2343 return result; 2335 return result;
2344 } 2336 }
2345 2337
2346 } // namespace blink 2338 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698