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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXObject.cpp

Issue 1348503003: One AXObjectCache per frame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix issues in AutomationApiTest.Events Created 5 years, 2 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, 2009, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 if (obj->style()->hasAppearance()) 907 if (obj->style()->hasAppearance())
908 LayoutTheme::theme().addVisualOverflow(*obj, r); 908 LayoutTheme::theme().addVisualOverflow(*obj, r);
909 result.unite(r); 909 result.unite(r);
910 } 910 }
911 } 911 }
912 return result; 912 return result;
913 } 913 }
914 914
915 AXObject* AXObject::elementAccessibilityHitTest(const IntPoint& point) const 915 AXObject* AXObject::elementAccessibilityHitTest(const IntPoint& point) const
916 { 916 {
917 // Send the hit test back into the sub-frame if necessary.
918 if (isAttachment()) {
919 Widget* widget = widgetForAttachmentView();
920 // Normalize the point for the widget's bounds.
921 if (widget && widget->isFrameView())
922 return axObjectCache().getOrCreate(widget)->accessibilityHitTest(Int Point(point - widget->frameRect().location()));
923 }
924
925 // Check if there are any mock elements that need to be handled. 917 // Check if there are any mock elements that need to be handled.
926 for (const auto& child : m_children) { 918 for (const auto& child : m_children) {
927 if (child->isMockObject() && child->elementRect().contains(point)) 919 if (child->isMockObject() && child->elementRect().contains(point))
928 return child->elementAccessibilityHitTest(point); 920 return child->elementAccessibilityHitTest(point);
929 } 921 }
930 922
931 return const_cast<AXObject*>(this); 923 return const_cast<AXObject*>(this);
932 } 924 }
933 925
934 const AXObject::AccessibilityChildrenVector& AXObject::children() 926 const AXObject::AccessibilityChildrenVector& AXObject::children()
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 void AXObject::clearChildren() 973 void AXObject::clearChildren()
982 { 974 {
983 // Detach all weak pointers from objects to their parents. 975 // Detach all weak pointers from objects to their parents.
984 for (const auto& child : m_children) 976 for (const auto& child : m_children)
985 child->detachFromParent(); 977 child->detachFromParent();
986 978
987 m_children.clear(); 979 m_children.clear();
988 m_haveChildren = false; 980 m_haveChildren = false;
989 } 981 }
990 982
991 AXObject* AXObject::focusedUIElement() const
992 {
993 Document* doc = document();
994 if (!doc)
995 return 0;
996
997 Page* page = doc->page();
998 if (!page)
999 return 0;
1000
1001 return axObjectCache().focusedUIElementForPage(page);
1002 }
1003
1004 Document* AXObject::document() const 983 Document* AXObject::document() const
1005 { 984 {
1006 FrameView* frameView = documentFrameView(); 985 FrameView* frameView = documentFrameView();
1007 if (!frameView) 986 if (!frameView)
1008 return 0; 987 return 0;
1009 988
1010 return frameView->frame().document(); 989 return frameView->frame().document();
1011 } 990 }
1012 991
1013 FrameView* AXObject::documentFrameView() const 992 FrameView* AXObject::documentFrameView() const
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1483
1505 DEFINE_TRACE(AXObject) 1484 DEFINE_TRACE(AXObject)
1506 { 1485 {
1507 visitor->trace(m_children); 1486 visitor->trace(m_children);
1508 visitor->trace(m_parent); 1487 visitor->trace(m_parent);
1509 visitor->trace(m_cachedLiveRegionRoot); 1488 visitor->trace(m_cachedLiveRegionRoot);
1510 visitor->trace(m_axObjectCache); 1489 visitor->trace(m_axObjectCache);
1511 } 1490 }
1512 1491
1513 } // namespace blink 1492 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698