Changeset 93429 in webkit
- Timestamp:
- Aug 19, 2011 12:26:03 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r93428 r93429 1 2011-08-19 Emil A Eklund <eae@chromium.org> 2 3 Switch RenderLayer to to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=66507 5 6 Reviewed by Eric Seidel. 7 8 Convert RenderLayer to new layout abstraction. 9 10 No new tests as no new functionality. 11 12 * rendering/LayoutTypes.h: 13 (WebCore::flooredLayoutSize): 14 * rendering/RenderLayer.cpp: 15 * rendering/RenderLayer.h: 16 * rendering/RenderLayerBacking.cpp: 17 * rendering/RenderLayerBacking.h: 18 * rendering/RenderLayerCompositor.cpp: 19 * rendering/RenderLayerCompositor.h: 20 1 21 2011-08-19 Mihnea Ovidenie <mihnea@adobe.com> 2 22 -
trunk/Source/WebCore/rendering/LayoutTypes.h
r93334 r93429 72 72 } 73 73 74 inline LayoutSize flooredLayoutSize(const FloatPoint& p) 75 { 76 return LayoutSize(static_cast<int>(p.x()), static_cast<int>(p.y())); 77 } 78 74 79 inline LayoutUnit roundedLayoutUnit(float value) 75 80 { -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r93287 r93429 254 254 } 255 255 256 void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags, IntPoint* cachedOffset)256 void RenderLayer::updateLayerPositions(UpdateLayerPositionsFlags flags, LayoutPoint* cachedOffset) 257 257 { 258 258 updateLayerPosition(); // For relpositioned layers or non-positioned layers, 259 259 // we need to keep in sync, since we may have shifted relative 260 260 // to our parent layer. 261 IntPoint oldCachedOffset;261 LayoutPoint oldCachedOffset; 262 262 if (cachedOffset) { 263 263 // We can't cache our offset to the repaint container if the mapping is anything more complex than a simple translation … … 276 276 cachedOffset->move(m_topLeft.x(), m_topLeft.y()); // Fast case 277 277 else { 278 IntPoint offset;278 LayoutPoint offset; 279 279 convertToLayerCoords(root(), offset); 280 280 *cachedOffset = offset; … … 283 283 } 284 284 285 IntPoint offset;285 LayoutPoint offset; 286 286 if (cachedOffset) { 287 287 offset = *cachedOffset; 288 288 #ifndef NDEBUG 289 IntPoint nonCachedOffset;289 LayoutPoint nonCachedOffset; 290 290 convertToLayerCoords(root(), nonCachedOffset); 291 291 ASSERT(offset == nonCachedOffset); … … 310 310 311 311 RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); 312 IntRect newRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);313 IntRect newOutlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, cachedOffset);312 LayoutRect newRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); 313 LayoutRect newOutlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, cachedOffset); 314 314 // FIXME: Should ASSERT that value calculated for newOutlineBox using the cached offset is the same 315 315 // as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048 … … 327 327 m_outlineBox = newOutlineBox; 328 328 } else { 329 m_repaintRect = IntRect();330 m_outlineBox = IntRect();329 m_repaintRect = LayoutRect(); 330 m_outlineBox = LayoutRect(); 331 331 } 332 332 … … 363 363 } 364 364 365 IntRect RenderLayer::repaintRectIncludingDescendants() const366 { 367 IntRect repaintRect = m_repaintRect;365 LayoutRect RenderLayer::repaintRectIncludingDescendants() const 366 { 367 LayoutRect repaintRect = m_repaintRect; 368 368 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 369 369 repaintRect.unite(child->repaintRectIncludingDescendants()); … … 642 642 void RenderLayer::updateLayerPosition() 643 643 { 644 IntPoint localPoint;645 IntSize inlineBoundingBoxOffset; // We don't put this into the RenderLayer x/y for inlines, so we need to subtract it out when done.644 LayoutPoint localPoint; 645 LayoutSize inlineBoundingBoxOffset; // We don't put this into the RenderLayer x/y for inlines, so we need to subtract it out when done. 646 646 if (renderer()->isRenderInline()) { 647 647 RenderInline* inlineFlow = toRenderInline(renderer()); 648 IntRect lineBox = inlineFlow->linesBoundingBox();648 LayoutRect lineBox = inlineFlow->linesBoundingBox(); 649 649 setSize(lineBox.size()); 650 650 inlineBoundingBoxOffset = toSize(lineBox.location()); … … 681 681 682 682 // For positioned layers, we subtract out the enclosing positioned layer's scroll offset. 683 IntSize offset = positionedParent->scrolledContentOffset();683 LayoutSize offset = positionedParent->scrolledContentOffset(); 684 684 localPoint -= offset; 685 685 686 686 if (renderer()->isPositioned() && positionedParent->renderer()->isRelPositioned() && positionedParent->renderer()->isRenderInline()) { 687 IntSize offset = toRenderInline(positionedParent->renderer())->relativePositionedInlineOffset(toRenderBox(renderer()));687 LayoutSize offset = toRenderInline(positionedParent->renderer())->relativePositionedInlineOffset(toRenderBox(renderer())); 688 688 localPoint += offset; 689 689 } … … 692 692 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. 693 693 // They won't split across columns properly. 694 IntSize columnOffset;694 LayoutSize columnOffset; 695 695 parent()->renderer()->adjustForColumns(columnOffset, localPoint); 696 696 localPoint += columnOffset; 697 697 } 698 698 699 IntSize scrollOffset = parent()->scrolledContentOffset();699 LayoutSize scrollOffset = parent()->scrolledContentOffset(); 700 700 localPoint -= scrollOffset; 701 701 } … … 705 705 localPoint.move(m_relativeOffset); 706 706 } else { 707 m_relativeOffset = IntSize();707 m_relativeOffset = LayoutSize(); 708 708 } 709 709 … … 723 723 724 724 // Maybe fetch the perspective from the backing? 725 const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();725 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); 726 726 const float boxWidth = borderBox.width(); 727 727 const float boxHeight = borderBox.height(); … … 748 748 return FloatPoint(); 749 749 750 const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();750 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); 751 751 RenderStyle* style = renderer()->style(); 752 752 … … 849 849 } 850 850 851 IntPoint RenderLayer::absoluteToContents(const IntPoint& absolutePoint) const851 LayoutPoint RenderLayer::absoluteToContents(const LayoutPoint& absolutePoint) const 852 852 { 853 853 // We don't use convertToLayerCoords because it doesn't know about transforms 854 return rounded IntPoint(renderer()->absoluteToLocal(absolutePoint, false, true));854 return roundedLayoutPoint(renderer()->absoluteToLocal(absolutePoint, false, true)); 855 855 } 856 856 … … 887 887 } 888 888 889 static IntRect transparencyClipBox(const RenderLayer* l, const RenderLayer* rootLayer, PaintBehavior paintBehavior);890 891 static void expandClipRectForDescendantsAndReflection( IntRect& clipRect, const RenderLayer* l, const RenderLayer* rootLayer, PaintBehavior paintBehavior)889 static LayoutRect transparencyClipBox(const RenderLayer*, const RenderLayer* rootLayer, PaintBehavior); 890 891 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, const RenderLayer* layer, const RenderLayer* rootLayer, PaintBehavior paintBehavior) 892 892 { 893 893 // If we have a mask, then the clip is limited to the border box area (and there is 894 894 // no need to examine child layers). 895 if (!l ->renderer()->hasMask()) {895 if (!layer->renderer()->hasMask()) { 896 896 // Note: we don't have to walk z-order lists since transparent elements always establish 897 897 // a stacking context. This means we can just walk the layer tree directly. 898 for (RenderLayer* curr = l ->firstChild(); curr; curr = curr->nextSibling()) {899 if (!l ->reflection() || l->reflectionLayer() != curr)898 for (RenderLayer* curr = layer->firstChild(); curr; curr = curr->nextSibling()) { 899 if (!layer->reflection() || layer->reflectionLayer() != curr) 900 900 clipRect.unite(transparencyClipBox(curr, rootLayer, paintBehavior)); 901 901 } … … 906 906 // FIXME: Accelerated compositing will eventually want to do something smart here to avoid incorporating this 907 907 // size into the parent layer. 908 if (l ->renderer()->hasReflection()) {909 IntPoint delta;910 l ->convertToLayerCoords(rootLayer, delta);908 if (layer->renderer()->hasReflection()) { 909 LayoutPoint delta; 910 layer->convertToLayerCoords(rootLayer, delta); 911 911 clipRect.move(-delta.x(), -delta.y()); 912 clipRect.unite(l ->renderBox()->reflectedRect(clipRect));912 clipRect.unite(layer->renderBox()->reflectedRect(clipRect)); 913 913 clipRect.moveBy(delta); 914 914 } 915 915 } 916 916 917 static IntRect transparencyClipBox(const RenderLayer* l, const RenderLayer* rootLayer, PaintBehavior paintBehavior)917 static LayoutRect transparencyClipBox(const RenderLayer* layer, const RenderLayer* rootLayer, PaintBehavior paintBehavior) 918 918 { 919 919 // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the … … 921 921 // would be better to respect clips. 922 922 923 if (rootLayer != l && l->paintsWithTransform(paintBehavior)) {923 if (rootLayer != layer && layer->paintsWithTransform(paintBehavior)) { 924 924 // The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass 925 925 // the transformed layer and all of its children. 926 IntPoint delta;927 l ->convertToLayerCoords(rootLayer, delta);926 LayoutPoint delta; 927 layer->convertToLayerCoords(rootLayer, delta); 928 928 929 929 TransformationMatrix transform; 930 930 transform.translate(delta.x(), delta.y()); 931 transform = transform * *l ->transform();932 933 IntRect clipRect = l->boundingBox(l);934 expandClipRectForDescendantsAndReflection(clipRect, l , l, paintBehavior);931 transform = transform * *layer->transform(); 932 933 LayoutRect clipRect = layer->boundingBox(layer); 934 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, paintBehavior); 935 935 return transform.mapRect(clipRect); 936 936 } 937 937 938 IntRect clipRect = l->boundingBox(rootLayer);939 expandClipRectForDescendantsAndReflection(clipRect, l , rootLayer, paintBehavior);938 LayoutRect clipRect = layer->boundingBox(rootLayer); 939 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, paintBehavior); 940 940 return clipRect; 941 941 } … … 953 953 m_usedTransparency = true; 954 954 p->save(); 955 IntRect clipRect = transparencyClipBox(this, rootLayer, paintBehavior);955 LayoutRect clipRect = transparencyClipBox(this, rootLayer, paintBehavior); 956 956 p->clip(clipRect); 957 957 p->beginTransparencyLayer(renderer()->opacity()); … … 1116 1116 1117 1117 void 1118 RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, IntPoint& location) const1118 RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint& location) const 1119 1119 { 1120 1120 if (ancestorLayer == this) … … 1126 1126 // localToAbsolute() on the RenderView. 1127 1127 FloatPoint absPos = renderer()->localToAbsolute(FloatPoint(), true); 1128 location += floored IntSize(absPos);1128 location += flooredLayoutSize(absPos); 1129 1129 return; 1130 1130 } … … 1150 1150 1151 1151 if (fixedPositionContainerLayer != ancestorLayer) { 1152 IntPoint fixedContainerCoords;1152 LayoutPoint fixedContainerCoords; 1153 1153 convertToLayerCoords(fixedPositionContainerLayer, fixedContainerCoords); 1154 1154 1155 IntPoint ancestorCoords;1155 LayoutPoint ancestorCoords; 1156 1156 ancestorLayer->convertToLayerCoords(fixedPositionContainerLayer, ancestorCoords); 1157 1157 … … 1183 1183 RenderLayer* positionedAncestor = parentLayer->enclosingPositionedAncestor(); 1184 1184 1185 IntPoint thisCoords;1185 LayoutPoint thisCoords; 1186 1186 convertToLayerCoords(positionedAncestor, thisCoords); 1187 1187 1188 IntPoint ancestorCoords;1188 LayoutPoint ancestorCoords; 1189 1189 ancestorLayer->convertToLayerCoords(positionedAncestor, ancestorCoords); 1190 1190 … … 1204 1204 1205 1205 void 1206 RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, IntRect& rect) const1207 { 1208 IntPoint delta;1206 RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect& rect) const 1207 { 1208 LayoutPoint delta; 1209 1209 convertToLayerCoords(ancestorLayer, delta); 1210 1210 rect.move(-delta.x(), -delta.y()); … … 1225 1225 } 1226 1226 1227 void RenderLayer::panScrollFromPoint(const IntPoint& sourcePoint)1227 void RenderLayer::panScrollFromPoint(const LayoutPoint& sourcePoint) 1228 1228 { 1229 1229 Frame* frame = renderer()->frame(); … … 1231 1231 return; 1232 1232 1233 IntPoint currentMousePosition = frame->eventHandler()->currentMousePosition();1233 LayoutPoint currentMousePosition = frame->eventHandler()->currentMousePosition(); 1234 1234 1235 1235 // We need to check if the current mouse position is out of the window. When the mouse is out of the window, the position is incoherent 1236 static IntPoint previousMousePosition;1236 static LayoutPoint previousMousePosition; 1237 1237 if (currentMousePosition.x() < 0 || currentMousePosition.y() < 0) 1238 1238 currentMousePosition = previousMousePosition; … … 1240 1240 previousMousePosition = currentMousePosition; 1241 1241 1242 int xDelta = currentMousePosition.x() - sourcePoint.x();1243 int yDelta = currentMousePosition.y() - sourcePoint.y();1242 LayoutUnit xDelta = currentMousePosition.x() - sourcePoint.x(); 1243 LayoutUnit yDelta = currentMousePosition.y() - sourcePoint.y(); 1244 1244 1245 1245 if (abs(xDelta) <= ScrollView::noPanScrollRadius) // at the center we let the space for the icon … … 1251 1251 } 1252 1252 1253 void RenderLayer::scrollByRecursively( int xDelta, int yDelta)1253 void RenderLayer::scrollByRecursively(LayoutUnit xDelta, LayoutUnit yDelta) 1254 1254 { 1255 1255 if (!xDelta && !yDelta) … … 1261 1261 1262 1262 if (renderer()->hasOverflowClip() && !restrictedByLineClamp) { 1263 int newOffsetX = scrollXOffset() + xDelta;1264 int newOffsetY = scrollYOffset() + yDelta;1263 LayoutUnit newOffsetX = scrollXOffset() + xDelta; 1264 LayoutUnit newOffsetY = scrollYOffset() + yDelta; 1265 1265 scrollToOffset(newOffsetX, newOffsetY); 1266 1266 1267 1267 // If this layer can't do the scroll we ask the next layer up that can scroll to try 1268 int leftToScrollX = newOffsetX - scrollXOffset();1269 int leftToScrollY = newOffsetY - scrollYOffset();1268 LayoutUnit leftToScrollX = newOffsetX - scrollXOffset(); 1269 LayoutUnit leftToScrollY = newOffsetY - scrollYOffset(); 1270 1270 if ((leftToScrollX || leftToScrollY) && renderer()->parent()) { 1271 1271 if (RenderLayer* scrollableLayer = enclosingScrollableLayer()) … … 1279 1279 // If we are here, we were called on a renderer that can be programmatically scrolled, but doesn't 1280 1280 // have an overflow clip. Which means that it is a document node that can be scrolled. 1281 renderer()->view()->frameView()->scrollBy( IntSize(xDelta, yDelta));1281 renderer()->view()->frameView()->scrollBy(LayoutSize(xDelta, yDelta)); 1282 1282 // FIXME: If we didn't scroll the whole way, do we want to try looking at the frames ownerElement? 1283 1283 // https://bugs.webkit.org/show_bug.cgi?id=28237 … … 1285 1285 } 1286 1286 1287 void RenderLayer::scrollToOffset( int x, int y, ScrollOffsetClamping clamp)1287 void RenderLayer::scrollToOffset(LayoutUnit x, LayoutUnit y, ScrollOffsetClamping clamp) 1288 1288 { 1289 1289 if (clamp == ScrollOffsetClamped) { … … 1292 1292 return; 1293 1293 1294 int maxX = scrollWidth() - box->clientWidth();1295 int maxY = scrollHeight() - box->clientHeight();1296 1297 x = min(max (x, 0), maxX);1298 y = min(max (y, 0), maxY);1299 } 1300 1301 ScrollableArea::scrollToOffsetWithoutAnimation( IntPoint(x, y));1302 } 1303 1304 void RenderLayer::scrollTo( int x, int y)1294 LayoutUnit maxX = scrollWidth() - box->clientWidth(); 1295 LayoutUnit maxY = scrollHeight() - box->clientHeight(); 1296 1297 x = min(max<LayoutUnit>(x, 0), maxX); 1298 y = min(max<LayoutUnit>(y, 0), maxY); 1299 } 1300 1301 ScrollableArea::scrollToOffsetWithoutAnimation(LayoutPoint(x, y)); 1302 } 1303 1304 void RenderLayer::scrollTo(LayoutUnit x, LayoutUnit y) 1305 1305 { 1306 1306 RenderBox* box = renderBox(); … … 1319 1319 // is either occluded by another layer or clipped by an enclosing 1320 1320 // layer or contains fixed backgrounds, etc.). 1321 IntSize newScrollOffset = IntSize(x - m_scrollOrigin.x(), y - m_scrollOrigin.y());1321 LayoutSize newScrollOffset = LayoutSize(x - m_scrollOrigin.x(), y - m_scrollOrigin.y()); 1322 1322 if (m_scrollOffset == newScrollOffset) 1323 1323 return; … … 1359 1359 1360 1360 RenderBoxModelObject* repaintContainer = renderer()->containerForRepaint(); 1361 IntRect rectForRepaint = renderer()->clippedOverflowRectForRepaint(repaintContainer);1361 LayoutRect rectForRepaint = renderer()->clippedOverflowRectForRepaint(repaintContainer); 1362 1362 1363 1363 Frame* frame = renderer()->frame(); … … 1381 1381 } 1382 1382 1383 void RenderLayer::scrollRectToVisible(const IntRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)1383 void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) 1384 1384 { 1385 1385 RenderLayer* parentLayer = 0; 1386 IntRect newRect = rect;1386 LayoutRect newRect = rect; 1387 1387 1388 1388 // We may end up propagating a scroll event. It is important that we suspend events until … … 1406 1406 absPos.move(box->borderLeft(), box->borderTop()); 1407 1407 1408 IntRect layerBounds = IntRect(absPos.x() + scrollXOffset(), absPos.y() + scrollYOffset(), box->clientWidth(), box->clientHeight());1409 IntRect exposeRect = IntRect(rect.x() + scrollXOffset(), rect.y() + scrollYOffset(), rect.width(), rect.height());1410 IntRect r = getRectToExpose(layerBounds, exposeRect, alignX, alignY);1408 LayoutRect layerBounds = LayoutRect(absPos.x() + scrollXOffset(), absPos.y() + scrollYOffset(), box->clientWidth(), box->clientHeight()); 1409 LayoutRect exposeRect = LayoutRect(rect.x() + scrollXOffset(), rect.y() + scrollYOffset(), rect.width(), rect.height()); 1410 LayoutRect r = getRectToExpose(layerBounds, exposeRect, alignX, alignY); 1411 1411 1412 int xOffset = r.x() - absPos.x();1413 int yOffset = r.y() - absPos.y();1412 LayoutUnit xOffset = r.x() - absPos.x(); 1413 LayoutUnit yOffset = r.y() - absPos.y(); 1414 1414 // Adjust offsets if they're outside of the allowable range. 1415 xOffset = max (0, min(scrollWidth() - layerBounds.width(), xOffset));1416 yOffset = max (0, min(scrollHeight() - layerBounds.height(), yOffset));1415 xOffset = max<LayoutUnit>(0, min(scrollWidth() - layerBounds.width(), xOffset)); 1416 yOffset = max<LayoutUnit>(0, min(scrollHeight() - layerBounds.height(), yOffset)); 1417 1417 1418 1418 if (xOffset != scrollXOffset() || yOffset != scrollYOffset()) { 1419 int diffX = scrollXOffset();1420 int diffY = scrollYOffset();1419 LayoutUnit diffX = scrollXOffset(); 1420 LayoutUnit diffY = scrollYOffset(); 1421 1421 scrollToOffset(xOffset, yOffset); 1422 1422 diffX = scrollXOffset() - diffX; … … 1428 1428 if (frameView) { 1429 1429 if (renderer()->document() && renderer()->document()->ownerElement() && renderer()->document()->ownerElement()->renderer()) { 1430 IntRect viewRect = frameView->visibleContentRect();1431 IntRect r = getRectToExpose(viewRect, rect, alignX, alignY);1430 LayoutRect viewRect = frameView->visibleContentRect(); 1431 LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY); 1432 1432 1433 int xOffset = r.x();1434 int yOffset = r.y();1433 LayoutUnit xOffset = r.x(); 1434 LayoutUnit yOffset = r.y(); 1435 1435 // Adjust offsets if they're outside of the allowable range. 1436 xOffset = max (0, min(frameView->contentsWidth(), xOffset));1437 yOffset = max (0, min(frameView->contentsHeight(), yOffset));1438 1439 frameView->setScrollPosition( IntPoint(xOffset, yOffset));1436 xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset)); 1437 yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset)); 1438 1439 frameView->setScrollPosition(LayoutPoint(xOffset, yOffset)); 1440 1440 parentLayer = renderer()->document()->ownerElement()->renderer()->enclosingLayer(); 1441 1441 newRect.setX(rect.x() - frameView->scrollX() + frameView->x()); 1442 1442 newRect.setY(rect.y() - frameView->scrollY() + frameView->y()); 1443 1443 } else { 1444 IntRect viewRect = frameView->visibleContentRect();1445 IntRect r = getRectToExpose(viewRect, rect, alignX, alignY);1444 LayoutRect viewRect = frameView->visibleContentRect(); 1445 LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY); 1446 1446 1447 1447 frameView->setScrollPosition(r.location()); … … 1467 1467 } 1468 1468 1469 IntRect RenderLayer::getRectToExpose(const IntRect &visibleRect, const IntRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)1469 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const LayoutRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) 1470 1470 { 1471 1471 // Determine the appropriate X behavior. 1472 1472 ScrollBehavior scrollX; 1473 IntRect exposeRectX(exposeRect.x(), visibleRect.y(), exposeRect.width(), visibleRect.height());1474 int intersectWidth = intersection(visibleRect, exposeRectX).width();1473 LayoutRect exposeRectX(exposeRect.x(), visibleRect.y(), exposeRect.width(), visibleRect.height()); 1474 LayoutUnit intersectWidth = intersection(visibleRect, exposeRectX).width(); 1475 1475 if (intersectWidth == exposeRect.width() || intersectWidth >= MIN_INTERSECT_FOR_REVEAL) 1476 1476 // If the rectangle is fully visible, use the specified visible behavior. … … 1494 1494 1495 1495 // Given the X behavior, compute the X coordinate. 1496 int x;1496 LayoutUnit x; 1497 1497 if (scrollX == noScroll) 1498 1498 x = visibleRect.x(); … … 1506 1506 // Determine the appropriate Y behavior. 1507 1507 ScrollBehavior scrollY; 1508 IntRect exposeRectY(visibleRect.x(), exposeRect.y(), visibleRect.width(), exposeRect.height());1509 int intersectHeight = intersection(visibleRect, exposeRectY).height();1508 LayoutRect exposeRectY(visibleRect.x(), exposeRect.y(), visibleRect.width(), exposeRect.height()); 1509 LayoutUnit intersectHeight = intersection(visibleRect, exposeRectY).height(); 1510 1510 if (intersectHeight == exposeRect.height()) 1511 1511 // If the rectangle is fully visible, use the specified visible behavior. … … 1527 1527 1528 1528 // Given the Y behavior, compute the Y coordinate. 1529 int y;1529 LayoutUnit y; 1530 1530 if (scrollY == noScroll) 1531 1531 y = visibleRect.y(); … … 1537 1537 y = exposeRect.y(); 1538 1538 1539 return IntRect(IntPoint(x, y), visibleRect.size());1539 return LayoutRect(LayoutPoint(x, y), visibleRect.size()); 1540 1540 } 1541 1541 … … 1554 1554 #endif 1555 1555 1556 IntPoint currentDocumentPosition = frameView->windowToContents(frame->eventHandler()->currentMousePosition());1557 scrollRectToVisible( IntRect(currentDocumentPosition, IntSize(1, 1)), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);1556 LayoutPoint currentDocumentPosition = frameView->windowToContents(frame->eventHandler()->currentMousePosition()); 1557 scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 1558 1558 } 1559 1559 … … 1623 1623 } 1624 1624 1625 int RenderLayer::scrollSize(ScrollbarOrientation orientation) const1625 LayoutUnit RenderLayer::scrollSize(ScrollbarOrientation orientation) const 1626 1626 { 1627 1627 Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_hBar : m_vBar).get(); … … 1629 1629 } 1630 1630 1631 void RenderLayer::setScrollOffset(const IntPoint& offset)1631 void RenderLayer::setScrollOffset(const LayoutPoint& offset) 1632 1632 { 1633 1633 scrollTo(offset.x(), offset.y()); 1634 1634 } 1635 1635 1636 int RenderLayer::scrollPosition(Scrollbar* scrollbar) const1636 LayoutUnit RenderLayer::scrollPosition(Scrollbar* scrollbar) const 1637 1637 { 1638 1638 if (scrollbar->orientation() == HorizontalScrollbar) … … 1643 1643 } 1644 1644 1645 IntPoint RenderLayer::scrollPosition() const1645 LayoutPoint RenderLayer::scrollPosition() const 1646 1646 { 1647 1647 return m_scrollOrigin + m_scrollOffset; 1648 1648 } 1649 1649 1650 IntPoint RenderLayer::minimumScrollPosition() const1650 LayoutPoint RenderLayer::minimumScrollPosition() const 1651 1651 { 1652 1652 return m_scrollOrigin; 1653 1653 } 1654 1654 1655 IntPoint RenderLayer::maximumScrollPosition() const1655 LayoutPoint RenderLayer::maximumScrollPosition() const 1656 1656 { 1657 1657 // FIXME: m_scrollSize may not be up-to-date if m_scrollDimensionsDirty is true. … … 1659 1659 } 1660 1660 1661 IntRect RenderLayer::visibleContentRect(bool includeScrollbars) const1662 { 1663 int verticalScrollbarWidth = 0;1664 int horizontalScrollbarHeight = 0;1661 LayoutRect RenderLayer::visibleContentRect(bool includeScrollbars) const 1662 { 1663 LayoutUnit verticalScrollbarWidth = 0; 1664 LayoutUnit horizontalScrollbarHeight = 0; 1665 1665 if (includeScrollbars) { 1666 1666 verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0; … … 1668 1668 } 1669 1669 1670 return IntRect(IntPoint(scrollXOffset(), scrollYOffset()),1671 IntSize(max(0, m_layerSize.width() - verticalScrollbarWidth),1672 max(0, m_layerSize.height() - horizontalScrollbarHeight)));1673 } 1674 1675 IntSize RenderLayer::overhangAmount() const1676 { 1677 return IntSize();1678 } 1679 1680 void RenderLayer::didCompleteRubberBand(const IntSize&) const1670 return LayoutRect(LayoutPoint(scrollXOffset(), scrollYOffset()), 1671 LayoutSize(max<LayoutUnit>(0, m_layerSize.width() - verticalScrollbarWidth), 1672 max<LayoutUnit>(0, m_layerSize.height() - horizontalScrollbarHeight))); 1673 } 1674 1675 LayoutSize RenderLayer::overhangAmount() const 1676 { 1677 return LayoutSize(); 1678 } 1679 1680 void RenderLayer::didCompleteRubberBand(const LayoutSize&) const 1681 1681 { 1682 1682 } … … 1688 1688 } 1689 1689 1690 static IntRect cornerRect(const RenderLayer* layer, const IntRect& bounds)1690 static LayoutRect cornerRect(const RenderLayer* layer, const LayoutRect& bounds) 1691 1691 { 1692 1692 int horizontalThickness; … … 1707 1707 verticalThickness = layer->horizontalScrollbar()->height(); 1708 1708 } 1709 return IntRect(bounds.maxX() - horizontalThickness - layer->renderer()->style()->borderRightWidth(),1710 bounds.maxY() - verticalThickness - layer->renderer()->style()->borderBottomWidth(),1711 horizontalThickness, verticalThickness);1712 } 1713 1714 IntRect RenderLayer::scrollCornerRect() const1709 return LayoutRect(bounds.maxX() - horizontalThickness - layer->renderer()->style()->borderRightWidth(), 1710 bounds.maxY() - verticalThickness - layer->renderer()->style()->borderBottomWidth(), 1711 horizontalThickness, verticalThickness); 1712 } 1713 1714 LayoutRect RenderLayer::scrollCornerRect() const 1715 1715 { 1716 1716 // We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box. … … 1723 1723 if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar))) 1724 1724 return cornerRect(this, renderBox()->borderBoxRect()); 1725 return IntRect();1726 } 1727 1728 static IntRect resizerCornerRect(const RenderLayer* layer, const IntRect& bounds)1725 return LayoutRect(); 1726 } 1727 1728 static LayoutRect resizerCornerRect(const RenderLayer* layer, const LayoutRect& bounds) 1729 1729 { 1730 1730 ASSERT(layer->renderer()->isBox()); 1731 1731 if (layer->renderer()->style()->resize() == RESIZE_NONE) 1732 return IntRect();1732 return LayoutRect(); 1733 1733 return cornerRect(layer, bounds); 1734 1734 } 1735 1735 1736 IntRect RenderLayer::scrollCornerAndResizerRect() const1736 LayoutRect RenderLayer::scrollCornerAndResizerRect() const 1737 1737 { 1738 1738 RenderBox* box = renderBox(); 1739 1739 if (!box) 1740 return IntRect();1741 IntRect scrollCornerAndResizer = scrollCornerRect();1740 return LayoutRect(); 1741 LayoutRect scrollCornerAndResizer = scrollCornerRect(); 1742 1742 if (scrollCornerAndResizer.isEmpty()) 1743 1743 scrollCornerAndResizer = resizerCornerRect(this, box->borderBoxRect()); … … 1751 1751 } 1752 1752 1753 IntRect RenderLayer::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const1753 LayoutRect RenderLayer::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const LayoutRect& scrollbarRect) const 1754 1754 { 1755 1755 RenderView* view = renderer()->view(); … … 1757 1757 return scrollbarRect; 1758 1758 1759 IntRect rect = scrollbarRect;1759 LayoutRect rect = scrollbarRect; 1760 1760 rect.move(scrollbarOffset(scrollbar)); 1761 1761 … … 1763 1763 } 1764 1764 1765 IntRect RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const1765 LayoutRect RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const LayoutRect& parentRect) const 1766 1766 { 1767 1767 RenderView* view = renderer()->view(); … … 1769 1769 return parentRect; 1770 1770 1771 IntRect rect = view->frameView()->convertToRenderer(renderer(), parentRect);1771 LayoutRect rect = view->frameView()->convertToRenderer(renderer(), parentRect); 1772 1772 rect.move(-scrollbarOffset(scrollbar)); 1773 1773 return rect; 1774 1774 } 1775 1775 1776 IntPoint RenderLayer::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const1776 LayoutPoint RenderLayer::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const LayoutPoint& scrollbarPoint) const 1777 1777 { 1778 1778 RenderView* view = renderer()->view(); … … 1780 1780 return scrollbarPoint; 1781 1781 1782 IntPoint point = scrollbarPoint;1782 LayoutPoint point = scrollbarPoint; 1783 1783 point.move(scrollbarOffset(scrollbar)); 1784 1784 return view->frameView()->convertFromRenderer(renderer(), point); 1785 1785 } 1786 1786 1787 IntPoint RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const1787 LayoutPoint RenderLayer::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const LayoutPoint& parentPoint) const 1788 1788 { 1789 1789 RenderView* view = renderer()->view(); … … 1791 1791 return parentPoint; 1792 1792 1793 IntPoint point = view->frameView()->convertToRenderer(renderer(), parentPoint);1793 LayoutPoint point = view->frameView()->convertToRenderer(renderer(), parentPoint); 1794 1794 1795 1795 point.move(-scrollbarOffset(scrollbar)); … … 1797 1797 } 1798 1798 1799 IntSize RenderLayer::contentsSize() const1800 { 1801 return IntSize(const_cast<RenderLayer*>(this)->scrollWidth(), const_cast<RenderLayer*>(this)->scrollHeight());1799 LayoutSize RenderLayer::contentsSize() const 1800 { 1801 return LayoutSize(const_cast<RenderLayer*>(this)->scrollWidth(), const_cast<RenderLayer*>(this)->scrollHeight()); 1802 1802 } 1803 1803 … … 1825 1825 } 1826 1826 1827 IntPoint RenderLayer::currentMousePosition() const1828 { 1829 return renderer()->frame() ? renderer()->frame()->eventHandler()->currentMousePosition() : IntPoint();1830 } 1831 1832 IntSize RenderLayer::scrollbarOffset(const Scrollbar* scrollbar) const1827 LayoutPoint RenderLayer::currentMousePosition() const 1828 { 1829 return renderer()->frame() ? renderer()->frame()->eventHandler()->currentMousePosition() : LayoutPoint(); 1830 } 1831 1832 LayoutSize RenderLayer::scrollbarOffset(const Scrollbar* scrollbar) const 1833 1833 { 1834 1834 RenderBox* box = renderBox(); 1835 1835 1836 1836 if (scrollbar == m_vBar.get()) 1837 return IntSize(box->width() - box->borderRight() - scrollbar->width(), box->borderTop());1837 return LayoutSize(box->width() - box->borderRight() - scrollbar->width(), box->borderTop()); 1838 1838 1839 1839 if (scrollbar == m_hBar.get()) 1840 return IntSize(box->borderLeft(), box->height() - box->borderBottom() - scrollbar->height());1840 return LayoutSize(box->borderLeft(), box->height() - box->borderBottom() - scrollbar->height()); 1841 1841 1842 1842 ASSERT_NOT_REACHED(); 1843 return IntSize();1844 } 1845 1846 void RenderLayer::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)1843 return LayoutSize(); 1844 } 1845 1846 void RenderLayer::invalidateScrollbarRect(Scrollbar* scrollbar, const LayoutRect& rect) 1847 1847 { 1848 1848 #if USE(ACCELERATED_COMPOSITING) … … 1859 1859 } 1860 1860 #endif 1861 IntRect scrollRect = rect;1861 LayoutRect scrollRect = rect; 1862 1862 RenderBox* box = renderBox(); 1863 1863 ASSERT(box); … … 1869 1869 } 1870 1870 1871 void RenderLayer::invalidateScrollCornerRect(const IntRect& rect)1871 void RenderLayer::invalidateScrollCornerRect(const LayoutRect& rect) 1872 1872 { 1873 1873 #if USE(ACCELERATED_COMPOSITING) … … 2030 2030 } 2031 2031 2032 void RenderLayer::positionOverflowControls(const IntSize& offsetFromLayer)2032 void RenderLayer::positionOverflowControls(const LayoutSize& offsetFromLayer) 2033 2033 { 2034 2034 if (!m_hBar && !m_vBar && (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE)) … … 2039 2039 return; 2040 2040 2041 const IntRect& borderBox = box->borderBoxRect();2042 const IntRect& scrollCorner = scrollCornerRect();2043 IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());2041 const LayoutRect& borderBox = box->borderBoxRect(); 2042 const LayoutRect& scrollCorner = scrollCornerRect(); 2043 LayoutRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size()); 2044 2044 if (m_vBar) 2045 m_vBar->setFrameRect( IntRect(absBounds.maxX() - box->borderRight() - m_vBar->width(),2046 absBounds.y() + box->borderTop(),2047 m_vBar->width(),2048 absBounds.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height()));2045 m_vBar->setFrameRect(LayoutRect(absBounds.maxX() - box->borderRight() - m_vBar->width(), 2046 absBounds.y() + box->borderTop(), 2047 m_vBar->width(), 2048 absBounds.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height())); 2049 2049 2050 2050 if (m_hBar) 2051 m_hBar->setFrameRect( IntRect(absBounds.x() + box->borderLeft(),2052 absBounds.maxY() - box->borderBottom() - m_hBar->height(),2053 absBounds.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),2054 m_hBar->height()));2051 m_hBar->setFrameRect(LayoutRect(absBounds.x() + box->borderLeft(), 2052 absBounds.maxY() - box->borderBottom() - m_hBar->height(), 2053 absBounds.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(), 2054 m_hBar->height())); 2055 2055 2056 2056 #if USE(ACCELERATED_COMPOSITING) … … 2071 2071 2072 2072 if (GraphicsLayer* layer = layerForScrollCorner()) { 2073 const IntRect& scrollCornerAndResizer = scrollCornerAndResizerRect();2073 const LayoutRect& scrollCornerAndResizer = scrollCornerAndResizerRect(); 2074 2074 layer->setPosition(scrollCornerAndResizer.location()); 2075 2075 layer->setSize(scrollCornerAndResizer.size()); … … 2084 2084 } 2085 2085 2086 int RenderLayer::scrollWidth()2086 LayoutUnit RenderLayer::scrollWidth() 2087 2087 { 2088 2088 if (m_scrollDimensionsDirty) … … 2091 2091 } 2092 2092 2093 int RenderLayer::scrollHeight()2093 LayoutUnit RenderLayer::scrollHeight() 2094 2094 { 2095 2095 if (m_scrollDimensionsDirty) … … 2098 2098 } 2099 2099 2100 int RenderLayer::overflowTop() const2100 LayoutUnit RenderLayer::overflowTop() const 2101 2101 { 2102 2102 RenderBox* box = renderBox(); 2103 IntRect overflowRect(box->layoutOverflowRect());2103 LayoutRect overflowRect(box->layoutOverflowRect()); 2104 2104 box->flipForWritingMode(overflowRect); 2105 2105 return overflowRect.y(); 2106 2106 } 2107 2107 2108 int RenderLayer::overflowBottom() const2108 LayoutUnit RenderLayer::overflowBottom() const 2109 2109 { 2110 2110 RenderBox* box = renderBox(); 2111 IntRect overflowRect(box->layoutOverflowRect());2111 LayoutRect overflowRect(box->layoutOverflowRect()); 2112 2112 box->flipForWritingMode(overflowRect); 2113 2113 return overflowRect.maxY(); 2114 2114 } 2115 2115 2116 int RenderLayer::overflowLeft() const2116 LayoutUnit RenderLayer::overflowLeft() const 2117 2117 { 2118 2118 RenderBox* box = renderBox(); 2119 IntRect overflowRect(box->layoutOverflowRect());2119 LayoutRect overflowRect(box->layoutOverflowRect()); 2120 2120 box->flipForWritingMode(overflowRect); 2121 2121 return overflowRect.x(); 2122 2122 } 2123 2123 2124 int RenderLayer::overflowRight() const2124 LayoutUnit RenderLayer::overflowRight() const 2125 2125 { 2126 2126 RenderBox* box = renderBox(); 2127 IntRect overflowRect(box->layoutOverflowRect());2127 LayoutRect overflowRect(box->layoutOverflowRect()); 2128 2128 box->flipForWritingMode(overflowRect); 2129 2129 return overflowRect.maxX(); … … 2143 2143 m_scrollSize.setHeight(overflowBottom() - overflowTop()); 2144 2144 2145 m_scrollOrigin = IntPoint(-m_scrollOverflow.width(), -m_scrollOverflow.height());2145 m_scrollOrigin = LayoutPoint(-m_scrollOverflow.width(), -m_scrollOverflow.height()); 2146 2146 2147 2147 if (needHBar) … … 2188 2188 // Layout may cause us to be in an invalid scroll position. In this case we need 2189 2189 // to pull our scroll offsets back to the max (or push them up to the min). 2190 int newX = max(0, min(scrollXOffset(), scrollWidth() - box->clientWidth()));2191 int newY = max(0, min(scrollYOffset(), scrollHeight() - box->clientHeight()));2190 LayoutUnit newX = max<LayoutUnit>(0, min(scrollXOffset(), scrollWidth() - box->clientWidth())); 2191 LayoutUnit newY = max<LayoutUnit>(0, min(scrollYOffset(), scrollHeight() - box->clientHeight())); 2192 2192 if (newX != scrollXOffset() || newY != scrollYOffset()) { 2193 2193 RenderView* view = renderer()->view(); … … 2259 2259 // Set up the range (and page step/line step). 2260 2260 if (m_hBar) { 2261 int clientWidth = box->clientWidth();2262 int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1);2261 LayoutUnit clientWidth = box->clientWidth(); 2262 LayoutUnit pageStep = max<LayoutUnit>(max<LayoutUnit>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); 2263 2263 m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 2264 2264 m_hBar->setProportion(clientWidth, m_scrollSize.width()); 2265 2265 } 2266 2266 if (m_vBar) { 2267 int clientHeight = box->clientHeight();2268 int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);2267 LayoutUnit clientHeight = box->clientHeight(); 2268 LayoutUnit pageStep = max<LayoutUnit>(max<LayoutUnit>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); 2269 2269 m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 2270 2270 m_vBar->setProportion(clientHeight, m_scrollSize.height()); … … 2281 2281 } 2282 2282 2283 void RenderLayer::paintOverflowControls(GraphicsContext* context, const LayoutPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)2283 void RenderLayer::paintOverflowControls(GraphicsContext* context, const LayoutPoint& paintOffset, const LayoutRect& damageRect, bool paintingOverlayControls) 2284 2284 { 2285 2285 // Don't do anything if we have no overflow. … … 2409 2409 } 2410 2410 2411 bool RenderLayer::isPointInResizeControl(const IntPoint& absolutePoint) const2411 bool RenderLayer::isPointInResizeControl(const LayoutPoint& absolutePoint) const 2412 2412 { 2413 2413 if (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE) … … 2417 2417 ASSERT(box); 2418 2418 2419 IntPoint localPoint = absoluteToContents(absolutePoint);2420 2421 IntRect localBounds(0, 0, box->width(), box->height());2419 LayoutPoint localPoint = absoluteToContents(absolutePoint); 2420 2421 LayoutRect localBounds(0, 0, box->width(), box->height()); 2422 2422 return resizerCornerRect(this, localBounds).contains(localPoint); 2423 2423 } 2424 2424 2425 bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)2425 bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const LayoutPoint& localPoint) 2426 2426 { 2427 2427 if (!m_hBar && !m_vBar && (!renderer()->hasOverflowClip() || renderer()->style()->resize() == RESIZE_NONE)) … … 2431 2431 ASSERT(box); 2432 2432 2433 IntRect resizeControlRect;2433 LayoutRect resizeControlRect; 2434 2434 if (renderer()->style()->resize() != RESIZE_NONE) { 2435 2435 resizeControlRect = resizerCornerRect(this, box->borderBoxRect()); … … 2438 2438 } 2439 2439 2440 int resizeControlSize = max(resizeControlRect.height(), 0);2440 LayoutUnit resizeControlSize = max<LayoutUnit>(resizeControlRect.height(), 0); 2441 2441 2442 2442 if (m_vBar) { 2443 IntRect vBarRect(box->width() - box->borderRight() - m_vBar->width(),2444 box->borderTop(),2445 m_vBar->width(),2446 box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));2443 LayoutRect vBarRect(box->width() - box->borderRight() - m_vBar->width(), 2444 box->borderTop(), 2445 m_vBar->width(), 2446 box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize)); 2447 2447 if (vBarRect.contains(localPoint)) { 2448 2448 result.setScrollbar(m_vBar.get()); … … 2451 2451 } 2452 2452 2453 resizeControlSize = max (resizeControlRect.width(), 0);2453 resizeControlSize = max<LayoutUnit>(resizeControlRect.width(), 0); 2454 2454 if (m_hBar) { 2455 IntRect hBarRect(box->borderLeft(),2456 box->height() - box->borderBottom() - m_hBar->height(),2457 box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),2458 m_hBar->height());2455 LayoutRect hBarRect(box->borderLeft(), 2456 box->height() - box->borderBottom() - m_hBar->height(), 2457 box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize), 2458 m_hBar->height()); 2459 2459 if (hBarRect.contains(localPoint)) { 2460 2460 result.setScrollbar(m_hBar.get()); … … 2471 2471 } 2472 2472 2473 void RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot)2473 void RenderLayer::paint(GraphicsContext* p, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot) 2474 2474 { 2475 2475 OverlapTestRequestMap overlapTestRequests; … … 2480 2480 } 2481 2481 2482 void RenderLayer::paintOverlayScrollbars(GraphicsContext* p, const IntRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot)2482 void RenderLayer::paintOverlayScrollbars(GraphicsContext* p, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot) 2483 2483 { 2484 2484 if (!m_containsDirtyOverlayScrollbars) … … 2489 2489 } 2490 2490 2491 static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)2491 static void setClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect) 2492 2492 { 2493 2493 if (paintDirtyRect == clipRect) … … 2497 2497 } 2498 2498 2499 static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)2499 static void restoreClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect) 2500 2500 { 2501 2501 if (paintDirtyRect == clipRect) … … 2508 2508 Vector<OverlapTestRequestClient*> overlappedRequestClients; 2509 2509 OverlapTestRequestMap::iterator end = overlapTestRequests.end(); 2510 IntRect boundingBox = layer->boundingBox(rootLayer);2510 LayoutRect boundingBox = layer->boundingBox(rootLayer); 2511 2511 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it) { 2512 2512 if (!boundingBox.intersects(it->second)) … … 2528 2528 2529 2529 void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p, 2530 const IntRect& paintDirtyRect, PaintBehavior paintBehavior,2530 const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior, 2531 2531 RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, 2532 2532 PaintLayerFlags paintFlags) … … 2575 2575 2576 2576 // Make sure the parent's clip rects have been calculated. 2577 IntRect clipRect = paintDirtyRect;2577 LayoutRect clipRect = paintDirtyRect; 2578 2578 if (parent()) { 2579 2579 clipRect = backgroundClipRect(rootLayer, paintFlags & PaintLayerTemporaryClipRects); … … 2586 2586 // Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space. 2587 2587 // This involves subtracting out the position of the layer in our current coordinate space. 2588 IntPoint delta;2588 LayoutPoint delta; 2589 2589 convertToLayerCoords(rootLayer, delta); 2590 2590 TransformationMatrix transform(layerTransform); … … 2618 2618 2619 2619 // Calculate the clip rects we should use. 2620 IntRect layerBounds, damageRect, clipRectToApply, outlineRect;2620 LayoutRect layerBounds, damageRect, clipRectToApply, outlineRect; 2621 2621 calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, localPaintFlags & PaintLayerTemporaryClipRects); 2622 IntPoint paintOffset = toPoint(layerBounds.location() - renderBoxLocation());2622 LayoutPoint paintOffset = toPoint(layerBounds.location() - renderBoxLocation()); 2623 2623 2624 2624 // Ensure our lists are up-to-date. … … 2729 2729 2730 2730 void RenderLayer::paintList(Vector<RenderLayer*>* list, RenderLayer* rootLayer, GraphicsContext* p, 2731 const IntRect& paintDirtyRect, PaintBehavior paintBehavior,2731 const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior, 2732 2732 RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, 2733 2733 PaintLayerFlags paintFlags) … … 2746 2746 2747 2747 void RenderLayer::paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext* context, 2748 const IntRect& paintDirtyRect, PaintBehavior paintBehavior,2748 const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior, 2749 2749 RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, 2750 2750 PaintLayerFlags paintFlags) … … 2766 2766 2767 2767 void RenderLayer::paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext* context, 2768 const IntRect& paintDirtyRect, PaintBehavior paintBehavior,2768 const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior, 2769 2769 RenderObject* paintingRoot, OverlapTestRequestMap* overlapTestRequests, 2770 2770 PaintLayerFlags paintFlags, const Vector<RenderLayer*>& columnLayers, size_t colIndex) … … 2776 2776 return; 2777 2777 2778 IntPoint layerOffset;2778 LayoutPoint layerOffset; 2779 2779 columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset); 2780 2780 … … 2786 2786 for (unsigned i = 0; i < colCount; i++) { 2787 2787 // For each rect, we clip to the rect, and then we adjust our coords. 2788 IntRect colRect = columnBlock->columnRectAt(colInfo, i);2788 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); 2789 2789 columnBlock->flipForWritingMode(colRect); 2790 2790 int logicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - columnBlock->logicalLeftOffsetForContent(); 2791 IntSize offset = isHorizontal ? IntSize(logicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, logicalLeftOffset);2791 LayoutSize offset = isHorizontal ? LayoutSize(logicalLeftOffset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, logicalLeftOffset); 2792 2792 2793 2793 colRect.moveBy(layerOffset); 2794 2794 2795 IntRect localDirtyRect(paintDirtyRect);2795 LayoutRect localDirtyRect(paintDirtyRect); 2796 2796 localDirtyRect.intersect(colRect); 2797 2797 … … 2821 2821 // Adjust the transform such that the renderer's upper left corner will paint at (0,0) in user space. 2822 2822 // This involves subtracting out the position of the layer in our current coordinate space. 2823 IntPoint childOffset;2823 LayoutPoint childOffset; 2824 2824 columnLayers[colIndex - 1]->convertToLayerCoords(rootLayer, childOffset); 2825 2825 TransformationMatrix transform; … … 2845 2845 } 2846 2846 2847 static inline IntRect frameVisibleRect(RenderObject* renderer)2847 static inline LayoutRect frameVisibleRect(RenderObject* renderer) 2848 2848 { 2849 2849 FrameView* frameView = renderer->document()->view(); 2850 2850 if (!frameView) 2851 return IntRect();2851 return LayoutRect(); 2852 2852 2853 2853 return frameView->visibleContentRect(); … … 2858 2858 renderer()->document()->updateLayout(); 2859 2859 2860 IntRect hitTestArea = renderer()->view()->documentRect();2860 LayoutRect hitTestArea = renderer()->view()->documentRect(); 2861 2861 if (!request.ignoreClipping()) 2862 2862 hitTestArea.intersect(frameVisibleRect(renderer())); … … 2993 2993 // Make sure the parent's clip rects have been calculated. 2994 2994 if (parent()) { 2995 IntRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects, IncludeOverlayScrollbarSize);2995 LayoutRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects, IncludeOverlayScrollbarSize); 2996 2996 // Go ahead and test the enclosing clip now. 2997 2997 if (!clipRect.intersects(hitTestArea)) … … 3383 3383 if (renderer()->hasOverflowClip() || renderer()->hasClip()) { 3384 3384 // This layer establishes a clip of some kind. 3385 IntPoint offset;3385 LayoutPoint offset; 3386 3386 convertToLayerCoords(rootLayer, offset); 3387 3387 RenderView* view = renderer()->view(); … … 3392 3392 3393 3393 if (renderer()->hasOverflowClip()) { 3394 IntRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset, relevancy);3394 LayoutRect newOverflowClip = toRenderBox(renderer())->overflowClipRect(offset, relevancy); 3395 3395 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect())); 3396 3396 if (renderer()->isPositioned() || renderer()->isRelPositioned()) … … 3398 3398 } 3399 3399 if (renderer()->hasClip()) { 3400 IntRect newPosClip = toRenderBox(renderer())->clipRect(offset);3400 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset); 3401 3401 clipRects.setPosClipRect(intersection(newPosClip, clipRects.posClipRect())); 3402 3402 clipRects.setOverflowClipRect(intersection(newPosClip, clipRects.overflowClipRect())); … … 3418 3418 } 3419 3419 3420 IntRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy relevancy) const3421 { 3422 IntRect backgroundRect;3420 LayoutRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy relevancy) const 3421 { 3422 LayoutRect backgroundRect; 3423 3423 if (parent()) { 3424 3424 ClipRects parentRects; … … 3473 3473 do { 3474 3474 if (boxShadow->style() == Normal) { 3475 IntRect shadowRect = layerBounds;3475 LayoutRect shadowRect = layerBounds; 3476 3476 shadowRect.move(boxShadow->x(), boxShadow->y()); 3477 3477 shadowRect.inflate(boxShadow->blur() + boxShadow->spread()); … … 3487 3487 } 3488 3488 3489 IntRect RenderLayer::childrenClipRect() const3489 LayoutRect RenderLayer::childrenClipRect() const 3490 3490 { 3491 3491 RenderView* renderView = renderer()->view(); 3492 3492 RenderLayer* clippingRootLayer = clippingRoot(); 3493 IntRect layerBounds, backgroundRect, foregroundRect, outlineRect;3493 LayoutRect layerBounds, backgroundRect, foregroundRect, outlineRect; 3494 3494 calculateRects(clippingRootLayer, renderView->unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); 3495 3495 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregroundRect)).enclosingBoundingBox(); 3496 3496 } 3497 3497 3498 IntRect RenderLayer::selfClipRect() const3498 LayoutRect RenderLayer::selfClipRect() const 3499 3499 { 3500 3500 RenderView* renderView = renderer()->view(); 3501 3501 RenderLayer* clippingRootLayer = clippingRoot(); 3502 IntRect layerBounds, backgroundRect, foregroundRect, outlineRect;3502 LayoutRect layerBounds, backgroundRect, foregroundRect, outlineRect; 3503 3503 calculateRects(clippingRootLayer, renderView->documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); 3504 3504 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(backgroundRect)).enclosingBoundingBox(); 3505 3505 } 3506 3506 3507 void RenderLayer::addBlockSelectionGapsBounds(const IntRect& bounds)3507 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) 3508 3508 { 3509 3509 m_blockSelectionGapsBounds.unite(bounds); … … 3512 3512 void RenderLayer::clearBlockSelectionGapsBounds() 3513 3513 { 3514 m_blockSelectionGapsBounds = IntRect();3514 m_blockSelectionGapsBounds = LayoutRect(); 3515 3515 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 3516 3516 child->clearBlockSelectionGapsBounds(); … … 3525 3525 return; 3526 3526 3527 IntRect rect = m_blockSelectionGapsBounds;3527 LayoutRect rect = m_blockSelectionGapsBounds; 3528 3528 rect.move(-scrolledContentOffset()); 3529 3529 if (renderer()->hasOverflowClip()) 3530 rect.intersect(toRenderBox(renderer())->overflowClipRect( IntPoint()));3530 rect.intersect(toRenderBox(renderer())->overflowClipRect(LayoutPoint())); 3531 3531 if (renderer()->hasClip()) 3532 rect.intersect(toRenderBox(renderer())->clipRect( IntPoint()));3532 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); 3533 3533 if (!rect.isEmpty()) 3534 3534 renderer()->repaintRectangle(rect); 3535 3535 } 3536 3536 3537 bool RenderLayer::intersectsDamageRect(const IntRect& layerBounds, const IntRect& damageRect, const RenderLayer* rootLayer) const3537 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer) const 3538 3538 { 3539 3539 // Always examine the canvas and the root. … … 3548 3548 ASSERT(view); 3549 3549 if (view && !renderer()->isRenderInline()) { 3550 IntRect b = layerBounds;3550 LayoutRect b = layerBounds; 3551 3551 b.inflate(view->maximalOutlineSize()); 3552 3552 if (b.intersects(damageRect)) … … 3559 3559 } 3560 3560 3561 IntRect RenderLayer::localBoundingBox() const3561 LayoutRect RenderLayer::localBoundingBox() const 3562 3562 { 3563 3563 // There are three special cases we need to consider. … … 3570 3570 // as part of our bounding box. We do this because we are the responsible layer for both hit testing and painting those 3571 3571 // floats. 3572 IntRect result;3572 LayoutRect result; 3573 3573 if (renderer()->isRenderInline()) 3574 3574 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox(); … … 3577 3577 for (RenderObject* child = renderer()->firstChild(); child; child = child->nextSibling()) { 3578 3578 if (child->isTableCell()) { 3579 IntRect bbox = toRenderBox(child)->borderBoxRect();3579 LayoutRect bbox = toRenderBox(child)->borderBoxRect(); 3580 3580 result.unite(bbox); 3581 IntRect overflowRect = renderBox()->visualOverflowRect();3581 LayoutRect overflowRect = renderBox()->visualOverflowRect(); 3582 3582 if (bbox != overflowRect) 3583 3583 result.unite(overflowRect); … … 3590 3590 result = box->maskClipRect(); 3591 3591 else { 3592 IntRect bbox = box->borderBoxRect();3592 LayoutRect bbox = box->borderBoxRect(); 3593 3593 result = bbox; 3594 IntRect overflowRect = box->visualOverflowRect();3594 LayoutRect overflowRect = box->visualOverflowRect(); 3595 3595 if (bbox != overflowRect) 3596 3596 result.unite(overflowRect); … … 3606 3606 } 3607 3607 3608 IntRect RenderLayer::boundingBox(const RenderLayer* ancestorLayer) const3608 LayoutRect RenderLayer::boundingBox(const RenderLayer* ancestorLayer) const 3609 3609 { 3610 IntRect result = localBoundingBox();3610 LayoutRect result = localBoundingBox(); 3611 3611 if (renderer()->isBox()) 3612 3612 renderBox()->flipForWritingMode(result); 3613 3613 else 3614 3614 renderer()->containingBlock()->flipForWritingMode(result); 3615 IntPoint delta;3615 LayoutPoint delta; 3616 3616 convertToLayerCoords(ancestorLayer, delta); 3617 3617 result.moveBy(delta); … … 3619 3619 } 3620 3620 3621 IntRect RenderLayer::absoluteBoundingBox() const3621 LayoutRect RenderLayer::absoluteBoundingBox() const 3622 3622 { 3623 3623 return boundingBox(root()); … … 3943 3943 } 3944 3944 3945 void RenderLayer::setBackingNeedsRepaintInRect(const IntRect& r)3945 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) 3946 3946 { 3947 3947 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here, … … 3951 3951 // If we're trying to repaint the placeholder document layer, propagate the 3952 3952 // repaint to the native view system. 3953 IntRect absRect(r);3954 IntPoint delta;3953 LayoutRect absRect(r); 3954 LayoutPoint delta; 3955 3955 convertToLayerCoords(root(), delta); 3956 3956 absRect.moveBy(delta); -
trunk/Source/WebCore/rendering/RenderLayer.h
r92874 r93429 77 77 } 78 78 79 ClipRects(const IntRect& r)79 ClipRects(const LayoutRect& r) 80 80 : m_overflowClipRect(r) 81 81 , m_fixedClipRect(r) … … 95 95 } 96 96 97 void reset(const IntRect& r)97 void reset(const LayoutRect& r) 98 98 { 99 99 m_overflowClipRect = r; … … 103 103 } 104 104 105 const IntRect& overflowClipRect() const { return m_overflowClipRect; }106 void setOverflowClipRect(const IntRect& r) { m_overflowClipRect = r; }107 108 const IntRect& fixedClipRect() const { return m_fixedClipRect; }109 void setFixedClipRect(const IntRect&r) { m_fixedClipRect = r; }110 111 const IntRect& posClipRect() const { return m_posClipRect; }112 void setPosClipRect(const IntRect& r) { m_posClipRect = r; }105 const LayoutRect& overflowClipRect() const { return m_overflowClipRect; } 106 void setOverflowClipRect(const LayoutRect& r) { m_overflowClipRect = r; } 107 108 const LayoutRect& fixedClipRect() const { return m_fixedClipRect; } 109 void setFixedClipRect(const LayoutRect&r) { m_fixedClipRect = r; } 110 111 const LayoutRect& posClipRect() const { return m_posClipRect; } 112 void setPosClipRect(const LayoutRect& r) { m_posClipRect = r; } 113 113 114 114 bool fixed() const { return m_fixed; } … … 148 148 149 149 private: 150 IntRect m_overflowClipRect;151 IntRect m_fixedClipRect;152 IntRect m_posClipRect;150 LayoutRect m_overflowClipRect; 151 LayoutRect m_fixedClipRect; 152 LayoutRect m_posClipRect; 153 153 unsigned m_refCnt : 31; 154 154 bool m_fixed : 1; … … 182 182 // if layer compositing is being used, 183 183 void setBackingNeedsRepaint(); 184 void setBackingNeedsRepaintInRect(const IntRect& r); // r is in the coordinate space of the layer's render object184 void setBackingNeedsRepaintInRect(const LayoutRect&); // r is in the coordinate space of the layer's render object 185 185 void repaintIncludingNonCompositingDescendants(RenderBoxModelObject* repaintContainer); 186 186 #endif … … 220 220 LayoutRect rect() const { return LayoutRect(location(), size()); } 221 221 222 int scrollWidth();223 int scrollHeight();224 225 void panScrollFromPoint(const IntPoint&);222 LayoutUnit scrollWidth(); 223 LayoutUnit scrollHeight(); 224 225 void panScrollFromPoint(const LayoutPoint&); 226 226 227 227 // Scrolling methods for layers that can scroll their overflow. 228 void scrollByRecursively( int xDelta, int yDelta);229 230 IntSize scrolledContentOffset() const { return scrollOffset() + m_scrollOverflow; }231 232 int scrollXOffset() const { return m_scrollOffset.width() + m_scrollOrigin.x(); }233 int scrollYOffset() const { return m_scrollOffset.height() + m_scrollOrigin.y(); }234 IntSize scrollOffset() const { return IntSize(scrollXOffset(), scrollYOffset()); }228 void scrollByRecursively(LayoutUnit xDelta, LayoutUnit yDelta); 229 230 LayoutSize scrolledContentOffset() const { return scrollOffset() + m_scrollOverflow; } 231 232 LayoutUnit scrollXOffset() const { return m_scrollOffset.width() + m_scrollOrigin.x(); } 233 LayoutUnit scrollYOffset() const { return m_scrollOffset.height() + m_scrollOrigin.y(); } 234 LayoutSize scrollOffset() const { return LayoutSize(scrollXOffset(), scrollYOffset()); } 235 235 236 236 enum ScrollOffsetClamping { … … 238 238 ScrollOffsetClamped 239 239 }; 240 void scrollToOffset( int x, int y, ScrollOffsetClamping = ScrollOffsetUnclamped);241 void scrollToXOffset( int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(x, scrollYOffset(), clamp); }242 void scrollToYOffset( int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(scrollXOffset(), y, clamp); }243 244 void scrollRectToVisible(const IntRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded);245 246 IntRect getRectToExpose(const IntRect& visibleRect, const IntRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);240 void scrollToOffset(LayoutUnit, LayoutUnit, ScrollOffsetClamping = ScrollOffsetUnclamped); 241 void scrollToXOffset(LayoutUnit x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(x, scrollYOffset(), clamp); } 242 void scrollToYOffset(LayoutUnit y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(scrollXOffset(), y, clamp); } 243 244 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded); 245 246 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); 247 247 248 248 bool scrollsOverflow() const; … … 266 266 267 267 bool hasOverflowControls() const; 268 bool isPointInResizeControl(const IntPoint& absolutePoint) const;269 bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);268 bool isPointInResizeControl(const LayoutPoint& absolutePoint) const; 269 bool hitTestOverflowControls(HitTestResult&, const LayoutPoint& localPoint); 270 270 LayoutSize offsetFromResizeCorner(const LayoutPoint& absolutePoint) const; 271 271 … … 308 308 }; 309 309 typedef unsigned UpdateLayerPositionsFlags; 310 void updateLayerPositions(UpdateLayerPositionsFlags = CheckForRepaint | IsCompositingUpdateRoot | UpdateCompositingLayers, IntPoint* cachedOffset = 0);310 void updateLayerPositions(UpdateLayerPositionsFlags = CheckForRepaint | IsCompositingUpdateRoot | UpdateCompositingLayers, LayoutPoint* cachedOffset = 0); 311 311 312 312 void updateTransform(); 313 313 314 void relativePositionOffset( int& relX, int& relY) const { relX += m_relativeOffset.width(); relY += m_relativeOffset.height(); }315 const IntSize& relativePositionOffset() const { return m_relativeOffset; }314 void relativePositionOffset(LayoutUnit& relX, LayoutUnit& relY) const { relX += m_relativeOffset.width(); relY += m_relativeOffset.height(); } 315 const LayoutSize& relativePositionOffset() const { return m_relativeOffset; } 316 316 317 317 void clearClipRectsIncludingDescendants(); 318 318 void clearClipRects(); 319 319 320 void addBlockSelectionGapsBounds(const IntRect&);320 void addBlockSelectionGapsBounds(const LayoutRect&); 321 321 void clearBlockSelectionGapsBounds(); 322 322 void repaintBlockSelectionGaps(); … … 359 359 #endif 360 360 361 void convertToLayerCoords(const RenderLayer* ancestorLayer, IntPoint& location) const;362 void convertToLayerCoords(const RenderLayer* ancestorLayer, IntRect& rect) const;361 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint& location) const; 362 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) const; 363 363 364 364 bool hasAutoZIndex() const { return renderer()->style()->hasAutoZIndex(); } … … 369 369 // front. The hitTest method looks for mouse events by walking 370 370 // layers that intersect the point from front to back. 371 void paint(GraphicsContext*, const IntRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* paintingRoot = 0);371 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* paintingRoot = 0); 372 372 bool hitTest(const HitTestRequest&, HitTestResult&); 373 void paintOverlayScrollbars(GraphicsContext*, const IntRect& damageRect, PaintBehavior, RenderObject* paintingRoot);373 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot); 374 374 375 375 // This method figures out our layerBounds in coordinates relative to … … 387 387 ClipRects* clipRects() const { return m_clipRects; } 388 388 389 IntRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.390 IntRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space.391 392 bool intersectsDamageRect(const IntRect& layerBounds, const IntRect& damageRect, const RenderLayer* rootLayer) const;389 LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space. 390 LayoutRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space. 391 392 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer) const; 393 393 394 394 // Bounding box relative to some ancestor layer. 395 IntRect boundingBox(const RenderLayer* rootLayer) const;395 LayoutRect boundingBox(const RenderLayer* rootLayer) const; 396 396 // Bounding box in the coordinates of this layer. 397 IntRect localBoundingBox() const;397 LayoutRect localBoundingBox() const; 398 398 // Bounding box relative to the root. 399 IntRect absoluteBoundingBox() const;399 LayoutRect absoluteBoundingBox() const; 400 400 401 401 void updateHoverActiveState(const HitTestRequest&, HitTestResult&); 402 402 403 403 // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint. 404 IntRect repaintRect() const { return m_repaintRect; }405 IntRect repaintRectIncludingDescendants() const;404 LayoutRect repaintRect() const { return m_repaintRect; } 405 LayoutRect repaintRectIncludingDescendants() const; 406 406 void computeRepaintRects(); 407 407 void updateRepaintRectsAfterScroll(bool fixed = false); … … 490 490 typedef unsigned PaintLayerFlags; 491 491 492 void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,492 void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, 493 493 PaintBehavior, RenderObject* paintingRoot, OverlapTestRequestMap* = 0, 494 494 PaintLayerFlags = 0); 495 495 void paintList(Vector<RenderLayer*>*, RenderLayer* rootLayer, GraphicsContext* p, 496 const IntRect& paintDirtyRect, PaintBehavior,496 const LayoutRect& paintDirtyRect, PaintBehavior, 497 497 RenderObject* paintingRoot, OverlapTestRequestMap*, 498 498 PaintLayerFlags); 499 499 void paintPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*, 500 const IntRect& paintDirtyRect, PaintBehavior,500 const LayoutRect& paintDirtyRect, PaintBehavior, 501 501 RenderObject* paintingRoot, OverlapTestRequestMap*, 502 502 PaintLayerFlags); 503 503 void paintChildLayerIntoColumns(RenderLayer* childLayer, RenderLayer* rootLayer, GraphicsContext*, 504 const IntRect& paintDirtyRect, PaintBehavior,504 const LayoutRect& paintDirtyRect, PaintBehavior, 505 505 RenderObject* paintingRoot, OverlapTestRequestMap*, 506 506 PaintLayerFlags, const Vector<RenderLayer*>& columnLayers, size_t columnIndex); … … 531 531 bool shouldBeNormalFlowOnly() const; 532 532 533 int scrollPosition(Scrollbar*) const;533 LayoutUnit scrollPosition(Scrollbar*) const; 534 534 535 535 // ScrollableArea interface 536 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&);537 virtual void invalidateScrollCornerRect(const IntRect&);536 virtual void invalidateScrollbarRect(Scrollbar*, const LayoutRect&); 537 virtual void invalidateScrollCornerRect(const LayoutRect&); 538 538 virtual bool isActive() const; 539 539 virtual bool isScrollCornerVisible() const; 540 virtual IntRect scrollCornerRect() const;541 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;542 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;543 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;544 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;545 virtual int scrollSize(ScrollbarOrientation) const;546 virtual void setScrollOffset(const IntPoint&);547 virtual IntPoint scrollPosition() const;548 virtual IntPoint minimumScrollPosition() const;549 virtual IntPoint maximumScrollPosition() const;550 virtual IntRect visibleContentRect(bool includeScrollbars) const;540 virtual LayoutRect scrollCornerRect() const; 541 virtual LayoutRect convertFromScrollbarToContainingView(const Scrollbar*, const LayoutRect&) const; 542 virtual LayoutRect convertFromContainingViewToScrollbar(const Scrollbar*, const LayoutRect&) const; 543 virtual LayoutPoint convertFromScrollbarToContainingView(const Scrollbar*, const LayoutPoint&) const; 544 virtual LayoutPoint convertFromContainingViewToScrollbar(const Scrollbar*, const LayoutPoint&) const; 545 virtual LayoutUnit scrollSize(ScrollbarOrientation) const; 546 virtual void setScrollOffset(const LayoutPoint&); 547 virtual LayoutPoint scrollPosition() const; 548 virtual LayoutPoint minimumScrollPosition() const; 549 virtual LayoutPoint maximumScrollPosition() const; 550 virtual LayoutRect visibleContentRect(bool includeScrollbars) const; 551 551 virtual LayoutUnit visibleHeight() const; 552 552 virtual LayoutUnit visibleWidth() const; 553 virtual IntSize contentsSize() const;554 virtual IntSize overhangAmount() const;555 virtual IntPoint currentMousePosition() const;556 virtual void didCompleteRubberBand(const IntSize&) const;553 virtual LayoutSize contentsSize() const; 554 virtual LayoutSize overhangAmount() const; 555 virtual LayoutPoint currentMousePosition() const; 556 virtual void didCompleteRubberBand(const LayoutSize&) const; 557 557 virtual bool shouldSuspendScrollAnimations() const; 558 558 virtual bool isOnActivePage() const; 559 559 560 560 // Rectangle encompassing the scroll corner and resizer rect. 561 IntRect scrollCornerAndResizerRect() const;561 LayoutRect scrollCornerAndResizerRect() const; 562 562 563 563 virtual void disconnectFromPage() { m_scrollableAreaPage = 0; } 564 564 565 565 // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. 566 void scrollTo( int x, int y);567 568 IntSize scrollbarOffset(const Scrollbar*) const;566 void scrollTo(LayoutUnit, LayoutUnit); 567 568 LayoutSize scrollbarOffset(const Scrollbar*) const; 569 569 570 570 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); … … 592 592 593 593 void parentClipRects(const RenderLayer* rootLayer, ClipRects&, bool temporaryClipRects = false, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; 594 IntRect backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;594 LayoutRect backgroundClipRect(const RenderLayer* rootLayer, bool temporaryClipRects, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; 595 595 596 596 RenderLayer* enclosingTransformedAncestor() const; 597 597 598 598 // Convert a point in absolute coords into layer coords, taking transforms into account 599 IntPoint absoluteToContents(const IntPoint&) const;600 601 void positionOverflowControls(const IntSize&);599 LayoutPoint absoluteToContents(const LayoutPoint&) const; 600 601 void positionOverflowControls(const LayoutSize&); 602 602 void updateScrollCornerStyle(); 603 603 void updateResizerStyle(); … … 621 621 void destroy(RenderArena*); 622 622 623 int overflowTop() const;624 int overflowBottom() const;625 int overflowLeft() const;626 int overflowRight() const;623 LayoutUnit overflowTop() const; 624 LayoutUnit overflowBottom() const; 625 LayoutUnit overflowLeft() const; 626 LayoutUnit overflowRight() const; 627 627 628 628 protected: … … 635 635 RenderLayer* m_last; 636 636 637 IntRect m_repaintRect; // Cached repaint rects. Used by layout.638 IntRect m_outlineBox;637 LayoutRect m_repaintRect; // Cached repaint rects. Used by layout. 638 LayoutRect m_outlineBox; 639 639 640 640 // Our current relative position offset. 641 IntSize m_relativeOffset;641 LayoutSize m_relativeOffset; 642 642 643 643 // Our (x,y) coordinates are in our parent layer's coordinate space. … … 648 648 649 649 // Our scroll offsets if the view is scrolled. 650 IntSize m_scrollOffset;651 652 IntSize m_scrollOverflow;650 LayoutSize m_scrollOffset; 651 652 LayoutSize m_scrollOverflow; 653 653 654 654 // The width/height of our scrolled area. 655 IntSize m_scrollSize;655 LayoutSize m_scrollSize; 656 656 657 657 // For layers with overflow, we have a pair of scrollbars. … … 710 710 bool m_containsDirtyOverlayScrollbars : 1; 711 711 712 IntPoint m_cachedOverlayScrollbarOffset;712 LayoutPoint m_cachedOverlayScrollbarOffset; 713 713 714 714 RenderMarquee* m_marquee; // Used by layers with overflow:marquee … … 728 728 729 729 private: 730 IntRect m_blockSelectionGapsBounds;730 LayoutRect m_blockSelectionGapsBounds; 731 731 732 732 #if USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r93040 r93429 66 66 static bool hasBoxDecorationsOrBackground(const RenderObject*); 67 67 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*); 68 static IntRect clipBox(RenderBox* renderer);68 static LayoutRect clipBox(RenderBox* renderer); 69 69 70 70 static inline bool isAcceleratedCanvas(RenderObject* renderer) … … 192 192 void RenderLayerBacking::updateCompositedBounds() 193 193 { 194 IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);194 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer); 195 195 196 196 // Clip to the size of the document or enclosing overflow-scroll layer. … … 208 208 209 209 // Start by clipping to the view's bounds. 210 IntRect clippingBounds = view->layoutOverflowRect();210 LayoutRect clippingBounds = view->layoutOverflowRect(); 211 211 212 212 if (m_owningLayer != rootLayer) 213 213 clippingBounds.intersect(m_owningLayer->backgroundClipRect(rootLayer, true)); 214 214 215 IntPoint delta;215 LayoutPoint delta; 216 216 m_owningLayer->convertToLayerCoords(rootLayer, delta); 217 217 clippingBounds.move(-delta.x(), -delta.y()); … … 334 334 } 335 335 336 static IntRect clipBox(RenderBox* renderer)337 { 338 IntRect result = PaintInfo::infiniteRect();336 static LayoutRect clipBox(RenderBox* renderer) 337 { 338 LayoutRect result = PaintInfo::infiniteRect(); 339 339 if (renderer->hasOverflowClip()) 340 result = renderer->overflowClipRect( IntPoint());340 result = renderer->overflowClipRect(LayoutPoint()); 341 341 342 342 if (renderer->hasClip()) 343 result.intersect(renderer->clipRect( IntPoint()));343 result.intersect(renderer->clipRect(LayoutPoint())); 344 344 345 345 return result; … … 368 368 369 369 // We compute everything relative to the enclosing compositing layer. 370 IntRect ancestorCompositingBounds;370 LayoutRect ancestorCompositingBounds; 371 371 if (compAncestor) { 372 372 ASSERT(compAncestor->backing()); … … 374 374 } 375 375 376 IntRect localCompositingBounds = compositedBounds();377 378 IntRect relativeCompositingBounds(localCompositingBounds);379 IntPoint delta;376 LayoutRect localCompositingBounds = compositedBounds(); 377 378 LayoutRect relativeCompositingBounds(localCompositingBounds); 379 LayoutPoint delta; 380 380 m_owningLayer->convertToLayerCoords(compAncestor, delta); 381 381 relativeCompositingBounds.moveBy(delta); 382 382 383 IntPoint graphicsLayerParentLocation;383 LayoutPoint graphicsLayerParentLocation; 384 384 if (compAncestor && compAncestor->backing()->hasClippingLayer()) { 385 385 // If the compositing ancestor has a layer to clip children, we parent in that, and therefore 386 386 // position relative to it. 387 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));387 LayoutRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); 388 388 graphicsLayerParentLocation = clippingBox.location(); 389 389 } else if (compAncestor) … … 396 396 // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects 397 397 // for a compositing layer, rootLayer is the layer itself. 398 IntRect parentClipRect = m_owningLayer->backgroundClipRect(compAncestor, true);398 LayoutRect parentClipRect = m_owningLayer->backgroundClipRect(compAncestor, true); 399 399 ASSERT(parentClipRect != PaintInfo::infiniteRect()); 400 400 m_ancestorClippingLayer->setPosition(FloatPoint() + (parentClipRect.location() - graphicsLayerParentLocation)); … … 410 410 m_graphicsLayer->setPosition(FloatPoint() + (relativeCompositingBounds.location() - graphicsLayerParentLocation)); 411 411 412 IntSize oldOffsetFromRenderer = m_graphicsLayer->offsetFromRenderer();413 m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - IntPoint());412 LayoutSize oldOffsetFromRenderer = m_graphicsLayer->offsetFromRenderer(); 413 m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - LayoutPoint()); 414 414 415 415 // If the compositing layer offset changes, we need to repaint. … … 428 428 429 429 // If we have a layer that clips children, position it. 430 IntRect clippingBox;430 LayoutRect clippingBox; 431 431 if (m_clippingLayer) { 432 432 clippingBox = clipBox(toRenderBox(renderer())); 433 433 m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location())); 434 434 m_clippingLayer->setSize(clippingBox.size()); 435 m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());435 m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - LayoutPoint()); 436 436 } 437 437 … … 446 446 447 447 if (m_owningLayer->hasTransform()) { 448 const IntRect borderBox = toRenderBox(renderer())->borderBoxRect();448 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); 449 449 450 450 // Get layout bounds in the coords of compAncestor to match relativeCompositingBounds. 451 IntRect layerBounds = IntRect(delta, borderBox.size());451 LayoutRect layerBounds = LayoutRect(delta, borderBox.size()); 452 452 453 453 // Update properties that depend on layer dimensions … … 482 482 FloatPoint foregroundPosition; 483 483 FloatSize foregroundSize = newSize; 484 IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer();484 LayoutSize foregroundOffset = m_graphicsLayer->offsetFromRenderer(); 485 485 if (m_clippingLayer) { 486 486 // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it, 487 487 // so that it gets correctly sorted with children. In that case, position relative to the clipping layer. 488 488 foregroundSize = FloatSize(clippingBox.size()); 489 foregroundOffset = clippingBox.location() - IntPoint();489 foregroundOffset = clippingBox.location() - LayoutPoint(); 490 490 } 491 491 … … 986 986 } 987 987 988 FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox) const988 FloatPoint3D RenderLayerBacking::computeTransformOrigin(const LayoutRect& borderBox) const 989 989 { 990 990 RenderStyle* style = renderer()->style(); … … 998 998 } 999 999 1000 FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox) const1000 FloatPoint RenderLayerBacking::computePerspectiveOrigin(const LayoutRect& borderBox) const 1001 1001 { 1002 1002 RenderStyle* style = renderer()->style(); … … 1013 1013 1014 1014 // Return the offset from the top-left of this compositing layer at which the renderer's contents are painted. 1015 IntSize RenderLayerBacking::contentOffsetInCompostingLayer() const1016 { 1017 return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y());1018 } 1019 1020 IntRect RenderLayerBacking::contentsBox() const1015 LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const 1016 { 1017 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y()); 1018 } 1019 1020 LayoutRect RenderLayerBacking::contentsBox() const 1021 1021 { 1022 1022 if (!renderer()->isBox()) 1023 return IntRect();1024 1025 IntRect contentsRect;1023 return LayoutRect(); 1024 1025 LayoutRect contentsRect; 1026 1026 #if ENABLE(VIDEO) 1027 1027 if (renderer()->isVideo()) { … … 1032 1032 contentsRect = toRenderBox(renderer())->contentBoxRect(); 1033 1033 1034 IntSize contentOffset = contentOffsetInCompostingLayer();1034 LayoutSize contentOffset = contentOffsetInCompostingLayer(); 1035 1035 contentsRect.move(contentOffset); 1036 1036 return contentsRect; … … 1058 1058 1059 1059 // r is in the coordinate space of the layer's render object 1060 void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)1060 void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r) 1061 1061 { 1062 1062 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { 1063 IntRect layerDirtyRect = r;1063 LayoutRect layerDirtyRect = r; 1064 1064 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer()); 1065 1065 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect); … … 1067 1067 1068 1068 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) { 1069 IntRect layerDirtyRect = r;1069 LayoutRect layerDirtyRect = r; 1070 1070 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer()); 1071 1071 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect); … … 1073 1073 1074 1074 if (m_maskLayer && m_maskLayer->drawsContent()) { 1075 IntRect layerDirtyRect = r;1075 LayoutRect layerDirtyRect = r; 1076 1076 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer()); 1077 1077 m_maskLayer->setNeedsDisplayInRect(layerDirtyRect); … … 1079 1079 } 1080 1080 1081 static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)1081 static void setClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect) 1082 1082 { 1083 1083 if (paintDirtyRect == clipRect) … … 1087 1087 } 1088 1088 1089 static void restoreClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect)1089 static void restoreClip(GraphicsContext* p, const LayoutRect& paintDirtyRect, const LayoutRect& clipRect) 1090 1090 { 1091 1091 if (paintDirtyRect == clipRect) … … 1096 1096 // Share this with RenderLayer::paintLayer, which would have to be educated about GraphicsLayerPaintingPhase? 1097 1097 void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context, 1098 const IntRect& paintDirtyRect, // in the coords of rootLayer1098 const LayoutRect& paintDirtyRect, // In the coords of rootLayer. 1099 1099 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase paintingPhase, 1100 1100 RenderObject* paintingRoot) … … 1108 1108 1109 1109 // Calculate the clip rects we should use. 1110 IntRect layerBounds, damageRect, clipRectToApply, outlineRect;1110 LayoutRect layerBounds, damageRect, clipRectToApply, outlineRect; 1111 1111 m_owningLayer->calculateRects(rootLayer, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); 1112 1112 1113 IntPoint paintOffset = toPoint(layerBounds.location() - m_owningLayer->renderBoxLocation());1113 LayoutPoint paintOffset = toPoint(layerBounds.location() - m_owningLayer->renderBoxLocation()); 1114 1114 1115 1115 // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which … … 1199 1199 } 1200 1200 1201 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)1201 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const LayoutRect& clip) 1202 1202 { 1203 1203 if (!scrollbar) … … 1205 1205 1206 1206 context.save(); 1207 const IntRect& scrollbarRect = scrollbar->frameRect();1207 const LayoutRect& scrollbarRect = scrollbar->frameRect(); 1208 1208 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); 1209 IntRect transformedClip = clip;1209 LayoutRect transformedClip = clip; 1210 1210 transformedClip.moveBy(scrollbarRect.location()); 1211 1211 scrollbar->paint(&context, transformedClip); … … 1214 1214 1215 1215 // Up-call from compositing layer drawing callback. 1216 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)1216 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const LayoutRect& clip) 1217 1217 { 1218 1218 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get()) { 1219 1219 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_owningLayer->renderer()->frame(), clip); 1220 1220 1221 IntSize offset = graphicsLayer->offsetFromRenderer();1221 LayoutSize offset = graphicsLayer->offsetFromRenderer(); 1222 1222 context.translate(-offset); 1223 1223 1224 IntRect clipRect(clip);1224 LayoutRect clipRect(clip); 1225 1225 clipRect.move(offset); 1226 1226 1227 1227 // The dirtyRect is in the coords of the painting root. 1228 IntRect dirtyRect = compositedBounds();1228 LayoutRect dirtyRect = compositedBounds(); 1229 1229 dirtyRect.intersect(clipRect); 1230 1230 … … 1238 1238 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip); 1239 1239 } else if (graphicsLayer == layerForScrollCorner()) { 1240 const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();1240 const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect(); 1241 1241 context.save(); 1242 1242 context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y()); 1243 IntRect transformedClip = clip;1243 LayoutRect transformedClip = clip; 1244 1244 transformedClip.moveBy(scrollCornerAndResizer.location()); 1245 m_owningLayer->paintScrollCorner(&context, IntPoint(), transformedClip);1246 m_owningLayer->paintResizer(&context, IntPoint(), transformedClip);1245 m_owningLayer->paintScrollCorner(&context, LayoutPoint(), transformedClip); 1246 m_owningLayer->paintResizer(&context, LayoutPoint(), transformedClip); 1247 1247 context.restore(); 1248 1248 } … … 1313 1313 } 1314 1314 1315 if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), anim, keyframes.animationName(), timeOffset)) {1315 if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, LayoutSize(), anim, keyframes.animationName(), timeOffset)) { 1316 1316 didAnimateOpacity = true; 1317 1317 compositor()->didStartAcceleratedAnimation(CSSPropertyOpacity); … … 1344 1344 opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity()))); 1345 1345 // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here. 1346 if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {1346 if (m_graphicsLayer->addAnimation(opacityVector, LayoutSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) { 1347 1347 // To ensure that the correct opacity is visible when the animation ends, also set the final opacity. 1348 1348 updateLayerOpacity(toStyle); … … 1411 1411 } 1412 1412 1413 IntRect RenderLayerBacking::compositedBounds() const1413 LayoutRect RenderLayerBacking::compositedBounds() const 1414 1414 { 1415 1415 return m_compositedBounds; 1416 1416 } 1417 1417 1418 void RenderLayerBacking::setCompositedBounds(const IntRect& bounds)1418 void RenderLayerBacking::setCompositedBounds(const LayoutRect& bounds) 1419 1419 { 1420 1420 m_compositedBounds = bounds; -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r93040 r93429 100 100 void setContentsNeedDisplay(); 101 101 // r is in the coordinate space of the layer's render object 102 void setContentsNeedDisplayInRect(const IntRect& r);102 void setContentsNeedDisplayInRect(const LayoutRect&); 103 103 104 104 // Notification from the renderer that its content changed. … … 117 117 void resumeAnimations(); 118 118 119 IntRect compositedBounds() const;120 void setCompositedBounds(const IntRect&);119 LayoutRect compositedBounds() const; 120 void setCompositedBounds(const LayoutRect&); 121 121 void updateCompositedBounds(); 122 122 … … 127 127 virtual void notifySyncRequired(const GraphicsLayer*); 128 128 129 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip);129 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const LayoutRect& clip); 130 130 131 131 virtual float deviceScaleFactor() const; … … 136 136 virtual bool showRepaintCounter() const; 137 137 138 IntRect contentsBox() const;138 LayoutRect contentsBox() const; 139 139 140 140 // For informative purposes only. … … 165 165 GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; 166 166 167 IntSize contentOffsetInCompostingLayer() const;167 LayoutSize contentOffsetInCompostingLayer() const; 168 168 // Result is transform origin in pixels. 169 FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;169 FloatPoint3D computeTransformOrigin(const LayoutRect& borderBox) const; 170 170 // Result is perspective origin in pixels. 171 FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;171 FloatPoint computePerspectiveOrigin(const LayoutRect& borderBox) const; 172 172 173 173 void updateLayerOpacity(const RenderStyle*); … … 191 191 bool hasNonCompositingDescendants() const; 192 192 193 void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);193 void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot); 194 194 195 195 static int graphicsLayerToCSSProperty(AnimatedPropertyID); … … 212 212 OwnPtr<GraphicsLayer> m_layerForScrollCorner; 213 213 214 IntRect m_compositedBounds;214 LayoutRect m_compositedBounds; 215 215 216 216 bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r93303 r93429 440 440 // The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant 441 441 // RenderLayers that are rendered by the composited RenderLayer. 442 IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)442 LayoutRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer) 443 443 { 444 444 if (!canBeComposited(layer)) 445 return IntRect();446 447 IntRect boundingBoxRect = layer->localBoundingBox();445 return LayoutRect(); 446 447 LayoutRect boundingBoxRect = layer->localBoundingBox(); 448 448 if (layer->renderer()->isRoot()) { 449 449 // If the root layer becomes composited (e.g. because some descendant with negative z-index is composited), … … 459 459 } 460 460 461 IntRect unionBounds = boundingBoxRect;461 LayoutRect unionBounds = boundingBoxRect; 462 462 463 463 if (layer->renderer()->hasOverflowClip() || layer->renderer()->hasMask()) { 464 IntPoint ancestorRelOffset;464 LayoutPoint ancestorRelOffset; 465 465 layer->convertToLayerCoords(ancestorLayer, ancestorRelOffset); 466 466 boundingBoxRect.moveBy(ancestorRelOffset); … … 470 470 if (RenderLayer* reflection = layer->reflectionLayer()) { 471 471 if (!reflection->isComposited()) { 472 IntRect childUnionBounds = calculateCompositedBounds(reflection, layer);472 LayoutRect childUnionBounds = calculateCompositedBounds(reflection, layer); 473 473 unionBounds.unite(childUnionBounds); 474 474 } … … 482 482 RenderLayer* curLayer = negZOrderList->at(i); 483 483 if (!curLayer->isComposited()) { 484 IntRect childUnionBounds = calculateCompositedBounds(curLayer, layer);484 LayoutRect childUnionBounds = calculateCompositedBounds(curLayer, layer); 485 485 unionBounds.unite(childUnionBounds); 486 486 } … … 493 493 RenderLayer* curLayer = posZOrderList->at(i); 494 494 if (!curLayer->isComposited()) { 495 IntRect childUnionBounds = calculateCompositedBounds(curLayer, layer);495 LayoutRect childUnionBounds = calculateCompositedBounds(curLayer, layer); 496 496 unionBounds.unite(childUnionBounds); 497 497 } … … 504 504 RenderLayer* curLayer = normalFlowList->at(i); 505 505 if (!curLayer->isComposited()) { 506 IntRect curAbsBounds = calculateCompositedBounds(curLayer, layer);506 LayoutRect curAbsBounds = calculateCompositedBounds(curLayer, layer); 507 507 unionBounds.unite(curAbsBounds); 508 508 } … … 516 516 } 517 517 518 IntPoint ancestorRelOffset;518 LayoutPoint ancestorRelOffset; 519 519 layer->convertToLayerCoords(ancestorLayer, ancestorRelOffset); 520 520 unionBounds.moveBy(ancestorRelOffset); … … 538 538 if (compLayer) { 539 539 ASSERT(compLayer->backing()); 540 IntRect compBounds = child->backing()->compositedBounds();541 542 IntPoint offset;540 LayoutRect compBounds = child->backing()->compositedBounds(); 541 542 LayoutPoint offset; 543 543 child->convertToLayerCoords(compLayer, offset); 544 544 compBounds.moveBy(offset); … … 566 566 } 567 567 568 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed)568 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, LayoutRect& layerBounds, bool& boundsComputed) 569 569 { 570 570 if (layer->isRootLayer()) … … 575 575 // Empty rects never intersect, but we need them to for the purposes of overlap testing. 576 576 if (layerBounds.isEmpty()) 577 layerBounds.setSize( IntSize(1, 1));577 layerBounds.setSize(LayoutSize(1, 1)); 578 578 boundsComputed = true; 579 579 } 580 580 581 IntRect clipRect = layer->backgroundClipRect(rootRenderLayer(), true);581 LayoutRect clipRect = layer->backgroundClipRect(rootRenderLayer(), true); 582 582 clipRect.intersect(layerBounds); 583 583 overlapMap.add(layer, clipRect); … … 589 589 return; 590 590 591 IntRect bounds;591 LayoutRect bounds; 592 592 bool haveComputedBounds = false; 593 593 addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds); … … 623 623 } 624 624 625 bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const IntRect& layerBounds)625 bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const LayoutRect& layerBounds) 626 626 { 627 627 RenderLayerCompositor::OverlapMap::const_iterator end = overlapMap.end(); 628 628 for (RenderLayerCompositor::OverlapMap::const_iterator it = overlapMap.begin(); it != end; ++it) { 629 const IntRect& bounds = it->second;629 const LayoutRect& bounds = it->second; 630 630 if (layerBounds.intersects(bounds)) 631 631 return true; … … 656 656 657 657 bool haveComputedBounds = false; 658 IntRect absBounds;658 LayoutRect absBounds; 659 659 if (overlapMap && !overlapMap->isEmpty()) { 660 660 // If we're testing for overlap, we only need to composite if we overlap something that is already composited. … … 662 662 // Empty rects never intersect, but we need them to for the purposes of overlap testing. 663 663 if (absBounds.isEmpty()) 664 absBounds.setSize( IntSize(1, 1));664 absBounds.setSize(LayoutSize(1, 1)); 665 665 haveComputedBounds = true; 666 666 mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds); … … 947 947 } 948 948 949 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset)949 void RenderLayerCompositor::frameViewDidChangeLocation(const LayoutPoint& contentsOffset) 950 950 { 951 951 if (m_overflowControlsHostLayer) … … 959 959 m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size()); 960 960 961 IntPoint scrollPosition = frameView->scrollPosition();961 LayoutPoint scrollPosition = frameView->scrollPosition(); 962 962 m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y())); 963 963 updateOverflowControlsLayers(); … … 965 965 } 966 966 967 void RenderLayerCompositor::frameViewDidScroll(const IntPoint& scrollPosition)967 void RenderLayerCompositor::frameViewDidScroll(const LayoutPoint& scrollPosition) 968 968 { 969 969 if (m_scrollLayer) … … 1111 1111 1112 1112 1113 void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const IntRect& absRect)1113 void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const LayoutRect& absRect) 1114 1114 { 1115 1115 recursiveRepaintLayerRect(rootRenderLayer(), absRect); 1116 1116 } 1117 1117 1118 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect)1118 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const LayoutRect& rect) 1119 1119 { 1120 1120 // FIXME: This method does not work correctly with transforms. … … 1127 1127 for (size_t i = 0; i < listSize; ++i) { 1128 1128 RenderLayer* curLayer = negZOrderList->at(i); 1129 IntRect childRect(rect);1129 LayoutRect childRect(rect); 1130 1130 curLayer->convertToLayerCoords(layer, childRect); 1131 1131 recursiveRepaintLayerRect(curLayer, childRect); … … 1137 1137 for (size_t i = 0; i < listSize; ++i) { 1138 1138 RenderLayer* curLayer = posZOrderList->at(i); 1139 IntRect childRect(rect);1139 LayoutRect childRect(rect); 1140 1140 curLayer->convertToLayerCoords(layer, childRect); 1141 1141 recursiveRepaintLayerRect(curLayer, childRect); … … 1147 1147 for (size_t i = 0; i < listSize; ++i) { 1148 1148 RenderLayer* curLayer = normalFlowList->at(i); 1149 IntRect childRect(rect);1149 LayoutRect childRect(rect); 1150 1150 curLayer->convertToLayerCoords(layer, childRect); 1151 1151 recursiveRepaintLayerRect(curLayer, childRect); … … 1203 1203 { 1204 1204 if (m_rootContentLayer) { 1205 const IntRect& documentRect = m_renderView->documentRect();1205 const LayoutRect& documentRect = m_renderView->documentRect(); 1206 1206 m_rootContentLayer->setSize(documentRect.size()); 1207 1207 m_rootContentLayer->setPosition(documentRect.location()); … … 1347 1347 return false; 1348 1348 1349 IntRect backgroundRect = layer->backgroundClipRect(computeClipRoot, true);1349 LayoutRect backgroundRect = layer->backgroundClipRect(computeClipRoot, true); 1350 1350 return backgroundRect != PaintInfo::infiniteRect(); 1351 1351 } … … 1438 1438 1439 1439 // Don't go into compositing mode if height or width are zero, or size is 1x1. 1440 IntRect contentBox = pluginRenderer->contentBoxRect();1440 LayoutRect contentBox = pluginRenderer->contentBoxRect(); 1441 1441 return contentBox.height() * contentBox.width() > 1; 1442 1442 } … … 1463 1463 1464 1464 // Don't go into compositing mode if height or width are zero. 1465 IntRect contentBox = frameRenderer->contentBoxRect();1465 LayoutRect contentBox = frameRenderer->contentBoxRect(); 1466 1466 return contentBox.height() * contentBox.width() > 0; 1467 1467 } … … 1523 1523 } 1524 1524 1525 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)1525 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const LayoutRect& clip) 1526 1526 { 1527 1527 if (!scrollbar) … … 1529 1529 1530 1530 context.save(); 1531 const IntRect& scrollbarRect = scrollbar->frameRect();1531 const LayoutRect& scrollbarRect = scrollbar->frameRect(); 1532 1532 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); 1533 IntRect transformedClip = clip;1533 LayoutRect transformedClip = clip; 1534 1534 transformedClip.moveBy(scrollbarRect.location()); 1535 1535 scrollbar->paint(&context, transformedClip); … … 1537 1537 } 1538 1538 1539 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip)1539 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const LayoutRect& clip) 1540 1540 { 1541 1541 if (graphicsLayer == layerForHorizontalScrollbar()) … … 1544 1544 paintScrollbar(m_renderView->frameView()->verticalScrollbar(), context, clip); 1545 1545 else if (graphicsLayer == layerForScrollCorner()) { 1546 const IntRect& scrollCorner = m_renderView->frameView()->scrollCornerRect();1546 const LayoutRect& scrollCorner = m_renderView->frameView()->scrollCornerRect(); 1547 1547 context.save(); 1548 1548 context.translate(-scrollCorner.x(), -scrollCorner.y()); 1549 IntRect transformedClip = clip;1549 LayoutRect transformedClip = clip; 1550 1550 transformedClip.moveBy(scrollCorner.location()); 1551 1551 m_renderView->frameView()->paintScrollCorner(&context, transformedClip); … … 1738 1738 m_layerForHorizontalScrollbar = nullptr; 1739 1739 if (Scrollbar* horizontalScrollbar = m_renderView->frameView()->verticalScrollbar()) 1740 m_renderView->frameView()->invalidateScrollbar(horizontalScrollbar, IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size()));1740 m_renderView->frameView()->invalidateScrollbar(horizontalScrollbar, LayoutRect(LayoutPoint(0, 0), horizontalScrollbar->frameRect().size())); 1741 1741 } 1742 1742 … … 1745 1745 m_layerForVerticalScrollbar = nullptr; 1746 1746 if (Scrollbar* verticalScrollbar = m_renderView->frameView()->verticalScrollbar()) 1747 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, IntRect(IntPoint(0, 0), verticalScrollbar->frameRect().size()));1747 m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, LayoutRect(LayoutPoint(0, 0), verticalScrollbar->frameRect().size())); 1748 1748 } 1749 1749 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r93040 r93429 120 120 // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer. 121 121 // If layerBoundingBox is not 0, on return it contains the bounding box of this layer only. 122 IntRect calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer);122 LayoutRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer); 123 123 124 124 // Repaint the appropriate layers when the given RenderLayer starts or stops being composited. … … 133 133 134 134 // Repaint parts of all composited layers that intersect the given absolute rectangle. 135 void repaintCompositedLayersAbsoluteRect(const IntRect&);135 void repaintCompositedLayersAbsoluteRect(const LayoutRect&); 136 136 137 137 RenderLayer* rootRenderLayer() const; … … 176 176 177 177 // Update the geometry of the layers used for clipping and scrolling in frames. 178 void frameViewDidChangeLocation(const IntPoint& contentsOffset);178 void frameViewDidChangeLocation(const LayoutPoint& contentsOffset); 179 179 void frameViewDidChangeSize(); 180 void frameViewDidScroll(const IntPoint& = IntPoint());180 void frameViewDidScroll(const LayoutPoint& = LayoutPoint()); 181 181 182 182 String layerTreeAsText(bool showDebugInfo = false); … … 203 203 virtual void notifyAnimationStarted(const GraphicsLayer*, double) { } 204 204 virtual void notifySyncRequired(const GraphicsLayer*) { scheduleLayerFlush(); } 205 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&);205 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const LayoutRect&); 206 206 207 207 // These calls return false always. They are saying that the layers associated with this client … … 223 223 224 224 // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect. 225 void recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect);226 227 typedef HashMap<RenderLayer*, IntRect> OverlapMap;228 void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed);225 void recursiveRepaintLayerRect(RenderLayer*, const LayoutRect&); 226 227 typedef HashMap<RenderLayer*, LayoutRect> OverlapMap; 228 void addToOverlapMap(OverlapMap&, RenderLayer*, LayoutRect& layerBounds, bool& boundsComputed); 229 229 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*); 230 static bool overlapsCompositedLayers(OverlapMap&, const IntRect& layerBounds);230 static bool overlapsCompositedLayers(OverlapMap&, const LayoutRect& layerBounds); 231 231 232 232 void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*);
Note: See TracChangeset
for help on using the changeset viewer.