Changeset 158963 in webkit


Ignore:
Timestamp:
Nov 8, 2013 3:24:40 PM (10 years ago)
Author:
Bem Jones-Bey
Message:

Use references instead of pointers to RenderBlockFlow in FloatingObjects and ComputeFloatOffsetAdapter
https://bugs.webkit.org/show_bug.cgi?id=124074

Reviewed by Sam Weinig.

Just a straightforward conversion from const pointers to const references.

Also, remove unneeded argument from FloatingObjects constructor.

No new tests, no behavior change.

  • rendering/FloatingObjects.cpp:

(WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
(WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
(WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
(WebCore::FloatingObjects::FloatingObjects):
(WebCore::FloatingObjects::clearLineBoxTreePointers):
(WebCore::FloatingObjects::computePlacedFloatsTree):
(WebCore::shapeInfoForFloat):
(WebCore::::updateOffsetIfNeeded):
(WebCore::::collectIfNeeded):
(WebCore::::heightRemaining):

  • rendering/FloatingObjects.h:
  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::createFloatingObjects):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r158962 r158963  
     12013-11-08  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        Use references instead of pointers to RenderBlockFlow in FloatingObjects and ComputeFloatOffsetAdapter
     4        https://bugs.webkit.org/show_bug.cgi?id=124074
     5
     6        Reviewed by Sam Weinig.
     7
     8        Just a straightforward conversion from const pointers to const references.
     9
     10        Also, remove unneeded argument from FloatingObjects constructor.
     11
     12        No new tests, no behavior change.
     13
     14        * rendering/FloatingObjects.cpp:
     15        (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
     16        (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
     17        (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
     18        (WebCore::FloatingObjects::FloatingObjects):
     19        (WebCore::FloatingObjects::clearLineBoxTreePointers):
     20        (WebCore::FloatingObjects::computePlacedFloatsTree):
     21        (WebCore::shapeInfoForFloat):
     22        (WebCore::::updateOffsetIfNeeded):
     23        (WebCore::::collectIfNeeded):
     24        (WebCore::::heightRemaining):
     25        * rendering/FloatingObjects.h:
     26        * rendering/RenderBlockFlow.cpp:
     27        (WebCore::RenderBlockFlow::createFloatingObjects):
     28
    1292013-11-08  Sam Weinig  <sam@webkit.org>
    230
  • trunk/Source/WebCore/rendering/FloatingObjects.cpp

    r158954 r158963  
    126126    typedef FloatingObjectInterval IntervalType;
    127127
    128     ComputeFloatOffsetAdapter(const RenderBlockFlow* renderer, LayoutUnit lineTop, LayoutUnit lineBottom, LayoutUnit offset)
     128    ComputeFloatOffsetAdapter(const RenderBlockFlow& renderer, LayoutUnit lineTop, LayoutUnit lineBottom, LayoutUnit offset)
    129129        : m_renderer(renderer)
    130130        , m_lineTop(roundToInt(lineTop))
     
    146146    bool updateOffsetIfNeeded(const FloatingObject*);
    147147
    148     const RenderBlockFlow* m_renderer;
     148    const RenderBlockFlow& m_renderer;
    149149    int m_lineTop;
    150150    int m_lineBottom;
     
    208208LayoutUnit FloatingObjects::findNextFloatLogicalBottomBelow(LayoutUnit logicalHeight)
    209209{
    210     FindNextFloatLogicalBottomAdapter adapter(*m_renderer, logicalHeight);
     210    FindNextFloatLogicalBottomAdapter adapter(m_renderer, logicalHeight);
    211211    placedFloatsTree().allOverlapsWithAdapter(adapter);
    212212
     
    216216LayoutUnit FloatingObjects::findNextFloatLogicalBottomBelowForBlock(LayoutUnit logicalHeight)
    217217{
    218     FindNextFloatLogicalBottomAdapter adapter(*m_renderer, logicalHeight);
     218    FindNextFloatLogicalBottomAdapter adapter(m_renderer, logicalHeight);
    219219    placedFloatsTree().allOverlapsWithAdapter(adapter);
    220220
     
    222222}
    223223
    224 FloatingObjects::FloatingObjects(const RenderBlockFlow* renderer, bool horizontalWritingMode)
     224FloatingObjects::FloatingObjects(const RenderBlockFlow& renderer)
    225225    : m_placedFloatsTree(UninitializedTree)
    226226    , m_leftObjectsCount(0)
    227227    , m_rightObjectsCount(0)
    228     , m_horizontalWritingMode(horizontalWritingMode)
     228    , m_horizontalWritingMode(renderer.isHorizontalWritingMode())
    229229    , m_renderer(renderer)
    230230{
     
    239239    // Clear references to originating lines, since the lines are being deleted
    240240    for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
    241         ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == m_renderer);
     241        ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == &m_renderer);
    242242        (*it)->setOriginatingLine(0);
    243243    }
     
    342342    if (m_set.isEmpty())
    343343        return;
    344     m_placedFloatsTree.initIfNeeded(m_renderer->view().intervalArena());
     344    m_placedFloatsTree.initIfNeeded(m_renderer.view().intervalArena());
    345345    for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
    346346        FloatingObject* floatingObject = it->get();
     
    358358
    359359#if ENABLE(CSS_SHAPES)
    360 static inline ShapeOutsideInfo* shapeInfoForFloat(const FloatingObject* floatingObject, const RenderBlockFlow* containingBlock, LayoutUnit lineTop, LayoutUnit lineBottom)
     360static inline ShapeOutsideInfo* shapeInfoForFloat(const FloatingObject* floatingObject, const RenderBlockFlow& containingBlock, LayoutUnit lineTop, LayoutUnit lineBottom)
    361361{
    362362    if (floatingObject) {
    363363        if (ShapeOutsideInfo* shapeOutside = floatingObject->renderer().shapeOutsideInfo()) {
    364             shapeOutside->updateDeltasForContainingBlockLine(containingBlock, floatingObject, lineTop, lineBottom - lineTop);
     364            shapeOutside->updateDeltasForContainingBlockLine(&containingBlock, floatingObject, lineTop, lineBottom - lineTop);
    365365            return shapeOutside;
    366366        }
     
    434434inline bool ComputeFloatOffsetAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
    435435{
    436     LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject);
     436    LayoutUnit logicalRight = m_renderer.logicalRightForFloat(floatingObject);
    437437    if (logicalRight > m_offset) {
    438438        m_offset = logicalRight;
     
    445445inline bool ComputeFloatOffsetAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
    446446{
    447     LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject);
     447    LayoutUnit logicalLeft = m_renderer.logicalLeftForFloat(floatingObject);
    448448    if (logicalLeft < m_offset) {
    449449        m_offset = logicalLeft;
     
    462462    // All the objects returned from the tree should be already placed.
    463463    ASSERT(floatingObject->isPlaced());
    464     ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingObject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lineTop, m_lineBottom));
     464    ASSERT(rangesIntersect(m_renderer.pixelSnappedLogicalTopForFloat(floatingObject), m_renderer.pixelSnappedLogicalBottomForFloat(floatingObject), m_lineTop, m_lineBottom));
    465465
    466466    bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
     
    472472LayoutUnit ComputeFloatOffsetAdapter<FloatTypeValue>::heightRemaining() const
    473473{
    474     return m_outermostFloat ? m_renderer->logicalBottomForFloat(m_outermostFloat) - m_lineTop : LayoutUnit(1);
     474    return m_outermostFloat ? m_renderer.logicalBottomForFloat(m_outermostFloat) - m_lineTop : LayoutUnit(1);
    475475}
    476476
  • trunk/Source/WebCore/rendering/FloatingObjects.h

    r158954 r158963  
    125125    WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED;
    126126public:
    127     FloatingObjects(const RenderBlockFlow*, bool horizontalWritingMode);
     127    FloatingObjects(const RenderBlockFlow&);
    128128    ~FloatingObjects();
    129129
     
    162162    unsigned m_rightObjectsCount;
    163163    bool m_horizontalWritingMode;
    164     const RenderBlockFlow* m_renderer;
     164    const RenderBlockFlow& m_renderer;
    165165};
    166166
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r158954 r158963  
    19281928void RenderBlockFlow::createFloatingObjects()
    19291929{
    1930     m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMode()));
     1930    m_floatingObjects = adoptPtr(new FloatingObjects(*this));
    19311931}
    19321932
Note: See TracChangeset for help on using the changeset viewer.