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

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: Add remaining asserts to test 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 return false; 680 return false;
681 681
682 // Don't ignore generic focusable elements like <div tabindex=0> 682 // Don't ignore generic focusable elements like <div tabindex=0>
683 // unless they're completely empty, with no children. 683 // unless they're completely empty, with no children.
684 if (isGenericFocusableElement() && node->hasChildren()) 684 if (isGenericFocusableElement() && node->hasChildren())
685 return false; 685 return false;
686 686
687 if (!ariaAccessibilityDescription().isEmpty()) 687 if (!ariaAccessibilityDescription().isEmpty())
688 return false; 688 return false;
689 689
690 if (isScrollableContainer())
691 return false;
692
690 // By default, objects should be ignored so that the AX hierarchy is not 693 // By default, objects should be ignored so that the AX hierarchy is not
691 // filled with unnecessary items. 694 // filled with unnecessary items.
692 return true; 695 return true;
693 } 696 }
694 697
695 // 698 //
696 // Properties of static elements. 699 // Properties of static elements.
697 // 700 //
698 701
699 const AtomicString& AXLayoutObject::accessKey() const 702 const AtomicString& AXLayoutObject::accessKey() const
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 if (!m_layoutObject || !m_layoutObject->isBoxModelObject()) 1644 if (!m_layoutObject || !m_layoutObject->isBoxModelObject())
1642 return; 1645 return;
1643 1646
1644 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject); 1647 LayoutBoxModelObject* layoutObject = toLayoutBoxModelObject(m_layoutObject);
1645 if (layoutObject->isTextField() && isHTMLInputElement(*node())) 1648 if (layoutObject->isTextField() && isHTMLInputElement(*node()))
1646 toHTMLInputElement(*node()).setValue(string); 1649 toHTMLInputElement(*node()).setValue(string);
1647 else if (layoutObject->isTextArea() && isHTMLTextAreaElement(*node())) 1650 else if (layoutObject->isTextArea() && isHTMLTextAreaElement(*node()))
1648 toHTMLTextAreaElement(*node()).setValue(string); 1651 toHTMLTextAreaElement(*node()).setValue(string);
1649 } 1652 }
1650 1653
1651 // FIXME: This function should use an IntSize to avoid the conversion below.
1652 void AXLayoutObject::scrollTo(const IntPoint& point) const
1653 {
1654 if (!m_layoutObject || !m_layoutObject->isBox())
1655 return;
1656
1657 LayoutBox* box = toLayoutBox(m_layoutObject);
1658 if (!box->canBeScrolledAndHasScrollableArea())
1659 return;
1660
1661 box->scrollToOffset(IntSize(point.x(), point.y()));
1662 }
1663
1664 // 1654 //
1665 // Notifications that this object may have changed. 1655 // Notifications that this object may have changed.
1666 // 1656 //
1667 1657
1668 void AXLayoutObject::handleActiveDescendantChanged() 1658 void AXLayoutObject::handleActiveDescendantChanged()
1669 { 1659 {
1670 Element* element = toElement(layoutObject()->node()); 1660 Element* element = toElement(layoutObject()->node());
1671 if (!element) 1661 if (!element)
1672 return; 1662 return;
1673 Document& doc = layoutObject()->document(); 1663 Document& doc = layoutObject()->document();
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 if (label && label->layoutObject()) { 2268 if (label && label->layoutObject()) {
2279 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect(); 2269 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR ect();
2280 result.unite(labelRect); 2270 result.unite(labelRect);
2281 } 2271 }
2282 } 2272 }
2283 2273
2284 return result; 2274 return result;
2285 } 2275 }
2286 2276
2287 } // namespace blink 2277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698