OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 return false; | 314 return false; |
315 | 315 |
316 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer)) | 316 if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer)) |
317 return false; | 317 return false; |
318 | 318 |
319 return true; | 319 return true; |
320 } | 320 } |
321 | 321 |
322 void RenderLayerBacking::updateCompositedBounds() | 322 void RenderLayerBacking::updateCompositedBounds() |
323 { | 323 { |
324 IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer); | 324 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLay er, m_owningLayer); |
325 | 325 |
326 // Clip to the size of the document or enclosing overflow-scroll layer. | 326 // Clip to the size of the document or enclosing overflow-scroll layer. |
327 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with. | 327 // If this or an ancestor is transformed, we can't currently compute the cor rect rect to intersect with. |
328 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist. | 328 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet exist. |
329 if (shouldClipCompositedBounds()) { | 329 if (shouldClipCompositedBounds()) { |
330 RenderView* view = m_owningLayer->renderer()->view(); | 330 RenderView* view = m_owningLayer->renderer()->view(); |
331 RenderLayer* rootLayer = view->layer(); | 331 RenderLayer* rootLayer = view->layer(); |
332 | 332 |
333 LayoutRect clippingBounds; | 333 LayoutRect clippingBounds; |
334 if (renderer()->style()->position() == FixedPosition && renderer()->cont ainer() == view) | 334 if (renderer()->style()->position() == FixedPosition && renderer()->cont ainer() == view) |
335 clippingBounds = view->frameView()->viewportConstrainedVisibleConten tRect(); | 335 clippingBounds = view->frameView()->viewportConstrainedVisibleConten tRect(); |
336 else | 336 else |
337 clippingBounds = view->unscaledDocumentRect(); | 337 clippingBounds = view->unscaledDocumentRect(); |
338 | 338 |
339 if (m_owningLayer != rootLayer) | 339 if (m_owningLayer != rootLayer) |
340 clippingBounds.intersect(m_owningLayer->backgroundClipRect(RenderLay er::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorr ect for CSS regions. | 340 clippingBounds.intersect(m_owningLayer->backgroundClipRect(RenderLay er::ClipRectsContext(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorr ect for CSS regions. |
341 | 341 |
342 LayoutPoint delta; | 342 LayoutPoint delta; |
343 m_owningLayer->convertToLayerCoords(rootLayer, delta); | 343 m_owningLayer->convertToLayerCoords(rootLayer, delta); |
344 clippingBounds.move(-delta.x(), -delta.y()); | 344 clippingBounds.move(-delta.x(), -delta.y()); |
345 | 345 |
346 layerBounds.intersect(pixelSnappedIntRect(clippingBounds)); | 346 layerBounds.intersect(clippingBounds); |
347 m_boundsConstrainedByClipping = true; | 347 m_boundsConstrainedByClipping = true; |
348 } else | 348 } else |
349 m_boundsConstrainedByClipping = false; | 349 m_boundsConstrainedByClipping = false; |
350 | 350 |
351 // If the element has a transform-origin that has fixed lengths, and the ren derer has zero size, | 351 // If the element has a transform-origin that has fixed lengths, and the ren derer has zero size, |
352 // then we need to ensure that the compositing layer has non-zero size so th at we can apply | 352 // then we need to ensure that the compositing layer has non-zero size so th at we can apply |
353 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse d as a fractional value). | 353 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse d as a fractional value). |
354 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { | 354 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { |
355 layerBounds.setWidth(1); | 355 layerBounds.setWidth(1); |
356 layerBounds.setHeight(1); | 356 layerBounds.setHeight(1); |
357 m_artificiallyInflatedBounds = true; | 357 m_artificiallyInflatedBounds = true; |
358 } else | 358 } else |
359 m_artificiallyInflatedBounds = false; | 359 m_artificiallyInflatedBounds = false; |
360 | 360 |
361 setCompositedBounds(layerBounds); | 361 setCompositedBounds(layerBounds); |
362 } | 362 } |
363 | 363 |
364 void RenderLayerBacking::updateAfterWidgetResize() | 364 void RenderLayerBacking::updateAfterWidgetResize() |
365 { | 365 { |
366 if (renderer()->isRenderPart()) { | 366 if (renderer()->isRenderPart()) { |
367 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram eContentsCompositor(toRenderPart(renderer()))) { | 367 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram eContentsCompositor(toRenderPart(renderer()))) { |
368 innerCompositor->frameViewDidChangeSize(); | 368 innerCompositor->frameViewDidChangeSize(); |
369 innerCompositor->frameViewDidChangeLocation(contentsBox().location() ); | 369 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location())); |
eae
2013/07/26 20:30:51
Don't you need to account for the subpixel accumul
| |
370 } | 370 } |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 void RenderLayerBacking::updateCompositingReasons() | 374 void RenderLayerBacking::updateCompositingReasons() |
375 { | 375 { |
376 // All other layers owned by this backing will have the same compositing rea son | 376 // All other layers owned by this backing will have the same compositing rea son |
377 // for their lifetime, so they are initialized only when created. | 377 // for their lifetime, so they are initialized only when created. |
378 m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons()); | 378 m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons()); |
379 } | 379 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 | 522 |
523 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); | 523 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); |
524 | 524 |
525 // We compute everything relative to the enclosing compositing layer. | 525 // We compute everything relative to the enclosing compositing layer. |
526 IntRect ancestorCompositingBounds; | 526 IntRect ancestorCompositingBounds; |
527 if (compAncestor) { | 527 if (compAncestor) { |
528 ASSERT(compAncestor->backing()); | 528 ASSERT(compAncestor->backing()); |
529 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->backing()- >compositedBounds()); | 529 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->backing()- >compositedBounds()); |
530 } | 530 } |
531 | 531 |
532 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds()); | 532 LayoutRect localRawCompositingBounds = compositedBounds(); |
533 LayoutPoint rawDelta; | |
534 m_owningLayer->convertToLayerCoords(compAncestor, rawDelta); | |
535 IntPoint delta = flooredIntPoint(rawDelta); | |
536 m_subpixelAccumulation = toLayoutSize(rawDelta.fraction()); | |
eae
2013/07/26 20:30:51
Wouldn't it make more sense to have the fraction m
leviw_travelin_and_unemployed
2013/07/26 20:36:21
We certainly can. It makes sense to me to request
| |
537 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat ive to absolute pixels instead of local coordinates. | |
538 localRawCompositingBounds.move(m_subpixelAccumulation); | |
533 | 539 |
540 IntRect localCompositingBounds = pixelSnappedIntRect(localRawCompositingBoun ds); | |
eae
2013/07/26 20:30:51
How about moving all of this snapping logic into a
leviw_travelin_and_unemployed
2013/07/26 20:36:21
Sure.
| |
534 IntRect relativeCompositingBounds(localCompositingBounds); | 541 IntRect relativeCompositingBounds(localCompositingBounds); |
535 IntPoint delta; | |
536 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta); | |
537 relativeCompositingBounds.moveBy(delta); | 542 relativeCompositingBounds.moveBy(delta); |
538 | 543 |
539 IntPoint graphicsLayerParentLocation; | 544 IntPoint graphicsLayerParentLocation; |
540 if (compAncestor && compAncestor->backing()->hasClippingLayer()) { | 545 if (compAncestor && compAncestor->backing()->hasClippingLayer()) { |
541 // If the compositing ancestor has a layer to clip children, we parent i n that, and therefore | 546 // If the compositing ancestor has a layer to clip children, we parent i n that, and therefore |
542 // position relative to it. | 547 // position relative to it. |
543 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); | 548 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); |
544 graphicsLayerParentLocation = clippingBox.location(); | 549 graphicsLayerParentLocation = clippingBox.location(); |
545 } else if (compAncestor) | 550 } else if (compAncestor) |
546 graphicsLayerParentLocation = ancestorCompositingBounds.location(); | 551 graphicsLayerParentLocation = ancestorCompositingBounds.location(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 m_maskLayer->setNeedsDisplay(); | 606 m_maskLayer->setNeedsDisplay(); |
602 } | 607 } |
603 m_maskLayer->setPosition(FloatPoint()); | 608 m_maskLayer->setPosition(FloatPoint()); |
604 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer() ); | 609 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer() ); |
605 } | 610 } |
606 | 611 |
607 if (m_owningLayer->hasTransform()) { | 612 if (m_owningLayer->hasTransform()) { |
608 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBox Rect(); | 613 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBox Rect(); |
609 | 614 |
610 // Get layout bounds in the coords of compAncestor to match relativeComp ositingBounds. | 615 // Get layout bounds in the coords of compAncestor to match relativeComp ositingBounds. |
611 IntRect layerBounds = IntRect(delta, borderBox.size()); | 616 IntRect layerBounds(delta, borderBox.size()); |
612 | 617 |
613 // Update properties that depend on layer dimensions | 618 // Update properties that depend on layer dimensions |
614 FloatPoint3D transformOrigin = computeTransformOrigin(borderBox); | 619 FloatPoint3D transformOrigin = computeTransformOrigin(borderBox); |
615 // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set. | 620 // Compute the anchor point, which is in the center of the renderer box unless transform-origin is set. |
616 FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layer Bounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeCom positingBounds.width() : 0.5f, | 621 FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layer Bounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeCom positingBounds.width() : 0.5f, |
617 relativeCompositingBounds.height() != 0.0f ? ((layer Bounds.y() - relativeCompositingBounds.y()) + transformOrigin.y()) / relativeCom positingBounds.height() : 0.5f, | 622 relativeCompositingBounds.height() != 0.0f ? ((layer Bounds.y() - relativeCompositingBounds.y()) + transformOrigin.y()) / relativeCom positingBounds.height() : 0.5f, |
618 transformOrigin.z()); | 623 transformOrigin.z()); |
619 m_graphicsLayer->setAnchorPoint(anchor); | 624 m_graphicsLayer->setAnchorPoint(anchor); |
620 | 625 |
621 RenderStyle* style = renderer()->style(); | 626 RenderStyle* style = renderer()->style(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 | 691 |
687 if (m_scrollingLayer) { | 692 if (m_scrollingLayer) { |
688 ASSERT(m_scrollingContentsLayer); | 693 ASSERT(m_scrollingContentsLayer); |
689 RenderBox* renderBox = toRenderBox(renderer()); | 694 RenderBox* renderBox = toRenderBox(renderer()); |
690 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); | 695 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); |
691 // FIXME: We should make RenderBox::clientBoxRect consider scrollbar pla cement. | 696 // FIXME: We should make RenderBox::clientBoxRect consider scrollbar pla cement. |
692 if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 697 if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
693 clientBox.move(renderBox->verticalScrollbarWidth(), 0); | 698 clientBox.move(renderBox->verticalScrollbarWidth(), 0); |
694 | 699 |
695 IntSize adjustedScrollOffset = m_owningLayer->adjustedScrollOffset(); | 700 IntSize adjustedScrollOffset = m_owningLayer->adjustedScrollOffset(); |
696 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom positingBounds.location())); | 701 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom positingBounds.location() + roundedIntSize(m_subpixelAccumulation))); |
eae
2013/07/26 20:30:51
Why round here?
| |
697 m_scrollingLayer->setSize(clientBox.size()); | 702 m_scrollingLayer->setSize(clientBox.size()); |
698 | 703 |
699 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer() ; | 704 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer() ; |
700 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()) ); | 705 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location()) ); |
701 | 706 |
702 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLaye r->offsetFromRenderer(); | 707 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLaye r->offsetFromRenderer(); |
703 | 708 |
704 IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHe ight()); | 709 IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHe ight()); |
705 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetCha nged) | 710 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetCha nged) |
706 m_scrollingContentsLayer->setNeedsDisplay(); | 711 m_scrollingContentsLayer->setNeedsDisplay(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get()); | 798 m_graphicsLayer->addChild(m_layerForVerticalScrollbar.get()); |
794 } | 799 } |
795 if (m_layerForScrollCorner) { | 800 if (m_layerForScrollCorner) { |
796 m_layerForScrollCorner->removeFromParent(); | 801 m_layerForScrollCorner->removeFromParent(); |
797 m_graphicsLayer->addChild(m_layerForScrollCorner.get()); | 802 m_graphicsLayer->addChild(m_layerForScrollCorner.get()); |
798 } | 803 } |
799 } | 804 } |
800 | 805 |
801 void RenderLayerBacking::updateContentsRect(bool isSimpleContainer) | 806 void RenderLayerBacking::updateContentsRect(bool isSimpleContainer) |
802 { | 807 { |
803 IntRect contentsRect; | 808 LayoutRect contentsRect; |
804 if (isSimpleContainer && renderer()->hasBackground()) | 809 if (isSimpleContainer && renderer()->hasBackground()) |
805 contentsRect = backgroundBox(); | 810 contentsRect = backgroundBox(); |
806 else | 811 else |
807 contentsRect = contentsBox(); | 812 contentsRect = contentsBox(); |
808 | 813 |
809 m_graphicsLayer->setContentsRect(contentsRect); | 814 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsRect)); |
810 } | 815 } |
811 | 816 |
812 void RenderLayerBacking::updateDrawsContent(bool isSimpleContainer) | 817 void RenderLayerBacking::updateDrawsContent(bool isSimpleContainer) |
813 { | 818 { |
814 if (m_scrollingLayer) { | 819 if (m_scrollingLayer) { |
815 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. | 820 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. |
816 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint. | 821 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint. |
817 // m_scrollingLayer never has backing store. | 822 // m_scrollingLayer never has backing store. |
818 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. | 823 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. |
819 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground(); | 824 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent() && m_owningLayer->hasBoxDecorationsOrBackground(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
927 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer->scrollableArea(), HorizontalScrollbar); | 932 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer->scrollableArea(), HorizontalScrollbar); |
928 if (verticalScrollbarLayerChanged) | 933 if (verticalScrollbarLayerChanged) |
929 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer->scrollableArea(), VerticalScrollbar); | 934 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning Layer->scrollableArea(), VerticalScrollbar); |
930 } | 935 } |
931 | 936 |
932 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged; | 937 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s crollCornerLayerChanged; |
933 } | 938 } |
934 | 939 |
935 void RenderLayerBacking::positionOverflowControlsLayers(const IntSize& offsetFro mRoot) | 940 void RenderLayerBacking::positionOverflowControlsLayers(const IntSize& offsetFro mRoot) |
936 { | 941 { |
937 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer(); | 942 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer() - rounded IntSize(m_subpixelAccumulation); |
938 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { | 943 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { |
939 Scrollbar* hBar = m_owningLayer->horizontalScrollbar(); | 944 Scrollbar* hBar = m_owningLayer->horizontalScrollbar(); |
940 if (hBar) { | 945 if (hBar) { |
941 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer); | 946 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o ffsetFromRenderer); |
942 layer->setSize(hBar->frameRect().size()); | 947 layer->setSize(hBar->frameRect().size()); |
943 if (layer->hasContentsLayer()) | 948 if (layer->hasContentsLayer()) |
944 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e())); | 949 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz e())); |
945 } | 950 } |
946 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); | 951 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); |
947 } | 952 } |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1425 float boxHeight = borderBox.height(); | 1430 float boxHeight = borderBox.height(); |
1426 | 1431 |
1427 FloatPoint origin; | 1432 FloatPoint origin; |
1428 origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth)); | 1433 origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth)); |
1429 origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight)); | 1434 origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight)); |
1430 | 1435 |
1431 return origin; | 1436 return origin; |
1432 } | 1437 } |
1433 | 1438 |
1434 // Return the offset from the top-left of this compositing layer at which the re nderer's contents are painted. | 1439 // Return the offset from the top-left of this compositing layer at which the re nderer's contents are painted. |
1435 IntSize RenderLayerBacking::contentOffsetInCompostingLayer() const | 1440 LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const |
1436 { | 1441 { |
1437 return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y()); | 1442 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y()); |
1438 } | 1443 } |
1439 | 1444 |
1440 IntRect RenderLayerBacking::contentsBox() const | 1445 LayoutRect RenderLayerBacking::contentsBox() const |
1441 { | 1446 { |
1442 IntRect contentsBox = contentsRect(renderer()); | 1447 LayoutRect contentsBox = contentsRect(renderer()); |
1443 contentsBox.move(contentOffsetInCompostingLayer()); | 1448 contentsBox.move(contentOffsetInCompostingLayer()); |
1444 return contentsBox; | 1449 return contentsBox; |
1445 } | 1450 } |
1446 | 1451 |
1447 IntRect RenderLayerBacking::backgroundBox() const | 1452 IntRect RenderLayerBacking::backgroundBox() const |
1448 { | 1453 { |
1449 IntRect backgroundBox = backgroundRect(renderer()); | 1454 LayoutRect backgroundBox = backgroundRect(renderer()); |
1450 backgroundBox.move(contentOffsetInCompostingLayer()); | 1455 backgroundBox.move(contentOffsetInCompostingLayer()); |
1451 return backgroundBox; | 1456 return pixelSnappedIntRect(backgroundBox); |
1452 } | 1457 } |
1453 | 1458 |
1454 GraphicsLayer* RenderLayerBacking::parentForSublayers() const | 1459 GraphicsLayer* RenderLayerBacking::parentForSublayers() const |
1455 { | 1460 { |
1456 if (m_scrollingContentsLayer) | 1461 if (m_scrollingContentsLayer) |
1457 return m_scrollingContentsLayer.get(); | 1462 return m_scrollingContentsLayer.get(); |
1458 | 1463 |
1459 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL ayer.get(); | 1464 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL ayer.get(); |
1460 } | 1465 } |
1461 | 1466 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1565 paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents; | 1570 paintFlags |= RenderLayer::PaintLayerPaintingOverflowContents; |
1566 if (paintingPhase & GraphicsLayerPaintCompositedScroll) | 1571 if (paintingPhase & GraphicsLayerPaintCompositedScroll) |
1567 paintFlags |= RenderLayer::PaintLayerPaintingCompositingScrollingPhase; | 1572 paintFlags |= RenderLayer::PaintLayerPaintingCompositingScrollingPhase; |
1568 | 1573 |
1569 if (graphicsLayer == m_backgroundLayer) | 1574 if (graphicsLayer == m_backgroundLayer) |
1570 paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | Rende rLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintin gCompositingForegroundPhase to walk child layers. | 1575 paintFlags |= (RenderLayer::PaintLayerPaintingRootBackgroundOnly | Rende rLayer::PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintin gCompositingForegroundPhase to walk child layers. |
1571 else if (compositor()->fixedRootBackgroundLayer()) | 1576 else if (compositor()->fixedRootBackgroundLayer()) |
1572 paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground; | 1577 paintFlags |= RenderLayer::PaintLayerPaintingSkipRootBackground; |
1573 | 1578 |
1574 // FIXME: GraphicsLayers need a way to split for RenderRegions. | 1579 // FIXME: GraphicsLayers need a way to split for RenderRegions. |
1575 RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, p aintBehavior, LayoutSize()); | 1580 RenderLayer::LayerPaintingInfo paintingInfo(m_owningLayer, paintDirtyRect, p aintBehavior, m_subpixelAccumulation); |
1576 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags); | 1581 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags); |
1577 | 1582 |
1578 ASSERT(graphicsLayer != m_backgroundLayer || paintFlags & RenderLayer::Paint LayerPaintingRootBackgroundOnly); | 1583 ASSERT(graphicsLayer != m_backgroundLayer || paintFlags & RenderLayer::Paint LayerPaintingRootBackgroundOnly); |
1579 | 1584 |
1580 if (m_owningLayer->containsDirtyOverlayScrollbars()) | 1585 if (m_owningLayer->containsDirtyOverlayScrollbars()) |
1581 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | Re nderLayer::PaintLayerPaintingOverlayScrollbars); | 1586 m_owningLayer->paintLayerContents(context, paintingInfo, paintFlags | Re nderLayer::PaintLayerPaintingOverlayScrollbars); |
1582 | 1587 |
1583 ASSERT(!m_owningLayer->m_usedTransparency); | 1588 ASSERT(!m_owningLayer->m_usedTransparency); |
1584 } | 1589 } |
1585 | 1590 |
(...skipping 21 matching lines...) Expand all Loading... | |
1607 | 1612 |
1608 if (graphicsLayer == m_graphicsLayer.get() | 1613 if (graphicsLayer == m_graphicsLayer.get() |
1609 || graphicsLayer == m_foregroundLayer.get() | 1614 || graphicsLayer == m_foregroundLayer.get() |
1610 || graphicsLayer == m_backgroundLayer.get() | 1615 || graphicsLayer == m_backgroundLayer.get() |
1611 || graphicsLayer == m_maskLayer.get() | 1616 || graphicsLayer == m_maskLayer.get() |
1612 || graphicsLayer == m_scrollingContentsLayer.get()) { | 1617 || graphicsLayer == m_scrollingContentsLayer.get()) { |
1613 InspectorInstrumentation::willPaint(renderer()); | 1618 InspectorInstrumentation::willPaint(renderer()); |
1614 | 1619 |
1615 // The dirtyRect is in the coords of the painting root. | 1620 // The dirtyRect is in the coords of the painting root. |
1616 IntRect dirtyRect = clip; | 1621 IntRect dirtyRect = clip; |
1617 if (!(paintingPhase & GraphicsLayerPaintOverflowContents)) | 1622 if (!(paintingPhase & GraphicsLayerPaintOverflowContents)) { |
1618 dirtyRect.intersect(compositedBounds()); | 1623 LayoutRect bounds = compositedBounds(); |
1624 bounds.move(m_subpixelAccumulation); | |
1625 dirtyRect.intersect(pixelSnappedIntRect(bounds)); | |
1626 } else { | |
1627 dirtyRect.move(roundedIntSize(m_subpixelAccumulation)); | |
1628 } | |
1619 | 1629 |
1620 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. | 1630 // We have to use the same root as for hit testing, because both methods can compute and cache clipRects. |
1621 paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase); | 1631 paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase); |
1622 | 1632 |
1623 InspectorInstrumentation::didPaint(renderer(), &context, clip); | 1633 InspectorInstrumentation::didPaint(renderer(), &context, clip); |
1624 } else if (graphicsLayer == layerForHorizontalScrollbar()) { | 1634 } else if (graphicsLayer == layerForHorizontalScrollbar()) { |
1625 paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip); | 1635 paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip); |
1626 } else if (graphicsLayer == layerForVerticalScrollbar()) { | 1636 } else if (graphicsLayer == layerForVerticalScrollbar()) { |
1627 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip); | 1637 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip); |
1628 } else if (graphicsLayer == layerForScrollCorner()) { | 1638 } else if (graphicsLayer == layerForScrollCorner()) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1805 void RenderLayerBacking::suspendAnimations(double time) | 1815 void RenderLayerBacking::suspendAnimations(double time) |
1806 { | 1816 { |
1807 m_graphicsLayer->suspendAnimations(time); | 1817 m_graphicsLayer->suspendAnimations(time); |
1808 } | 1818 } |
1809 | 1819 |
1810 void RenderLayerBacking::resumeAnimations() | 1820 void RenderLayerBacking::resumeAnimations() |
1811 { | 1821 { |
1812 m_graphicsLayer->resumeAnimations(); | 1822 m_graphicsLayer->resumeAnimations(); |
1813 } | 1823 } |
1814 | 1824 |
1815 IntRect RenderLayerBacking::compositedBounds() const | 1825 LayoutRect RenderLayerBacking::compositedBounds() const |
1816 { | 1826 { |
1817 return m_compositedBounds; | 1827 return m_compositedBounds; |
1818 } | 1828 } |
1819 | 1829 |
1820 void RenderLayerBacking::setCompositedBounds(const IntRect& bounds) | 1830 void RenderLayerBacking::setCompositedBounds(const LayoutRect& bounds) |
1821 { | 1831 { |
1822 m_compositedBounds = bounds; | 1832 m_compositedBounds = bounds; |
1823 } | 1833 } |
1824 | 1834 |
1825 CSSPropertyID RenderLayerBacking::graphicsLayerToCSSProperty(AnimatedPropertyID property) | 1835 CSSPropertyID RenderLayerBacking::graphicsLayerToCSSProperty(AnimatedPropertyID property) |
1826 { | 1836 { |
1827 CSSPropertyID cssProperty = CSSPropertyInvalid; | 1837 CSSPropertyID cssProperty = CSSPropertyInvalid; |
1828 switch (property) { | 1838 switch (property) { |
1829 case AnimatedPropertyWebkitTransform: | 1839 case AnimatedPropertyWebkitTransform: |
1830 cssProperty = CSSPropertyWebkitTransform; | 1840 cssProperty = CSSPropertyWebkitTransform; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1895 if (m_layerForVerticalScrollbar) | 1905 if (m_layerForVerticalScrollbar) |
1896 backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate (); | 1906 backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate (); |
1897 | 1907 |
1898 if (m_layerForScrollCorner) | 1908 if (m_layerForScrollCorner) |
1899 backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate(); | 1909 backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate(); |
1900 | 1910 |
1901 return backingMemory; | 1911 return backingMemory; |
1902 } | 1912 } |
1903 | 1913 |
1904 } // namespace WebCore | 1914 } // namespace WebCore |
OLD | NEW |