Commit edd1f691 authored by bjonesbe@adobe.com's avatar bjonesbe@adobe.com
Browse files

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b51a271d
2013-08-28 Bem Jones-Bey <bjonesbe@adobe.com>
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 <tczene@inf.u-szeged.hu>
 
Resolve unused parameter warning in ScriptedAnimationController.cpp.
......@@ -4439,7 +4439,7 @@ inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop,
}
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 @@ inline bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject:
}
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 @@ inline bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject:
}
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 @@ inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
}
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 @@ LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay
#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 RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La
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)
......
......@@ -737,12 +737,12 @@ private:
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 @@ protected:
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 @@ protected:
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;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment