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

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: Rebase 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
« no previous file with comments | « Source/modules/accessibility/AXLayoutObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // We want to notify that the combo box has changed its active descendant, 237 // We want to notify that the combo box has changed its active descendant,
238 // but we do not want to change the focus, because focus should remain with the combo box. 238 // but we do not want to change the focus, because focus should remain with the combo box.
239 if (isComboBox()) 239 if (isComboBox())
240 return true; 240 return true;
241 241
242 return shouldFocusActiveDescendant(); 242 return shouldFocusActiveDescendant();
243 } 243 }
244 244
245 ScrollableArea* AXLayoutObject::getScrollableAreaIfScrollable() const 245 ScrollableArea* AXLayoutObject::getScrollableAreaIfScrollable() const
246 { 246 {
247 // If the parent is a FrameView, then this object isn't really scrollable; t he parent should handle the scrolling. 247 // FIXME(dmazzoni): the plan is to get rid of AXScrollView, but until
248 // this is done, a WebArea delegates its scrolling to its parent scroll view .
249 // http://crbug.com/484878
248 if (parentObject() && parentObject()->isAXScrollView()) 250 if (parentObject() && parentObject()->isAXScrollView())
249 return 0; 251 return parentObject()->getScrollableAreaIfScrollable();
250 252
251 if (!m_layoutObject || !m_layoutObject->isBox()) 253 if (!m_layoutObject || !m_layoutObject->isBox())
252 return 0; 254 return 0;
253 255
254 LayoutBox* box = toLayoutBox(m_layoutObject); 256 LayoutBox* box = toLayoutBox(m_layoutObject);
255 if (!box->canBeScrolledAndHasScrollableArea()) 257 if (!box->canBeScrolledAndHasScrollableArea())
256 return 0; 258 return 0;
257 259
258 return box->scrollableArea(); 260 return box->scrollableArea();
259 } 261 }
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 return false; 743 return false;
742 744
743 // Don't ignore generic focusable elements like <div tabindex=0> 745 // Don't ignore generic focusable elements like <div tabindex=0>
744 // unless they're completely empty, with no children. 746 // unless they're completely empty, with no children.
745 if (isGenericFocusableElement() && node->hasChildren()) 747 if (isGenericFocusableElement() && node->hasChildren())
746 return false; 748 return false;
747 749
748 if (!ariaAccessibilityDescription().isEmpty()) 750 if (!ariaAccessibilityDescription().isEmpty())
749 return false; 751 return false;
750 752
753 if (isScrollableContainer())
754 return false;
755
751 // By default, objects should be ignored so that the AX hierarchy is not 756 // By default, objects should be ignored so that the AX hierarchy is not
752 // filled with unnecessary items. 757 // filled with unnecessary items.
753 if (ignoredReasons) 758 if (ignoredReasons)
754 ignoredReasons->append(IgnoredReason(AXUninteresting)); 759 ignoredReasons->append(IgnoredReason(AXUninteresting));
755 return true; 760 return true;
756 } 761 }
757 762
758 // 763 //
759 // Properties of static elements. 764 // Properties of static elements.
760 // 765 //
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) 1861 if (!m_layoutObject || !m_layoutObject->isBoxModelObject())
1857 return; 1862 return;
1858 1863
1859 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject); 1864 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject);
1860 if (layoutObject->isTextField() && isHTMLInputElement(*node())) 1865 if (layoutObject->isTextField() && isHTMLInputElement(*node()))
1861 toHTMLInputElement(*node()).setValue(string); 1866 toHTMLInputElement(*node()).setValue(string);
1862 else if (layoutObject->isTextArea() && isHTMLTextAreaElement(*node())) 1867 else if (layoutObject->isTextArea() && isHTMLTextAreaElement(*node()))
1863 toHTMLTextAreaElement(*node()).setValue(string); 1868 toHTMLTextAreaElement(*node()).setValue(string);
1864 } 1869 }
1865 1870
1866 // FIXME: This function should use an IntSize to avoid the conversion below.
1867 void AXLayoutObject::scrollTo(const IntPoint& point) const
1868 {
1869 if (!m_layoutObject || !m_layoutObject->isBox())
1870 return;
1871
1872 LayoutBox* box = toLayoutBox(m_layoutObject);
1873 if (!box->canBeScrolledAndHasScrollableArea())
1874 return;
1875
1876 box->scrollToOffset(IntSize(point.x(), point.y()));
1877 }
1878
1879 // 1871 //
1880 // Notifications that this object may have changed. 1872 // Notifications that this object may have changed.
1881 // 1873 //
1882 1874
1883 void AXLayoutObject::handleActiveDescendantChanged() 1875 void AXLayoutObject::handleActiveDescendantChanged()
1884 { 1876 {
1885 Element* element = toElement(layoutObject()->node()); 1877 Element* element = toElement(layoutObject()->node());
1886 if (!element) 1878 if (!element)
1887 return; 1879 return;
1888 Document& doc = layoutObject()->document(); 1880 Document& doc = layoutObject()->document();
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 if (label && label->layoutObject()) { 2485 if (label && label->layoutObject()) {
2494 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2486 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2495 result.unite(labelRect); 2487 result.unite(labelRect);
2496 } 2488 }
2497 } 2489 }
2498 2490
2499 return result; 2491 return result;
2500 } 2492 }
2501 2493
2502 } // namespace blink 2494 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXLayoutObject.h ('k') | Source/modules/accessibility/AXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698