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

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

Issue 1207613004: Fix leaking AXNodeObjects when sub document detaches (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 1 month 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 // case SeparatorRole: 1219 // case SeparatorRole:
1220 return true; 1220 return true;
1221 default: 1221 default:
1222 return false; 1222 return false;
1223 } 1223 }
1224 } 1224 }
1225 1225
1226 AXObject* AXLayoutObject::ancestorForWhichThisIsAPresentationalChild() const 1226 AXObject* AXLayoutObject::ancestorForWhichThisIsAPresentationalChild() const
1227 { 1227 {
1228 // Walk the parent chain looking for a parent that has presentational childr en 1228 // Walk the parent chain looking for a parent that has presentational childr en
1229 AXObject* parent = parentObject(); 1229 AXObject* parent = parentObjectIfExists();
1230 while (parent) { 1230 while (parent) {
1231 if (parent->ariaRoleHasPresentationalChildren()) 1231 if (parent->ariaRoleHasPresentationalChildren())
1232 break; 1232 break;
1233 1233
1234 // The descendants of a AXMenuList that are AXLayoutObjects are all 1234 // The descendants of a AXMenuList that are AXLayoutObjects are all
1235 // presentational. (The real descendants are a AXMenuListPopup and 1235 // presentational. (The real descendants are a AXMenuListPopup and
1236 // AXMenuListOptions, which are not AXLayoutObjects.) 1236 // AXMenuListOptions, which are not AXLayoutObjects.)
1237 if (parent->isMenuList()) 1237 if (parent->isMenuList())
1238 break; 1238 break;
1239 1239
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 1557
1558 return AXObject::elementAccessibilityHitTest(point); 1558 return AXObject::elementAccessibilityHitTest(point);
1559 } 1559 }
1560 1560
1561 // 1561 //
1562 // High-level accessibility tree access. 1562 // High-level accessibility tree access.
1563 // 1563 //
1564 1564
1565 AXObject* AXLayoutObject::computeParent() const 1565 AXObject* AXLayoutObject::computeParent() const
1566 { 1566 {
1567 ASSERT(!isDetached());
1567 if (!m_layoutObject) 1568 if (!m_layoutObject)
1568 return 0; 1569 return 0;
1569 1570
1570 if (ariaRoleAttribute() == MenuBarRole) 1571 if (ariaRoleAttribute() == MenuBarRole)
1571 return axObjectCache().getOrCreate(m_layoutObject->parent()); 1572 return axObjectCache().getOrCreate(m_layoutObject->parent());
1572 1573
1573 // menuButton and its corresponding menu are DOM siblings, but Accessibility needs them to be parent/child 1574 // menuButton and its corresponding menu are DOM siblings, but Accessibility needs them to be parent/child
1574 if (ariaRoleAttribute() == MenuRole) { 1575 if (ariaRoleAttribute() == MenuRole) {
1575 AXObject* parent = menuButtonForMenu(); 1576 AXObject* parent = menuButtonForMenu();
1576 if (parent) 1577 if (parent)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 } 1671 }
1671 1672
1672 if (!nextSibling) 1673 if (!nextSibling)
1673 return 0; 1674 return 0;
1674 1675
1675 return axObjectCache().getOrCreate(nextSibling); 1676 return axObjectCache().getOrCreate(nextSibling);
1676 } 1677 }
1677 1678
1678 void AXLayoutObject::addChildren() 1679 void AXLayoutObject::addChildren()
1679 { 1680 {
1681 ASSERT(!isDetached());
1680 // If the need to add more children in addition to existing children arises, 1682 // If the need to add more children in addition to existing children arises,
1681 // childrenChanged should have been called, leaving the object with no child ren. 1683 // childrenChanged should have been called, leaving the object with no child ren.
1682 ASSERT(!m_haveChildren); 1684 ASSERT(!m_haveChildren);
1683 1685
1684 m_haveChildren = true; 1686 m_haveChildren = true;
1685 1687
1686 if (!canHaveChildren()) 1688 if (!canHaveChildren())
1687 return; 1689 return;
1688 1690
1689 HeapVector<Member<AXObject>> ownedChildren; 1691 HeapVector<Member<AXObject>> ownedChildren;
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 if (label && label->layoutObject()) { 2592 if (label && label->layoutObject()) {
2591 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct(); 2593 LayoutRect labelRect = axObjectCache().getOrCreate(label)->elementRe ct();
2592 result.unite(labelRect); 2594 result.unite(labelRect);
2593 } 2595 }
2594 } 2596 }
2595 2597
2596 return result; 2598 return result;
2597 } 2599 }
2598 2600
2599 } // namespace blink 2601 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698