+2011-05-11 Emil A Eklund <eae@chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ Convert RenderFlexibleBox to use IntPoint/IntSize instead of x,y/w,h pairs
+ https://bugs.webkit.org/show_bug.cgi?id=60592
+
+ Refactoring, covered by existing tests.
+
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutBlock):
+ (WebCore::RenderFlexibleBox::layoutHorizontalBox):
+ (WebCore::RenderFlexibleBox::layoutVerticalBox):
+ (WebCore::RenderFlexibleBox::placeChild):
+ * rendering/RenderFlexibleBox.h:
+
2011-05-10 Ilya Tikhonovsky <loislo@chromium.org>
Unreviewed buildfix for strict OwnPtr.
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
- int previousWidth = width();
- int previousHeight = height();
+ IntSize previousSize = size();
computeLogicalWidth();
computeLogicalHeight();
m_overflow.clear();
- if (previousWidth != width() || previousHeight != height() ||
- (parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL &&
- parent()->style()->boxAlign() == BSTRETCH))
+ if (previousSize != size()
+ || (parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL
+ && parent()->style()->boxAlign() == BSTRETCH))
relayoutChildren = true;
setHeight(0);
int oldClientAfterEdge = clientLogicalBottom();
computeLogicalHeight();
- if (previousHeight != height())
+ if (previousSize.height() != height())
relayoutChildren = true;
layoutPositionedObjects(relayoutChildren || isRoot());
break;
}
- placeChild(child, xPos, childY);
+ placeChild(child, IntPoint(xPos, childY));
xPos += child->width() + child->marginRight();
}
remainingSpace -= (remainingSpace/totalChildren);
--totalChildren;
- placeChild(child, child->x() + offset, child->y());
+ placeChild(child, child->location() + IntSize(offset, 0));
}
}
} else {
if (child->isPositioned())
continue;
- placeChild(child, child->x() + offset, child->y());
+ placeChild(child, child->location() + IntSize(offset, 0));
}
}
}
}
// Place the child.
- placeChild(child, childX, height());
+ placeChild(child, IntPoint(childX, height()));
setHeight(height() + child->height() + child->marginBottom());
}
offset += remainingSpace/totalChildren;
remainingSpace -= (remainingSpace/totalChildren);
--totalChildren;
- placeChild(child, child->x(), child->y() + offset);
+ placeChild(child, child->location() + IntSize(0, offset));
}
}
} else {
for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (child->isPositioned())
continue;
- placeChild(child, child->x(), child->y() + offset);
+ placeChild(child, child->location() + IntSize(0, offset));
}
}
}
}
}
-void RenderFlexibleBox::placeChild(RenderBox* child, int x, int y)
+void RenderFlexibleBox::placeChild(RenderBox* child, IntPoint location)
{
- IntRect oldRect(child->x(), child->y() , child->width(), child->height());
+ IntRect oldRect = child->frameRect();
// Place the child.
- child->setLocation(x, y);
+ child->setLocation(location);
// If the child moved, we have to repaint it as well as any floating/positioned
// descendants. An exception is if we need a layout. In this case, we know we're going to