Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Code cleanup: rename FloatIntervalSearchAdapter and remove unnecessar…
…y 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.


Canonical link: https://commits.webkit.org/138398@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
bemjb committed Aug 28, 2013
1 parent 283529d commit 3e879ed
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 23 deletions.
37 changes: 37 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,40 @@
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.
Expand Down
18 changes: 9 additions & 9 deletions Source/WebCore/rendering/RenderBlock.cpp
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -4461,25 +4461,25 @@ 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)
m_outermostFloat = floatingObject;
}

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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
28 changes: 14 additions & 14 deletions Source/WebCore/rendering/RenderBlock.h
Expand Up @@ -737,12 +737,12 @@ class RenderBlock : public RenderBox {
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); }
Expand Down Expand Up @@ -1205,21 +1205,21 @@ class RenderBlock : public RenderBox {
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)
Expand All @@ -1236,8 +1236,8 @@ class RenderBlock : public RenderBox {
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;
};
Expand Down

0 comments on commit 3e879ed

Please sign in to comment.