Make the placed floats tree use LayoutUnit instead of int
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2013 01:32:33 +0000 (01:32 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Nov 2013 01:32:33 +0000 (01:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124207

Reviewed by Alexandru Chiculita.

The dimensions of floats are in LayoutUnits, so it doesn't make sense
to be converting to ints for use in the placed floats tree.

Also add missed "explicit" to single argument FloatingObjects
constructor.

No new tests, no behavior change.

* rendering/FloatingObjects.cpp:
(WebCore::rangesIntersect):
(WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
(WebCore::ComputeFloatOffsetAdapter::lowValue):
(WebCore::ComputeFloatOffsetAdapter::highValue):
(WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
(WebCore::FindNextFloatLogicalBottomAdapter::lowValue):
(WebCore::FindNextFloatLogicalBottomAdapter::highValue):
* rendering/FloatingObjects.h:
* rendering/RenderFlowThread.h:

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

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

index 426a1e4..562112d 100644 (file)
@@ -1,3 +1,29 @@
+2013-11-12  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        Make the placed floats tree use LayoutUnit instead of int
+        https://bugs.webkit.org/show_bug.cgi?id=124207
+
+        Reviewed by Alexandru Chiculita.
+
+        The dimensions of floats are in LayoutUnits, so it doesn't make sense
+        to be converting to ints for use in the placed floats tree.
+
+        Also add missed "explicit" to single argument FloatingObjects
+        constructor.
+
+        No new tests, no behavior change.
+
+        * rendering/FloatingObjects.cpp:
+        (WebCore::rangesIntersect):
+        (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
+        (WebCore::ComputeFloatOffsetAdapter::lowValue):
+        (WebCore::ComputeFloatOffsetAdapter::highValue):
+        (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
+        (WebCore::FindNextFloatLogicalBottomAdapter::lowValue):
+        (WebCore::FindNextFloatLogicalBottomAdapter::highValue):
+        * rendering/FloatingObjects.h:
+        * rendering/RenderFlowThread.h:
+
 2013-11-12  Alexey Proskuryakov  <ap@apple.com>
 
         Implement key generation and JWK import for RSASSA-PKCS1-v1_5
index 60e1910..12556a4 100644 (file)
@@ -99,7 +99,7 @@ std::unique_ptr<FloatingObject> FloatingObject::unsafeClone() const
     return cloneObject;
 }
 
-inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom)
+inline static bool rangesIntersect(LayoutUnit floatTop, LayoutUnit floatBottom, LayoutUnit objectTop, LayoutUnit objectBottom)
 {
     if (objectTop >= floatBottom || objectBottom < floatTop)
         return false;
@@ -126,15 +126,15 @@ public:
 
     ComputeFloatOffsetAdapter(const RenderBlockFlow& renderer, LayoutUnit lineTop, LayoutUnit lineBottom, LayoutUnit offset)
         : m_renderer(renderer)
-        , m_lineTop(roundToInt(lineTop))
-        , m_lineBottom(roundToInt(lineBottom))
+        , m_lineTop(lineTop)
+        , m_lineBottom(lineBottom)
         , m_offset(offset)
         , m_outermostFloat(0)
     {
     }
 
-    int lowValue() const { return m_lineTop; }
-    int highValue() const { return m_lineBottom; }
+    LayoutUnit lowValue() const { return m_lineTop; }
+    LayoutUnit highValue() const { return m_lineBottom; }
     void collectIfNeeded(const IntervalType&);
 
     LayoutUnit offset() const { return m_offset; }
@@ -145,8 +145,8 @@ private:
     bool updateOffsetIfNeeded(const FloatingObject*);
 
     const RenderBlockFlow& m_renderer;
-    int m_lineTop;
-    int m_lineBottom;
+    LayoutUnit m_lineTop;
+    LayoutUnit m_lineBottom;
     LayoutUnit m_offset;
     const FloatingObject* m_outermostFloat;
 };
@@ -157,15 +157,15 @@ public:
 
     FindNextFloatLogicalBottomAdapter(const RenderBlockFlow& renderer, LayoutUnit belowLogicalHeight)
         : m_renderer(renderer)
-        , m_belowLogicalHeight(floorToInt(belowLogicalHeight))
-        , m_aboveLogicalHeight(roundToInt(LayoutUnit::max()))
+        , m_belowLogicalHeight(belowLogicalHeight)
+        , m_aboveLogicalHeight(LayoutUnit::max())
         , m_nextLogicalBottom(LayoutUnit::max())
         , m_nextShapeLogicalBottom(LayoutUnit::max())
     {
     }
 
-    int lowValue() const { return m_belowLogicalHeight; }
-    int highValue() const { return m_aboveLogicalHeight; }
+    LayoutUnit lowValue() const { return m_belowLogicalHeight; }
+    LayoutUnit highValue() const { return m_aboveLogicalHeight; }
     void collectIfNeeded(const IntervalType&);
 
     LayoutUnit nextLogicalBottom() { return m_nextLogicalBottom == LayoutUnit::max() ? LayoutUnit() : m_nextLogicalBottom; }
@@ -173,8 +173,8 @@ public:
 
 private:
     const RenderBlockFlow& m_renderer;
-    int m_belowLogicalHeight;
-    int m_aboveLogicalHeight;
+    LayoutUnit m_belowLogicalHeight;
+    LayoutUnit m_aboveLogicalHeight;
     LayoutUnit m_nextLogicalBottom;
     LayoutUnit m_nextShapeLogicalBottom;
 };
index d451dba..8519237 100644 (file)
@@ -113,8 +113,8 @@ struct FloatingObjectHashTranslator {
 
 typedef ListHashSet<std::unique_ptr<FloatingObject>, 4, FloatingObjectHashFunctions> FloatingObjectSet;
 
-typedef PODInterval<int, FloatingObject*> FloatingObjectInterval;
-typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree;
+typedef PODInterval<LayoutUnit, FloatingObject*> FloatingObjectInterval;
+typedef PODIntervalTree<LayoutUnit, FloatingObject*> FloatingObjectTree;
 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> IntervalArena;
 
 // FIXME: This is really the same thing as FloatingObjectSet.
@@ -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&);
+    explicit FloatingObjects(const RenderBlockFlow&);
     ~FloatingObjects();
 
     void clear();