[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hyatt at apple.com
hyatt at apple.com
Wed Dec 22 14:02:57 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f382f2edb034dcd0eb4fffbafa93ff37a0afa688
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 1 21:25:39 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=47015
Reviewed by Sam Weinig.
Change FloatingObject to store its dimensions as a rect.
This will make it easier for logical access for block-flow later on if
top/bottom is no different from left/width. This change also simplifies
calling code a bit in places.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addOverflowFromFloats):
(WebCore::RenderBlock::repaintOverhangingFloats):
(WebCore::RenderBlock::paintFloats):
(WebCore::RenderBlock::fillSelectionGaps):
(WebCore::RenderBlock::insertFloatingObject):
(WebCore::RenderBlock::removeFloatingObject):
(WebCore::RenderBlock::removeFloatingObjectsBelow):
(WebCore::RenderBlock::positionNewFloats):
(WebCore::RenderBlock::positionNewFloatOnLine):
(WebCore::RenderBlock::logicalLeftOffsetForLine):
(WebCore::RenderBlock::logicalRightOffsetForLine):
(WebCore::RenderBlock::nextFloatBottomBelow):
(WebCore::RenderBlock::floatBottom):
(WebCore::RenderBlock::lowestPosition):
(WebCore::RenderBlock::rightmostPosition):
(WebCore::RenderBlock::leftmostPosition):
(WebCore::RenderBlock::leftBottom):
(WebCore::RenderBlock::rightBottom):
(WebCore::RenderBlock::clearFloats):
(WebCore::RenderBlock::addOverhangingFloats):
(WebCore::RenderBlock::addIntrudingFloats):
(WebCore::RenderBlock::hitTestFloats):
(WebCore::RenderBlock::adjustForBorderFit):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::FloatingObject::FloatingObject):
(WebCore::RenderBlock::FloatingObject::left):
(WebCore::RenderBlock::FloatingObject::right):
(WebCore::RenderBlock::FloatingObject::top):
(WebCore::RenderBlock::FloatingObject::bottom):
(WebCore::RenderBlock::FloatingObject::width):
(WebCore::RenderBlock::FloatingObject::height):
(WebCore::RenderBlock::FloatingObject::setLeft):
(WebCore::RenderBlock::FloatingObject::setTop):
(WebCore::RenderBlock::FloatingObject::setWidth):
(WebCore::RenderBlock::FloatingObject::setHeight):
(WebCore::RenderBlock::FloatingObject::frameRect):
(WebCore::RenderBlock::FloatingObject::setFrameRect):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutInlineChildren):
(WebCore::RenderBlock::matchedEndLine):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 97487ee..9b29c1b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,56 @@
+2010-10-01 David Hyatt <hyatt at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=47015
+
+ Change FloatingObject to store its dimensions as a rect.
+ This will make it easier for logical access for block-flow later on if
+ top/bottom is no different from left/width. This change also simplifies
+ calling code a bit in places.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::addOverflowFromFloats):
+ (WebCore::RenderBlock::repaintOverhangingFloats):
+ (WebCore::RenderBlock::paintFloats):
+ (WebCore::RenderBlock::fillSelectionGaps):
+ (WebCore::RenderBlock::insertFloatingObject):
+ (WebCore::RenderBlock::removeFloatingObject):
+ (WebCore::RenderBlock::removeFloatingObjectsBelow):
+ (WebCore::RenderBlock::positionNewFloats):
+ (WebCore::RenderBlock::positionNewFloatOnLine):
+ (WebCore::RenderBlock::logicalLeftOffsetForLine):
+ (WebCore::RenderBlock::logicalRightOffsetForLine):
+ (WebCore::RenderBlock::nextFloatBottomBelow):
+ (WebCore::RenderBlock::floatBottom):
+ (WebCore::RenderBlock::lowestPosition):
+ (WebCore::RenderBlock::rightmostPosition):
+ (WebCore::RenderBlock::leftmostPosition):
+ (WebCore::RenderBlock::leftBottom):
+ (WebCore::RenderBlock::rightBottom):
+ (WebCore::RenderBlock::clearFloats):
+ (WebCore::RenderBlock::addOverhangingFloats):
+ (WebCore::RenderBlock::addIntrudingFloats):
+ (WebCore::RenderBlock::hitTestFloats):
+ (WebCore::RenderBlock::adjustForBorderFit):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::FloatingObject::FloatingObject):
+ (WebCore::RenderBlock::FloatingObject::left):
+ (WebCore::RenderBlock::FloatingObject::right):
+ (WebCore::RenderBlock::FloatingObject::top):
+ (WebCore::RenderBlock::FloatingObject::bottom):
+ (WebCore::RenderBlock::FloatingObject::width):
+ (WebCore::RenderBlock::FloatingObject::height):
+ (WebCore::RenderBlock::FloatingObject::setLeft):
+ (WebCore::RenderBlock::FloatingObject::setTop):
+ (WebCore::RenderBlock::FloatingObject::setWidth):
+ (WebCore::RenderBlock::FloatingObject::setHeight):
+ (WebCore::RenderBlock::FloatingObject::frameRect):
+ (WebCore::RenderBlock::FloatingObject::setFrameRect):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::layoutInlineChildren):
+ (WebCore::RenderBlock::matchedEndLine):
+
2010-10-01 Enrica Casucci <enrica at apple.com>
Reviewed by Darin Adler.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index d503fe4..2907efe 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1310,7 +1310,7 @@ void RenderBlock::addOverflowFromFloats()
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for (; (r = it.current()); ++it) {
if (r->m_shouldPaint && !r->m_renderer->hasSelfPaintingLayer())
- addOverflowFromChild(r->m_renderer, IntSize(r->m_left + r->m_renderer->marginLeft(), r->m_top + r->m_renderer->marginTop()));
+ addOverflowFromChild(r->m_renderer, IntSize(r->left() + r->m_renderer->marginLeft(), r->top() + r->m_renderer->marginTop()));
}
return;
}
@@ -2075,7 +2075,7 @@ void RenderBlock::repaintOverhangingFloats(bool paintAllDescendants)
// Only repaint the object if it is overhanging, is not in its own layer, and
// is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter
// condition is replaced with being a descendant of us.
- if (r->m_bottom > height() && ((paintAllDescendants && r->m_renderer->isDescendantOf(this)) || r->m_shouldPaint) && !r->m_renderer->hasSelfPaintingLayer()) {
+ if (r->bottom() > height() && ((paintAllDescendants && r->m_renderer->isDescendantOf(this)) || r->m_shouldPaint) && !r->m_renderer->hasSelfPaintingLayer()) {
r->m_renderer->repaint();
r->m_renderer->repaintOverhangingFloats();
}
@@ -2387,8 +2387,8 @@ void RenderBlock::paintFloats(PaintInfo& paintInfo, int tx, int ty, bool preserv
if (r->m_shouldPaint && !r->m_renderer->hasSelfPaintingLayer()) {
PaintInfo currentPaintInfo(paintInfo);
currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
- int currentTX = tx + r->m_left - r->m_renderer->x() + r->m_renderer->marginLeft();
- int currentTY = ty + r->m_top - r->m_renderer->y() + r->m_renderer->marginTop();
+ int currentTX = tx + r->left() - r->m_renderer->x() + r->m_renderer->marginLeft();
+ int currentTY = ty + r->top() - r->m_renderer->y() + r->m_renderer->marginTop();
r->m_renderer->paint(currentPaintInfo, currentTX, currentTY);
if (!preservePhase) {
currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
@@ -2597,8 +2597,8 @@ GapRects RenderBlock::fillSelectionGaps(RenderBlock* rootBlock, int blockX, int
if (m_floatingObjects) {
for (DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects); it.current(); ++it) {
FloatingObject* r = it.current();
- paintInfo->context->clipOut(IntRect(tx + r->m_left + r->m_renderer->marginLeft(),
- ty + r->m_top + r->m_renderer->marginTop(),
+ paintInfo->context->clipOut(IntRect(tx + r->left() + r->m_renderer->marginLeft(),
+ ty + r->top() + r->m_renderer->marginTop(),
r->m_renderer->width(), r->m_renderer->height()));
}
}
@@ -2928,8 +2928,7 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o)
FloatingObject* newObj = new FloatingObject(o->style()->floating() == FLEFT ? FloatingObject::FloatLeft : FloatingObject::FloatRight);
- newObj->m_top = -1;
- newObj->m_bottom = -1;
+ newObj->setTop(-1);
// Our location is irrelevant if we're unsplittable or no pagination is in effect.
// Just go ahead and lay out the float.
@@ -2940,7 +2939,7 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o)
o->computeLogicalWidth();
o->computeBlockDirectionMargins(this);
}
- newObj->m_width = o->width() + o->marginLeft() + o->marginRight();
+ newObj->setWidth(o->width() + o->marginLeft() + o->marginRight());
newObj->m_shouldPaint = !o->hasSelfPaintingLayer(); // If a layer exists, the float will paint itself. Otherwise someone else will.
newObj->m_isDescendant = true;
@@ -2958,11 +2957,11 @@ void RenderBlock::removeFloatingObject(RenderBox* o)
while (it.current()) {
if (it.current()->m_renderer == o) {
if (childrenInline()) {
- int bottom = it.current()->m_bottom;
+ int bottom = it.current()->bottom();
// Special-case zero- and less-than-zero-height floats: those don't touch
// the line that they're on, but it still needs to be dirtied. This is
// accomplished by pretending they have a height of 1.
- bottom = max(bottom, it.current()->m_top + 1);
+ bottom = max(bottom, it.current()->top() + 1);
markLinesDirtyInVerticalRange(0, bottom);
}
m_floatingObjects->removeRef(it.current());
@@ -2978,7 +2977,7 @@ void RenderBlock::removeFloatingObjectsBelow(FloatingObject* lastFloat, int y)
return;
FloatingObject* curr = m_floatingObjects->last();
- while (curr != lastFloat && (curr->m_top == -1 || curr->m_top >= y)) {
+ while (curr != lastFloat && (curr->top() == -1 || curr->top() >= y)) {
m_floatingObjects->removeLast();
curr = m_floatingObjects->last();
}
@@ -2992,14 +2991,14 @@ bool RenderBlock::positionNewFloats()
FloatingObject* f = m_floatingObjects->last();
// If all floats have already been positioned, then we have no work to do.
- if (!f || f->m_top != -1)
+ if (!f || f->top() != -1)
return false;
// Move backwards through our floating object list until we find a float that has
// already been positioned. Then we'll be able to move forward, positioning all of
// the new floats that need it.
FloatingObject* lastFloat = m_floatingObjects->getPrev();
- while (lastFloat && lastFloat->m_top == -1) {
+ while (lastFloat && lastFloat->top() == -1) {
f = m_floatingObjects->prev();
lastFloat = m_floatingObjects->getPrev();
}
@@ -3008,7 +3007,7 @@ bool RenderBlock::positionNewFloats()
// The float cannot start above the y position of the last positioned float.
if (lastFloat)
- y = max(lastFloat->m_top, y);
+ y = max(lastFloat->top(), y);
// Now walk through the set of unpositioned floats and place them.
while (f) {
@@ -3023,7 +3022,7 @@ bool RenderBlock::positionNewFloats()
int ro = logicalRightOffsetForContent(); // Constant part of right offset.
int lo = logicalLeftOffsetForContent(); // Constant part of left offset.
- int fwidth = f->m_width; // The width we look for.
+ int fwidth = f->width(); // The width we look for.
if (ro - lo < fwidth)
fwidth = ro - lo; // Never look for more than what will be available.
@@ -3043,7 +3042,7 @@ bool RenderBlock::positionNewFloats()
fx = logicalLeftOffsetForLine(y, lo, false, &heightRemainingLeft);
}
fx = max(0, fx);
- f->m_left = fx;
+ f->setLeft(fx);
o->setLocation(fx + o->marginLeft(), y + o->marginTop());
} else {
int heightRemainingLeft = 1;
@@ -3053,7 +3052,7 @@ bool RenderBlock::positionNewFloats()
y += min(heightRemainingLeft, heightRemainingRight);
fx = logicalRightOffsetForLine(y, ro, false, &heightRemainingRight);
}
- f->m_left = fx - f->m_width;
+ f->setLeft(fx - f->width());
o->setLocation(fx - o->marginRight() - o->width(), y + o->marginTop());
}
@@ -3086,9 +3085,9 @@ bool RenderBlock::positionNewFloats()
}
}
- f->m_top = y;
- f->m_bottom = f->m_top + o->marginTop() + o->height() + o->marginBottom();
-
+ f->setTop(y);
+ f->setHeight(o->marginTop() + o->height() + o->marginBottom());
+
// If the child moved, we have to repaint it.
if (o->checkForRepaintDuringLayout())
o->repaintDuringLayoutIfMoved(oldRect);
@@ -3104,7 +3103,7 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec
if (!didPosition || !newFloat->m_paginationStrut)
return didPosition;
- int floatTop = newFloat->m_top;
+ int floatTop = newFloat->top();
int paginationStrut = newFloat->m_paginationStrut;
FloatingObject* f = m_floatingObjects->last();
@@ -3114,7 +3113,7 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec
return didPosition;
for (f = m_floatingObjects->prev(); f && f != lastFloatFromPreviousLine; f = m_floatingObjects->prev()) {
- if (f->m_top == height()) {
+ if (f->top() == height()) {
ASSERT(!f->m_paginationStrut);
f->m_paginationStrut = paginationStrut;
RenderBox* o = f->m_renderer;
@@ -3122,8 +3121,7 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec
if (o->isRenderBlock())
toRenderBlock(o)->setChildNeedsLayout(true, false);
o->layoutIfNeeded();
- f->m_top += f->m_paginationStrut;
- f->m_bottom += f->m_paginationStrut;
+ f->setTop(f->top() + f->m_paginationStrut);
}
}
@@ -3221,13 +3219,13 @@ int RenderBlock::logicalLeftOffsetForLine(int y, int fixedOffset, bool applyText
if ( heightRemaining ) *heightRemaining = 1;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
- for ( ; (r = it.current()); ++it )
- {
- if (r->m_top <= y && r->m_bottom > y &&
- r->type() == FloatingObject::FloatLeft &&
- r->m_left + r->m_width > left) {
- left = r->m_left + r->m_width;
- if ( heightRemaining ) *heightRemaining = r->m_bottom - y;
+ for ( ; (r = it.current()); ++it) {
+ if (r->top() <= y && r->bottom() > y
+ && r->type() == FloatingObject::FloatLeft
+ && r->right() > left) {
+ left = r->right();
+ if (heightRemaining)
+ *heightRemaining = r->bottom() - y;
}
}
}
@@ -3250,13 +3248,13 @@ int RenderBlock::logicalRightOffsetForLine(int y, int fixedOffset, bool applyTex
if (heightRemaining) *heightRemaining = 1;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
- for ( ; (r = it.current()); ++it )
- {
- if (r->m_top <= y && r->m_bottom > y &&
- r->type() == FloatingObject::FloatRight &&
- r->m_left < right) {
- right = r->m_left;
- if ( heightRemaining ) *heightRemaining = r->m_bottom - y;
+ for ( ; (r = it.current()); ++it) {
+ if (r->top() <= y && r->bottom() > y
+ && r->type() == FloatingObject::FloatRight
+ && r->left() < right) {
+ right = r->left();
+ if (heightRemaining)
+ *heightRemaining = r->bottom() - y;
}
}
}
@@ -3287,8 +3285,8 @@ int RenderBlock::nextFloatBottomBelow(int height) const
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it) {
- if (r->m_bottom > height)
- bottom = min(r->m_bottom, bottom);
+ if (r->bottom() > height)
+ bottom = min(r->bottom(), bottom);
}
return bottom == INT_MAX ? 0 : bottom;
@@ -3302,8 +3300,8 @@ RenderBlock::floatBottom() const
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it )
- if (r->m_bottom>bottom)
- bottom = r->m_bottom;
+ if (r->bottom() > bottom)
+ bottom = r->bottom();
return bottom;
}
@@ -3373,7 +3371,7 @@ int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf)
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it ) {
if (r->m_shouldPaint || r->m_renderer->hasSelfPaintingLayer()) {
- int lp = r->m_top + r->m_renderer->marginTop() + r->m_renderer->lowestPosition(false);
+ int lp = r->top() + r->m_renderer->marginTop() + r->m_renderer->lowestPosition(false);
bottom = max(bottom, lp + relativeOffset);
}
}
@@ -3470,7 +3468,7 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it ) {
if (r->m_shouldPaint || r->m_renderer->hasSelfPaintingLayer()) {
- int rp = r->m_left + r->m_renderer->marginLeft() + r->m_renderer->rightmostPosition(false);
+ int rp = r->left() + r->m_renderer->marginLeft() + r->m_renderer->rightmostPosition(false);
right = max(right, rp + relativeOffset);
}
}
@@ -3571,7 +3569,7 @@ int RenderBlock::leftmostPosition(bool includeOverflowInterior, bool includeSelf
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for ( ; (r = it.current()); ++it ) {
if (r->m_shouldPaint || r->m_renderer->hasSelfPaintingLayer()) {
- int lp = r->m_left + r->m_renderer->marginLeft() + r->m_renderer->leftmostPosition(false);
+ int lp = r->left() + r->m_renderer->marginLeft() + r->m_renderer->leftmostPosition(false);
left = min(left, lp + relativeOffset);
}
}
@@ -3585,30 +3583,28 @@ int RenderBlock::leftmostPosition(bool includeOverflowInterior, bool includeSelf
return left;
}
-int
-RenderBlock::leftBottom()
+int RenderBlock::leftBottom()
{
if (!m_floatingObjects) return 0;
int bottom = 0;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
- for ( ; (r = it.current()); ++it )
- if (r->m_bottom > bottom && r->type() == FloatingObject::FloatLeft)
- bottom = r->m_bottom;
+ for ( ; (r = it.current()); ++it)
+ if (r->bottom() > bottom && r->type() == FloatingObject::FloatLeft)
+ bottom = r->bottom();
return bottom;
}
-int
-RenderBlock::rightBottom()
+int RenderBlock::rightBottom()
{
if (!m_floatingObjects) return 0;
int bottom = 0;
FloatingObject* r;
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
- for ( ; (r = it.current()); ++it )
- if (r->m_bottom>bottom && r->type() == FloatingObject::FloatRight)
- bottom = r->m_bottom;
+ for ( ; (r = it.current()); ++it)
+ if (r->bottom() > bottom && r->type() == FloatingObject::FloatRight)
+ bottom = r->bottom();
return bottom;
}
@@ -3699,19 +3695,19 @@ void RenderBlock::clearFloats()
for (FloatingObject* f = m_floatingObjects->first(); f; f = m_floatingObjects->next()) {
FloatingObject* oldFloatingObject = floatMap.get(f->m_renderer);
if (oldFloatingObject) {
- if (f->m_width != oldFloatingObject->m_width || f->m_left != oldFloatingObject->m_left) {
+ if (f->width() != oldFloatingObject->width() || f->left() != oldFloatingObject->left()) {
changeTop = 0;
- changeBottom = max(changeBottom, max(f->m_bottom, oldFloatingObject->m_bottom));
- } else if (f->m_bottom != oldFloatingObject->m_bottom) {
- changeTop = min(changeTop, min(f->m_bottom, oldFloatingObject->m_bottom));
- changeBottom = max(changeBottom, max(f->m_bottom, oldFloatingObject->m_bottom));
+ changeBottom = max(changeBottom, max(f->bottom(), oldFloatingObject->bottom()));
+ } else if (f->bottom() != oldFloatingObject->bottom()) {
+ changeTop = min(changeTop, min(f->bottom(), oldFloatingObject->bottom()));
+ changeBottom = max(changeBottom, max(f->bottom(), oldFloatingObject->bottom()));
}
floatMap.remove(f->m_renderer);
delete oldFloatingObject;
} else {
changeTop = 0;
- changeBottom = max(changeBottom, f->m_bottom);
+ changeBottom = max(changeBottom, f->bottom());
}
}
}
@@ -3721,7 +3717,7 @@ void RenderBlock::clearFloats()
FloatingObject* floatingObject = (*it).second;
if (!floatingObject->m_isDescendant) {
changeTop = 0;
- changeBottom = max(changeBottom, floatingObject->m_bottom);
+ changeBottom = max(changeBottom, floatingObject->bottom());
}
}
deleteAllValues(floatMap);
@@ -3742,17 +3738,13 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int xoff, int yoff, bo
// overflow.
DeprecatedPtrListIterator<FloatingObject> it(*child->m_floatingObjects);
for (FloatingObject* r; (r = it.current()); ++it) {
- int bottom = child->y() + r->m_bottom;
+ int bottom = child->y() + r->bottom();
lowestFloatBottom = max(lowestFloatBottom, bottom);
if (bottom > height()) {
// If the object is not in the list, we add it now.
if (!containsFloat(r->m_renderer)) {
- FloatingObject *floatingObj = new FloatingObject(r->type());
- floatingObj->m_top = r->m_top - yoff;
- floatingObj->m_bottom = r->m_bottom - yoff;
- floatingObj->m_left = r->m_left - xoff;
- floatingObj->m_width = r->m_width;
+ FloatingObject* floatingObj = new FloatingObject(r->type(), IntRect(r->left() - xoff, r->top() - yoff, r->width(), r->height()));
floatingObj->m_renderer = r->m_renderer;
// The nearest enclosing layer always paints the float (so that zindex and stacking
@@ -3781,7 +3773,7 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int xoff, int yoff, bo
r->m_shouldPaint = true;
if (r->m_shouldPaint && !r->m_renderer->hasSelfPaintingLayer())
- child->addOverflowFromChild(r->m_renderer, IntSize(r->m_left + r->m_renderer->marginLeft(), r->m_top + r->m_renderer->marginTop()));
+ child->addOverflowFromChild(r->m_renderer, IntSize(r->left() + r->m_renderer->marginLeft(), r->top() + r->m_renderer->marginTop()));
}
return lowestFloatBottom;
}
@@ -3794,7 +3786,7 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, int xoff, int yoff)
DeprecatedPtrListIterator<FloatingObject> it(*prev->m_floatingObjects);
for (FloatingObject *r; (r = it.current()); ++it) {
- if (r->m_bottom > yoff) {
+ if (r->bottom() > yoff) {
// The object may already be in our list. Check for it up front to avoid
// creating duplicate entries.
FloatingObject* f = 0;
@@ -3806,20 +3798,17 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, int xoff, int yoff)
}
}
if (!f) {
- FloatingObject *floatingObj = new FloatingObject(r->type());
- floatingObj->m_top = r->m_top - yoff;
- floatingObj->m_bottom = r->m_bottom - yoff;
- floatingObj->m_left = r->m_left - xoff;
+ FloatingObject* floatingObj = new FloatingObject(r->type(), IntRect(r->left() - xoff - marginLeft(), r->top() - yoff, r->width(), r->height()));
+
// Applying the child's margin makes no sense in the case where the child was passed in.
// since his own margin was added already through the subtraction of the |xoff| variable
// above. |xoff| will equal -flow->marginLeft() in this case, so it's already been taken
// into account. Only apply this code if |child| is false, since otherwise the left margin
// will get applied twice.
if (prev != parent())
- floatingObj->m_left += prev->marginLeft();
- floatingObj->m_left -= marginLeft();
+ floatingObj->setLeft(floatingObj->left() + prev->marginLeft());
+
floatingObj->m_shouldPaint = false; // We are not in the direct inheritance chain for this float. We will never paint it.
- floatingObj->m_width = r->m_width;
floatingObj->m_renderer = r->m_renderer;
// We create the floating object list lazily.
@@ -4050,8 +4039,8 @@ bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& re
DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects);
for (it.toLast(); (floatingObject = it.current()); --it) {
if (floatingObject->m_shouldPaint && !floatingObject->m_renderer->hasSelfPaintingLayer()) {
- int xOffset = tx + floatingObject->m_left + floatingObject->m_renderer->marginLeft() - floatingObject->m_renderer->x();
- int yOffset = ty + floatingObject->m_top + floatingObject->m_renderer->marginTop() - floatingObject->m_renderer->y();
+ int xOffset = tx + floatingObject->left() + floatingObject->m_renderer->marginLeft() - floatingObject->m_renderer->x();
+ int yOffset = ty + floatingObject->top() + floatingObject->m_renderer->marginTop() - floatingObject->m_renderer->y();
if (floatingObject->m_renderer->hitTest(request, result, IntPoint(x, y), xOffset, yOffset)) {
updateHitTestResult(result, IntPoint(x - xOffset, y - yOffset));
return true;
@@ -5537,7 +5526,7 @@ void RenderBlock::adjustForBorderFit(int x, int& left, int& right) const
for (; (r = it.current()); ++it) {
// Only examine the object if our m_shouldPaint flag is set.
if (r->m_shouldPaint) {
- int floatLeft = r->m_left - r->m_renderer->x() + r->m_renderer->marginLeft();
+ int floatLeft = r->left() - r->m_renderer->x() + r->m_renderer->marginLeft();
int floatRight = floatLeft + r->m_renderer->width();
left = min(left, floatLeft);
right = max(right, floatRight);
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 6c6829f..d58c48a 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -364,12 +364,9 @@ private:
FloatRight
};
- FloatingObject(Type type)
+ FloatingObject(Type type, const IntRect& frameRect = IntRect())
: m_renderer(0)
- , m_top(0)
- , m_bottom(0)
- , m_left(0)
- , m_width(0)
+ , m_frameRect(frameRect)
, m_paginationStrut(0)
, m_type(type)
, m_shouldPaint(true)
@@ -379,11 +376,23 @@ private:
Type type() { return static_cast<Type>(m_type); }
+ int left() const { return m_frameRect.x(); }
+ int right() const { return m_frameRect.right(); }
+ int top() const { return m_frameRect.y(); }
+ int bottom() const { return m_frameRect.bottom(); }
+ int width() const { return m_frameRect.width(); }
+ int height() const { return m_frameRect.height(); }
+
+ void setLeft(int left) { m_frameRect.setX(left); }
+ void setTop(int top) { m_frameRect.setY(top); }
+ void setWidth(int width) { m_frameRect.setWidth(width); }
+ void setHeight(int height) { m_frameRect.setHeight(height); }
+
+ const IntRect& frameRect() const { return m_frameRect; }
+ void setFrameRect(const IntRect& frameRect) { m_frameRect = frameRect; }
+
RenderBox* m_renderer;
- int m_top;
- int m_bottom;
- int m_left;
- int m_width;
+ IntRect m_frameRect;
int m_paginationStrut;
unsigned m_type : 1; // Type (left or right aligned)
bool m_shouldPaint : 1;
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index 68fad63..ff4e62f 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -810,7 +810,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i
lastRootBox()->floats().append(f->m_renderer);
ASSERT(f->m_renderer == floats[floatIndex].object);
// If a float's geometry has changed, give up on syncing with clean lines.
- if (floats[floatIndex].rect != IntRect(f->m_left, f->m_top, f->m_width, f->m_bottom - f->m_top))
+ if (floats[floatIndex].rect != f->frameRect())
checkForEndLineMatch = false;
floatIndex++;
}
@@ -1108,7 +1108,7 @@ bool RenderBlock::matchedEndLine(const InlineBidiResolver& resolver, const Inlin
int bottom = lastLine->blockHeight() + abs(delta);
for (FloatingObject* f = m_floatingObjects->first(); f; f = m_floatingObjects->next()) {
- if (f->m_bottom >= top && f->m_bottom < bottom)
+ if (f->bottom() >= top && f->bottom() < bottom)
return false;
}
@@ -1142,7 +1142,7 @@ bool RenderBlock::matchedEndLine(const InlineBidiResolver& resolver, const Inlin
int bottom = lastLine->blockHeight() + abs(delta);
for (FloatingObject* f = m_floatingObjects->first(); f; f = m_floatingObjects->next()) {
- if (f->m_bottom >= top && f->m_bottom < bottom)
+ if (f->bottom() >= top && f->bottom() < bottom)
return false;
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list