Changeset 191234 in webkit


Ignore:
Timestamp:
Oct 16, 2015 8:36:56 PM (9 years ago)
Author:
Alan Bujtas
Message:

RenderBlockFlow::*logical*ForFloat should take FloatingObject reference.
https://bugs.webkit.org/show_bug.cgi?id=150266

Reviewed by Simon Fraser.

No change in behaviour.

  • rendering/FloatingObjects.cpp:

(WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
(WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
(WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
(WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining):
(WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
(WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
(WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
(WebCore::RenderBlockFlow::repaintOverhangingFloats):
(WebCore::RenderBlockFlow::insertFloatingObject):
(WebCore::RenderBlockFlow::removeFloatingObject):
(WebCore::RenderBlockFlow::removeFloatingObjectsBelow):
(WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
(WebCore::RenderBlockFlow::positionNewFloats):
(WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
(WebCore::RenderBlockFlow::lowestInitialLetterLogicalBottom):
(WebCore::RenderBlockFlow::addOverhangingFloats):
(WebCore::RenderBlockFlow::hasOverhangingFloat):
(WebCore::RenderBlockFlow::addIntrudingFloats):

  • rendering/RenderBlockFlow.h:

(WebCore::RenderBlockFlow::logicalTopForFloat):
(WebCore::RenderBlockFlow::logicalBottomForFloat):
(WebCore::RenderBlockFlow::logicalLeftForFloat):
(WebCore::RenderBlockFlow::logicalRightForFloat):
(WebCore::RenderBlockFlow::logicalWidthForFloat):
(WebCore::RenderBlockFlow::logicalHeightForFloat):
(WebCore::RenderBlockFlow::setLogicalTopForFloat):
(WebCore::RenderBlockFlow::setLogicalLeftForFloat):
(WebCore::RenderBlockFlow::setLogicalHeightForFloat):
(WebCore::RenderBlockFlow::setLogicalWidthForFloat):
(WebCore::RenderBlockFlow::logicalSizeForFloat): Deleted.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
(WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
(WebCore::RenderBlockFlow::positionNewFloatOnLine):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::addOverflowFromChild):

  • rendering/RenderBox.h:

(WebCore::RenderBox::addOverflowFromChild):

  • rendering/line/BreakingContext.h:

(WebCore::BreakingContext::handleFloat):

  • rendering/line/LineWidth.cpp:

(WebCore::newFloatShrinksLine):
(WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):

  • rendering/shapes/ShapeOutsideInfo.cpp:

(WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine):

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r191233 r191234  
     12015-10-16  Zalan Bujtas  <zalan@apple.com>
     2
     3        RenderBlockFlow::*logical*ForFloat should take FloatingObject reference.
     4        https://bugs.webkit.org/show_bug.cgi?id=150266
     5
     6        Reviewed by Simon Fraser.
     7
     8        No change in behaviour.
     9
     10        * rendering/FloatingObjects.cpp:
     11        (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
     12        (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
     13        (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
     14        (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining):
     15        (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
     16        (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
     17        (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
     18        * rendering/RenderBlockFlow.cpp:
     19        (WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
     20        (WebCore::RenderBlockFlow::repaintOverhangingFloats):
     21        (WebCore::RenderBlockFlow::insertFloatingObject):
     22        (WebCore::RenderBlockFlow::removeFloatingObject):
     23        (WebCore::RenderBlockFlow::removeFloatingObjectsBelow):
     24        (WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
     25        (WebCore::RenderBlockFlow::positionNewFloats):
     26        (WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
     27        (WebCore::RenderBlockFlow::lowestInitialLetterLogicalBottom):
     28        (WebCore::RenderBlockFlow::addOverhangingFloats):
     29        (WebCore::RenderBlockFlow::hasOverhangingFloat):
     30        (WebCore::RenderBlockFlow::addIntrudingFloats):
     31        * rendering/RenderBlockFlow.h:
     32        (WebCore::RenderBlockFlow::logicalTopForFloat):
     33        (WebCore::RenderBlockFlow::logicalBottomForFloat):
     34        (WebCore::RenderBlockFlow::logicalLeftForFloat):
     35        (WebCore::RenderBlockFlow::logicalRightForFloat):
     36        (WebCore::RenderBlockFlow::logicalWidthForFloat):
     37        (WebCore::RenderBlockFlow::logicalHeightForFloat):
     38        (WebCore::RenderBlockFlow::setLogicalTopForFloat):
     39        (WebCore::RenderBlockFlow::setLogicalLeftForFloat):
     40        (WebCore::RenderBlockFlow::setLogicalHeightForFloat):
     41        (WebCore::RenderBlockFlow::setLogicalWidthForFloat):
     42        (WebCore::RenderBlockFlow::logicalSizeForFloat): Deleted.
     43        * rendering/RenderBlockLineLayout.cpp:
     44        (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
     45        (WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
     46        (WebCore::RenderBlockFlow::positionNewFloatOnLine):
     47        * rendering/RenderBox.cpp:
     48        (WebCore::RenderBox::addOverflowFromChild):
     49        * rendering/RenderBox.h:
     50        (WebCore::RenderBox::addOverflowFromChild):
     51        * rendering/line/BreakingContext.h:
     52        (WebCore::BreakingContext::handleFloat):
     53        * rendering/line/LineWidth.cpp:
     54        (WebCore::newFloatShrinksLine):
     55        (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):
     56        * rendering/shapes/ShapeOutsideInfo.cpp:
     57        (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine):
     58
    1592015-10-16  Jiewen Tan  <jiewen_tan@apple.com>
    260
  • trunk/Source/WebCore/rendering/FloatingObjects.cpp

    r185517 r191234  
    211211inline void FindNextFloatLogicalBottomAdapter::collectIfNeeded(const IntervalType& interval)
    212212{
    213     const FloatingObject* floatingObject = interval.data();
     213    const auto& floatingObject = *interval.data();
    214214    if (!rangesIntersect(interval.low(), interval.high(), m_belowLogicalHeight, m_aboveLogicalHeight))
    215215        return;
    216216
    217217    // All the objects returned from the tree should be already placed.
    218     ASSERT(floatingObject->isPlaced());
     218    ASSERT(floatingObject.isPlaced());
    219219    ASSERT(rangesIntersect(m_renderer.logicalTopForFloat(floatingObject), m_renderer.logicalBottomForFloat(floatingObject), m_belowLogicalHeight, m_aboveLogicalHeight));
    220220
     
    224224
    225225#if ENABLE(CSS_SHAPES)
    226     if (ShapeOutsideInfo* shapeOutside = floatingObject->renderer().shapeOutsideInfo()) {
    227         LayoutUnit shapeBottom = m_renderer.logicalTopForFloat(floatingObject) + m_renderer.marginBeforeForChild(floatingObject->renderer()) + shapeOutside->shapeLogicalBottom();
     226    if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
     227        LayoutUnit shapeBottom = m_renderer.logicalTopForFloat(floatingObject) + m_renderer.marginBeforeForChild(floatingObject.renderer()) + shapeOutside->shapeLogicalBottom();
    228228        // Use the shapeBottom unless it extends outside of the margin box, in which case it is clipped.
    229229        m_nextShapeLogicalBottom = std::min(shapeBottom, floatBottom);
     
    434434inline bool ComputeFloatOffsetForFloatLayoutAdapter<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 ComputeFloatOffsetForFloatLayoutAdapter<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;
     
    456456LayoutUnit ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining() const
    457457{
    458     return this->m_outermostFloat ? this->m_renderer.logicalBottomForFloat(this->m_outermostFloat) - this->m_lineTop : LayoutUnit::fromPixel(1);
     458    return this->m_outermostFloat ? this->m_renderer.logicalBottomForFloat(*this->m_outermostFloat) - this->m_lineTop : LayoutUnit::fromPixel(1);
    459459}
    460460
     
    462462inline void ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval)
    463463{
    464     const FloatingObject* floatingObject = interval.data();
    465     if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom))
     464    const auto& floatingObject = *interval.data();
     465    if (floatingObject.type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom))
    466466        return;
    467467
    468468    // All the objects returned from the tree should be already placed.
    469     ASSERT(floatingObject->isPlaced());
     469    ASSERT(floatingObject.isPlaced());
    470470    ASSERT(rangesIntersect(m_renderer.logicalTopForFloat(floatingObject), m_renderer.logicalBottomForFloat(floatingObject), m_lineTop, m_lineBottom));
    471471
    472     bool floatIsNewExtreme = updateOffsetIfNeeded(*floatingObject);
     472    bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
    473473    if (floatIsNewExtreme)
    474         m_outermostFloat = floatingObject;
     474        m_outermostFloat = &floatingObject;
    475475}
    476476
     
    478478inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject& floatingObject)
    479479{
    480     LayoutUnit logicalRight = m_renderer.logicalRightForFloat(&floatingObject);
     480    LayoutUnit logicalRight = m_renderer.logicalRightForFloat(floatingObject);
    481481#if ENABLE(CSS_SHAPES)
    482482    if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
     
    499499inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject& floatingObject)
    500500{
    501     LayoutUnit logicalLeft = m_renderer.logicalLeftForFloat(&floatingObject);
     501    LayoutUnit logicalLeft = m_renderer.logicalLeftForFloat(floatingObject);
    502502#if ENABLE(CSS_SHAPES)
    503503    if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer().shapeOutsideInfo()) {
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r191002 r191234  
    268268            auto end = floatingObjectSet.end();
    269269            for (auto it = floatingObjectSet.begin(); it != end; ++it) {
    270                 FloatingObject* floatingObject = it->get();
    271                 std::unique_ptr<FloatingObject> oldFloatingObject = floatMap.take(&floatingObject->renderer());
     270                const auto& floatingObject = *it->get();
     271                std::unique_ptr<FloatingObject> oldFloatingObject = floatMap.take(&floatingObject.renderer());
    272272                LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject);
    273273                if (oldFloatingObject) {
    274                     LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloatingObject.get());
    275                     if (logicalWidthForFloat(floatingObject) != logicalWidthForFloat(oldFloatingObject.get()) || logicalLeftForFloat(floatingObject) != logicalLeftForFloat(oldFloatingObject.get())) {
     274                    LayoutUnit oldLogicalBottom = logicalBottomForFloat(*oldFloatingObject);
     275                    if (logicalWidthForFloat(floatingObject) != logicalWidthForFloat(*oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftForFloat(*oldFloatingObject)) {
    276276                        changeLogicalTop = 0;
    277277                        changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom));
     
    282282                        }
    283283                        LayoutUnit logicalTop = logicalTopForFloat(floatingObject);
    284                         LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject.get());
     284                        LayoutUnit oldLogicalTop = logicalTopForFloat(*oldFloatingObject);
    285285                        if (logicalTop != oldLogicalTop) {
    286286                            changeLogicalTop = std::min(changeLogicalTop, std::min(logicalTop, oldLogicalTop));
     
    302302        auto end = floatMap.end();
    303303        for (auto it = floatMap.begin(); it != end; ++it) {
    304             FloatingObject* floatingObject = it->value.get();
    305             if (!floatingObject->isDescendant()) {
     304            const auto& floatingObject = *it->value.get();
     305            if (!floatingObject.isDescendant()) {
    306306                changeLogicalTop = 0;
    307307                changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(floatingObject));
     
    21552155    auto end = floatingObjectSet.end();
    21562156    for (auto it = floatingObjectSet.begin(); it != end; ++it) {
    2157         FloatingObject* floatingObject = it->get();
     2157        const auto& floatingObject = *it->get();
    21582158        // Only repaint the object if it is overhanging, is not in its own layer, and
    21592159        // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter
    21602160        // condition is replaced with being a descendant of us.
     2161        auto& renderer = floatingObject.renderer();
    21612162        if (logicalBottomForFloat(floatingObject) > logicalHeight()
    2162             && !floatingObject->renderer().hasSelfPaintingLayer()
    2163             && (floatingObject->shouldPaint() || (paintAllDescendants && floatingObject->renderer().isDescendantOf(this)))) {
    2164             floatingObject->renderer().repaint();
    2165             floatingObject->renderer().repaintOverhangingFloats(false);
     2163            && !renderer.hasSelfPaintingLayer()
     2164            && (floatingObject.shouldPaint() || (paintAllDescendants && renderer.isDescendantOf(this)))) {
     2165            renderer.repaint();
     2166            renderer.repaintOverhangingFloats(false);
    21662167        }
    21672168    }
     
    22792280    }
    22802281
    2281     setLogicalWidthForFloat(floatingObject.get(), logicalWidthForChild(floatBox) + marginStartForChild(floatBox) + marginEndForChild(floatBox));
     2282    setLogicalWidthForFloat(*floatingObject, logicalWidthForChild(floatBox) + marginStartForChild(floatBox) + marginEndForChild(floatBox));
    22822283
    22832284    return m_floatingObjects->add(WTF::move(floatingObject));
     
    22902291        auto it = floatingObjectSet.find<RenderBox&, FloatingObjectHashTranslator>(floatBox);
    22912292        if (it != floatingObjectSet.end()) {
    2292             FloatingObject* floatingObject = it->get();
     2293            auto& floatingObject = *it->get();
    22932294            if (childrenInline()) {
    22942295                LayoutUnit logicalTop = logicalTopForFloat(floatingObject);
     
    23042305                    logicalBottom = std::max(logicalBottom, logicalTop + 1);
    23052306                }
    2306                 if (floatingObject->originatingLine()) {
    2307                     floatingObject->originatingLine()->removeFloat(floatBox);
     2307                if (floatingObject.originatingLine()) {
     2308                    floatingObject.originatingLine()->removeFloat(floatBox);
    23082309                    if (!selfNeedsLayout()) {
    2309                         ASSERT(&floatingObject->originatingLine()->renderer() == this);
    2310                         floatingObject->originatingLine()->markDirty();
     2310                        ASSERT(&floatingObject.originatingLine()->renderer() == this);
     2311                        floatingObject.originatingLine()->markDirty();
    23112312                    }
    23122313#if !ASSERT_DISABLED
    2313                     floatingObject->setOriginatingLine(0);
     2314                    floatingObject.setOriginatingLine(0);
    23142315#endif
    23152316                }
    23162317                markLinesDirtyInBlockRange(0, logicalBottom);
    23172318            }
    2318             m_floatingObjects->remove(floatingObject);
     2319            m_floatingObjects->remove(&floatingObject);
    23192320        }
    23202321    }
     
    23282329    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    23292330    FloatingObject* curr = floatingObjectSet.last().get();
    2330     while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(curr) >= logicalOffset)) {
     2331    while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(*curr) >= logicalOffset)) {
    23312332        m_floatingObjects->remove(curr);
    23322333        if (floatingObjectSet.isEmpty())
     
    23522353}
    23532354
    2354 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject* floatingObject, LayoutUnit logicalTopOffset)
    2355 {
    2356     RenderBox& childBox = floatingObject->renderer();
     2355LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject& floatingObject, LayoutUnit logicalTopOffset)
     2356{
     2357    auto& childBox = floatingObject.renderer();
    23572358    LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset.
    23582359    LayoutUnit logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset.
     
    24722473    // The float cannot start above the top position of the last positioned float.
    24732474    if (lastPlacedFloatingObject)
    2474         logicalTop = std::max(logicalTopForFloat(lastPlacedFloatingObject), logicalTop);
     2475        logicalTop = std::max(logicalTopForFloat(*lastPlacedFloatingObject), logicalTop);
    24752476
    24762477    auto end = floatingObjectSet.end();
    24772478    // Now walk through the set of unpositioned floats and place them.
    24782479    for (; it != end; ++it) {
    2479         FloatingObject* floatingObject = it->get();
     2480        auto& floatingObject = *it->get();
    24802481        // The containing block is responsible for positioning floats, so if we have floats in our
    24812482        // list that come from somewhere else, do not attempt to position them.
    2482         if (floatingObject->renderer().containingBlock() != this)
     2483        auto& childBox = floatingObject.renderer();
     2484        if (childBox.containingBlock() != this)
    24832485            continue;
    2484 
    2485         RenderBox& childBox = floatingObject->renderer();
    24862486
    24872487        LayoutUnit childLogicalLeftMargin = style().isLeftToRightDirection() ? marginStartForChild(childBox) : marginEndForChild(childBox);
     
    25232523           
    25242524            if (newLogicalTop != floatLogicalLocation.y()) {
    2525                 floatingObject->setPaginationStrut(newLogicalTop - floatLogicalLocation.y());
     2525                floatingObject.setPaginationStrut(newLogicalTop - floatLogicalLocation.y());
    25262526
    25272527                floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop);
     
    25462546        setLogicalHeightForFloat(floatingObject, logicalHeightForChildForFragmentation(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
    25472547
    2548         m_floatingObjects->addPlacedObject(floatingObject);
     2548        m_floatingObjects->addPlacedObject(&floatingObject);
    25492549
    25502550#if ENABLE(CSS_SHAPES)
     
    26212621    auto end = floatingObjectSet.end();
    26222622    for (auto it = floatingObjectSet.begin(); it != end; ++it) {
    2623         FloatingObject* floatingObject = it->get();
    2624         if (floatingObject->isPlaced() && floatingObject->type() & floatType)
     2623        const auto& floatingObject = *it->get();
     2624        if (floatingObject.isPlaced() && floatingObject.type() & floatType)
    26252625            lowestFloatBottom = std::max(lowestFloatBottom, logicalBottomForFloat(floatingObject));
    26262626    }
     
    26362636    auto end = floatingObjectSet.end();
    26372637    for (auto it = floatingObjectSet.begin(); it != end; ++it) {
    2638         FloatingObject* floatingObject = it->get();
    2639         if (floatingObject->isPlaced() && floatingObject->renderer().style().styleType() == FIRST_LETTER && floatingObject->renderer().style().initialLetterDrop() > 0)
     2638        const auto& floatingObject = *it->get();
     2639        if (floatingObject.isPlaced() && floatingObject.renderer().style().styleType() == FIRST_LETTER && floatingObject.renderer().style().initialLetterDrop() > 0)
    26402640            lowestFloatBottom = std::max(lowestFloatBottom, logicalBottomForFloat(floatingObject));
    26412641    }
     
    26572657    auto childEnd = child.m_floatingObjects->set().end();
    26582658    for (auto childIt = child.m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) {
    2659         FloatingObject* floatingObject = childIt->get();
     2659        auto& floatingObject = *childIt->get();
    26602660        LayoutUnit floatLogicalBottom = std::min(logicalBottomForFloat(floatingObject), LayoutUnit::max() - childLogicalTop);
    26612661        LayoutUnit logicalBottom = childLogicalTop + floatLogicalBottom;
     
    26642664        if (logicalBottom > logicalHeight()) {
    26652665            // If the object is not in the list, we add it now.
    2666             if (!containsFloat(floatingObject->renderer())) {
     2666            if (!containsFloat(floatingObject.renderer())) {
    26672667                LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-childLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft);
    26682668                bool shouldPaint = false;
     
    26722672                // far out as we can, to the outermost block that overlaps the float, stopping only
    26732673                // if we hit a self-painting layer boundary.
    2674                 if (floatingObject->renderer().enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) {
    2675                     floatingObject->setShouldPaint(false);
     2674                if (floatingObject.renderer().enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) {
     2675                    floatingObject.setShouldPaint(false);
    26762676                    shouldPaint = true;
    26772677                }
     
    26802680                    createFloatingObjects();
    26812681
    2682                 m_floatingObjects->add(floatingObject->copyToNewContainer(offset, shouldPaint, true));
     2682                m_floatingObjects->add(floatingObject.copyToNewContainer(offset, shouldPaint, true));
    26832683            }
    26842684        } else {
    2685             if (makeChildPaintOtherFloats && !floatingObject->shouldPaint() && !floatingObject->renderer().hasSelfPaintingLayer()
    2686                 && floatingObject->renderer().isDescendantOf(&child) && floatingObject->renderer().enclosingFloatPaintingLayer() == child.enclosingFloatPaintingLayer()) {
     2685            const auto& renderer = floatingObject.renderer();
     2686            if (makeChildPaintOtherFloats && !floatingObject.shouldPaint() && !renderer.hasSelfPaintingLayer()
     2687                && renderer.isDescendantOf(&child) && renderer.enclosingFloatPaintingLayer() == child.enclosingFloatPaintingLayer()) {
    26872688                // The float is not overhanging from this block, so if it is a descendant of the child, the child should
    26882689                // paint it (the other case is that it is intruding into the child), unless it has its own layer or enclosing
     
    26902691                // If makeChildPaintOtherFloats is false, it means that the child must already know about all the floats
    26912692                // it should paint.
    2692                 floatingObject->setShouldPaint(true);
     2693                floatingObject.setShouldPaint(true);
    26932694            }
    26942695           
    26952696            // Since the float doesn't overhang, it didn't get put into our list. We need to add its overflow in to the child now.
    2696             if (floatingObject->isDescendant())
    2697                 child.addOverflowFromChild(&floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floatingObject)));
     2697            if (floatingObject.isDescendant())
     2698                child.addOverflowFromChild(&renderer, LayoutSize(xPositionForFloatIncludingMargin(&floatingObject), yPositionForFloatIncludingMargin(&floatingObject)));
    26982699        }
    26992700    }
     
    27072708
    27082709    const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
    2709     auto it = floatingObjectSet.find<RenderBox&, FloatingObjectHashTranslator>(renderer);
     2710    const auto it = floatingObjectSet.find<RenderBox&, FloatingObjectHashTranslator>(renderer);
    27102711    if (it == floatingObjectSet.end())
    27112712        return false;
    27122713
    2713     return logicalBottomForFloat(it->get()) > logicalHeight();
     2714    return logicalBottomForFloat(*it->get()) > logicalHeight();
    27142715}
    27152716
     
    27312732    auto prevEnd = prevSet.end();
    27322733    for (auto prevIt = prevSet.begin(); prevIt != prevEnd; ++prevIt) {
    2733         FloatingObject* floatingObject = prevIt->get();
     2734        auto& floatingObject = *prevIt->get();
    27342735        if (logicalBottomForFloat(floatingObject) > logicalTopOffset) {
    2735             if (!m_floatingObjects || !m_floatingObjects->set().contains<FloatingObject&, FloatingObjectHashTranslator>(*floatingObject)) {
     2736            if (!m_floatingObjects || !m_floatingObjects->set().contains<FloatingObject&, FloatingObjectHashTranslator>(floatingObject)) {
    27362737                // We create the floating object list lazily.
    27372738                if (!m_floatingObjects)
     
    27472748                    : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != container ? prev->marginTop() : LayoutUnit()));
    27482749
    2749                 m_floatingObjects->add(floatingObject->copyToNewContainer(offset));
     2750                m_floatingObjects->add(floatingObject.copyToNewContainer(offset));
    27502751            }
    27512752        }
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r191195 r191234  
    298298    const FloatingObjectSet* floatingObjectSet() const { return m_floatingObjects ? &m_floatingObjects->set() : nullptr; }
    299299
    300     LayoutUnit logicalTopForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->y() : floatingObject->x(); }
    301     LayoutUnit logicalBottomForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->maxY() : floatingObject->maxX(); }
    302     LayoutUnit logicalLeftForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->x() : floatingObject->y(); }
    303     LayoutUnit logicalRightForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->maxX() : floatingObject->maxY(); }
    304     LayoutUnit logicalWidthForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->width() : floatingObject->height(); }
    305     LayoutUnit logicalHeightForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->height() : floatingObject->width(); }
    306     LayoutSize logicalSizeForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? LayoutSize(floatingObject->width(), floatingObject->height()) : LayoutSize(floatingObject->height(), floatingObject->width()); }
    307 
    308     void setLogicalTopForFloat(FloatingObject* floatingObject, LayoutUnit logicalTop)
     300    LayoutUnit logicalTopForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.y() : floatingObject.x(); }
     301    LayoutUnit logicalBottomForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.maxY() : floatingObject.maxX(); }
     302    LayoutUnit logicalLeftForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.x() : floatingObject.y(); }
     303    LayoutUnit logicalRightForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.maxX() : floatingObject.maxY(); }
     304    LayoutUnit logicalWidthForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.width() : floatingObject.height(); }
     305    LayoutUnit logicalHeightForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.height() : floatingObject.width(); }
     306
     307    void setLogicalTopForFloat(FloatingObject& floatingObject, LayoutUnit logicalTop)
    309308    {
    310309        if (isHorizontalWritingMode())
    311             floatingObject->setY(logicalTop);
     310            floatingObject.setY(logicalTop);
    312311        else
    313             floatingObject->setX(logicalTop);
     312            floatingObject.setX(logicalTop);
    314313    }
    315     void setLogicalLeftForFloat(FloatingObject* floatingObject, LayoutUnit logicalLeft)
     314    void setLogicalLeftForFloat(FloatingObject& floatingObject, LayoutUnit logicalLeft)
    316315    {
    317316        if (isHorizontalWritingMode())
    318             floatingObject->setX(logicalLeft);
     317            floatingObject.setX(logicalLeft);
    319318        else
    320             floatingObject->setY(logicalLeft);
     319            floatingObject.setY(logicalLeft);
    321320    }
    322     void setLogicalHeightForFloat(FloatingObject* floatingObject, LayoutUnit logicalHeight)
     321    void setLogicalHeightForFloat(FloatingObject& floatingObject, LayoutUnit logicalHeight)
    323322    {
    324323        if (isHorizontalWritingMode())
    325             floatingObject->setHeight(logicalHeight);
     324            floatingObject.setHeight(logicalHeight);
    326325        else
    327             floatingObject->setWidth(logicalHeight);
     326            floatingObject.setWidth(logicalHeight);
    328327    }
    329     void setLogicalWidthForFloat(FloatingObject* floatingObject, LayoutUnit logicalWidth)
     328    void setLogicalWidthForFloat(FloatingObject& floatingObject, LayoutUnit logicalWidth)
    330329    {
    331330        if (isHorizontalWritingMode())
    332             floatingObject->setWidth(logicalWidth);
     331            floatingObject.setWidth(logicalWidth);
    333332        else
    334             floatingObject->setHeight(logicalWidth);
     333            floatingObject.setHeight(logicalWidth);
    335334    }
    336335
     
    491490    void removeFloatingObject(RenderBox&);
    492491    void removeFloatingObjectsBelow(FloatingObject*, int logicalOffset);
    493     LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset);
     492    LayoutPoint computeLogicalLocationForFloat(const FloatingObject&, LayoutUnit logicalTopOffset);
    494493
    495494    // Called from lineWidth, to position the floats added in the last line.
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r191195 r191234  
    12561256        const InlineIterator oldEnd = end;
    12571257        bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
    1258         FloatingObject* lastFloatFromPreviousLine = (containsFloats()) ? m_floatingObjects->set().last().get() : 0;
     1258        FloatingObject* lastFloatFromPreviousLine = (containsFloats()) ? m_floatingObjects->set().last().get() : nullptr;
    12591259
    12601260        WordMeasurements wordMeasurements;
     
    18991899    auto end = floatingObjectSet.end();
    19001900    for (auto it = floatingObjectSet.begin(); it != end; ++it) {
    1901         FloatingObject* floatingObject = it->get();
     1901        const auto& floatingObject = *it->get();
    19021902        if (logicalBottomForFloat(floatingObject) >= logicalTop && logicalBottomForFloat(floatingObject) < logicalBottom)
    19031903            return false;
     
    20762076    ASSERT(floatingObjectSet.last().get() == &newFloat);
    20772077
    2078     LayoutUnit floatLogicalTop = logicalTopForFloat(&newFloat);
     2078    LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat);
    20792079    LayoutUnit paginationStrut = newFloat.paginationStrut();
    20802080
     
    20872087    while (it != begin) {
    20882088        --it;
    2089         FloatingObject* floatingObject = it->get();
    2090         if (floatingObject == lastFloatFromPreviousLine)
     2089        auto& floatingObject = *it->get();
     2090        if (&floatingObject == lastFloatFromPreviousLine)
    20912091            break;
    20922092        if (logicalTopForFloat(floatingObject) == logicalHeight() + lineInfo.floatPaginationStrut()) {
    2093             floatingObject->setPaginationStrut(paginationStrut + floatingObject->paginationStrut());
    2094             RenderBox& floatBox = floatingObject->renderer();
     2093            floatingObject.setPaginationStrut(paginationStrut + floatingObject.paginationStrut());
     2094            RenderBox& floatBox = floatingObject.renderer();
    20952095            setLogicalTopForChild(floatBox, logicalTopForChild(floatBox) + marginBeforeForChild(floatBox) + paginationStrut);
    20962096
    2097             if (updateRegionRangeForBoxChild(floatingObject->renderer()))
     2097            if (updateRegionRangeForBoxChild(floatBox))
    20982098                floatBox.setNeedsLayout(MarkOnlyThis);
    20992099            else if (is<RenderBlock>(floatBox))
     
    21042104            // isPlaced to false. Otherwise it will trigger an assert in logicalTopForFloat.
    21052105            LayoutUnit oldLogicalTop = logicalTopForFloat(floatingObject);
    2106             m_floatingObjects->removePlacedObject(floatingObject);
     2106            m_floatingObjects->removePlacedObject(&floatingObject);
    21072107            setLogicalTopForFloat(floatingObject, oldLogicalTop + paginationStrut);
    2108             m_floatingObjects->addPlacedObject(floatingObject);
     2108            m_floatingObjects->addPlacedObject(&floatingObject);
    21092109        }
    21102110    }
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r191002 r191234  
    44484448}
    44494449
    4450 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta)
     4450void RenderBox::addOverflowFromChild(const RenderBox* child, const LayoutSize& delta)
    44514451{
    44524452    // Never allow flow threads to propagate overflow up to a parent.
  • trunk/Source/WebCore/rendering/RenderBox.h

    r190834 r191234  
    205205    void addVisualEffectOverflow();
    206206    LayoutRect applyVisualEffectOverflow(const LayoutRect&) const;
    207     void addOverflowFromChild(RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
    208     void addOverflowFromChild(RenderBox* child, const LayoutSize& delta);
     207    void addOverflowFromChild(const RenderBox* child) { addOverflowFromChild(child, child->locationOffset()); }
     208    void addOverflowFromChild(const RenderBox* child, const LayoutSize& delta);
    209209   
    210210    void updateLayerTransform();
  • trunk/Source/WebCore/rendering/line/BreakingContext.h

    r191195 r191234  
    445445{
    446446    auto& floatBox = downcast<RenderBox>(*m_current.renderer());
    447     FloatingObject* floatingObject = m_lineBreaker.insertFloatingObject(floatBox);
     447    const auto& floatingObject = *m_lineBreaker.insertFloatingObject(floatBox);
    448448    // check if it fits in the current line.
    449449    // If it does, position it now, otherwise, position
    450450    // it after moving to next line (in clearFloats() func)
    451451    if (m_floatsFitOnLine && m_width.fitsOnLineExcludingTrailingWhitespace(m_block.logicalWidthForFloat(floatingObject))) {
    452         m_lineBreaker.positionNewFloatOnLine(*floatingObject, m_lastFloatFromPreviousLine, m_lineInfo, m_width);
     452        m_lineBreaker.positionNewFloatOnLine(floatingObject, m_lastFloatFromPreviousLine, m_lineInfo, m_width);
    453453        if (m_lineBreakHistory.renderer() == m_current.renderer()) {
    454454            ASSERT(!m_lineBreakHistory.offset());
  • trunk/Source/WebCore/rendering/line/LineWidth.cpp

    r191195 r191234  
    8080{
    8181    LayoutUnit blockOffset = block.logicalHeight();
    82     if (blockOffset >= block.logicalTopForFloat(&newFloat) && blockOffset < block.logicalBottomForFloat(&newFloat))
     82    if (blockOffset >= block.logicalTopForFloat(newFloat) && blockOffset < block.logicalBottomForFloat(newFloat))
    8383        return true;
    8484
     
    103103
    104104    if (newFloat.type() == FloatingObject::FloatLeft) {
    105         float newLeft = m_block.logicalRightForFloat(&newFloat);
     105        float newLeft = m_block.logicalRightForFloat(newFloat);
    106106        if (shouldIndentText() && m_block.style().isLeftToRightDirection())
    107107            newLeft += floorToInt(m_block.textIndentOffset());
     
    116116        m_left = std::max<float>(m_left, newLeft);
    117117    } else {
    118         float newRight = m_block.logicalLeftForFloat(&newFloat);
     118        float newRight = m_block.logicalLeftForFloat(newFloat);
    119119        if (shouldIndentText() && !m_block.style().isLeftToRightDirection())
    120120            newRight -= floorToInt(m_block.textIndentOffset());
  • trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

    r191049 r191234  
    308308{
    309309    ASSERT(lineHeight >= 0);
    310     LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject) + containingBlock.marginBeforeForChild(m_renderer);
     310    LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(floatingObject) + containingBlock.marginBeforeForChild(m_renderer);
    311311    LayoutUnit borderBoxLineTop = lineTop - borderBoxTop;
    312312
    313313    if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, lineHeight)) {
    314314        LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset();
    315         LayoutUnit floatMarginBoxWidth = std::max<LayoutUnit>(LayoutUnit(), containingBlock.logicalWidthForFloat(&floatingObject));
     315        LayoutUnit floatMarginBoxWidth = std::max<LayoutUnit>(LayoutUnit(), containingBlock.logicalWidthForFloat(floatingObject));
    316316
    317317        if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, lineHeight)) {
Note: See TracChangeset for help on using the changeset viewer.