| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "platform/graphics/paint/ClipDisplayItem.h" | 63 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 64 #include "platform/graphics/paint/DisplayItemList.h" | 64 #include "platform/graphics/paint/DisplayItemList.h" |
| 65 #include "platform/graphics/paint/TransformDisplayItem.h" | 65 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 66 #include "wtf/CurrentTime.h" | 66 #include "wtf/CurrentTime.h" |
| 67 #include "wtf/text/StringBuilder.h" | 67 #include "wtf/text/StringBuilder.h" |
| 68 | 68 |
| 69 namespace blink { | 69 namespace blink { |
| 70 | 70 |
| 71 using namespace HTMLNames; | 71 using namespace HTMLNames; |
| 72 | 72 |
| 73 static IntRect clipBox(RenderBox* renderer); | 73 static IntRect clipBox(LayoutBox* renderer); |
| 74 | 74 |
| 75 static IntRect contentsRect(const LayoutObject* renderer) | 75 static IntRect contentsRect(const LayoutObject* renderer) |
| 76 { | 76 { |
| 77 if (!renderer->isBox()) | 77 if (!renderer->isBox()) |
| 78 return IntRect(); | 78 return IntRect(); |
| 79 | 79 |
| 80 return renderer->isVideo() ? | 80 return renderer->isVideo() ? |
| 81 toLayoutVideo(renderer)->videoBox() : | 81 toLayoutVideo(renderer)->videoBox() : |
| 82 pixelSnappedIntRect(toRenderBox(renderer)->contentBoxRect()); | 82 pixelSnappedIntRect(toLayoutBox(renderer)->contentBoxRect()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 static IntRect backgroundRect(const LayoutObject* renderer) | 85 static IntRect backgroundRect(const LayoutObject* renderer) |
| 86 { | 86 { |
| 87 if (!renderer->isBox()) | 87 if (!renderer->isBox()) |
| 88 return IntRect(); | 88 return IntRect(); |
| 89 | 89 |
| 90 LayoutRect rect; | 90 LayoutRect rect; |
| 91 const RenderBox* box = toRenderBox(renderer); | 91 const LayoutBox* box = toLayoutBox(renderer); |
| 92 EFillBox clip = box->style()->backgroundClip(); | 92 EFillBox clip = box->style()->backgroundClip(); |
| 93 switch (clip) { | 93 switch (clip) { |
| 94 case BorderFillBox: | 94 case BorderFillBox: |
| 95 rect = box->borderBoxRect(); | 95 rect = box->borderBoxRect(); |
| 96 break; | 96 break; |
| 97 case PaddingFillBox: | 97 case PaddingFillBox: |
| 98 rect = box->paddingBoxRect(); | 98 rect = box->paddingBoxRect(); |
| 99 break; | 99 break; |
| 100 case ContentFillBox: | 100 case ContentFillBox: |
| 101 rect = box->contentBoxRect(); | 101 rect = box->contentBoxRect(); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 { | 264 { |
| 265 m_graphicsLayer->setOpacity(compositingOpacity(style.opacity())); | 265 m_graphicsLayer->setOpacity(compositingOpacity(style.opacity())); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void CompositedLayerMapping::updateTransform(const LayoutStyle& style) | 268 void CompositedLayerMapping::updateTransform(const LayoutStyle& style) |
| 269 { | 269 { |
| 270 // FIXME: This could use m_owningLayer.transform(), but that currently has t
ransform-origin | 270 // FIXME: This could use m_owningLayer.transform(), but that currently has t
ransform-origin |
| 271 // baked into it, and we don't want that. | 271 // baked into it, and we don't want that. |
| 272 TransformationMatrix t; | 272 TransformationMatrix t; |
| 273 if (m_owningLayer.hasTransformRelatedProperty()) { | 273 if (m_owningLayer.hasTransformRelatedProperty()) { |
| 274 style.applyTransform(t, LayoutSize(toRenderBox(renderer())->pixelSnapped
Size()), LayoutStyle::ExcludeTransformOrigin); | 274 style.applyTransform(t, LayoutSize(toLayoutBox(renderer())->pixelSnapped
Size()), LayoutStyle::ExcludeTransformOrigin); |
| 275 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing()); | 275 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 m_graphicsLayer->setTransform(t); | 278 m_graphicsLayer->setTransform(t); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void CompositedLayerMapping::updateFilters(const LayoutStyle& style) | 281 void CompositedLayerMapping::updateFilters(const LayoutStyle& style) |
| 282 { | 282 { |
| 283 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); | 283 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); |
| 284 } | 284 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 layerConfigChanged = LayerCompositor::parentFrameContentLayers(toLayoutP
art(renderer)); | 538 layerConfigChanged = LayerCompositor::parentFrameContentLayers(toLayoutP
art(renderer)); |
| 539 | 539 |
| 540 // Changes to either the internal hierarchy or the mask layer have an impact | 540 // Changes to either the internal hierarchy or the mask layer have an impact |
| 541 // on painting phases, so we need to update when either are updated. | 541 // on painting phases, so we need to update when either are updated. |
| 542 if (layerConfigChanged || maskLayerChanged) | 542 if (layerConfigChanged || maskLayerChanged) |
| 543 updatePaintingPhases(); | 543 updatePaintingPhases(); |
| 544 | 544 |
| 545 return layerConfigChanged; | 545 return layerConfigChanged; |
| 546 } | 546 } |
| 547 | 547 |
| 548 static IntRect clipBox(RenderBox* renderer) | 548 static IntRect clipBox(LayoutBox* renderer) |
| 549 { | 549 { |
| 550 LayoutRect result = LayoutRect::infiniteIntRect(); | 550 LayoutRect result = LayoutRect::infiniteIntRect(); |
| 551 if (renderer->hasOverflowClip()) | 551 if (renderer->hasOverflowClip()) |
| 552 result = renderer->overflowClipRect(LayoutPoint()); | 552 result = renderer->overflowClipRect(LayoutPoint()); |
| 553 | 553 |
| 554 if (renderer->hasClip()) | 554 if (renderer->hasClip()) |
| 555 result.intersect(renderer->clipRect(LayoutPoint())); | 555 result.intersect(renderer->clipRect(LayoutPoint())); |
| 556 | 556 |
| 557 return pixelSnappedIntRect(result); | 557 return pixelSnappedIntRect(result); |
| 558 } | 558 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 695 |
| 696 FloatSize contentsSize = relativeCompositingBounds.size(); | 696 FloatSize contentsSize = relativeCompositingBounds.size(); |
| 697 | 697 |
| 698 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); | 698 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); |
| 699 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
graphicsLayerParentLocation); | 699 updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor,
graphicsLayerParentLocation); |
| 700 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); | 700 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); |
| 701 | 701 |
| 702 // If we have a layer that clips children, position it. | 702 // If we have a layer that clips children, position it. |
| 703 IntRect clippingBox; | 703 IntRect clippingBox; |
| 704 if (m_childContainmentLayer) | 704 if (m_childContainmentLayer) |
| 705 clippingBox = clipBox(toRenderBox(renderer())); | 705 clippingBox = clipBox(toLayoutBox(renderer())); |
| 706 | 706 |
| 707 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); | 707 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); |
| 708 updateChildTransformLayerGeometry(); | 708 updateChildTransformLayerGeometry(); |
| 709 | 709 |
| 710 updateMaskLayerGeometry(); | 710 updateMaskLayerGeometry(); |
| 711 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi
tingBounds); | 711 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi
tingBounds); |
| 712 updateForegroundLayerGeometry(contentsSize, clippingBox); | 712 updateForegroundLayerGeometry(contentsSize, clippingBox); |
| 713 updateBackgroundLayerGeometry(contentsSize); | 713 updateBackgroundLayerGeometry(contentsSize); |
| 714 updateReflectionLayerGeometry(layersNeedingPaintInvalidation); | 714 updateReflectionLayerGeometry(layersNeedingPaintInvalidation); |
| 715 updateScrollingLayerGeometry(localCompositingBounds); | 715 updateScrollingLayerGeometry(localCompositingBounds); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 m_graphicsLayer->setContentsVisible(contentsVisible); | 761 m_graphicsLayer->setContentsVisible(contentsVisible); |
| 762 | 762 |
| 763 m_graphicsLayer->setBackfaceVisibility(renderer()->style()->backfaceVisibili
ty() == BackfaceVisibilityVisible); | 763 m_graphicsLayer->setBackfaceVisibility(renderer()->style()->backfaceVisibili
ty() == BackfaceVisibilityVisible); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void CompositedLayerMapping::computeGraphicsLayerParentLocation(const Layer* com
positingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsL
ayerParentLocation) | 766 void CompositedLayerMapping::computeGraphicsLayerParentLocation(const Layer* com
positingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsL
ayerParentLocation) |
| 767 { | 767 { |
| 768 if (compositingContainer && compositingContainer->compositedLayerMapping()->
hasClippingLayer()) { | 768 if (compositingContainer && compositingContainer->compositedLayerMapping()->
hasClippingLayer()) { |
| 769 // If the compositing ancestor has a layer to clip children, we parent i
n that, and therefore | 769 // If the compositing ancestor has a layer to clip children, we parent i
n that, and therefore |
| 770 // position relative to it. | 770 // position relative to it. |
| 771 IntRect clippingBox = clipBox(toRenderBox(compositingContainer->renderer
())); | 771 IntRect clippingBox = clipBox(toLayoutBox(compositingContainer->renderer
())); |
| 772 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co
mpositingContainer->subpixelAccumulation()); | 772 graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(co
mpositingContainer->subpixelAccumulation()); |
| 773 } else if (compositingContainer && compositingContainer->compositedLayerMapp
ing()->childTransformLayer()) { | 773 } else if (compositingContainer && compositingContainer->compositedLayerMapp
ing()->childTransformLayer()) { |
| 774 // Similarly, if the compositing ancestor has a child transform layer, w
e parent in that, and therefore | 774 // Similarly, if the compositing ancestor has a child transform layer, w
e parent in that, and therefore |
| 775 // position relative to it. It's already taken into account the contents
offset, so we do not need to here. | 775 // position relative to it. It's already taken into account the contents
offset, so we do not need to here. |
| 776 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp
ixelAccumulation()); | 776 graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subp
ixelAccumulation()); |
| 777 } else if (compositingContainer) { | 777 } else if (compositingContainer) { |
| 778 graphicsLayerParentLocation = ancestorCompositingBounds.location(); | 778 graphicsLayerParentLocation = ancestorCompositingBounds.location(); |
| 779 } else { | 779 } else { |
| 780 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio
n(); | 780 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio
n(); |
| 781 } | 781 } |
| 782 | 782 |
| 783 if (compositingContainer && compositingContainer->needsCompositedScrolling()
) { | 783 if (compositingContainer && compositingContainer->needsCompositedScrolling()
) { |
| 784 RenderBox* renderBox = toRenderBox(compositingContainer->renderer()); | 784 LayoutBox* layoutBox = toLayoutBox(compositingContainer->renderer()); |
| 785 IntSize scrollOffset = renderBox->scrolledContentOffset(); | 785 IntSize scrollOffset = layoutBox->scrolledContentOffset(); |
| 786 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); | 786 IntPoint scrollOrigin(layoutBox->borderLeft(), layoutBox->borderTop()); |
| 787 graphicsLayerParentLocation = scrollOrigin - scrollOffset; | 787 graphicsLayerParentLocation = scrollOrigin - scrollOffset; |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 | 790 |
| 791 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const Layer* co
mpositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoin
t& graphicsLayerParentLocation) | 791 void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const Layer* co
mpositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoin
t& graphicsLayerParentLocation) |
| 792 { | 792 { |
| 793 if (!compositingContainer || !m_ancestorClippingLayer) | 793 if (!compositingContainer || !m_ancestorClippingLayer) |
| 794 return; | 794 return; |
| 795 | 795 |
| 796 ClipRectsContext clipRectsContext(compositingContainer, PaintingClipRectsIgn
oringOverflowClip, IgnoreOverlayScrollbarSize); | 796 ClipRectsContext clipRectsContext(compositingContainer, PaintingClipRectsIgn
oringOverflowClip, IgnoreOverlayScrollbarSize); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position(
)); | 846 m_childClippingMaskLayer->setPosition(m_childContainmentLayer->position(
)); |
| 847 m_childClippingMaskLayer->setSize(m_childContainmentLayer->size()); | 847 m_childClippingMaskLayer->setSize(m_childContainmentLayer->size()); |
| 848 m_childClippingMaskLayer->setOffsetFromRenderer(m_childContainmentLayer-
>offsetFromRenderer()); | 848 m_childClippingMaskLayer->setOffsetFromRenderer(m_childContainmentLayer-
>offsetFromRenderer()); |
| 849 } | 849 } |
| 850 } | 850 } |
| 851 | 851 |
| 852 void CompositedLayerMapping::updateChildTransformLayerGeometry() | 852 void CompositedLayerMapping::updateChildTransformLayerGeometry() |
| 853 { | 853 { |
| 854 if (!m_childTransformLayer) | 854 if (!m_childTransformLayer) |
| 855 return; | 855 return; |
| 856 const IntRect borderBox = toRenderBox(m_owningLayer.renderer())->pixelSnappe
dBorderBoxRect(); | 856 const IntRect borderBox = toLayoutBox(m_owningLayer.renderer())->pixelSnappe
dBorderBoxRect(); |
| 857 m_childTransformLayer->setSize(borderBox.size()); | 857 m_childTransformLayer->setSize(borderBox.size()); |
| 858 m_childTransformLayer->setPosition(FloatPoint(contentOffsetInCompositingLaye
r())); | 858 m_childTransformLayer->setPosition(FloatPoint(contentOffsetInCompositingLaye
r())); |
| 859 } | 859 } |
| 860 | 860 |
| 861 void CompositedLayerMapping::updateMaskLayerGeometry() | 861 void CompositedLayerMapping::updateMaskLayerGeometry() |
| 862 { | 862 { |
| 863 if (!m_maskLayer) | 863 if (!m_maskLayer) |
| 864 return; | 864 return; |
| 865 | 865 |
| 866 if (m_maskLayer->size() != m_graphicsLayer->size()) { | 866 if (m_maskLayer->size() != m_graphicsLayer->size()) { |
| 867 m_maskLayer->setSize(m_graphicsLayer->size()); | 867 m_maskLayer->setSize(m_graphicsLayer->size()); |
| 868 m_maskLayer->setNeedsDisplay(); | 868 m_maskLayer->setNeedsDisplay(); |
| 869 } | 869 } |
| 870 m_maskLayer->setPosition(FloatPoint()); | 870 m_maskLayer->setPosition(FloatPoint()); |
| 871 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()); | 871 m_maskLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffs
etFromCompositedAncestor, const IntRect& relativeCompositingBounds) | 874 void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffs
etFromCompositedAncestor, const IntRect& relativeCompositingBounds) |
| 875 { | 875 { |
| 876 if (m_owningLayer.hasTransformRelatedProperty()) { | 876 if (m_owningLayer.hasTransformRelatedProperty()) { |
| 877 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); | 877 const LayoutRect borderBox = toLayoutBox(renderer())->borderBoxRect(); |
| 878 | 878 |
| 879 // Get layout bounds in the coords of compositingContainer to match rela
tiveCompositingBounds. | 879 // Get layout bounds in the coords of compositingContainer to match rela
tiveCompositingBounds. |
| 880 IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_owningLayer.su
bpixelAccumulation()), borderBox.size()); | 880 IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_owningLayer.su
bpixelAccumulation()), borderBox.size()); |
| 881 layerBounds.moveBy(snappedOffsetFromCompositedAncestor); | 881 layerBounds.moveBy(snappedOffsetFromCompositedAncestor); |
| 882 | 882 |
| 883 // Update properties that depend on layer dimensions | 883 // Update properties that depend on layer dimensions |
| 884 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); | 884 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); |
| 885 | 885 |
| 886 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the | 886 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the |
| 887 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. | 887 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 907 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref
lectionInfo()->reflectionLayer()->compositedLayerMapping(); | 907 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref
lectionInfo()->reflectionLayer()->compositedLayerMapping(); |
| 908 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer
, &m_owningLayer, layersNeedingPaintInvalidation); | 908 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer
, &m_owningLayer, layersNeedingPaintInvalidation); |
| 909 } | 909 } |
| 910 | 910 |
| 911 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) | 911 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) |
| 912 { | 912 { |
| 913 if (!m_scrollingLayer) | 913 if (!m_scrollingLayer) |
| 914 return; | 914 return; |
| 915 | 915 |
| 916 ASSERT(m_scrollingContentsLayer); | 916 ASSERT(m_scrollingContentsLayer); |
| 917 RenderBox* renderBox = toRenderBox(renderer()); | 917 LayoutBox* layoutBox = toLayoutBox(renderer()); |
| 918 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); | 918 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); |
| 919 DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedSc
rollOffset(); | 919 DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedSc
rollOffset(); |
| 920 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi
tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()))); | 920 m_scrollingLayer->setPosition(FloatPoint(clientBox.location() - localComposi
tingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()))); |
| 921 m_scrollingLayer->setSize(clientBox.size()); | 921 m_scrollingLayer->setSize(clientBox.size()); |
| 922 | 922 |
| 923 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer(); | 923 IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer(); |
| 924 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())); | 924 m_scrollingLayer->setOffsetFromRenderer(-toIntSize(clientBox.location())); |
| 925 | 925 |
| 926 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) { | 926 if (m_childClippingMaskLayer && !renderer()->style()->clipPath()) { |
| 927 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); | 927 m_childClippingMaskLayer->setPosition(m_scrollingLayer->position()); |
| 928 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); | 928 m_childClippingMaskLayer->setSize(m_scrollingLayer->size()); |
| 929 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca
tion())); | 929 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.loca
tion())); |
| 930 } | 930 } |
| 931 | 931 |
| 932 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->o
ffsetFromRenderer(); | 932 bool clientBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->o
ffsetFromRenderer(); |
| 933 | 933 |
| 934 IntSize scrollSize(renderBox->scrollWidth(), renderBox->scrollHeight()); | 934 IntSize scrollSize(layoutBox->scrollWidth(), layoutBox->scrollHeight()); |
| 935 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged
) | 935 if (scrollSize != m_scrollingContentsLayer->size() || clientBoxOffsetChanged
) |
| 936 m_scrollingContentsLayer->setNeedsDisplay(); | 936 m_scrollingContentsLayer->setNeedsDisplay(); |
| 937 | 937 |
| 938 DoubleSize scrollingContentsOffset(clientBox.location().x() - adjustedScroll
Offset.width(), clientBox.location().y() - adjustedScrollOffset.height()); | 938 DoubleSize scrollingContentsOffset(clientBox.location().x() - adjustedScroll
Offset.width(), clientBox.location().y() - adjustedScrollOffset.height()); |
| 939 // The scroll offset change is compared using floating point so that fractio
nal scroll offset | 939 // The scroll offset change is compared using floating point so that fractio
nal scroll offset |
| 940 // change can be propagated to compositor. | 940 // change can be propagated to compositor. |
| 941 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetDoubleFromRen
derer() || scrollSize != m_scrollingContentsLayer->size()) { | 941 if (scrollingContentsOffset != m_scrollingContentsLayer->offsetDoubleFromRen
derer() || scrollSize != m_scrollingContentsLayer->size()) { |
| 942 bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChange(&m
_owningLayer); | 942 bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChange(&m
_owningLayer); |
| 943 m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? FloatPo
int() : FloatPoint(-toFloatSize(adjustedScrollOffset))); | 943 m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? FloatPo
int() : FloatPoint(-toFloatSize(adjustedScrollOffset))); |
| 944 } | 944 } |
| 945 | 945 |
| 946 m_scrollingContentsLayer->setSize(scrollSize); | 946 m_scrollingContentsLayer->setSize(scrollSize); |
| 947 // FIXME: The paint offset and the scroll offset should really be separate c
oncepts. | 947 // FIXME: The paint offset and the scroll offset should really be separate c
oncepts. |
| 948 m_scrollingContentsLayer->setOffsetDoubleFromRenderer(scrollingContentsOffse
t, GraphicsLayer::DontSetNeedsDisplay); | 948 m_scrollingContentsLayer->setOffsetDoubleFromRenderer(scrollingContentsOffse
t, GraphicsLayer::DontSetNeedsDisplay); |
| 949 | 949 |
| 950 if (m_foregroundLayer) { | 950 if (m_foregroundLayer) { |
| 951 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) | 951 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) |
| 952 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); | 952 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); |
| 953 m_foregroundLayer->setNeedsDisplay(); | 953 m_foregroundLayer->setNeedsDisplay(); |
| 954 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offse
tFromRenderer()); | 954 m_foregroundLayer->setOffsetFromRenderer(m_scrollingContentsLayer->offse
tFromRenderer()); |
| 955 } | 955 } |
| 956 | 956 |
| 957 updateScrollingBlockSelection(); | 957 updateScrollingBlockSelection(); |
| 958 } | 958 } |
| 959 | 959 |
| 960 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() | 960 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() |
| 961 { | 961 { |
| 962 if (!m_childClippingMaskLayer || !renderer()->style()->clipPath()) | 962 if (!m_childClippingMaskLayer || !renderer()->style()->clipPath()) |
| 963 return; | 963 return; |
| 964 RenderBox* renderBox = toRenderBox(renderer()); | 964 LayoutBox* layoutBox = toLayoutBox(renderer()); |
| 965 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); | 965 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); |
| 966 | 966 |
| 967 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); | 967 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); |
| 968 m_childClippingMaskLayer->setSize(m_graphicsLayer->size()); | 968 m_childClippingMaskLayer->setSize(m_graphicsLayer->size()); |
| 969 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.location
())); | 969 m_childClippingMaskLayer->setOffsetFromRenderer(toIntSize(clientBox.location
())); |
| 970 | 970 |
| 971 // NOTE: also some stuff happening in updateChildContainmentLayerGeometry(). | 971 // NOTE: also some stuff happening in updateChildContainmentLayerGeometry(). |
| 972 } | 972 } |
| 973 | 973 |
| 974 void CompositedLayerMapping::updateForegroundLayerGeometry(const FloatSize& rela
tiveCompositingBoundsSize, const IntRect& clippingBox) | 974 void CompositedLayerMapping::updateForegroundLayerGeometry(const FloatSize& rela
tiveCompositingBoundsSize, const IntRect& clippingBox) |
| 975 { | 975 { |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2356 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2357 name = "Scrolling Block Selection Layer"; | 2357 name = "Scrolling Block Selection Layer"; |
| 2358 } else { | 2358 } else { |
| 2359 ASSERT_NOT_REACHED(); | 2359 ASSERT_NOT_REACHED(); |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 return name; | 2362 return name; |
| 2363 } | 2363 } |
| 2364 | 2364 |
| 2365 } // namespace blink | 2365 } // namespace blink |
| OLD | NEW |