Use references instead of pointers to RenderBlockFlow in FloatingObjects and ComputeF...
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Nov 2013 23:24:40 +0000 (23:24 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Nov 2013 23:24:40 +0000 (23:24 +0000)
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):

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/FloatingObjects.cpp
Source/WebCore/rendering/FloatingObjects.h
Source/WebCore/rendering/RenderBlockFlow.cpp

index 0a9d98d..071fbcf 100644 (file)
@@ -1,3 +1,31 @@
+2013-11-08  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        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):
+
 2013-11-08  Sam Weinig  <sam@webkit.org>
 
         Teach SubframeLoader a bit about references
index 4a04ade..2eceb4c 100644 (file)
@@ -125,7 +125,7 @@ class ComputeFloatOffsetAdapter {
 public:
     typedef FloatingObjectInterval IntervalType;
 
-    ComputeFloatOffsetAdapter(const RenderBlockFlow* renderer, LayoutUnit lineTop, LayoutUnit lineBottom, LayoutUnit offset)
+    ComputeFloatOffsetAdapter(const RenderBlockFlow& renderer, LayoutUnit lineTop, LayoutUnit lineBottom, LayoutUnit offset)
         : m_renderer(renderer)
         , m_lineTop(roundToInt(lineTop))
         , m_lineBottom(roundToInt(lineBottom))
@@ -145,7 +145,7 @@ public:
 private:
     bool updateOffsetIfNeeded(const FloatingObject*);
 
-    const RenderBlockFlow* m_renderer;
+    const RenderBlockFlow& m_renderer;
     int m_lineTop;
     int m_lineBottom;
     LayoutUnit m_offset;
@@ -207,7 +207,7 @@ inline void FindNextFloatLogicalBottomAdapter::collectIfNeeded(const IntervalTyp
 
 LayoutUnit FloatingObjects::findNextFloatLogicalBottomBelow(LayoutUnit logicalHeight)
 {
-    FindNextFloatLogicalBottomAdapter adapter(*m_renderer, logicalHeight);
+    FindNextFloatLogicalBottomAdapter adapter(m_renderer, logicalHeight);
     placedFloatsTree().allOverlapsWithAdapter(adapter);
 
     return adapter.nextShapeLogicalBottom();
@@ -215,17 +215,17 @@ LayoutUnit FloatingObjects::findNextFloatLogicalBottomBelow(LayoutUnit logicalHe
 
 LayoutUnit FloatingObjects::findNextFloatLogicalBottomBelowForBlock(LayoutUnit logicalHeight)
 {
-    FindNextFloatLogicalBottomAdapter adapter(*m_renderer, logicalHeight);
+    FindNextFloatLogicalBottomAdapter adapter(m_renderer, logicalHeight);
     placedFloatsTree().allOverlapsWithAdapter(adapter);
 
     return adapter.nextLogicalBottom();
 }
 
-FloatingObjects::FloatingObjects(const RenderBlockFlow* renderer, bool horizontalWritingMode)
+FloatingObjects::FloatingObjects(const RenderBlockFlow& renderer)
     : m_placedFloatsTree(UninitializedTree)
     , m_leftObjectsCount(0)
     , m_rightObjectsCount(0)
-    , m_horizontalWritingMode(horizontalWritingMode)
+    , m_horizontalWritingMode(renderer.isHorizontalWritingMode())
     , m_renderer(renderer)
 {
 }
@@ -238,7 +238,7 @@ void FloatingObjects::clearLineBoxTreePointers()
 {
     // Clear references to originating lines, since the lines are being deleted
     for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
-        ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == m_renderer);
+        ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == &m_renderer);
         (*it)->setOriginatingLine(0);
     }
 }
@@ -341,7 +341,7 @@ void FloatingObjects::computePlacedFloatsTree()
     ASSERT(!m_placedFloatsTree.isInitialized());
     if (m_set.isEmpty())
         return;
-    m_placedFloatsTree.initIfNeeded(m_renderer->view().intervalArena());
+    m_placedFloatsTree.initIfNeeded(m_renderer.view().intervalArena());
     for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
         FloatingObject* floatingObject = it->get();
         if (floatingObject->isPlaced())
@@ -357,11 +357,11 @@ inline const FloatingObjectTree& FloatingObjects::placedFloatsTree()
 }
 
 #if ENABLE(CSS_SHAPES)
