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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXNodeObject.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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 parentNode = toHTMLOptionElement(node)->ownerSelectElement(); 2135 parentNode = toHTMLOptionElement(node)->ownerSelectElement();
2136 2136
2137 if (!parentNode) 2137 if (!parentNode)
2138 parentNode = node->parentNode(); 2138 parentNode = node->parentNode();
2139 2139
2140 return parentNode; 2140 return parentNode;
2141 } 2141 }
2142 2142
2143 AXObject* AXNodeObject::computeParent() const 2143 AXObject* AXNodeObject::computeParent() const
2144 { 2144 {
2145 ASSERT(!isDetached());
2145 if (Node* parentNode = getParentNodeForComputeParent(node())) 2146 if (Node* parentNode = getParentNodeForComputeParent(node()))
2146 return axObjectCache().getOrCreate(parentNode); 2147 return axObjectCache().getOrCreate(parentNode);
2147 2148
2148 return nullptr; 2149 return nullptr;
2149 } 2150 }
2150 2151
2151 AXObject* AXNodeObject::computeParentIfExists() const 2152 AXObject* AXNodeObject::computeParentIfExists() const
2152 { 2153 {
2153 if (Node* parentNode = getParentNodeForComputeParent(node())) 2154 if (Node* parentNode = getParentNodeForComputeParent(node()))
2154 return axObjectCache().get(parentNode); 2155 return axObjectCache().get(parentNode);
(...skipping 21 matching lines...) Expand all
2176 2177
2177 Node* nextSibling = node()->nextSibling(); 2178 Node* nextSibling = node()->nextSibling();
2178 if (!nextSibling) 2179 if (!nextSibling)
2179 return 0; 2180 return 0;
2180 2181
2181 return axObjectCache().getOrCreate(nextSibling); 2182 return axObjectCache().getOrCreate(nextSibling);
2182 } 2183 }
2183 2184
2184 void AXNodeObject::addChildren() 2185 void AXNodeObject::addChildren()
2185 { 2186 {
2187 ASSERT(!isDetached());
2186 // If the need to add more children in addition to existing children arises, 2188 // If the need to add more children in addition to existing children arises,
2187 // childrenChanged should have been called, leaving the object with no child ren. 2189 // childrenChanged should have been called, leaving the object with no child ren.
2188 ASSERT(!m_haveChildren); 2190 ASSERT(!m_haveChildren);
2189 2191
2190 if (!m_node) 2192 if (!m_node)
2191 return; 2193 return;
2192 2194
2193 m_haveChildren = true; 2195 m_haveChildren = true;
2194 2196
2195 // The only time we add children from the DOM tree to a node with a layoutOb ject is when it's a canvas. 2197 // The only time we add children from the DOM tree to a node with a layoutOb ject is when it's a canvas.
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 return String(); 3113 return String();
3112 } 3114 }
3113 3115
3114 DEFINE_TRACE(AXNodeObject) 3116 DEFINE_TRACE(AXNodeObject)
3115 { 3117 {
3116 visitor->trace(m_node); 3118 visitor->trace(m_node);
3117 AXObject::trace(visitor); 3119 AXObject::trace(visitor);
3118 } 3120 }
3119 3121
3120 } // namespace blin 3122 } // namespace blin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698