| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 return true; | 341 return true; |
| 342 } | 342 } |
| 343 | 343 |
| 344 void CompositedLayerMapping::updateCompositedBounds() | 344 void CompositedLayerMapping::updateCompositedBounds() |
| 345 { | 345 { |
| 346 // We need to know if we draw content in order to update our bounds (this ha
s an effect | 346 // We need to know if we draw content in order to update our bounds (this ha
s an effect |
| 347 // on whether or not descendands will paint into our backing). Update this v
alue now. | 347 // on whether or not descendands will paint into our backing). Update this v
alue now. |
| 348 updateDrawsContent(isSimpleContainerCompositingLayer()); | 348 updateDrawsContent(isSimpleContainerCompositingLayer()); |
| 349 | 349 |
| 350 IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer,
m_owningLayer); | 350 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLay
er, m_owningLayer); |
| 351 | 351 |
| 352 // Clip to the size of the document or enclosing overflow-scroll layer. | 352 // Clip to the size of the document or enclosing overflow-scroll layer. |
| 353 // If this or an ancestor is transformed, we can't currently compute the cor
rect rect to intersect with. | 353 // If this or an ancestor is transformed, we can't currently compute the cor
rect rect to intersect with. |
| 354 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet
exist. | 354 // We'd need RenderObject::convertContainerToLocalQuad(), which doesn't yet
exist. |
| 355 if (shouldClipCompositedBounds()) { | 355 if (shouldClipCompositedBounds()) { |
| 356 RenderView* view = m_owningLayer->renderer()->view(); | 356 RenderView* view = m_owningLayer->renderer()->view(); |
| 357 RenderLayer* rootLayer = view->layer(); | 357 RenderLayer* rootLayer = view->layer(); |
| 358 | 358 |
| 359 LayoutRect clippingBounds; | 359 LayoutRect clippingBounds; |
| 360 if (renderer()->style()->position() == FixedPosition && renderer()->cont
ainer() == view) | 360 if (renderer()->style()->position() == FixedPosition && renderer()->cont
ainer() == view) |
| 361 clippingBounds = view->frameView()->viewportConstrainedVisibleConten
tRect(); | 361 clippingBounds = view->frameView()->viewportConstrainedVisibleConten
tRect(); |
| 362 else | 362 else |
| 363 clippingBounds = view->unscaledDocumentRect(); | 363 clippingBounds = view->unscaledDocumentRect(); |
| 364 | 364 |
| 365 if (m_owningLayer != rootLayer) | 365 if (m_owningLayer != rootLayer) |
| 366 clippingBounds.intersect(m_owningLayer->backgroundClipRect(ClipRects
Context(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS r
egions. | 366 clippingBounds.intersect(m_owningLayer->backgroundClipRect(ClipRects
Context(rootLayer, 0, AbsoluteClipRects)).rect()); // FIXME: Incorrect for CSS r
egions. |
| 367 | 367 |
| 368 LayoutPoint delta; | 368 LayoutPoint delta; |
| 369 m_owningLayer->convertToLayerCoords(rootLayer, delta); | 369 m_owningLayer->convertToLayerCoords(rootLayer, delta); |
| 370 clippingBounds.move(-delta.x(), -delta.y()); | 370 clippingBounds.move(-delta.x(), -delta.y()); |
| 371 | 371 |
| 372 layerBounds.intersect(pixelSnappedIntRect(clippingBounds)); | 372 layerBounds.intersect(clippingBounds); |
| 373 m_boundsConstrainedByClipping = true; | 373 m_boundsConstrainedByClipping = true; |
| 374 } else { | 374 } else { |
| 375 m_boundsConstrainedByClipping = false; | 375 m_boundsConstrainedByClipping = false; |
| 376 } | 376 } |
| 377 | 377 |
| 378 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, | 378 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, |
| 379 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply | 379 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply |
| 380 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse
d as a fractional value). | 380 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse
d as a fractional value). |
| 381 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { | 381 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { |
| 382 layerBounds.setWidth(1); | 382 layerBounds.setWidth(1); |
| 383 layerBounds.setHeight(1); | 383 layerBounds.setHeight(1); |
| 384 m_artificiallyInflatedBounds = true; | 384 m_artificiallyInflatedBounds = true; |
| 385 } else { | 385 } else { |
| 386 m_artificiallyInflatedBounds = false; | 386 m_artificiallyInflatedBounds = false; |
| 387 } | 387 } |
| 388 | 388 |
| 389 setCompositedBounds(layerBounds); | 389 setCompositedBounds(layerBounds); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void CompositedLayerMapping::updateAfterWidgetResize() | 392 void CompositedLayerMapping::updateAfterWidgetResize() |
| 393 { | 393 { |
| 394 if (renderer()->isRenderPart()) { | 394 if (renderer()->isRenderPart()) { |
| 395 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram
eContentsCompositor(toRenderPart(renderer()))) { | 395 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram
eContentsCompositor(toRenderPart(renderer()))) { |
| 396 innerCompositor->frameViewDidChangeSize(); | 396 innerCompositor->frameViewDidChangeSize(); |
| 397 innerCompositor->frameViewDidChangeLocation(contentsBox().location()
); | 397 // We can floor this point because our frameviews are always aligned
to pixel boundaries. |
| 398 ASSERT(contentsBox().location() == flooredIntPoint(contentsBox().loc
ation())); |
| 399 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents
Box().location())); |
| 398 } | 400 } |
| 399 } | 401 } |
| 400 } | 402 } |
| 401 | 403 |
| 402 void CompositedLayerMapping::updateCompositingReasons() | 404 void CompositedLayerMapping::updateCompositingReasons() |
| 403 { | 405 { |
| 404 // All other layers owned by this mapping will have the same compositing rea
son | 406 // All other layers owned by this mapping will have the same compositing rea
son |
| 405 // for their lifetime, so they are initialized only when created. | 407 // for their lifetime, so they are initialized only when created. |
| 406 m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons()); | 408 m_graphicsLayer->setCompositingReasons(m_owningLayer->compositingReasons()); |
| 407 } | 409 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 LayoutRect result = PaintInfo::infiniteRect(); | 540 LayoutRect result = PaintInfo::infiniteRect(); |
| 539 if (renderer->hasOverflowClip()) | 541 if (renderer->hasOverflowClip()) |
| 540 result = renderer->overflowClipRect(LayoutPoint(), 0); // FIXME: Incorre
ct for CSS regions. | 542 result = renderer->overflowClipRect(LayoutPoint(), 0); // FIXME: Incorre
ct for CSS regions. |
| 541 | 543 |
| 542 if (renderer->hasClip()) | 544 if (renderer->hasClip()) |
| 543 result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorr
ect for CSS regions. | 545 result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorr
ect for CSS regions. |
| 544 | 546 |
| 545 return pixelSnappedIntRect(result); | 547 return pixelSnappedIntRect(result); |
| 546 } | 548 } |
| 547 | 549 |
| 550 void CompositedLayerMapping::adjustBoundsForSubPixelAccumulation(const RenderLay
er* compositedAncestor, IntRect& localBounds, IntRect& relativeBounds, IntPoint&
delta) |
| 551 { |
| 552 LayoutRect localRawCompositingBounds = compositedBounds(); |
| 553 LayoutPoint rawDelta; |
| 554 m_owningLayer->convertToLayerCoords(compositedAncestor, rawDelta); |
| 555 delta = flooredIntPoint(rawDelta); |
| 556 m_subpixelAccumulation = toLayoutSize(rawDelta).fraction(); |
| 557 RELEASE_ASSERT(m_subpixelAccumulation.width() < 1 && m_subpixelAccumulation.
height() < 1); |
| 558 |
| 559 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat
ive to absolute pixels instead of local coordinates. |
| 560 localRawCompositingBounds.move(m_subpixelAccumulation); |
| 561 localBounds = pixelSnappedIntRect(localRawCompositingBounds); |
| 562 |
| 563 relativeBounds = localBounds; |
| 564 relativeBounds.moveBy(delta); |
| 565 } |
| 566 |
| 548 void CompositedLayerMapping::updateGraphicsLayerGeometry() | 567 void CompositedLayerMapping::updateGraphicsLayerGeometry() |
| 549 { | 568 { |
| 550 // If we haven't built z-order lists yet, wait until later. | 569 // If we haven't built z-order lists yet, wait until later. |
| 551 if (m_owningLayer->stackingNode()->isStackingContainer() && m_owningLayer->s
tackingNode()->zOrderListsDirty()) | 570 if (m_owningLayer->stackingNode()->isStackingContainer() && m_owningLayer->s
tackingNode()->zOrderListsDirty()) |
| 552 return; | 571 return; |
| 553 | 572 |
| 554 // Set transform property, if it is not animating. We have to do this here b
ecause the transform | 573 // Set transform property, if it is not animating. We have to do this here b
ecause the transform |
| 555 // is affected by the layer dimensions. | 574 // is affected by the layer dimensions. |
| 556 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() | 575 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() |
| 557 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransfo
rm) | 576 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransfo
rm) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 587 | 606 |
| 588 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); | 607 RenderLayer* compAncestor = m_owningLayer->ancestorCompositingLayer(); |
| 589 | 608 |
| 590 // We compute everything relative to the enclosing compositing layer. | 609 // We compute everything relative to the enclosing compositing layer. |
| 591 IntRect ancestorCompositingBounds; | 610 IntRect ancestorCompositingBounds; |
| 592 if (compAncestor) { | 611 if (compAncestor) { |
| 593 ASSERT(compAncestor->hasCompositedLayerMapping()); | 612 ASSERT(compAncestor->hasCompositedLayerMapping()); |
| 594 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited
LayerMapping()->compositedBounds()); | 613 ancestorCompositingBounds = pixelSnappedIntRect(compAncestor->composited
LayerMapping()->compositedBounds()); |
| 595 } | 614 } |
| 596 | 615 |
| 597 IntRect localCompositingBounds = pixelSnappedIntRect(compositedBounds()); | 616 IntRect localCompositingBounds; |
| 598 | 617 IntRect relativeCompositingBounds; |
| 599 IntRect relativeCompositingBounds(localCompositingBounds); | |
| 600 IntPoint delta; | 618 IntPoint delta; |
| 601 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta); | 619 adjustBoundsForSubPixelAccumulation(compAncestor, localCompositingBounds, re
lativeCompositingBounds, delta); |
| 602 relativeCompositingBounds.moveBy(delta); | |
| 603 | 620 |
| 604 IntPoint graphicsLayerParentLocation; | 621 IntPoint graphicsLayerParentLocation; |
| 605 if (compAncestor && compAncestor->compositedLayerMapping()->hasClippingLayer
()) { | 622 if (compAncestor && compAncestor->compositedLayerMapping()->hasClippingLayer
()) { |
| 606 // If the compositing ancestor has a layer to clip children, we parent i
n that, and therefore | 623 // If the compositing ancestor has a layer to clip children, we parent i
n that, and therefore |
| 607 // position relative to it. | 624 // position relative to it. |
| 608 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); | 625 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); |
| 609 graphicsLayerParentLocation = clippingBox.location(); | 626 graphicsLayerParentLocation = clippingBox.location(); |
| 610 } else if (compAncestor) { | 627 } else if (compAncestor) { |
| 611 graphicsLayerParentLocation = ancestorCompositingBounds.location(); | 628 graphicsLayerParentLocation = ancestorCompositingBounds.location(); |
| 612 } else { | 629 } else { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 m_maskLayer->setNeedsDisplay(); | 689 m_maskLayer->setNeedsDisplay(); |
| 673 } | 690 } |
| 674 m_maskLayer->setPosition(FloatPoint()); | 691 m_maskLayer->setPosition(FloatPoint()); |
| 675 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()
); | 692 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()
); |
| 676 } | 693 } |
| 677 | 694 |
| 678 if (m_owningLayer->hasTransform()) { | 695 if (m_owningLayer->hasTransform()) { |
| 679 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBox
Rect(); | 696 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBox
Rect(); |
| 680 | 697 |
| 681 // Get layout bounds in the coords of compAncestor to match relativeComp
ositingBounds. | 698 // Get layout bounds in the coords of compAncestor to match relativeComp
ositingBounds. |
| 682 IntRect layerBounds = IntRect(delta, borderBox.size()); | 699 IntRect layerBounds(delta, borderBox.size()); |
| 683 | 700 |
| 684 // Update properties that depend on layer dimensions | 701 // Update properties that depend on layer dimensions |
| 685 FloatPoint3D transformOrigin = computeTransformOrigin(borderBox); | 702 FloatPoint3D transformOrigin = computeTransformOrigin(borderBox); |
| 686 // Compute the anchor point, which is in the center of the renderer box
unless transform-origin is set. | 703 // Compute the anchor point, which is in the center of the renderer box
unless transform-origin is set. |
| 687 FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layerB
ounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeComp
ositingBounds.width() : 0.5f, | 704 FloatPoint3D anchor(relativeCompositingBounds.width() != 0.0f ? ((layerB
ounds.x() - relativeCompositingBounds.x()) + transformOrigin.x()) / relativeComp
ositingBounds.width() : 0.5f, |
| 688 relativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - rel
ativeCompositingBounds.y()) + transformOrigin.y()) / relativeCompositingBounds.h
eight() : 0.5f, | 705 relativeCompositingBounds.height() != 0.0f ? ((layerBounds.y() - rel
ativeCompositingBounds.y()) + transformOrigin.y()) / relativeCompositingBounds.h
eight() : 0.5f, |
| 689 transformOrigin.z()); | 706 transformOrigin.z()); |
| 690 m_graphicsLayer->setAnchorPoint(anchor); | 707 m_graphicsLayer->setAnchorPoint(anchor); |
| 691 | 708 |
| 692 RenderStyle* style = renderer()->style(); | 709 RenderStyle* style = renderer()->style(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 774 |
| 758 if (m_scrollingLayer) { | 775 if (m_scrollingLayer) { |
| 759 ASSERT(m_scrollingContentsLayer); | 776 ASSERT(m_scrollingContentsLayer); |
| 760 RenderBox* renderBox = toRenderBox(renderer()); | 777 RenderBox* renderBox = toRenderBox(renderer()); |
| 761 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); | 778 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); |
| 762 // FIXME: We should make RenderBox::clientBoxRect consider scrollbar pla
cement. | 779 // FIXME: We should make RenderBox::clientBoxRect consider scrollbar pla
cement. |
| 763 if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 780 if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 764 clientBox.move(renderBox->verticalScrollbarWidth(), 0); | 781 clientBox.move(renderBox->verticalScrollbarWidth(), 0); |
| 765 | 782 |
| 766 IntSize adjustedScrollOffset = m_owningLayer->scrollableArea()->adjusted
ScrollOffset(); | 783 IntSize adjustedScrollOffset = m_owningLayer->scrollableArea()->adjusted
ScrollOffset(); |
| 767 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom
positingBounds.location())); | 784 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localCom
positingBounds.location() + roundedIntSize(m_subpixelAccumulation))); |
| 768 m_scrollingLayer->setSize(clientBox.size()); | 785 m_scrollingLayer->setSize(clientBox.size()); |
| 769 | 786 |
| 770 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer()
; | 787 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer()
; |
| 771 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())
); | 788 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())
); |
| 772 | 789 |
| 773 if (m_childClippingMaskLayer) { | 790 if (m_childClippingMaskLayer) { |
| 774 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); | 791 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); |
| 775 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); | 792 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); |
| 776 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.
location())); | 793 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.
location())); |
| 777 } | 794 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 800 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) | 817 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) |
| 801 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); | 818 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); |
| 802 m_foregroundLayer->setNeedsDisplay(); | 819 m_foregroundLayer->setNeedsDisplay(); |
| 803 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->o
ffsetFromRenderer()); | 820 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->o
ffsetFromRenderer()); |
| 804 } | 821 } |
| 805 } | 822 } |
| 806 | 823 |
| 807 if (m_squashingLayer) { | 824 if (m_squashingLayer) { |
| 808 ASSERT(compositor()->layerSquashingEnabled()); | 825 ASSERT(compositor()->layerSquashingEnabled()); |
| 809 | 826 |
| 810 IntRect totalSquashBounds; | 827 LayoutRect totalSquashBounds; |
| 811 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { | 828 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { |
| 812 IntRect squashedBounds = compositor()->calculateCompositedBounds(m_s
quashedLayers[i].renderLayer, m_squashedLayers[i].renderLayer); | 829 LayoutRect squashedBounds = compositor()->calculateCompositedBounds(
m_squashedLayers[i].renderLayer, m_squashedLayers[i].renderLayer); |
| 813 | 830 |
| 814 // Store the composited bounds before applying the offset. | 831 // Store the composited bounds before applying the offset. |
| 815 // FIXME: consider whether it is more efficient or clarifies the mat
h to store the compositedBounds after applying the offset. | 832 // FIXME: consider whether it is more efficient or clarifies the mat
h to store the compositedBounds after applying the offset. |
| 816 m_squashedLayers[i].compositedBounds = squashedBounds; | 833 m_squashedLayers[i].compositedBounds = squashedBounds; |
| 817 | 834 |
| 818 squashedBounds.move(m_squashedLayers[i].offsetFromBackingRoot); | 835 squashedBounds.move(m_squashedLayers[i].offsetFromBackingRoot); |
| 819 totalSquashBounds.unite(squashedBounds); | 836 totalSquashBounds.unite(squashedBounds); |
| 820 } | 837 } |
| 821 | 838 |
| 822 IntPoint squashLayerPosition; | 839 IntPoint squashLayerPosition; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 m_squashingContainmentLayer->addChild(m_ancestorClippingLayer.get())
; | 951 m_squashingContainmentLayer->addChild(m_ancestorClippingLayer.get())
; |
| 935 else | 952 else |
| 936 m_squashingContainmentLayer->addChild(m_graphicsLayer.get()); | 953 m_squashingContainmentLayer->addChild(m_graphicsLayer.get()); |
| 937 | 954 |
| 938 m_squashingContainmentLayer->addChild(m_squashingLayer.get()); | 955 m_squashingContainmentLayer->addChild(m_squashingLayer.get()); |
| 939 } | 956 } |
| 940 } | 957 } |
| 941 | 958 |
| 942 void CompositedLayerMapping::updateContentsRect(bool isSimpleContainer) | 959 void CompositedLayerMapping::updateContentsRect(bool isSimpleContainer) |
| 943 { | 960 { |
| 944 IntRect contentsRect; | 961 LayoutRect contentsRect; |
| 945 if (isSimpleContainer && renderer()->hasBackground()) | 962 if (isSimpleContainer && renderer()->hasBackground()) |
| 946 contentsRect = backgroundBox(); | 963 contentsRect = backgroundBox(); |
| 947 else | 964 else |
| 948 contentsRect = contentsBox(); | 965 contentsRect = contentsBox(); |
| 949 | 966 |
| 950 m_graphicsLayer->setContentsRect(contentsRect); | 967 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsRect)); |
| 951 } | 968 } |
| 952 | 969 |
| 953 void CompositedLayerMapping::updateDrawsContent(bool isSimpleContainer) | 970 void CompositedLayerMapping::updateDrawsContent(bool isSimpleContainer) |
| 954 { | 971 { |
| 955 if (m_scrollingLayer) { | 972 if (m_scrollingLayer) { |
| 956 // We don't have to consider overflow controls, because we know that the
scrollbars are drawn elsewhere. | 973 // We don't have to consider overflow controls, because we know that the
scrollbars are drawn elsewhere. |
| 957 // m_graphicsLayer only needs backing store if the non-scrolling parts (
background, outlines, borders, shadows etc) need to paint. | 974 // m_graphicsLayer only needs backing store if the non-scrolling parts (
background, outlines, borders, shadows etc) need to paint. |
| 958 // m_scrollingLayer never has backing store. | 975 // m_scrollingLayer never has backing store. |
| 959 // m_scrollingContentsLayer only needs backing store if the scrolled con
tents need to paint. | 976 // m_scrollingContentsLayer only needs backing store if the scrolled con
tents need to paint. |
| 960 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent()
&& m_owningLayer->hasBoxDecorationsOrBackground(); | 977 bool hasNonScrollingPaintedContent = m_owningLayer->hasVisibleContent()
&& m_owningLayer->hasBoxDecorationsOrBackground(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer->scrollableArea(), HorizontalScrollbar); | 1084 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer->scrollableArea(), HorizontalScrollbar); |
| 1068 if (verticalScrollbarLayerChanged) | 1085 if (verticalScrollbarLayerChanged) |
| 1069 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer->scrollableArea(), VerticalScrollbar); | 1086 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owning
Layer->scrollableArea(), VerticalScrollbar); |
| 1070 } | 1087 } |
| 1071 | 1088 |
| 1072 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s
crollCornerLayerChanged; | 1089 return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || s
crollCornerLayerChanged; |
| 1073 } | 1090 } |
| 1074 | 1091 |
| 1075 void CompositedLayerMapping::positionOverflowControlsLayers(const IntSize& offse
tFromRoot) | 1092 void CompositedLayerMapping::positionOverflowControlsLayers(const IntSize& offse
tFromRoot) |
| 1076 { | 1093 { |
| 1077 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer(); | 1094 IntSize offsetFromRenderer = m_graphicsLayer->offsetFromRenderer() - rounded
IntSize(m_subpixelAccumulation); |
| 1078 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { | 1095 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { |
| 1079 Scrollbar* hBar = m_owningLayer->scrollableArea()->horizontalScrollbar()
; | 1096 Scrollbar* hBar = m_owningLayer->scrollableArea()->horizontalScrollbar()
; |
| 1080 if (hBar) { | 1097 if (hBar) { |
| 1081 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o
ffsetFromRenderer); | 1098 layer->setPosition(hBar->frameRect().location() - offsetFromRoot - o
ffsetFromRenderer); |
| 1082 layer->setSize(hBar->frameRect().size()); | 1099 layer->setSize(hBar->frameRect().size()); |
| 1083 if (layer->hasContentsLayer()) | 1100 if (layer->hasContentsLayer()) |
| 1084 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz
e())); | 1101 layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().siz
e())); |
| 1085 } | 1102 } |
| 1086 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); | 1103 layer->setDrawsContent(hBar && !layer->hasContentsLayer()); |
| 1087 } | 1104 } |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 float boxHeight = borderBox.height(); | 1655 float boxHeight = borderBox.height(); |
| 1639 | 1656 |
| 1640 FloatPoint origin; | 1657 FloatPoint origin; |
| 1641 origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth)); | 1658 origin.setX(floatValueForLength(style->perspectiveOriginX(), boxWidth)); |
| 1642 origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight)); | 1659 origin.setY(floatValueForLength(style->perspectiveOriginY(), boxHeight)); |
| 1643 | 1660 |
| 1644 return origin; | 1661 return origin; |
| 1645 } | 1662 } |
| 1646 | 1663 |
| 1647 // Return the offset from the top-left of this compositing layer at which the re
nderer's contents are painted. | 1664 // Return the offset from the top-left of this compositing layer at which the re
nderer's contents are painted. |
| 1648 IntSize CompositedLayerMapping::contentOffsetInCompostingLayer() const | 1665 LayoutSize CompositedLayerMapping::contentOffsetInCompostingLayer() const |
| 1649 { | 1666 { |
| 1650 return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y()); | 1667 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y()); |
| 1651 } | 1668 } |
| 1652 | 1669 |
| 1653 IntRect CompositedLayerMapping::contentsBox() const | 1670 LayoutRect CompositedLayerMapping::contentsBox() const |
| 1654 { | 1671 { |
| 1655 IntRect contentsBox = contentsRect(renderer()); | 1672 LayoutRect contentsBox = contentsRect(renderer()); |
| 1656 contentsBox.move(contentOffsetInCompostingLayer()); | 1673 contentsBox.move(contentOffsetInCompostingLayer()); |
| 1657 return contentsBox; | 1674 return contentsBox; |
| 1658 } | 1675 } |
| 1659 | 1676 |
| 1660 IntRect CompositedLayerMapping::backgroundBox() const | 1677 IntRect CompositedLayerMapping::backgroundBox() const |
| 1661 { | 1678 { |
| 1662 IntRect backgroundBox = backgroundRect(renderer()); | 1679 LayoutRect backgroundBox = backgroundRect(renderer()); |
| 1663 backgroundBox.move(contentOffsetInCompostingLayer()); | 1680 backgroundBox.move(contentOffsetInCompostingLayer()); |
| 1664 return backgroundBox; | 1681 return pixelSnappedIntRect(backgroundBox); |
| 1665 } | 1682 } |
| 1666 | 1683 |
| 1667 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const | 1684 GraphicsLayer* CompositedLayerMapping::parentForSublayers() const |
| 1668 { | 1685 { |
| 1669 if (m_scrollingContentsLayer) | 1686 if (m_scrollingContentsLayer) |
| 1670 return m_scrollingContentsLayer.get(); | 1687 return m_scrollingContentsLayer.get(); |
| 1671 | 1688 |
| 1672 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL
ayer.get(); | 1689 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL
ayer.get(); |
| 1673 } | 1690 } |
| 1674 | 1691 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 paintFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPainting
CompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhas
e to walk child layers. | 1846 paintFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPainting
CompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhas
e to walk child layers. |
| 1830 else if (compositor()->fixedRootBackgroundLayer()) | 1847 else if (compositor()->fixedRootBackgroundLayer()) |
| 1831 paintFlags |= PaintLayerPaintingSkipRootBackground; | 1848 paintFlags |= PaintLayerPaintingSkipRootBackground; |
| 1832 | 1849 |
| 1833 // Note carefully: in theory it is appropriate to invoke context->save() her
e | 1850 // Note carefully: in theory it is appropriate to invoke context->save() her
e |
| 1834 // and restore the context after painting. For efficiency, we are assuming t
hat | 1851 // and restore the context after painting. For efficiency, we are assuming t
hat |
| 1835 // it is equivalent to manually undo this offset translation, which means we
are | 1852 // it is equivalent to manually undo this offset translation, which means we
are |
| 1836 // assuming that the context's space was not affected by the RenderLayer | 1853 // assuming that the context's space was not affected by the RenderLayer |
| 1837 // painting code. | 1854 // painting code. |
| 1838 | 1855 |
| 1839 LayoutSize offset = paintInfo.offsetFromRenderer; | 1856 IntSize offset = paintInfo.offsetFromRenderer; |
| 1840 context->translate(-offset); | 1857 context->translate(-offset); |
| 1841 LayoutRect relativeClip(clip); | |
| 1842 relativeClip.move(offset); | |
| 1843 | 1858 |
| 1844 // The dirtyRect is in the coords of the painting root. | 1859 // The dirtyRect is in the coords of the painting root. |
| 1845 IntRect dirtyRect = pixelSnappedIntRect(relativeClip); | 1860 IntRect dirtyRect(clip); |
| 1846 if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)) | 1861 dirtyRect.move(offset); |
| 1847 dirtyRect.intersect(paintInfo.compositedBounds); | 1862 |
| 1863 if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)) { |
| 1864 LayoutRect bounds = paintInfo.compositedBounds; |
| 1865 bounds.move(m_subpixelAccumulation); |
| 1866 dirtyRect.intersect(pixelSnappedIntRect(bounds)); |
| 1867 } else { |
| 1868 dirtyRect.move(roundedIntSize(m_subpixelAccumulation)); |
| 1869 } |
| 1848 | 1870 |
| 1849 #ifndef NDEBUG | 1871 #ifndef NDEBUG |
| 1850 paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut(); | 1872 paintInfo.renderLayer->renderer()->assertSubtreeIsLaidOut(); |
| 1851 #endif | 1873 #endif |
| 1852 | 1874 |
| 1853 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { | 1875 if (paintInfo.renderLayer->compositingState() != PaintsIntoGroupedBacking) { |
| 1854 // FIXME: GraphicsLayers need a way to split for RenderRegions. | 1876 // FIXME: GraphicsLayers need a way to split for RenderRegions. |
| 1855 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, LayoutSize()); | 1877 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, m_subpixelAccumulation); |
| 1856 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFl
ags); | 1878 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, paintFl
ags); |
| 1857 | 1879 |
| 1858 ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRo
otBackgroundOnly); | 1880 ASSERT(!paintInfo.isBackgroundLayer || paintFlags & PaintLayerPaintingRo
otBackgroundOnly); |
| 1859 | 1881 |
| 1860 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) | 1882 if (paintInfo.renderLayer->containsDirtyOverlayScrollbars()) |
| 1861 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, pai
ntFlags | PaintLayerPaintingOverlayScrollbars); | 1883 paintInfo.renderLayer->paintLayerContents(context, paintingInfo, pai
ntFlags | PaintLayerPaintingOverlayScrollbars); |
| 1862 } else { | 1884 } else { |
| 1863 ASSERT(compositor()->layerSquashingEnabled()); | 1885 ASSERT(compositor()->layerSquashingEnabled()); |
| 1864 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, LayoutSize()); | 1886 LayerPaintingInfo paintingInfo(paintInfo.renderLayer, dirtyRect, PaintBe
haviorNormal, LayoutSize()); |
| 1865 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags); | 1887 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 } | 2098 } |
| 2077 | 2099 |
| 2078 void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double
wallClockTime, double monotonicTime) | 2100 void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double
wallClockTime, double monotonicTime) |
| 2079 { | 2101 { |
| 2080 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) | 2102 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) |
| 2081 renderer()->node()->document().cssPendingAnimations().notifyCompositorAn
imationStarted(monotonicTime); | 2103 renderer()->node()->document().cssPendingAnimations().notifyCompositorAn
imationStarted(monotonicTime); |
| 2082 else | 2104 else |
| 2083 renderer()->animation().notifyAnimationStarted(renderer(), wallClockTime
); | 2105 renderer()->animation().notifyAnimationStarted(renderer(), wallClockTime
); |
| 2084 } | 2106 } |
| 2085 | 2107 |
| 2086 IntRect CompositedLayerMapping::compositedBounds() const | 2108 LayoutRect CompositedLayerMapping::compositedBounds() const |
| 2087 { | 2109 { |
| 2088 return m_compositedBounds; | 2110 return m_compositedBounds; |
| 2089 } | 2111 } |
| 2090 | 2112 |
| 2091 void CompositedLayerMapping::setCompositedBounds(const IntRect& bounds) | 2113 void CompositedLayerMapping::setCompositedBounds(const LayoutRect& bounds) |
| 2092 { | 2114 { |
| 2093 m_compositedBounds = bounds; | 2115 m_compositedBounds = bounds; |
| 2094 } | 2116 } |
| 2095 | 2117 |
| 2096 void CompositedLayerMapping::addRenderLayerToSquashingGraphicsLayer(RenderLayer*
layer, IntSize offsetFromTargetBacking, size_t nextSquashedLayerIndex) | 2118 void CompositedLayerMapping::addRenderLayerToSquashingGraphicsLayer(RenderLayer*
layer, IntSize offsetFromTargetBacking, size_t nextSquashedLayerIndex) |
| 2097 { | 2119 { |
| 2098 ASSERT(compositor()->layerSquashingEnabled()); | 2120 ASSERT(compositor()->layerSquashingEnabled()); |
| 2099 | 2121 |
| 2100 GraphicsLayerPaintInfo paintInfo; | 2122 GraphicsLayerPaintInfo paintInfo; |
| 2101 paintInfo.renderLayer = layer; | 2123 paintInfo.renderLayer = layer; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2224 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
| 2203 name = "Scrolling Contents Layer"; | 2225 name = "Scrolling Contents Layer"; |
| 2204 } else { | 2226 } else { |
| 2205 ASSERT_NOT_REACHED(); | 2227 ASSERT_NOT_REACHED(); |
| 2206 } | 2228 } |
| 2207 | 2229 |
| 2208 return name; | 2230 return name; |
| 2209 } | 2231 } |
| 2210 | 2232 |
| 2211 } // namespace WebCore | 2233 } // namespace WebCore |
| OLD | NEW |