Title: [154758] trunk/Source/WebCore
Revision
154758
Author
[email protected]
Date
2013-08-28 10:11:59 -0700 (Wed, 28 Aug 2013)

Log Message

Code cleanup: rename FloatIntervalSearchAdapter and remove unnecessary inlines
https://bugs.webkit.org/show_bug.cgi?id=120378

Reviewed by Darin Adler.

Rename FloatIntervalSearchAdapter to ComputeFloatOffsetAdapter. The
naming of this adapter has caused much confusion in reading the code,
as it wasn't apparent that calls to it were actually doing anything
other than searching the interval tree. The new name is a much better
description of what it actually does.

Also, rename m_lowValue and m_highValue member variables to make it
easier to read the code that uses them.

Removed the inlines based on a change by eseidel in Blink.

No new tests, no behavior change.

* rendering/RenderBlock.cpp:
(WebCore::::updateOffsetIfNeeded): Update for renames.
(WebCore::::collectIfNeeded): Ditto.
(WebCore::::getHeightRemaining): Ditto.
(WebCore::RenderBlock::logicalLeftFloatOffsetForLine): Ditto.
(WebCore::RenderBlock::logicalRightFloatOffsetForLine): Ditto.
* rendering/RenderBlock.h:
(WebCore::RenderBlock::FloatingObject::x): Remove unnecessary inline.
(WebCore::RenderBlock::FloatingObject::maxX): Ditto.
(WebCore::RenderBlock::FloatingObject::y): Ditto.
(WebCore::RenderBlock::FloatingObject::maxY): Ditto.
(WebCore::RenderBlock::FloatingObject::width): Ditto.
(WebCore::RenderBlock::FloatingObject::height): Ditto.
(WebCore::RenderBlock::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter): Rename.
(WebCore::RenderBlock::ComputeFloatOffsetAdapter::lowValue): Rename m_lowValue.
(WebCore::RenderBlock::ComputeFloatOffsetAdapter::highValue): Rename m_highValue.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154757 => 154758)


--- trunk/Source/WebCore/ChangeLog	2013-08-28 17:11:40 UTC (rev 154757)
+++ trunk/Source/WebCore/ChangeLog	2013-08-28 17:11:59 UTC (rev 154758)
@@ -1,3 +1,40 @@
+2013-08-28  Bem Jones-Bey  <[email protected]>
+
+        Code cleanup: rename FloatIntervalSearchAdapter and remove unnecessary inlines
+        https://bugs.webkit.org/show_bug.cgi?id=120378
+
+        Reviewed by Darin Adler.
+
+        Rename FloatIntervalSearchAdapter to ComputeFloatOffsetAdapter. The
+        naming of this adapter has caused much confusion in reading the code,
+        as it wasn't apparent that calls to it were actually doing anything
+        other than searching the interval tree. The new name is a much better
+        description of what it actually does.
+
+        Also, rename m_lowValue and m_highValue member variables to make it
+        easier to read the code that uses them.
+
+        Removed the inlines based on a change by eseidel in Blink.
+
+        No new tests, no behavior change.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::::updateOffsetIfNeeded): Update for renames.
+        (WebCore::::collectIfNeeded): Ditto.
+        (WebCore::::getHeightRemaining): Ditto.
+        (WebCore::RenderBlock::logicalLeftFloatOffsetForLine): Ditto.
+        (WebCore::RenderBlock::logicalRightFloatOffsetForLine): Ditto.
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::FloatingObject::x): Remove unnecessary inline.
+        (WebCore::RenderBlock::FloatingObject::maxX): Ditto.
+        (WebCore::RenderBlock::FloatingObject::y): Ditto.
+        (WebCore::RenderBlock::FloatingObject::maxY): Ditto.
+        (WebCore::RenderBlock::FloatingObject::width): Ditto.
+        (WebCore::RenderBlock::FloatingObject::height): Ditto.
+        (WebCore::RenderBlock::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter): Rename.
+        (WebCore::RenderBlock::ComputeFloatOffsetAdapter::lowValue): Rename m_lowValue.
+        (WebCore::RenderBlock::ComputeFloatOffsetAdapter::highValue): Rename m_highValue.
+
 2013-08-28  Tamas Czene  <[email protected]>
 
         Resolve unused parameter warning in ScriptedAnimationController.cpp.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (154757 => 154758)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-08-28 17:11:40 UTC (rev 154757)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-08-28 17:11:59 UTC (rev 154758)
