Changeset 24103 in webkit
- Timestamp:
- Jul 8, 2007 2:02:23 PM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r24099 r24103 1 2007-07-08 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Maciej. 4 5 - fix leaks introduced in r24099 6 7 * dom/Element.cpp: 8 (WebCore::Element::~Element): Do not delete the cached computed style here. 9 (WebCore::Element::detach): Delete the computed style here instead. 10 (WebCore::Element::computedStyle): Removed a redundant ref() which was 11 causing the leak. Changed to return 0 if the element is not attached, 12 because in that case there is currently no way to tell when to delete the computed 13 style. 14 1 15 2007-07-08 Mitz Pettel <mitz@webkit.org> 2 16 -
trunk/WebCore/dom/Element.cpp
r24099 r24103 108 108 ElementRareDataMap::iterator it = dataMap.find(this); 109 109 ASSERT(it != dataMap.end()); 110 it->second->resetComputedStyle(this);111 110 delete it->second; 112 111 dataMap.remove(it); … … 671 670 { 672 671 stopUpdateFocusAppearanceTimer(); 672 if (ElementRareData* rd = rareData()) 673 rd->resetComputedStyle(this); 673 674 ContainerNode::detach(); 674 675 } … … 1090 1091 return usedStyle; 1091 1092 1093 if (!attached()) 1094 // FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the 1095 // document tree and figure out when to destroy the computed style for such elements. 1096 return 0; 1097 1092 1098 ElementRareData* rd = createRareData(); 1093 if (!rd->m_computedStyle) {1099 if (!rd->m_computedStyle) 1094 1100 rd->m_computedStyle = document()->styleSelector()->styleForElement(this, parent() ? parent()->computedStyle() : 0); 1095 rd->m_computedStyle->ref();1096 }1097 1101 return rd->m_computedStyle; 1098 1102 }
Note: See TracChangeset
for help on using the changeset viewer.