RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMa...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2016 18:56:54 +0000 (18:56 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Nov 2016 18:56:54 +0000 (18:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164639

Reviewed by Simon Fraser.

Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
(WebCore::canComputeRegionRangeForBox):
(WebCore::RenderBlock::computeRegionRangeForBoxChild):
(WebCore::RenderBlock::estimateRegionRangeForBoxChild):
(WebCore::RenderBlock::updateRegionRangeForBoxChild):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasRegionRangeInFlowThread):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::removeFlowChildInfo):
(WebCore::RenderFlowThread::validateRegions):
(WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
(WebCore::RenderFlowThread::removeLineRegionInfo):
(WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
(WebCore::RenderFlowThread::setRegionRangeForBox):
(WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
(WebCore::RenderFlowThread::computedRegionRangeForBox):
(WebCore::RenderFlowThread::checkLinesConsistency):
* rendering/RenderFlowThread.h:
* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
* rendering/RenderNamedFlowFragment.h:
* rendering/RenderNamedFlowThread.cpp:
(WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
(WebCore::RenderNamedFlowThread::removeFlowChildInfo):
* rendering/RenderNamedFlowThread.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::removeRenderBoxRegionInfo):
* rendering/RenderRegion.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208597 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderFlowThread.cpp
Source/WebCore/rendering/RenderFlowThread.h
Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
Source/WebCore/rendering/RenderMultiColumnFlowThread.h
Source/WebCore/rendering/RenderNamedFlowFragment.cpp
Source/WebCore/rendering/RenderNamedFlowFragment.h
Source/WebCore/rendering/RenderNamedFlowThread.cpp
Source/WebCore/rendering/RenderNamedFlowThread.h
Source/WebCore/rendering/RenderRegion.cpp
Source/WebCore/rendering/RenderRegion.h

index d878322..89f6fd4 100644 (file)
@@ -1,3 +1,49 @@
+2016-11-11  Zalan Bujtas  <zalan@apple.com>
+
+        RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMap::remove
+        https://bugs.webkit.org/show_bug.cgi?id=164639
+
+        Reviewed by Simon Fraser.
+
+        Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in. 
+
+        No change in functionality.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
+        (WebCore::canComputeRegionRangeForBox):
+        (WebCore::RenderBlock::computeRegionRangeForBoxChild):
+        (WebCore::RenderBlock::estimateRegionRangeForBoxChild):
+        (WebCore::RenderBlock::updateRegionRangeForBoxChild):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::hasRegionRangeInFlowThread):
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::removeFlowChildInfo):
+        (WebCore::RenderFlowThread::validateRegions):
+        (WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
+        (WebCore::RenderFlowThread::removeLineRegionInfo):
+        (WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
+        (WebCore::RenderFlowThread::setRegionRangeForBox):
+        (WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
+        (WebCore::RenderFlowThread::computedRegionRangeForBox):
+        (WebCore::RenderFlowThread::checkLinesConsistency):
+        * rendering/RenderFlowThread.h:
+        * rendering/RenderMultiColumnFlowThread.cpp:
+        (WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
+        * rendering/RenderMultiColumnFlowThread.h:
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
+        * rendering/RenderNamedFlowFragment.h:
+        * rendering/RenderNamedFlowThread.cpp:
+        (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
+        (WebCore::RenderNamedFlowThread::removeFlowChildInfo):
+        * rendering/RenderNamedFlowThread.h:
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::removeRenderBoxRegionInfo):
+        * rendering/RenderRegion.h:
+
 2016-11-11  Megan Gardner  <megan_gardner@apple.com>
 
         [Cocoa] Support wide gamut for Drag Image UI
index b492111..87901c8 100644 (file)
@@ -3394,11 +3394,11 @@ void RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants()
     setCachedFlowThreadContainingBlockNeedsUpdate();
 
     if (flowThread)
-        flowThread->removeFlowChildInfo(this);
+        flowThread->removeFlowChildInfo(*this);
 
     for (auto& child : childrenOfType<RenderElement>(*this)) {
         if (flowThread)
-            flowThread->removeFlowChildInfo(&child);
+            flowThread->removeFlowChildInfo(child);
         if (is<RenderBlock>(child))
             downcast<RenderBlock>(child).invalidateFlowThreadContainingBlockIncludingDescendants();
     }
@@ -3621,9 +3621,8 @@ RenderRegion* RenderBlock::regionAtBlockOffset(LayoutUnit blockOffset) const
     return flowThread->regionAtBlockOffset(this, offsetFromLogicalTopOfFirstPage() + blockOffset, true);
 }
 
-static bool canComputeRegionRangeForBox(const RenderBlock* parentBlock, const RenderBox& childBox, const RenderFlowThread* flowThreadContainingBlock)
+static bool canComputeRegionRangeForBox(const RenderBlock& parentBlock, const RenderBox& childBox, const RenderFlowThread* flowThreadContainingBlock)
 {
-    ASSERT(parentBlock);
     ASSERT(!childBox.isRenderNamedFlowThread());
 
     if (!flowThreadContainingBlock)
@@ -3653,7 +3652,7 @@ bool RenderBlock::childBoxIsUnsplittableForFragmentation(const RenderBox& child)
 void RenderBlock::computeRegionRangeForBoxChild(const RenderBox& box) const
 {
     RenderFlowThread* flowThread = flowThreadContainingBlock();
-    ASSERT(canComputeRegionRangeForBox(this, box, flowThread));
+    ASSERT(canComputeRegionRangeForBox(*this, box, flowThread));
 
     RenderRegion* startRegion;
     RenderRegion* endRegion;
@@ -3665,13 +3664,13 @@ void RenderBlock::computeRegionRangeForBoxChild(const RenderBox& box) const
         endRegion = flowThread->regionAtBlockOffset(this, offsetFromLogicalTopOfFirstRegion + logicalHeightForChild(box), true);
     }
 
-    flowThread->setRegionRangeForBox(&box, startRegion, endRegion);
+    flowThread->setRegionRangeForBox(box, startRegion, endRegion);
 }
 
 void RenderBlock::estimateRegionRangeForBoxChild(const RenderBox& box) const
 {
     RenderFlowThread* flowThread = flowThreadContainingBlock();
-    if (!canComputeRegionRangeForBox(this, box, flowThread))
+    if (!canComputeRegionRangeForBox(*this, box, flowThread))
         return;
 
     if (childBoxIsUnsplittableForFragmentation(box)) {
@@ -3686,13 +3685,13 @@ void RenderBlock::estimateRegionRangeForBoxChild(const RenderBox& box) const
     RenderRegion* startRegion = flowThread->regionAtBlockOffset(this, offsetFromLogicalTopOfFirstRegion, true);
     RenderRegion* endRegion = flowThread->regionAtBlockOffset(this, offsetFromLogicalTopOfFirstRegion + estimatedValues.m_extent, true);
 
-    flowThread->setRegionRangeForBox(&box, startRegion, endRegion);
+    flowThread->setRegionRangeForBox(box, startRegion, endRegion);
 }
 
 bool RenderBlock::updateRegionRangeForBoxChild(const RenderBox& box) const
 {
     RenderFlowThread* flowThread = flowThreadContainingBlock();
-    if (!canComputeRegionRangeForBox(this, box, flowThread))
+    if (!canComputeRegionRangeForBox(*this, box, flowThread))
         return false;
 
     RenderRegion* startRegion = nullptr;
index d982975..fa4542d 100644 (file)
@@ -203,7 +203,7 @@ bool RenderBox::hasRegionRangeInFlowThread() const
     if (!flowThread || !flowThread->hasValidRegionInfo())
         return false;
 
-    return flowThread->hasCachedRegionRangeForBox(this);
+    return flowThread->hasCachedRegionRangeForBox(*this);
 }
 
 LayoutRect RenderBox::clientBoxRectInRegion(RenderRegion* region) const
index b127227..4420750 100644 (file)
@@ -2208,7 +2208,7 @@ void RenderElement::removeFromRenderFlowThreadIncludingDescendants(bool shouldUp
     // We have to ask for our containing flow thread as it may be above the removed sub-tree.
     RenderFlowThread* flowThreadContainingBlock = this->flowThreadContainingBlock();
     while (flowThreadContainingBlock) {
-        flowThreadContainingBlock->removeFlowChildInfo(this);
+        flowThreadContainingBlock->removeFlowChildInfo(*this);
 
         if (flowThreadContainingBlock->flowThreadState() == NotInsideFlowThread)
             break;
index 401844c..d423ac3 100644 (file)
@@ -91,11 +91,11 @@ void RenderFlowThread::styleDidChange(StyleDifference diff, const RenderStyle* o
         invalidateRegions();
 }
 
-void RenderFlowThread::removeFlowChildInfo(RenderElement* child)
+void RenderFlowThread::removeFlowChildInfo(RenderElement& child)
 {
-    if (is<RenderBlockFlow>(*child))
+    if (is<RenderBlockFlow>(child))
         removeLineRegionInfo(downcast<RenderBlockFlow>(child));
-    if (is<RenderBox>(*child))
+    if (is<RenderBox>(child))
         removeRenderBoxRegionInfo(downcast<RenderBox>(child));
 }
 
@@ -171,7 +171,7 @@ void RenderFlowThread::validateRegions()
                 previousRegionLogicalWidth = regionLogicalWidth;
             }
 
-            setRegionRangeForBox(this, m_regionList.first(), m_regionList.last());
+            setRegionRangeForBox(*this, m_regionList.first(), m_regionList.last());
         }
     }
 
@@ -559,7 +559,7 @@ RenderRegion* RenderFlowThread::mapFromFlowToRegion(TransformState& transformSta
     return renderRegion;
 }
 
-void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box)
+void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox& box)
 {
     if (!hasRegions())
         return;
@@ -572,7 +572,7 @@ void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box)
 
     RenderRegion* startRegion = nullptr;
     RenderRegion* endRegion = nullptr;
-    if (getRegionRangeForBox(box, startRegion, endRegion)) {
+    if (getRegionRangeForBox(&box, startRegion, endRegion)) {
         for (auto it = m_regionList.find(startRegion), end = m_regionList.end(); it != end; ++it) {
             RenderRegion* region = *it;
             region->removeRenderBoxRegionInfo(box);
@@ -584,21 +584,19 @@ void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box)
 #ifndef NDEBUG
     // We have to make sure we did not leave any RenderBoxRegionInfo attached.
     for (auto& region : m_regionList)
-        ASSERT(!region->renderBoxRegionInfo(box));
+        ASSERT(!region->renderBoxRegionInfo(&box));
 #endif
 
-    m_regionRangeMap.remove(box);
+    m_regionRangeMap.remove(&box);
 }
 
-void RenderFlowThread::removeLineRegionInfo(const RenderBlockFlow* blockFlow)
+void RenderFlowThread::removeLineRegionInfo(const RenderBlockFlow& blockFlow)
 {
-    if (!m_lineToRegionMap || blockFlow->lineLayoutPath() == SimpleLinesPath)
+    if (!m_lineToRegionMap || blockFlow.lineLayoutPath() == SimpleLinesPath)
         return;
 
-    for (RootInlineBox* curr = blockFlow->firstRootBox(); curr; curr = curr->nextRootBox()) {
-        if (m_lineToRegionMap->contains(curr))
-            m_lineToRegionMap->remove(curr);
-    }
+    for (auto* curr = blockFlow.firstRootBox(); curr; curr = curr->nextRootBox())
+        m_lineToRegionMap->remove(curr);
 
     ASSERT_WITH_SECURITY_IMPLICATION(checkLinesConsistency(blockFlow));
 }
@@ -699,7 +697,7 @@ RenderRegion* RenderFlowThread::lastRegion() const
     return m_regionList.last();
 }
 
-void RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle(const RenderBox* box,
+void RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle(const RenderBox& box,
     const RenderRegion* newStartRegion, const RenderRegion* newEndRegion,
     const RenderRegion* oldStartRegion, const RenderRegion* oldEndRegion)
 {
@@ -716,7 +714,7 @@ void RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle(const RenderBox* b
         if (!(insideOldRegionRange && insideNewRegionRange)) {
             if (is<RenderNamedFlowFragment>(*region))
                 downcast<RenderNamedFlowFragment>(*region).clearObjectStyleInRegion(box);
-            if (region->renderBoxRegionInfo(box))
+            if (region->renderBoxRegionInfo(&box))
                 region->removeRenderBoxRegionInfo(box);
         }
 
@@ -727,14 +725,14 @@ void RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle(const RenderBox* b
     }
 }
 
-void RenderFlowThread::setRegionRangeForBox(const RenderBox* box, RenderRegion* startRegion, RenderRegion* endRegion)
+void RenderFlowThread::setRegionRangeForBox(const RenderBox& box, RenderRegion* startRegion, RenderRegion* endRegion)
 {
     ASSERT(hasRegions());
     ASSERT(startRegion && endRegion && startRegion->flowThread() == this && endRegion->flowThread() == this);
 
-    auto it = m_regionRangeMap.find(box);
+    auto it = m_regionRangeMap.find(&box);
     if (it == m_regionRangeMap.end()) {
-        m_regionRangeMap.set(box, RenderRegionRange(startRegion, endRegion));
+        m_regionRangeMap.set(&box, RenderRegionRange(startRegion, endRegion));
         return;
     }
 
@@ -747,11 +745,9 @@ void RenderFlowThread::setRegionRangeForBox(const RenderBox* box, RenderRegion*
     range.setRange(startRegion, endRegion);
 }
 
-bool RenderFlowThread::hasCachedRegionRangeForBox(const RenderBox* box) const
+bool RenderFlowThread::hasCachedRegionRangeForBox(const RenderBox& box) const
 {
-    ASSERT(box);
-
-    return m_regionRangeMap.contains(box);
+    return m_regionRangeMap.contains(&box);
 }
 
 bool RenderFlowThread::getRegionRangeForBoxFromCachedInfo(const RenderBox* box, RenderRegion*& startRegion, RenderRegion*& endRegion) const
@@ -802,11 +798,10 @@ bool RenderFlowThread::computedRegionRangeForBox(const RenderBox* box, RenderReg
     if (getRegionRangeForBox(box, startRegion, endRegion))
         return true;
 
-    // Search the region range using the information provided by the
-    // containing block chain.
-    RenderBox* cb = const_cast<RenderBox*>(box);
-    while (!cb->isRenderFlowThread()) {
-        InlineElementBox* boxWrapper = cb->inlineBoxWrapper();
+    // Search the region range using the information provided by the containing block chain.
+    auto* containingBlock = const_cast<RenderBox*>(box);
+    while (!containingBlock->isRenderFlowThread()) {
+        InlineElementBox* boxWrapper = containingBlock->inlineBoxWrapper();
         if (boxWrapper && boxWrapper->root().containingRegion()) {
             startRegion = endRegion = boxWrapper->root().containingRegion();
             ASSERT(m_regionList.contains(startRegion));
@@ -816,18 +811,17 @@ bool RenderFlowThread::computedRegionRangeForBox(const RenderBox* box, RenderReg
         // FIXME: Use the containingBlock() value once we patch all the layout systems to be region range aware
         // (e.g. if we use containingBlock() the shadow controls of a video element won't get the range from the
         // video box because it's not a block; they need to be patched separately).
-        ASSERT(cb->parent());
-        cb = &cb->parent()->enclosingBox();
-        ASSERT(cb);
+        ASSERT(containingBlock->parent());
+        containingBlock = &containingBlock->parent()->enclosingBox();
+        ASSERT(containingBlock);
 
         // If a box doesn't have a cached region range it usually means the box belongs to a line so startRegion should be equal with endRegion.
         // FIXME: Find the cases when this startRegion should not be equal with endRegion and make sure these boxes have cached region ranges.
-        if (hasCachedRegionRangeForBox(cb)) {
-            startRegion = endRegion = regionAtBlockOffset(cb, box->offsetFromLogicalTopOfFirstPage(), true);
+        if (containingBlock && hasCachedRegionRangeForBox(*containingBlock)) {
+            startRegion = endRegion = regionAtBlockOffset(containingBlock, containingBlock->offsetFromLogicalTopOfFirstPage(), true);
             return true;
         }
     }
-
     ASSERT_NOT_REACHED();
     return false;
 }
@@ -931,7 +925,7 @@ bool RenderFlowThread::isAutoLogicalHeightRegionsCountConsistent() const
 #endif
 
 #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
-bool RenderFlowThread::checkLinesConsistency(const RenderBlockFlow* removedBlock) const
+bool RenderFlowThread::checkLinesConsistency(const RenderBlockFlow& removedBlock) const
 {
     if (!m_lineToRegionMap)
         return true;
@@ -939,7 +933,7 @@ bool RenderFlowThread::checkLinesConsistency(const RenderBlockFlow* removedBlock
     for (auto& linePair : *m_lineToRegionMap.get()) {
         const RootInlineBox* line = linePair.key;
         RenderRegion* region = linePair.value;
-        if (&line->blockFlow() == removedBlock)
+        if (&line->blockFlow() == &removedBlock)
             return false;
         if (line->blockFlow().flowThreadState() == NotInsideFlowThread)
             return false;
index 33a6adb..3b3b35e 100644 (file)
@@ -60,13 +60,13 @@ class RenderFlowThread: public RenderBlockFlow {
 public:
     virtual ~RenderFlowThread() { }
 
-    virtual void removeFlowChildInfo(RenderElement*);
+    virtual void removeFlowChildInfo(RenderElement&);
 #ifndef NDEBUG
     bool hasChildInfo(RenderObject* child) const { return is<RenderBox>(child) && m_regionRangeMap.contains(downcast<RenderBox>(child)); }
 #endif
 
 #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
-    bool checkLinesConsistency(const RenderBlockFlow*) const;
+    bool checkLinesConsistency(const RenderBlockFlow&) const;
 #endif
     
     void deleteLines() override;
@@ -133,10 +133,10 @@ public:
     bool previousRegionCountChanged() const { return m_previousRegionCount != m_regionList.size(); };
     void updatePreviousRegionCount() { m_previousRegionCount = m_regionList.size(); };
 
-    virtual void setRegionRangeForBox(const RenderBox*, RenderRegion*, RenderRegion*);
+    virtual void setRegionRangeForBox(const RenderBox&, RenderRegion*, RenderRegion*);
     bool getRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
     bool computedRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
-    bool hasCachedRegionRangeForBox(const RenderBox*) const;
+    bool hasCachedRegionRangeForBox(const RenderBox&) const;
 
     // Check if the object is in region and the region is part of this flow thread.
     bool objectInFlowRegion(const RenderObject*, const RenderRegion*) const;
@@ -200,7 +200,7 @@ public:
     void pushFlowThreadLayoutState(const RenderObject&);
     void popFlowThreadLayoutState();
     LayoutUnit offsetFromLogicalTopOfFirstRegion(const RenderBlock*) const;
-    void clearRenderBoxRegionInfoAndCustomStyle(const RenderBox*, const RenderRegion*, const RenderRegion*, const RenderRegion*, const RenderRegion*);
+    void clearRenderBoxRegionInfoAndCustomStyle(const RenderBox&, const RenderRegion*, const RenderRegion*, const RenderRegion*, const RenderRegion*);
 
     void addRegionsVisualEffectOverflow(const RenderBox*);
     void addRegionsVisualOverflowFromTheme(const RenderBlock*);
@@ -274,8 +274,8 @@ protected:
 
     bool getRegionRangeForBoxFromCachedInfo(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const;
 
-    void removeRenderBoxRegionInfo(RenderBox*);
-    void removeLineRegionInfo(const RenderBlockFlow*);
+    void removeRenderBoxRegionInfo(RenderBox&);
+    void removeLineRegionInfo(const RenderBlockFlow&);
 
     RenderRegionList m_regionList;
     unsigned short m_previousRegionCount;
index 8c49cf3..82f2840 100644 (file)
@@ -545,7 +545,7 @@ RenderRegion* RenderMultiColumnFlowThread::regionAtBlockOffset(const RenderBox*
     return columnSet;
 }
 
-void RenderMultiColumnFlowThread::setRegionRangeForBox(const RenderBox* box, RenderRegion* startRegion, RenderRegion* endRegion)
+void RenderMultiColumnFlowThread::setRegionRangeForBox(const RenderBox& box, RenderRegion* startRegion, RenderRegion* endRegion)
 {
     // Some column sets may have zero height, which means that two or more sets may start at the
     // exact same flow thread position, which means that some parts of the code may believe that a
index b97376f..84273b7 100644 (file)
@@ -121,7 +121,7 @@ private:
     void setPageBreak(const RenderBlock*, LayoutUnit offset, LayoutUnit spaceShortage) override;
     void updateMinimumPageHeight(const RenderBlock*, LayoutUnit offset, LayoutUnit minHeight) override;
     RenderRegion* regionAtBlockOffset(const RenderBox*, LayoutUnit, bool extendLastRegion = false) const override;
-    void setRegionRangeForBox(const RenderBox*, RenderRegion*, RenderRegion*) override;
+    void setRegionRangeForBox(const RenderBox&, RenderRegion*, RenderRegion*) override;
     bool addForcedRegionBreak(const RenderBlock*, LayoutUnit, RenderBox* breakChild, bool isBefore, LayoutUnit* offsetBreakAdjustment = 0) override;
     bool isPageLogicalHeightKnown() const override;
 
index 3150de8..fffec01 100644 (file)
@@ -401,14 +401,13 @@ void RenderNamedFlowFragment::setRendererStyleInRegion(RenderElement& renderer,
     m_rendererRegionStyle.set(&renderer, WTFMove(styleInfo));
 }
 
-void RenderNamedFlowFragment::clearObjectStyleInRegion(const RenderElement* object)
+void RenderNamedFlowFragment::clearObjectStyleInRegion(const RenderElement& object)
 {
-    ASSERT(object);
-    m_rendererRegionStyle.remove(object);
+    m_rendererRegionStyle.remove(&object);
 
     // Clear the style for the children of this object.
-    for (auto& child : childrenOfType<RenderElement>(*object))
-        clearObjectStyleInRegion(&child);
+    for (auto& child : childrenOfType<RenderElement>(object))
+        clearObjectStyleInRegion(child);
 }
 
 void RenderNamedFlowFragment::setRegionObjectsRegionStyle()
index 1e2a010..aac4f92 100644 (file)
@@ -79,7 +79,7 @@ public:
     RenderLayerModelObject& layerOwner() const { return downcast<RenderLayerModelObject>(*parent()); }
 
     bool hasCustomRegionStyle() const { return m_hasCustomRegionStyle; }
-    void clearObjectStyleInRegion(const RenderElement*);
+    void clearObjectStyleInRegion(const RenderElement&);
 
     void setRegionObjectsRegionStyle();
     void restoreRegionObjectsOriginalStyle();
index 3765409..0a8651e 100644 (file)
@@ -779,7 +779,7 @@ void RenderNamedFlowThread::checkRegionsWithStyling()
     m_hasRegionsWithStyling = hasRegionsWithStyling;
 }
 
-void RenderNamedFlowThread::clearRenderObjectCustomStyle(const RenderElement* object)
+void RenderNamedFlowThread::clearRenderObjectCustomStyle(const RenderElement& object)
 {
     // Clear the styles for the object in the regions.
     // FIXME: Region styling is not computed only for the region range of the object so this is why we need to walk the whole chain.
@@ -787,7 +787,7 @@ void RenderNamedFlowThread::clearRenderObjectCustomStyle(const RenderElement* ob
         downcast<RenderNamedFlowFragment>(*region).clearObjectStyleInRegion(object);
 }
 
-void RenderNamedFlowThread::removeFlowChildInfo(RenderElement* child)
+void RenderNamedFlowThread::removeFlowChildInfo(RenderElement& child)
 {
     RenderFlowThread::removeFlowChildInfo(child);
     clearRenderObjectCustomStyle(child);
index 8c1ef0a..fee2f35 100644 (file)
@@ -82,9 +82,9 @@ public:
     bool hasRegionsWithStyling() const { return m_hasRegionsWithStyling; }
     void checkRegionsWithStyling();
 
-    void clearRenderObjectCustomStyle(const RenderElement*);
+    void clearRenderObjectCustomStyle(const RenderElement&);
 
-    void removeFlowChildInfo(RenderElement*) override;
+    void removeFlowChildInfo(RenderElement&) override;
 
     LayoutUnit flowContentBottom() const { return m_flowContentBottom; }
     void dispatchNamedFlowEvents();
index efa0722..6bb7890 100644 (file)
@@ -325,9 +325,9 @@ std::unique_ptr<RenderBoxRegionInfo> RenderRegion::takeRenderBoxRegionInfo(const
     return m_renderBoxRegionInfo.take(box);
 }
 
-void RenderRegion::removeRenderBoxRegionInfo(const RenderBox* box)
+void RenderRegion::removeRenderBoxRegionInfo(const RenderBox& box)
 {
-    m_renderBoxRegionInfo.remove(box);
+    m_renderBoxRegionInfo.remove(&box);
 }
 
 void RenderRegion::deleteAllRenderBoxRegionInfo()
index 9a44010..b67d516 100644 (file)
@@ -68,7 +68,7 @@ public:
     RenderBoxRegionInfo* setRenderBoxRegionInfo(const RenderBox*, LayoutUnit logicalLeftInset, LayoutUnit logicalRightInset,
         bool containingBlockChainIsInset);
     std::unique_ptr<RenderBoxRegionInfo> takeRenderBoxRegionInfo(const RenderBox*);
-    void removeRenderBoxRegionInfo(const RenderBox*);
+    void removeRenderBoxRegionInfo(const RenderBox&);
 
     void deleteAllRenderBoxRegionInfo();