-static inline ShapeOutsideInfo* shapeInfoForFloat(const FloatingObject* floatingObject, const RenderBlockFlow* containingBlock, LayoutUnit lineTop, LayoutUnit lineBottom)
+static inline ShapeOutsideInfo* shapeInfoForFloat(const FloatingObject* floatingObject, const RenderBlockFlow& containingBlock, LayoutUnit lineTop, LayoutUnit lineBottom)
 {
     if (floatingObject) {
         if (ShapeOutsideInfo* shapeOutside = floatingObject->renderer().shapeOutsideInfo()) {
-            shapeOutside->updateDeltasForContainingBlockLine(containingBlock, floatingObject, lineTop, lineBottom - lineTop);
+            shapeOutside->updateDeltasForContainingBlockLine(&containingBlock, floatingObject, lineTop, lineBottom - lineTop);
             return shapeOutside;
         }
     }
@@ -433,7 +433,7 @@ LayoutUnit FloatingObjects::logicalRightOffset(LayoutUnit fixedOffset, LayoutUni
 template<>
 inline bool ComputeFloatOffsetAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
 {
-    LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject);
+    LayoutUnit logicalRight = m_renderer.logicalRightForFloat(floatingObject);
     if (logicalRight > m_offset) {
         m_offset = logicalRight;
         return true;
@@ -444,7 +444,7 @@ inline bool ComputeFloatOffsetAdapter<FloatingObject::FloatLeft>::updateOffsetIf
 template<>
 inline bool ComputeFloatOffsetAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
 {
-    LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject);
+    LayoutUnit logicalLeft = m_renderer.logicalLeftForFloat(floatingObject);
     if (logicalLeft < m_offset) {
         m_offset = logicalLeft;
         return true;
@@ -461,7 +461,7 @@ inline void ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const Int
 
     // All the objects returned from the tree should be already placed.
     ASSERT(floatingObject->isPlaced());
-    ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingObject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lineTop, m_lineBottom));
+    ASSERT(rangesIntersect(m_renderer.pixelSnappedLogicalTopForFloat(floatingObject), m_renderer.pixelSnappedLogicalBottomForFloat(floatingObject), m_lineTop, m_lineBottom));
 
     bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
     if (floatIsNewExtreme)
@@ -471,7 +471,7 @@ inline void ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const Int
 template <FloatingObject::Type FloatTypeValue>
 LayoutUnit ComputeFloatOffsetAdapter<FloatTypeValue>::heightRemaining() const
 {
-    return m_outermostFloat ? m_renderer->logicalBottomForFloat(m_outermostFloat) - m_lineTop : LayoutUnit(1);
+    return m_outermostFloat ? m_renderer.logicalBottomForFloat(m_outermostFloat) - m_lineTop : LayoutUnit(1);
 }
 
 #ifndef NDEBUG
index 0b475cf..628940f 100644 (file)
@@ -124,7 +124,7 @@ typedef HashMap<RenderBox*, std::unique_ptr<FloatingObject>> RendererToFloatInfo
 class FloatingObjects {
     WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED;
 public:
-    FloatingObjects(const RenderBlockFlow*, bool horizontalWritingMode);
+    FloatingObjects(const RenderBlockFlow&);
     ~FloatingObjects();
 
     void clear();
@@ -161,7 +161,7 @@ private:
     unsigned m_leftObjectsCount;
     unsigned m_rightObjectsCount;
     bool m_horizontalWritingMode;
-    const RenderBlockFlow* m_renderer;
+    const RenderBlockFlow& m_renderer;
 };
 
 #ifndef NDEBUG
index 12cdb95..8e99c51 100644 (file)
@@ -1927,7 +1927,7 @@ void RenderBlockFlow::clipOutFloatingObjects(RenderBlock& rootBlock, const Paint
 
 void RenderBlockFlow::createFloatingObjects()
 {
-    m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMode()));
+    m_floatingObjects = adoptPtr(new FloatingObjects(*this));
 }
 
 void RenderBlockFlow::removeFloatingObjects()