Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (87879 => 87880)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-06-02 06:30:25 UTC (rev 87879)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2011-06-02 06:41:17 UTC (rev 87880)
@@ -275,29 +275,24 @@
if (!m_parent || m_parent->renderer() == renderer()->containingBlock())
cachedOffset->move(m_topLeft.x(), m_topLeft.y()); // Fast case
else {
- int x = 0;
- int y = 0;
- convertToLayerCoords(root(), x, y);
- *cachedOffset = IntPoint(x, y);
+ IntPoint offset;
+ convertToLayerCoords(root(), offset);
+ *cachedOffset = offset;
}
}
}
- int x = 0;
- int y = 0;
+ IntPoint offset;
if (cachedOffset) {
- x += cachedOffset->x();
- y += cachedOffset->y();
+ offset = *cachedOffset;
#ifndef NDEBUG
- int nonCachedX = 0;
- int nonCachedY = 0;
- convertToLayerCoords(root(), nonCachedX, nonCachedY);
- ASSERT(x == nonCachedX);
- ASSERT(y == nonCachedY);
+ IntPoint nonCachedOffset;
+ convertToLayerCoords(root(), nonCachedOffset);
+ ASSERT(offset == nonCachedOffset);
#endif
} else
- convertToLayerCoords(root(), x, y);
- positionOverflowControls(IntSize(x, y));
+ convertToLayerCoords(root(), offset);
+ positionOverflowControls(toSize(offset));
updateVisibilityStatus();
@@ -901,12 +896,11 @@
// FIXME: Accelerated compositing will eventually want to do something smart here to avoid incorporating this
// size into the parent layer.
if (l->renderer()->hasReflection()) {
- int deltaX = 0;
- int deltaY = 0;
- l->convertToLayerCoords(rootLayer, deltaX, deltaY);
- clipRect.move(-deltaX, -deltaY);
+ IntPoint delta;
+ l->convertToLayerCoords(rootLayer, delta);
+ clipRect.move(-delta.x(), -delta.y());
clipRect.unite(l->renderBox()->reflectedRect(clipRect));
- clipRect.move(deltaX, deltaY);
+ clipRect.move(delta);
}
}
@@ -919,12 +913,11 @@
if (rootLayer != l && l->paintsWithTransform(paintBehavior)) {
// The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass
// the transformed layer and all of its children.
- int x = 0;
- int y = 0;
- l->convertToLayerCoords(rootLayer, x, y);
+ IntPoint delta;
+ l->convertToLayerCoords(rootLayer, delta);
TransformationMatrix transform;
- transform.translate(x, y);
+ transform.translate(delta.x(), delta.y());
transform = transform * *l->transform();
IntRect clipRect = l->boundingBox(l);
@@ -1112,7 +1105,7 @@
}
void
-RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, int& xPos, int& yPos) const
+RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, IntPoint& location) const
{
if (ancestorLayer == this)
return;
@@ -1122,8 +1115,7 @@
// If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling
// localToAbsolute() on the RenderView.
FloatPoint absPos = renderer()->localToAbsolute(FloatPoint(), true);
- xPos += absPos.x();
- yPos += absPos.y();
+ location += flooredIntSize(absPos);
return;
}
@@ -1147,16 +1139,13 @@
ASSERT(fixedPositionContainerLayer); // We should have hit the RenderView's layer at least.
if (fixedPositionContainerLayer != ancestorLayer) {
- int fixedContainerX = 0;
- int fixedContainerY = 0;
- convertToLayerCoords(fixedPositionContainerLayer, fixedContainerX, fixedContainerY);
-
- int ancestorX = 0;
- int ancestorY = 0;
- ancestorLayer->convertToLayerCoords(fixedPositionContainerLayer, ancestorX, ancestorY);
-
- xPos += (fixedContainerX - ancestorX);
- yPos += (fixedContainerY - ancestorY);
+ IntPoint fixedContainerCoords;
+ convertToLayerCoords(fixedPositionContainerLayer, fixedContainerCoords);
+
+ IntPoint ancestorCoords;
+ ancestorLayer->convertToLayerCoords(fixedPositionContainerLayer, ancestorCoords);
+
+ location += (fixedContainerCoords - ancestorCoords);
return;
}
}
@@ -1183,16 +1172,13 @@
// to enclosingPositionedAncestor and subtract.
RenderLayer* positionedAncestor = parentLayer->enclosingPositionedAncestor();
- int thisX = 0;
- int thisY = 0;
- convertToLayerCoords(positionedAncestor, thisX, thisY);
+ IntPoint thisCoords;
+ convertToLayerCoords(positionedAncestor, thisCoords);
- int ancestorX = 0;
- int ancestorY = 0;
- ancestorLayer->convertToLayerCoords(positionedAncestor, ancestorX, ancestorY);
-
- xPos += (thisX - ancestorX);
- yPos += (thisY - ancestorY);
+ IntPoint ancestorCoords;
+ ancestorLayer->convertToLayerCoords(positionedAncestor, ancestorCoords);
+
+ location += (thisCoords - ancestorCoords);
return;
}
} else
@@ -1200,13 +1186,20 @@
if (!parentLayer)
return;
-
- parentLayer->convertToLayerCoords(ancestorLayer, xPos, yPos);
- xPos += m_topLeft.x();
- yPos += m_topLeft.y();
+ parentLayer->convertToLayerCoords(ancestorLayer, location);
+
+ location += toSize(m_topLeft);
}
+void
+RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, IntRect& rect) const
+{
+ IntPoint delta;
+ convertToLayerCoords(ancestorLayer, delta);
+ rect.move(-delta.x(), -delta.y());
+}
+
static inline int adjustedScrollDelta(int beginningDelta) {
// This implemention matches Firefox's.
// http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml#856.
@@ -2571,11 +2564,10 @@
// Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space.
// This involves subtracting out the position of the layer in our current coordinate space.
- int x = 0;
- int y = 0;
- convertToLayerCoords(rootLayer, x, y);
+ IntPoint delta;
+ convertToLayerCoords(rootLayer, delta);
TransformationMatrix transform(layerTransform);
- transform.translateRight(x, y);
+ transform.translateRight(delta.x(), delta.y());
// Apply the transform.
{
@@ -2765,9 +2757,8 @@
if (!columnBlock || !columnBlock->hasColumns())
return;
- int layerX = 0;
- int layerY = 0;
- columnBlock->layer()->convertToLayerCoords(rootLayer, layerX, layerY);
+ IntPoint layerOffset;
+ columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset);
bool isHorizontal = columnBlock->style()->isHorizontalWritingMode();
@@ -2781,7 +2772,7 @@
int logicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - columnBlock->logicalLeftOffsetForContent();
IntSize offset = isHorizontal ? IntSize(logicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, logicalLeftOffset);
- colRect.move(layerX, layerY);
+ colRect.move(layerOffset);
IntRect localDirtyRect(paintDirtyRect);
localDirtyRect.intersect(colRect);
@@ -2811,11 +2802,10 @@
} else {
// Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space.
// This involves subtracting out the position of the layer in our current coordinate space.
- int childX = 0;
- int childY = 0;
- columnLayers[colIndex - 1]->convertToLayerCoords(rootLayer, childX, childY);
+ IntPoint childOffset;
+ columnLayers[colIndex - 1]->convertToLayerCoords(rootLayer, childOffset);
TransformationMatrix transform;
- transform.translateRight(childX + offset.width(), childY + offset.height());
+ transform.translateRight(childOffset.x() + offset.width(), childOffset.y() + offset.height());
// Apply the transform.
context->concatCTM(transform.toAffineTransform());
@@ -2909,26 +2899,25 @@
const HitTestingTransformState* containerTransformState) const
{
RefPtr<HitTestingTransformState> transformState;
- int offsetX = 0;
- int offsetY = 0;
+ IntPoint offset;
if (containerTransformState) {
// If we're already computing transform state, then it's relative to the container (which we know is non-null).
transformState = HitTestingTransformState::create(*containerTransformState);
- convertToLayerCoords(containerLayer, offsetX, offsetY);
+ convertToLayerCoords(containerLayer, offset);
} else {
// If this is the first time we need to make transform state, then base it off of hitTestPoint,
// which is relative to rootLayer.
transformState = HitTestingTransformState::create(hitTestPoint, FloatQuad(hitTestRect));
- convertToLayerCoords(rootLayer, offsetX, offsetY);
+ convertToLayerCoords(rootLayer, offset);
}
RenderObject* containerRenderer = containerLayer ? containerLayer->renderer() : 0;
if (renderer()->shouldUseTransformFromContainer(containerRenderer)) {
TransformationMatrix containerTransform;
- renderer()->getTransformFromContainer(containerRenderer, IntSize(offsetX, offsetY), containerTransform);
+ renderer()->getTransformFromContainer(containerRenderer, toSize(offset), containerTransform);
transformState->applyTransform(containerTransform, HitTestingTransformState::AccumulateTransform);
} else {
- transformState->translate(offsetX, offsetY, HitTestingTransformState::AccumulateTransform);
+ transformState->translate(offset.x(), offset.y(), HitTestingTransformState::AccumulateTransform);
}
return transformState;
@@ -3237,11 +3226,10 @@
ASSERT(columnBlock && columnBlock->hasColumns());
if (!columnBlock || !columnBlock->hasColumns())
return 0;
+
+ IntPoint layerOffset;
+ columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset);
- int layerX = 0;
- int layerY = 0;
- columnBlock->layer()->convertToLayerCoords(rootLayer, layerX, layerY);
-
ColumnInfo* colInfo = columnBlock->columnInfo();
int colCount = columnBlock->columnCount(colInfo);
@@ -3268,7 +3256,7 @@
currLogicalTopOffset -= blockDelta;
else
currLogicalTopOffset += blockDelta;
- colRect.move(layerX, layerY);
+ colRect.move(layerOffset);
IntRect localClipRect(hitTestRect);
localClipRect.intersect(colRect);
@@ -3377,24 +3365,22 @@
// Update the clip rects that will be passed to child layers.
if (renderer()->hasOverflowClip() || renderer()->hasClip()) {
// This layer establishes a clip of some kind.
- int x = 0;
- int y = 0;
- convertToLayerCoords(rootLayer, x, y);
+ IntPoint offset;
+ convertToLayerCoords(rootLayer, offset);
RenderView* view = renderer()->view();
ASSERT(view);
if (view && clipRects.fixed() && rootLayer->renderer() == view) {
- x -= view->frameView()->scrollXForFixedPosition();
- y -= view->frameView()->scrollYForFixedPosition();
+ offset -= view->frameView()->scrollOffsetForFixedPosition();
}
if (renderer()->hasOverflowClip()) {
- IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(x, y, relevancy);
+ IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset.x(), offset.y(), relevancy);
clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
if (renderer()->isPositioned() || renderer()->isRelPositioned())
clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
}
if (renderer()->hasClip()) {
- IntRect newPosClip = toRenderBox(renderer())->clipRect(x, y);
+ IntRect newPosClip = toRenderBox(renderer())->clipRect(offset.x(), offset.y());
clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect()));
clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect()));
clipRects.setFixedClipRect(intersection(newPosClip, clipRects.fixedClipRect()));
@@ -3444,19 +3430,18 @@
foregroundRect = backgroundRect;
outlineRect = backgroundRect;
- int x = 0;
- int y = 0;
- convertToLayerCoords(rootLayer, x, y);
- layerBounds = IntRect(IntPoint(x, y), size());
+ IntPoint offset;
+ convertToLayerCoords(rootLayer, offset);
+ layerBounds = IntRect(offset, size());
// Update the clip rects that will be passed to child layers.
if (renderer()->hasOverflowClip() || renderer()->hasClip()) {
// This layer establishes a clip of some kind.
if (renderer()->hasOverflowClip())
- foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(x, y, relevancy));
+ foregroundRect.intersect(toRenderBox(renderer())->overflowClipRect(offset.x(), offset.y(), relevancy));
if (renderer()->hasClip()) {
// Clip applies to *us* as well, so go ahead and update the damageRect.
- IntRect newPosClip = toRenderBox(renderer())->clipRect(x, y);
+ IntRect newPosClip = toRenderBox(renderer())->clipRect(offset.x(), offset.y());
backgroundRect.intersect(newPosClip);
foregroundRect.intersect(newPosClip);
outlineRect.intersect(newPosClip);
@@ -3610,9 +3595,9 @@
renderBox()->flipForWritingMode(result);
else
renderer()->containingBlock()->flipForWritingMode(result);
- int deltaX = 0, deltaY = 0;
- convertToLayerCoords(ancestorLayer, deltaX, deltaY);
- result.move(deltaX, deltaY);
+ IntPoint delta;
+ convertToLayerCoords(ancestorLayer, delta);
+ result.move(delta);
return result;
}
@@ -3947,10 +3932,9 @@
// If we're trying to repaint the placeholder document layer, propagate the
// repaint to the native view system.
IntRect absRect(r);
- int x = 0;
- int y = 0;
- convertToLayerCoords(root(), x, y);
- absRect.move(x, y);
+ IntPoint delta;
+ convertToLayerCoords(root(), delta);
+ absRect.move(delta);
RenderView* view = renderer()->view();
if (view)
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (87879 => 87880)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2011-06-02 06:30:25 UTC (rev 87879)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2011-06-02 06:41:17 UTC (rev 87880)
@@ -203,10 +203,9 @@
if (m_owningLayer != rootLayer)
clippingBounds.intersect(m_owningLayer->backgroundClipRect(rootLayer, true));
- int deltaX = 0;
- int deltaY = 0;
- m_owningLayer->convertToLayerCoords(rootLayer, deltaX, deltaY);
- clippingBounds.move(-deltaX, -deltaY);
+ IntPoint delta;
+ m_owningLayer->convertToLayerCoords(rootLayer, delta);
+ clippingBounds.move(-delta.x(), -delta.y());
layerBounds.intersect(clippingBounds);
}
@@ -356,9 +355,9 @@
IntRect localCompositingBounds = compositedBounds();
IntRect relativeCompositingBounds(localCompositingBounds);
- int deltaX = 0, deltaY = 0;
- m_owningLayer->convertToLayerCoords(compAncestor, deltaX, deltaY);
- relativeCompositingBounds.move(deltaX, deltaY);
+ IntPoint delta;
+ m_owningLayer->convertToLayerCoords(compAncestor, delta);
+ relativeCompositingBounds.move(delta);
IntPoint graphicsLayerParentLocation;
if (compAncestor && compAncestor->backing()->hasClippingLayer()) {
@@ -379,8 +378,7 @@
m_ancestorClippingLayer->setSize(parentClipRect.size());
// backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords.
- IntSize rendererOffset(parentClipRect.location().x() - deltaX, parentClipRect.location().y() - deltaY);
- m_ancestorClippingLayer->setOffsetFromRenderer(rendererOffset);
+ m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta);
// The primary layer is then parented in, and positioned relative to this clipping layer.
graphicsLayerParentLocation = parentClipRect.location();
@@ -427,7 +425,7 @@
const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();
// Get layout bounds in the coords of compAncestor to match relativeCompositingBounds.
- IntRect layerBounds = IntRect(deltaX, deltaY, borderBox.width(), borderBox.height());
+ IntRect layerBounds = IntRect(delta, borderBox.size());
// Update properties that depend on layer dimensions
FloatPoint3D transformOrigin = computeTransformOrigin(borderBox);
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (87879 => 87880)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-06-02 06:30:25 UTC (rev 87879)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-06-02 06:41:17 UTC (rev 87880)
@@ -449,9 +449,9 @@
IntRect unionBounds = boundingBoxRect;
if (layer->renderer()->hasOverflowClip() || layer->renderer()->hasMask()) {
- int ancestorRelX = 0, ancestorRelY = 0;
- layer->convertToLayerCoords(ancestorLayer, ancestorRelX, ancestorRelY);
- boundingBoxRect.move(ancestorRelX, ancestorRelY);
+ IntPoint ancestorRelOffset;
+ layer->convertToLayerCoords(ancestorLayer, ancestorRelOffset);
+ boundingBoxRect.move(ancestorRelOffset);
return boundingBoxRect;
}
@@ -503,9 +503,9 @@
unionBounds = affineTrans->mapRect(unionBounds);
}
- int ancestorRelX = 0, ancestorRelY = 0;
- layer->convertToLayerCoords(ancestorLayer, ancestorRelX, ancestorRelY);
- unionBounds.move(ancestorRelX, ancestorRelY);
+ IntPoint ancestorRelOffset;
+ layer->convertToLayerCoords(ancestorLayer, ancestorRelOffset);
+ unionBounds.move(ancestorRelOffset);
return unionBounds;
}
@@ -527,9 +527,9 @@
ASSERT(compLayer->backing());
IntRect compBounds = child->backing()->compositedBounds();
- int offsetX = 0, offsetY = 0;
- child->convertToLayerCoords(compLayer, offsetX, offsetY);
- compBounds.move(offsetX, offsetY);
+ IntPoint offset;
+ child->convertToLayerCoords(compLayer, offset);
+ compBounds.move(offset);
compLayer->setBackingNeedsRepaintInRect(compBounds);
@@ -1071,11 +1071,8 @@
size_t listSize = negZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = negZOrderList->at(i);
- int x = 0;
- int y = 0;
- curLayer->convertToLayerCoords(layer, x, y);
IntRect childRect(rect);
- childRect.move(-x, -y);
+ curLayer->convertToLayerCoords(layer, childRect);
recursiveRepaintLayerRect(curLayer, childRect);
}
}
@@ -1084,11 +1081,8 @@
size_t listSize = posZOrderList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = posZOrderList->at(i);
- int x = 0;
- int y = 0;
- curLayer->convertToLayerCoords(layer, x, y);
IntRect childRect(rect);
- childRect.move(-x, -y);
+ curLayer->convertToLayerCoords(layer, childRect);
recursiveRepaintLayerRect(curLayer, childRect);
}
}
@@ -1097,11 +1091,8 @@
size_t listSize = normalFlowList->size();
for (size_t i = 0; i < listSize; ++i) {
RenderLayer* curLayer = normalFlowList->at(i);
- int x = 0;
- int y = 0;
- curLayer->convertToLayerCoords(layer, x, y);
IntRect childRect(rect);
- childRect.move(-x, -y);
+ curLayer->convertToLayerCoords(layer, childRect);
recursiveRepaintLayerRect(curLayer, childRect);
}
}