Changeset 79834 in webkit


Ignore:
Timestamp:
Feb 27, 2011 5:33:53 PM (13 years ago)
Author:
benjamin.poulain@nokia.com
Message:

2011-02-27 Benjamin Poulain <benjamin.poulain@nokia.com>

Reviewed by Sam Weinig.

Use OwnPtr to handle the memory of RenderBlock::m_floatingObjects and RenderBlock::m_positionedObjects
https://bugs.webkit.org/show_bug.cgi?id=55327

Refactor RenderBlock to use OwnPtr for m_floatingObjects and m_positionedObjects so we do not have
to release the memory manually.

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::~RenderBlock): (WebCore::RenderBlock::selectionGaps): (WebCore::RenderBlock::insertPositionedObject): (WebCore::RenderBlock::insertFloatingObject): (WebCore::RenderBlock::addOverhangingFloats): (WebCore::RenderBlock::addIntrudingFloats):
  • rendering/RenderBlock.h: (WebCore::RenderBlock::positionedObjects):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r79825 r79834  
     12011-02-27  Benjamin Poulain  <benjamin.poulain@nokia.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Use OwnPtr to handle the memory of RenderBlock::m_floatingObjects and RenderBlock::m_positionedObjects
     6        https://bugs.webkit.org/show_bug.cgi?id=55327
     7
     8        Refactor RenderBlock to use OwnPtr for m_floatingObjects and m_positionedObjects so we do not have
     9        to release the memory manually.
     10
     11        * rendering/RenderBlock.cpp:
     12        (WebCore::RenderBlock::~RenderBlock):
     13        (WebCore::RenderBlock::selectionGaps):
     14        (WebCore::RenderBlock::insertPositionedObject):
     15        (WebCore::RenderBlock::insertFloatingObject):
     16        (WebCore::RenderBlock::addOverhangingFloats):
     17        (WebCore::RenderBlock::addIntrudingFloats):
     18        * rendering/RenderBlock.h:
     19        (WebCore::RenderBlock::positionedObjects):
     20
    1212011-02-27  Benjamin Poulain  <benjamin.poulain@nokia.com>
    222
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r79817 r79834  
    125125    if (m_floatingObjects)
    126126        deleteAllValues(*m_floatingObjects);
    127     delete m_floatingObjects;
    128     delete m_positionedObjects;
    129127   
    130128    if (hasColumns())
     
    27532751        rootBlock->flipForWritingMode(flippedBlockRect);
    27542752        flippedBlockRect.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y());
    2755         clipOutPositionedObjects(paintInfo, flippedBlockRect.location(), m_positionedObjects);
     2753        clipOutPositionedObjects(paintInfo, flippedBlockRect.location(), m_positionedObjects.get());
    27562754        if (isBody() || isRoot()) // The <body> must make sure to examine its containingBlock's positioned objects.
    27572755            for (RenderBlock* cb = containingBlock(); cb && !cb->isRenderView(); cb = cb->containingBlock())
    2758                 clipOutPositionedObjects(paintInfo, IntPoint(cb->x(), cb->y()), cb->m_positionedObjects); // FIXME: Not right for flipped writing modes.
     2756                clipOutPositionedObjects(paintInfo, IntPoint(cb->x(), cb->y()), cb->m_positionedObjects.get()); // FIXME: Not right for flipped writing modes.
    27592757        if (m_floatingObjects) {
    27602758            FloatingObjectSetIterator end = m_floatingObjects->end();
     
    30183016    // Create the list of special objects if we don't aleady have one
    30193017    if (!m_positionedObjects)
    3020         m_positionedObjects = new PositionedObjectsListHashSet;
     3018        m_positionedObjects = adoptPtr(new PositionedObjectsListHashSet);
    30213019
    30223020    m_positionedObjects->add(o);
     
    30683066    // Create the list of special objects if we don't aleady have one
    30693067    if (!m_floatingObjects)
    3070         m_floatingObjects = new FloatingObjectSet;
     3068        m_floatingObjects = adoptPtr(new FloatingObjectSet);
    30713069    else {
    30723070        // Don't insert the object again if it's already in the list
     
    36493647                // We create the floating object list lazily.
    36503648                if (!m_floatingObjects)
    3651                     m_floatingObjects = new FloatingObjectSet;
     3649                    m_floatingObjects = adoptPtr(new FloatingObjectSet);
    36523650
    36533651                m_floatingObjects->add(floatingObj);
     
    37083706                // We create the floating object list lazily.
    37093707                if (!m_floatingObjects)
    3710                     m_floatingObjects = new FloatingObjectSet;
     3708                    m_floatingObjects = adoptPtr(new FloatingObjectSet);
    37113709                m_floatingObjects->add(floatingObj);
    37123710            }
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r79817 r79834  
    2828#include "RenderLineBoxList.h"
    2929#include "RootInlineBox.h"
     30#include <wtf/OwnPtr.h>
    3031#include <wtf/ListHashSet.h>
    3132
     
    8182
    8283    typedef ListHashSet<RenderBox*, 4> PositionedObjectsListHashSet;
    83     PositionedObjectsListHashSet* positionedObjects() const { return m_positionedObjects; }
     84    PositionedObjectsListHashSet* positionedObjects() const { return m_positionedObjects.get(); }
    8485
    8586    void addPercentHeightDescendant(RenderBox*);
     
    713714    typedef ListHashSet<FloatingObject*, 4, FloatingObjectHashFunctions> FloatingObjectSet;
    714715    typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator;
    715     FloatingObjectSet* m_floatingObjects;
     716    OwnPtr<FloatingObjectSet> m_floatingObjects;
    716717   
    717718    typedef PositionedObjectsListHashSet::const_iterator Iterator;
    718     PositionedObjectsListHashSet* m_positionedObjects;
     719    OwnPtr<PositionedObjectsListHashSet> m_positionedObjects;
    719720
    720721    // Allocated only when some of these fields have non-default values
Note: See TracChangeset for help on using the changeset viewer.