@@ -4439,7 +4439,7 @@
 }
 
 template<>
-inline bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
+inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
 {
     LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject);
     if (logicalRight > m_offset) {
@@ -4450,7 +4450,7 @@
 }
 
 template<>
-inline bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
+inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject)
 {
     LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject);
     if (logicalLeft < m_offset) {
@@ -4461,15 +4461,15 @@
 }
 
 template <RenderBlock::FloatingObject::Type FloatTypeValue>
-inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval)
+inline void RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval)
 {
     const FloatingObject* floatingObject = interval.data();
-    if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lowValue, m_highValue))
+    if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom))
         return;
 
     // 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_lowValue, m_highValue));
+    ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingObject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lineTop, m_lineBottom));
 
     bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
     if (floatIsNewExtreme)
@@ -4477,9 +4477,9 @@
 }
 
 template <RenderBlock::FloatingObject::Type FloatTypeValue>
-LayoutUnit RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::getHeightRemaining() const
+LayoutUnit RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::getHeightRemaining() const
 {
-    return m_outermostFloat ? m_renderer->logicalBottomForFloat(m_outermostFloat) - m_lowValue : LayoutUnit(1);
+    return m_outermostFloat ? m_renderer->logicalBottomForFloat(m_outermostFloat) - m_lineTop : LayoutUnit(1);
 }
 
 LayoutUnit RenderBlock::textIndentOffset() const
@@ -4519,7 +4519,7 @@
 #endif
     LayoutUnit left = fixedOffset;
     if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) {
-        FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left);
+        ComputeFloatOffsetAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left);
         m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
 
         if (heightRemaining)
@@ -4587,7 +4587,7 @@
     LayoutUnit right = fixedOffset;
     if (m_floatingObjects && m_floatingObjects->hasRightObjects()) {
         LayoutUnit rightFloatOffset = fixedOffset;
-        FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset);
+        ComputeFloatOffsetAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset);
         m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter);
 
         if (heightRemaining)

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (154757 => 154758)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2013-08-28 17:11:40 UTC (rev 154757)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2013-08-28 17:11:59 UTC (rev 154758)
@@ -737,12 +737,12 @@
         bool isPlaced() const { return m_isPlaced; }
         void setIsPlaced(bool placed = true) { m_isPlaced = placed; }
 
-        inline LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); }
-        inline LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); }
-        inline LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); }
-        inline LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); }
-        inline LayoutUnit width() const { return m_frameRect.width(); }
-        inline LayoutUnit height() const { return m_frameRect.height(); }
+        LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); }
+        LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); }
+        LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); }
+        LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); }
+        LayoutUnit width() const { return m_frameRect.width(); }
+        LayoutUnit height() const { return m_frameRect.height(); }
 
         void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); }
         void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); }
@@ -1205,21 +1205,21 @@
     typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> IntervalArena;
     
     template <FloatingObject::Type FloatTypeValue>
-    class FloatIntervalSearchAdapter {
+    class ComputeFloatOffsetAdapter {
     public:
         typedef FloatingObjectInterval IntervalType;
         
-        FloatIntervalSearchAdapter(const RenderBlock* renderer, int lowValue, int highValue, LayoutUnit& offset)
+        ComputeFloatOffsetAdapter(const RenderBlock* renderer, int lineTop, int lineBottom, LayoutUnit& offset)
             : m_renderer(renderer)
-            , m_lowValue(lowValue)
-            , m_highValue(highValue)
+            , m_lineTop(lineTop)
+            , m_lineBottom(lineBottom)
             , m_offset(offset)
             , m_outermostFloat(0)
         {
         }
         
-        inline int lowValue() const { return m_lowValue; }
-        inline int highValue() const { return m_highValue; }
+        int lowValue() const { return m_lineTop; }
+        int highValue() const { return m_lineBottom; }
         void collectIfNeeded(const IntervalType&);
 
 #if ENABLE(CSS_SHAPES)
@@ -1236,8 +1236,8 @@
         bool updateOffsetIfNeeded(const FloatingObject*);
 
         const RenderBlock* m_renderer;
-        int m_lowValue;
-        int m_highValue;
+        int m_lineTop;
+        int m_lineBottom;
         LayoutUnit& m_offset;
         const FloatingObject* m_outermostFloat;
     };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to