Diff
Modified: trunk/Source/WebCore/ChangeLog (90524 => 90525)
--- trunk/Source/WebCore/ChangeLog 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/ChangeLog 2011-07-07 02:32:26 UTC (rev 90525)
@@ -1,3 +1,45 @@
+2011-07-06 Emil A Eklund <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Switch offsetFromContainer and related to to new layout types
+ https://bugs.webkit.org/show_bug.cgi?id=63659
+
+ Switch offsetFromContainer and related mapping methods to new layout unit
+ abstraction.
+
+ No new tests, no functionality changes.
+
+ * rendering/LayoutTypes.h:
+ (WebCore::enclosingLayoutRect):
+ (WebCore::roundedLayoutPoint):
+ (WebCore::roundedLayoutUnit):
+ Add LayoutUnit versions of enclosingIntRect, roundedIntPoint and lroundf.
+ For now these map to their int counterpart but once we switch to float or
+ fixed point they'll be no-ops and eventually will be removed.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::mapLocalToContainer):
+ (WebCore::RenderBox::mapAbsoluteToLocalPoint):
+ (WebCore::RenderBox::offsetFromContainer):
+ * rendering/RenderBox.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::linesBoundingBox):
+ (WebCore::RenderInline::offsetFromContainer):
+ (WebCore::RenderInline::mapLocalToContainer):
+ (WebCore::RenderInline::mapAbsoluteToLocalPoint):
+ (WebCore::RenderInline::relativePositionedInlineOffset):
+ * rendering/RenderInline.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::offsetFromContainer):
+ (WebCore::RenderObject::offsetFromAncestorContainer):
+ * rendering/RenderObject.h:
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::offsetFromContainer):
+ * rendering/RenderTableCell.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::convertToPaintingRect):
+
2011-07-06 Levi Weintraub <[email protected]>
Switch FrameSelection to new Layout Types
Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (90524 => 90525)
--- trunk/Source/WebCore/rendering/LayoutTypes.h 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h 2011-07-07 02:32:26 UTC (rev 90525)
@@ -37,6 +37,7 @@
#define LayoutTypes_h
#include "FloatPoint.h"
+#include "FloatRect.h"
#include "IntRect.h"
namespace WebCore {
@@ -46,6 +47,11 @@
typedef IntSize LayoutSize;
typedef IntRect LayoutRect;
+inline LayoutRect enclosingLayoutRect(const FloatRect& rect)
+{
+ return enclosingIntRect(rect);
+}
+
inline LayoutPoint roundedLayoutPoint(const FloatPoint& p)
{
return roundedIntPoint(p);
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2011-07-07 02:32:26 UTC (rev 90525)
@@ -1238,7 +1238,7 @@
if (wasFixed)
*wasFixed = fixed;
- IntSize containerOffset = offsetFromContainer(o, roundedIntPoint(transformState.mappedPoint()));
+ LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint()));
bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
if (useTransforms && shouldUseTransformFromContainer(o)) {
@@ -1251,7 +1251,7 @@
if (containerSkipped) {
// There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe
// to just subtract the delta between the repaintContainer and o.
- IntSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
+ LayoutSize containerOffset = repaintContainer->offsetFromAncestorContainer(o);
transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
return;
}
@@ -1279,7 +1279,7 @@
o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState);
- IntSize containerOffset = offsetFromContainer(o, IntPoint());
+ LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
if (useTransforms && shouldUseTransformFromContainer(o)) {
@@ -1290,20 +1290,20 @@
transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
}
-IntSize RenderBox::offsetFromContainer(RenderObject* o, const IntPoint& point) const
+LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
{
ASSERT(o == container());
- IntSize offset;
+ LayoutSize offset;
if (isRelPositioned())
offset += relativePositionOffset();
if (!isInline() || isReplaced()) {
if (style()->position() != AbsolutePosition && style()->position() != FixedPosition) {
if (o->hasColumns()) {
- IntRect columnRect(frameRect());
+ LayoutRect columnRect(frameRect());
toRenderBlock(o)->flipForWritingModeIncludingColumns(columnRect);
- offset += IntSize(columnRect.location().x(), columnRect.location().y());
+ offset += LayoutSize(columnRect.location().x(), columnRect.location().y());
columnRect.moveBy(point);
o->adjustForColumns(offset, columnRect.location());
} else
Modified: trunk/Source/WebCore/rendering/RenderBox.h (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderBox.h 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2011-07-07 02:32:26 UTC (rev 90525)
@@ -249,7 +249,7 @@
int overrideHeight() const;
virtual void setOverrideSize(int);
- virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
+ virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
LayoutUnit computeBorderBoxLogicalWidth(LayoutUnit width) const;
LayoutUnit computeBorderBoxLogicalHeight(LayoutUnit height) const;
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2011-07-07 02:32:26 UTC (rev 90525)
@@ -738,14 +738,14 @@
return RenderBoxModelObject::positionForPoint(point);
}
-IntRect RenderInline::linesBoundingBox() const
+LayoutRect RenderInline::linesBoundingBox() const
{
if (!alwaysCreateLineBoxes()) {
ASSERT(!firstLineBox());
- return enclosingIntRect(culledInlineBoundingBox(this));
+ return enclosingLayoutRect(culledInlineBoundingBox(this));
}
- IntRect result;
+ LayoutRect result;
// See <rdar://problem/5289721>, for an unknown reason the linked list here is sometimes inconsistent, first is non-zero and last is zero. We have been
// unable to reproduce this at all (and consequently unable to figure ot why this is happening). The assert will hopefully catch the problem in debug
@@ -768,7 +768,7 @@
float y = isHorizontal ? firstLineBox()->y() : logicalLeftSide;
float width = isHorizontal ? logicalRightSide - logicalLeftSide : lastLineBox()->logicalBottom() - x;
float height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide;
- result = enclosingIntRect(FloatRect(x, y, width, height));
+ result = enclosingLayoutRect(FloatRect(x, y, width, height));
}
return result;
@@ -1093,11 +1093,11 @@
o->computeRectForRepaint(repaintContainer, rect, fixed);
}
-IntSize RenderInline::offsetFromContainer(RenderObject* container, const IntPoint& point) const
+LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const LayoutPoint& point) const
{
ASSERT(container == this->container());
- IntSize offset;
+ LayoutSize offset;
if (isRelPositioned())
offset += relativePositionOffset();
@@ -1134,7 +1134,7 @@
if (o->isBox() && o->style()->isFlippedBlocksWritingMode())
transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedIntPoint(transformState.mappedPoint())) - centerPoint);
- IntSize containerOffset = offsetFromContainer(o, roundedIntPoint(transformState.mappedPoint()));
+ LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint()));
bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
if (useTransforms && shouldUseTransformFromContainer(o)) {
@@ -1166,7 +1166,7 @@
o->mapAbsoluteToLocalPoint(fixed, useTransforms, transformState);
- IntSize containerOffset = offsetFromContainer(o, IntPoint());
+ LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->preserves3D());
if (useTransforms && shouldUseTransformFromContainer(o)) {
@@ -1285,23 +1285,23 @@
return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
}
-IntSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const
+LayoutSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const
{
// FIXME: This function isn't right with mixed writing modes.
ASSERT(isRelPositioned());
if (!isRelPositioned())
- return IntSize();
+ return LayoutSize();
// When we have an enclosing relpositioned inline, we need to add in the offset of the first line
// box from the rest of the content, but only in the cases where we know we're positioned
// relative to the inline itself.
- IntSize logicalOffset;
- int inlinePosition;
- int blockPosition;
+ LayoutSize logicalOffset;
+ LayoutUnit inlinePosition;
+ LayoutUnit blockPosition;
if (firstLineBox()) {
- inlinePosition = lroundf(firstLineBox()->logicalLeft());
+ inlinePosition = roundedLayoutUnit(firstLineBox()->logicalLeft());
blockPosition = firstLineBox()->logicalTop();
} else {
inlinePosition = layer()->staticInlinePosition();
Modified: trunk/Source/WebCore/rendering/RenderInline.h (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderInline.h 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2011-07-07 02:32:26 UTC (rev 90525)
@@ -51,9 +51,9 @@
virtual void absoluteRects(Vector<IntRect>&, const IntPoint& accumulatedOffset);
virtual void absoluteQuads(Vector<FloatQuad>&);
- virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
+ virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
- IntRect linesBoundingBox() const;
+ LayoutRect linesBoundingBox() const;
IntRect linesVisualOverflowBoundingBox() const;
InlineFlowBox* createAndAppendInlineFlowBox();
@@ -73,7 +73,7 @@
virtual void updateDragState(bool dragOn);
- IntSize relativePositionedInlineOffset(const RenderBox* child) const;
+ LayoutSize relativePositionedInlineOffset(const RenderBox* child) const;
virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
void paintOutline(GraphicsContext*, const IntPoint&);
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2011-07-07 02:32:26 UTC (rev 90525)
@@ -1931,11 +1931,11 @@
return transformState.lastPlanarQuad();
}
-IntSize RenderObject::offsetFromContainer(RenderObject* o, const IntPoint& point) const
+LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
{
ASSERT(o == container());
- IntSize offset;
+ LayoutSize offset;
o->adjustForColumns(offset, point);
@@ -1945,10 +1945,10 @@
return offset;
}
-IntSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const
+LayoutSize RenderObject::offsetFromAncestorContainer(RenderObject* container) const
{
- IntSize offset;
- IntPoint referencePoint;
+ LayoutSize offset;
+ LayoutPoint referencePoint;
const RenderObject* currContainer = this;
do {
RenderObject* nextContainer = currContainer->container();
@@ -1956,7 +1956,7 @@
if (!nextContainer)
break;
ASSERT(!currContainer->hasTransform());
- IntSize currentOffset = currContainer->offsetFromContainer(nextContainer, referencePoint);
+ LayoutSize currentOffset = currContainer->offsetFromContainer(nextContainer, referencePoint);
offset += currentOffset;
referencePoint.move(currentOffset);
currContainer = nextContainer;
Modified: trunk/Source/WebCore/rendering/RenderObject.h (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderObject.h 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2011-07-07 02:32:26 UTC (rev 90525)
@@ -588,9 +588,9 @@
// Return the offset from the container() renderer (excluding transforms). In multi-column layout,
// different offsets apply at different points, so return the offset that applies to the given point.
- virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
+ virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
// Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
- IntSize offsetFromAncestorContainer(RenderObject*) const;
+ LayoutSize offsetFromAncestorContainer(RenderObject*) const;
virtual void absoluteRects(Vector<IntRect>&, const IntPoint&) { }
// FIXME: useTransforms should go away eventually
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-07-07 02:32:26 UTC (rev 90525)
@@ -224,11 +224,11 @@
RenderBlock::setOverrideSize(max(0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter()));
}
-IntSize RenderTableCell::offsetFromContainer(RenderObject* o, const IntPoint& point) const
+LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const
{
ASSERT(o == container());
- IntSize offset = RenderBlock::offsetFromContainer(o, point);
+ LayoutSize offset = RenderBlock::offsetFromContainer(o, point);
if (parent())
offset.expand(-parentBox()->x(), -parentBox()->y());
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2011-07-07 02:32:26 UTC (rev 90525)
@@ -145,7 +145,7 @@
virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
virtual void paintMask(PaintInfo&, const LayoutPoint&);
- virtual IntSize offsetFromContainer(RenderObject*, const IntPoint&) const;
+ virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false);
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (90524 => 90525)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2011-07-07 02:24:02 UTC (rev 90524)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2011-07-07 02:32:26 UTC (rev 90525)
@@ -554,7 +554,7 @@
const RenderObject* renderer = partRenderer;
while (renderer && renderer != inputRenderer) {
RenderObject* containingRenderer = renderer->container();
- offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, IntPoint());
+ offsetFromInputRenderer -= renderer->offsetFromContainer(containingRenderer, LayoutPoint());
renderer = containingRenderer;
}
// If the input renderer was not a container, something went wrong