Commit e3b3816a authored by hyatt@apple.com's avatar hyatt@apple.com

2009-01-26 David Hyatt <hyatt@apple.com>

        Eliminate rightmostPosition, lowestPosition and leftmostPosition from RenderFlow.  Move the code into
        RenderBlock's methods.

        Reviewed by Eric Seidel

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::lowestPosition):
        (WebCore::RenderBlock::rightmostPosition):
        (WebCore::RenderBlock::leftmostPosition):
        * rendering/RenderFlow.cpp:
        * rendering/RenderFlow.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6a1dcd50
2009-01-26 David Hyatt <hyatt@apple.com>
Eliminate rightmostPosition, lowestPosition and leftmostPosition from RenderFlow. Move the code into
RenderBlock's methods.
Reviewed by Eric Seidel
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::lowestPosition):
(WebCore::RenderBlock::rightmostPosition):
(WebCore::RenderBlock::leftmostPosition):
* rendering/RenderFlow.cpp:
* rendering/RenderFlow.h:
2009-01-26 Darin Fisher <darin@chromium.org>
Reviewed by Eric Seidel.
......@@ -2559,7 +2559,23 @@ IntRect RenderBlock::floatRect() const
int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
{
int bottom = RenderFlow::lowestPosition(includeOverflowInterior, includeSelf);
if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
return includeSelf && width() > 0 ? overflowHeight(false) : 0;
int bottom = includeSelf && width() > 0 ? height() : 0;
if (!hasColumns()) {
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
// For now, we have to descend into all the children, since we may have a huge abs div inside
// a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
// the abs div.
for (RenderObject* c = firstChild(); c; c = c->nextSibling()) {
if (!c->isFloatingOrPositioned() && !c->isText() && !c->isRenderInline())
bottom = max(bottom, toRenderBox(c)->y() + c->lowestPosition(false));
}
}
if (includeSelf && isRelPositioned())
bottom += relativePositionOffsetY();
if (!includeOverflowInterior && hasOverflowClip())
return bottom;
......@@ -2605,7 +2621,6 @@ int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf)
}
}
if (!includeSelf && lastLineBox()) {
int lp = lastLineBox()->yPos() + lastLineBox()->height();
bottom = max(bottom, lp);
......@@ -2616,7 +2631,25 @@ int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf)
int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
int right = RenderFlow::rightmostPosition(includeOverflowInterior, includeSelf);
if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
return includeSelf && height() > 0 ? overflowWidth(false) : 0;
int right = includeSelf && height() > 0 ? width() : 0;
if (!hasColumns()) {
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
// For now, we have to descend into all the children, since we may have a huge abs div inside
// a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
// the abs div.
for (RenderObject* c = firstChild(); c; c = c->nextSibling()) {
if (!c->isFloatingOrPositioned() && c->isBox() && !c->isRenderInline())
right = max(right, toRenderBox(c)->x() + c->rightmostPosition(false));
}
}
if (includeSelf && isRelPositioned())
right += relativePositionOffsetX();
if (!includeOverflowInterior && hasOverflowClip())
return right;
......@@ -2678,7 +2711,24 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel
int RenderBlock::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
int left = RenderFlow::leftmostPosition(includeOverflowInterior, includeSelf);
if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
return includeSelf && height() > 0 ? overflowLeft(false) : width();
int left = includeSelf && height() > 0 ? 0 : width();
if (!hasColumns()) {
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
// For now, we have to descend into all the children, since we may have a huge abs div inside
// a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
// the abs div.
for (RenderObject* c = firstChild(); c; c = c->nextSibling()) {
if (!c->isFloatingOrPositioned() && c->isBox() && !c->isRenderInline())
left = min(left, toRenderBox(c)->x() + c->leftmostPosition(false));
}
}
if (includeSelf && isRelPositioned())
left += relativePositionOffsetX();
if (!includeOverflowInterior && hasOverflowClip())
return left;
......
......@@ -480,79 +480,6 @@ bool RenderFlow::hitTestLines(const HitTestRequest& request, HitTestResult& resu
return false;
}
int RenderFlow::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
{
ASSERT(!isRenderInline());
if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
return includeSelf && width() > 0 ? overflowHeight(false) : 0;
int bottom = includeSelf && width() > 0 ? height() : 0;
if (!hasColumns()) {
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
// For now, we have to descend into all the children, since we may have a huge abs div inside
// a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
// the abs div.
for (RenderObject* c = firstChild(); c; c = c->nextSibling()) {
if (!c->isFloatingOrPositioned() && !c->isText() && !c->isRenderInline())
bottom = max(bottom, toRenderBox(c)->y() + c->lowestPosition(false));
}
}
if (includeSelf && isRelPositioned())
bottom += relativePositionOffsetY();
return bottom;
}
int RenderFlow::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
ASSERT(!isRenderInline());
if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
return includeSelf && height() > 0 ? overflowWidth(false) : 0;
int right = includeSelf && height() > 0 ? width() : 0;
if (!hasColumns()) {
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
// For now, we have to descend into all the children, since we may have a huge abs div inside
// a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
// the abs div.
for (RenderObject* c = firstChild(); c; c = c->nextSibling()) {
if (!c->isFloatingOrPositioned() && c->isBox() && !c->isRenderInline())
right = max(right, toRenderBox(c)->x() + c->rightmostPosition(false));
}
}
if (includeSelf && isRelPositioned())
right += relativePositionOffsetX();
return right;
}
int RenderFlow::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
ASSERT(!isRenderInline());
if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
return includeSelf && height() > 0 ? overflowLeft(false) : width();
int left = includeSelf && height() > 0 ? 0 : width();
if (!hasColumns()) {
// FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
// For now, we have to descend into all the children, since we may have a huge abs div inside
// a tiny rel div buried somewhere deep in our child tree. In this case we have to get to
// the abs div.
for (RenderObject* c = firstChild(); c; c = c->nextSibling()) {
if (!c->isFloatingOrPositioned() && c->isBox() && !c->isRenderInline())
left = min(left, toRenderBox(c)->x() + c->leftmostPosition(false));
}
}
if (includeSelf && isRelPositioned())
left += relativePositionOffsetX();
return left;
}
IntRect RenderFlow::localCaretRect(InlineBox* inlineBox, int caretOffset, int* extraWidthToEndOfLine)
{
// Do the normal calculation in most cases.
......
......@@ -89,10 +89,6 @@ public:
void paintLines(PaintInfo&, int tx, int ty);
bool hitTestLines(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
virtual int lowestPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
virtual int rightmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
virtual int leftmostPosition(bool includeOverflowInterior = true, bool includeSelf = true) const;
virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
......
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