Changeset 24103 in webkit


Ignore:
Timestamp:
Jul 8, 2007 2:02:23 PM (17 years ago)
Author:
bdash
Message:

2007-07-08 Mitz Pettel <mitz@webkit.org>

Reviewed by Maciej.

  • fix leaks introduced in r24099
  • dom/Element.cpp: (WebCore::Element::~Element): Do not delete the cached computed style here. (WebCore::Element::detach): Delete the computed style here instead. (WebCore::Element::computedStyle): Removed a redundant ref() which was causing the leak. Changed to return 0 if the element is not attached, because in that case there is currently no way to tell when to delete the computed style.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r24099 r24103  
     12007-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
    1152007-07-08  Mitz Pettel  <mitz@webkit.org>
    216
  • trunk/WebCore/dom/Element.cpp

    r24099 r24103  
    108108        ElementRareDataMap::iterator it = dataMap.find(this);
    109109        ASSERT(it != dataMap.end());
    110         it->second->resetComputedStyle(this);
    111110        delete it->second;
    112111        dataMap.remove(it);
     
    671670{
    672671    stopUpdateFocusAppearanceTimer();
     672    if (ElementRareData* rd = rareData())
     673        rd->resetComputedStyle(this);
    673674    ContainerNode::detach();
    674675}
     
    10901091        return usedStyle;
    10911092
     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
    10921098    ElementRareData* rd = createRareData();
    1093     if (!rd->m_computedStyle) {
     1099    if (!rd->m_computedStyle)
    10941100        rd->m_computedStyle = document()->styleSelector()->styleForElement(this, parent() ? parent()->computedStyle() : 0);
    1095         rd->m_computedStyle->ref();
    1096     }
    10971101    return rd->m_computedStyle;
    10981102}
Note: See TracChangeset for help on using the changeset viewer.