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 22 matching lines...) Expand all Loading... | |
33 #include "core/fetch/ImageResource.h" | 33 #include "core/fetch/ImageResource.h" |
34 #include "core/html/HTMLIFrameElement.h" | 34 #include "core/html/HTMLIFrameElement.h" |
35 #include "core/html/HTMLMediaElement.h" | 35 #include "core/html/HTMLMediaElement.h" |
36 #include "core/html/canvas/CanvasRenderingContext.h" | 36 #include "core/html/canvas/CanvasRenderingContext.h" |
37 #include "core/inspector/InspectorInstrumentation.h" | 37 #include "core/inspector/InspectorInstrumentation.h" |
38 #include "core/page/Chrome.h" | 38 #include "core/page/Chrome.h" |
39 #include "core/page/FrameView.h" | 39 #include "core/page/FrameView.h" |
40 #include "core/page/Settings.h" | 40 #include "core/page/Settings.h" |
41 #include "core/page/animation/AnimationController.h" | 41 #include "core/page/animation/AnimationController.h" |
42 #include "core/page/scrolling/ScrollingCoordinator.h" | 42 #include "core/page/scrolling/ScrollingCoordinator.h" |
43 #include "core/platform/chromium/TraceEvent.h" | |
43 #include "core/platform/graphics/FontCache.h" | 44 #include "core/platform/graphics/FontCache.h" |
44 #include "core/platform/graphics/GraphicsContext.h" | 45 #include "core/platform/graphics/GraphicsContext.h" |
45 #include "core/platform/graphics/GraphicsLayer.h" | 46 #include "core/platform/graphics/GraphicsLayer.h" |
46 #include "core/plugins/PluginView.h" | 47 #include "core/plugins/PluginView.h" |
47 #include "core/rendering/RenderApplet.h" | 48 #include "core/rendering/RenderApplet.h" |
48 #include "core/rendering/RenderEmbeddedObject.h" | 49 #include "core/rendering/RenderEmbeddedObject.h" |
49 #include "core/rendering/RenderIFrame.h" | 50 #include "core/rendering/RenderIFrame.h" |
50 #include "core/rendering/RenderImage.h" | 51 #include "core/rendering/RenderImage.h" |
51 #include "core/rendering/RenderLayer.h" | 52 #include "core/rendering/RenderLayer.h" |
52 #include "core/rendering/RenderLayerCompositor.h" | 53 #include "core/rendering/RenderLayerCompositor.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 if (page && frame && page->mainFrame() == frame) { | 165 if (page && frame && page->mainFrame() == frame) { |
165 m_isMainFrameRenderViewLayer = true; | 166 m_isMainFrameRenderViewLayer = true; |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
169 createPrimaryGraphicsLayer(); | 170 createPrimaryGraphicsLayer(); |
170 } | 171 } |
171 | 172 |
172 RenderLayerBacking::~RenderLayerBacking() | 173 RenderLayerBacking::~RenderLayerBacking() |
173 { | 174 { |
174 updateClippingLayers(false, false); | 175 updateClippingLayers(false, false, false); |
175 updateOverflowControlsLayers(false, false, false); | 176 updateOverflowControlsLayers(false, false, false); |
176 updateForegroundLayer(false); | 177 updateForegroundLayer(false); |
177 updateBackgroundLayer(false); | 178 updateBackgroundLayer(false); |
178 updateMaskLayer(false); | 179 updateMaskLayer(false); |
179 updateScrollingLayers(false); | 180 updateScrollingLayers(false); |
180 destroyGraphicsLayers(); | 181 destroyGraphicsLayers(); |
181 } | 182 } |
182 | 183 |
183 PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(CompositingRea sons reasons) | 184 PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(CompositingRea sons reasons) |
184 { | 185 { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 | 412 |
412 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning Layer))) | 413 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning Layer))) |
413 layerConfigChanged = true; | 414 layerConfigChanged = true; |
414 | 415 |
415 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants (m_owningLayer); | 416 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants (m_owningLayer); |
416 | 417 |
417 // Our scrolling layer will clip. | 418 // Our scrolling layer will clip. |
418 if (m_owningLayer->needsCompositedScrolling()) | 419 if (m_owningLayer->needsCompositedScrolling()) |
419 needsDescendentsClippingLayer = false; | 420 needsDescendentsClippingLayer = false; |
420 | 421 |
421 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), needs DescendentsClippingLayer)) | 422 bool needsAncestorClip = compositor->clippedByAncestor(m_owningLayer); |
423 bool needsScrollClip = compositor->clippedByScrollingAncestor(m_owningLayer) ; | |
424 if (updateClippingLayers(needsAncestorClip, needsDescendentsClippingLayer, n eedsScrollClip)) | |
422 layerConfigChanged = true; | 425 layerConfigChanged = true; |
423 | 426 |
424 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer())) | 427 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer())) |
425 layerConfigChanged = true; | 428 layerConfigChanged = true; |
426 | 429 |
427 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling())) | 430 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling())) |
428 layerConfigChanged = true; | 431 layerConfigChanged = true; |
429 | 432 |
433 updateScrollParent(); | |
434 | |
435 // If the clip we want to ignore is established by a stacking sibling, it wo n't affect us. | |
436 // We've already made sure that we don't get a troublesome m_ancestorClippin gLayer in this case. | |
437 if (!needsAncestorClip) | |
438 updateClipParent(); | |
439 | |
430 if (layerConfigChanged) | 440 if (layerConfigChanged) |
431 updateInternalHierarchy(); | 441 updateInternalHierarchy(); |
432 | 442 |
433 if (updateMaskLayer(renderer->hasMask())) | 443 if (updateMaskLayer(renderer->hasMask())) |
434 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); | 444 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); |
435 | 445 |
436 if (m_owningLayer->hasReflection()) { | 446 if (m_owningLayer->hasReflection()) { |
437 if (m_owningLayer->reflectionLayer()->backing()) { | 447 if (m_owningLayer->reflectionLayer()->backing()) { |
438 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->b acking()->graphicsLayer(); | 448 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->b acking()->graphicsLayer(); |
439 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); | 449 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 else | 546 else |
537 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio n(); | 547 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio n(); |
538 | 548 |
539 if (compAncestor && compAncestor->needsCompositedScrolling()) { | 549 if (compAncestor && compAncestor->needsCompositedScrolling()) { |
540 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); | 550 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); |
541 IntSize scrollOffset = compAncestor->scrolledContentOffset(); | 551 IntSize scrollOffset = compAncestor->scrolledContentOffset(); |
542 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); | 552 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); |
543 graphicsLayerParentLocation = scrollOrigin - scrollOffset; | 553 graphicsLayerParentLocation = scrollOrigin - scrollOffset; |
544 } | 554 } |
545 | 555 |
556 RenderLayer* scrollAncestor = 0; | |
557 if (compAncestor && m_ancestorScrollClippingLayer) { | |
558 scrollAncestor = m_owningLayer->ancestorScrollingLayer(); | |
559 ASSERT(scrollAncestor); | |
560 RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, Temporar yClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip, scrollAncestor); | |
561 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundCl ipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. | |
562 ASSERT(parentClipRect != PaintInfo::infiniteRect()); | |
563 | |
564 m_ancestorScrollClippingLayer->setPosition(FloatPoint(parentClipRect.loc ation() - graphicsLayerParentLocation)); | |
565 m_ancestorScrollClippingLayer->setSize(parentClipRect.size()); | |
566 | |
567 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords. | |
568 m_ancestorScrollClippingLayer->setOffsetFromRenderer(parentClipRect.loca tion() - delta); | |
569 | |
570 graphicsLayerParentLocation = parentClipRect.location(); | |
571 } | |
572 | |
546 if (compAncestor && m_ancestorClippingLayer) { | 573 if (compAncestor && m_ancestorClippingLayer) { |
547 // Call calculateRects to get the backgroundRect which is what is used t o clip the contents of this | 574 // Call calculateRects to get the backgroundRect which is what is used t o clip the contents of this |
548 // layer. Note that we call it with temporaryClipRects = true because no rmally when computing clip rects | 575 // layer. Note that we call it with temporaryClipRects = true because no rmally when computing clip rects |
549 // for a compositing layer, rootLayer is the layer itself. | 576 // for a compositing layer, rootLayer is the layer itself. Also note tha t if we have an ancestor clipping |
550 RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, Temporar yClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip); | 577 // layer, then we have a scroll parent. As such, we consider ourself unc lipped with respect to that |
578 // scroll parent -- it's as if we are contained within a large, unclippe d scrolling layer that moves | |
579 // beneath the clip established by our scroll parent. If we did not do t his, we would be completely | |
580 // clipped and ignored when we slid outside our scroll parent's clip, pr eventing us from being | |
581 // prepainted, etc. | |
582 RenderLayer* clipRoot = compAncestor; | |
583 IntPoint scrollToCompAncestorOffset; | |
584 IntPoint compToScrollAncestorOffset; | |
585 if (m_ancestorScrollClippingLayer) { | |
586 ASSERT(m_owningLayer->renderer()->containingBlock()->enclosingLayer( ) != scrollAncestor); | |
587 ASSERT(scrollAncestor && scrollAncestor->hasAncestor(compAncestor)); | |
588 clipRoot = scrollAncestor; | |
589 scrollAncestor->convertToPixelSnappedLayerCoords(compAncestor, compT oScrollAncestorOffset); | |
590 scrollToCompAncestorOffset = -compToScrollAncestorOffset; | |
enne (OOO)
2013/08/22 20:54:30
Is this the equivalent of the "scroll buddy" scrol
| |
591 } | |
592 | |
593 RenderLayer::ClipRectsContext clipRectsContext(clipRoot, 0, TemporaryCli pRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip); | |
551 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundCl ipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. | 594 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundCl ipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. |
595 | |
552 ASSERT(parentClipRect != PaintInfo::infiniteRect()); | 596 ASSERT(parentClipRect != PaintInfo::infiniteRect()); |
553 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location( ) - graphicsLayerParentLocation)); | 597 |
598 // If we have an ancestor scroll clipping layer, then our clip rects wil l already be in our scroll | |
599 // parent's space (it would be the clip root), so there is no need to ad just the position of the | |
600 // ancestor clip's graphics layer. Otherwise, our clip is with respect t o compAncestor, so we must | |
601 // adjust here. | |
602 IntPoint positionOffset; | |
603 if (!m_ancestorScrollClippingLayer) | |
604 positionOffset = graphicsLayerParentLocation; | |
605 | |
606 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location( ) - positionOffset)); | |
554 m_ancestorClippingLayer->setSize(parentClipRect.size()); | 607 m_ancestorClippingLayer->setSize(parentClipRect.size()); |
555 | 608 |
556 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY to get back to local coords. | 609 // backgroundRect is relative to clipRoot, so subtract deltaX/deltaY and the scrollToCompAncestorOffset to get back to local coords. |
557 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - delta); | 610 IntPoint clipToLocalOffset = delta + scrollToCompAncestorOffset; |
611 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location() - clipToLocalOffset); | |
558 | 612 |
559 // The primary layer is then parented in, and positioned relative to thi s clipping layer. | 613 // The primary layer is then parented in, and positioned relative to thi s clipping layer. |
560 graphicsLayerParentLocation = parentClipRect.location(); | 614 graphicsLayerParentLocation = parentClipRect.location() + compToScrollAn cestorOffset; |
561 } | 615 } |
562 | 616 |
563 FloatSize contentsSize = relativeCompositingBounds.size(); | 617 FloatSize contentsSize = relativeCompositingBounds.size(); |
564 | 618 |
565 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation)); | 619 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation)); |
566 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion())); | 620 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca tion())); |
567 | 621 |
568 FloatSize oldSize = m_graphicsLayer->size(); | 622 FloatSize oldSize = m_graphicsLayer->size(); |
569 if (oldSize != contentsSize) { | 623 if (oldSize != contentsSize) { |
570 m_graphicsLayer->setSize(contentsSize); | 624 m_graphicsLayer->setSize(contentsSize); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 | 796 |
743 // Page scale is applied as a transform on the root render view layer. Becau se the scroll | 797 // Page scale is applied as a transform on the root render view layer. Becau se the scroll |
744 // layer is further up in the hierarchy, we need to avoid marking the root r ender view | 798 // layer is further up in the hierarchy, we need to avoid marking the root r ender view |
745 // layer as a container. | 799 // layer as a container. |
746 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa yer(); | 800 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa yer(); |
747 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSupe rlayers(), isContainer); | 801 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSupe rlayers(), isContainer); |
748 } | 802 } |
749 | 803 |
750 void RenderLayerBacking::updateInternalHierarchy() | 804 void RenderLayerBacking::updateInternalHierarchy() |
751 { | 805 { |
806 if (m_ancestorScrollClippingLayer) | |
807 m_ancestorScrollClippingLayer->removeAllChildren(); | |
808 | |
752 // m_foregroundLayer has to be inserted in the correct order with child laye rs, | 809 // m_foregroundLayer has to be inserted in the correct order with child laye rs, |
753 // so it's not inserted here. | 810 // so it's not inserted here. |
754 if (m_ancestorClippingLayer) | 811 if (m_ancestorClippingLayer) |
755 m_ancestorClippingLayer->removeAllChildren(); | 812 m_ancestorClippingLayer->removeAllChildren(); |
756 | 813 |
757 m_graphicsLayer->removeFromParent(); | 814 m_graphicsLayer->removeFromParent(); |
758 | 815 |
759 if (m_ancestorClippingLayer) | 816 if (m_ancestorClippingLayer) |
760 m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); | 817 m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); |
761 | 818 |
819 if (m_ancestorScrollClippingLayer) { | |
820 if (m_ancestorClippingLayer) | |
821 m_ancestorScrollClippingLayer->addChild(m_ancestorClippingLayer.get( )); | |
822 else | |
823 m_ancestorScrollClippingLayer->addChild(m_graphicsLayer.get()); | |
824 } | |
825 | |
762 if (m_childContainmentLayer) { | 826 if (m_childContainmentLayer) { |
763 m_childContainmentLayer->removeFromParent(); | 827 m_childContainmentLayer->removeFromParent(); |
764 m_graphicsLayer->addChild(m_childContainmentLayer.get()); | 828 m_graphicsLayer->addChild(m_childContainmentLayer.get()); |
765 } | 829 } |
766 | 830 |
767 if (m_scrollingLayer) { | 831 if (m_scrollingLayer) { |
768 GraphicsLayer* superlayer = m_childContainmentLayer ? m_childContainment Layer.get() : m_graphicsLayer.get(); | 832 GraphicsLayer* superlayer = m_childContainmentLayer ? m_childContainment Layer.get() : m_graphicsLayer.get(); |
769 m_scrollingLayer->removeFromParent(); | 833 m_scrollingLayer->removeFromParent(); |
770 superlayer->addChild(m_scrollingLayer.get()); | 834 superlayer->addChild(m_scrollingLayer.get()); |
771 } | 835 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
831 // FIXME: we could refine this to only allocate backing for one of these lay ers if possible. | 895 // FIXME: we could refine this to only allocate backing for one of these lay ers if possible. |
832 m_graphicsLayer->setDrawsContent(hasPaintedContent); | 896 m_graphicsLayer->setDrawsContent(hasPaintedContent); |
833 if (m_foregroundLayer) | 897 if (m_foregroundLayer) |
834 m_foregroundLayer->setDrawsContent(hasPaintedContent); | 898 m_foregroundLayer->setDrawsContent(hasPaintedContent); |
835 | 899 |
836 if (m_backgroundLayer) | 900 if (m_backgroundLayer) |
837 m_backgroundLayer->setDrawsContent(hasPaintedContent); | 901 m_backgroundLayer->setDrawsContent(hasPaintedContent); |
838 } | 902 } |
839 | 903 |
840 // Return true if the layers changed. | 904 // Return true if the layers changed. |
841 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs DescendantClip) | 905 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs DescendantClip, bool needsScrollClip) |
842 { | 906 { |
907 TRACE_EVENT_INSTANT2( | |
908 "comp-scroll", | |
909 "RenderLayerBacking::updateClippingLayers", | |
910 "needsAncestorClip", needsAncestorClip, | |
911 "needsScrollClip", needsScrollClip); | |
912 | |
843 bool layersChanged = false; | 913 bool layersChanged = false; |
844 | 914 |
845 if (needsAncestorClip) { | 915 if (needsAncestorClip) { |
846 if (!m_ancestorClippingLayer) { | 916 if (!m_ancestorClippingLayer) { |
847 m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayer ForClip); | 917 m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayer ForClip); |
848 m_ancestorClippingLayer->setMasksToBounds(true); | 918 m_ancestorClippingLayer->setMasksToBounds(true); |
849 layersChanged = true; | 919 layersChanged = true; |
850 } | 920 } |
851 } else if (m_ancestorClippingLayer) { | 921 } else if (m_ancestorClippingLayer) { |
852 m_ancestorClippingLayer->removeFromParent(); | 922 m_ancestorClippingLayer->removeFromParent(); |
853 m_ancestorClippingLayer = nullptr; | 923 m_ancestorClippingLayer = nullptr; |
854 layersChanged = true; | 924 layersChanged = true; |
855 } | 925 } |
856 | 926 |
857 if (needsDescendantClip) { | 927 if (needsDescendantClip) { |
858 // We don't need a child containment layer if we're the main frame rende r view | 928 // We don't need a child containment layer if we're the main frame rende r view |
859 // layer. It's redundant as the frame clip above us will handle this cli pping. | 929 // layer. It's redundant as the frame clip above us will handle this cli pping. |
860 if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) { | 930 if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) { |
861 m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayer ForClip); | 931 m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayer ForClip); |
862 m_childContainmentLayer->setMasksToBounds(true); | 932 m_childContainmentLayer->setMasksToBounds(true); |
863 layersChanged = true; | 933 layersChanged = true; |
864 } | 934 } |
865 } else if (hasClippingLayer()) { | 935 } else if (hasClippingLayer()) { |
866 m_childContainmentLayer->removeFromParent(); | 936 m_childContainmentLayer->removeFromParent(); |
867 m_childContainmentLayer = nullptr; | 937 m_childContainmentLayer = nullptr; |
868 layersChanged = true; | 938 layersChanged = true; |
869 } | 939 } |
870 | 940 |
941 if (needsScrollClip) { | |
942 if (!m_ancestorScrollClippingLayer) { | |
943 m_ancestorScrollClippingLayer = createGraphicsLayer(CompositingReaso nLayerForClip); | |
944 m_ancestorScrollClippingLayer->setMasksToBounds(true); | |
945 layersChanged = true; | |
946 } | |
947 } else if (m_ancestorScrollClippingLayer) { | |
948 m_ancestorScrollClippingLayer->removeFromParent(); | |
949 m_ancestorScrollClippingLayer = nullptr; | |
950 layersChanged = true; | |
951 } | |
952 | |
871 return layersChanged; | 953 return layersChanged; |
872 } | 954 } |
873 | 955 |
874 void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgr oundLayerPaintsFixedRootBackground) | 956 void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgr oundLayerPaintsFixedRootBackground) |
875 { | 957 { |
876 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB ackground; | 958 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB ackground; |
877 } | 959 } |
878 | 960 |
879 bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll barLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) | 961 bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll barLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) |
880 { | 962 { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1083 updateInternalHierarchy(); | 1165 updateInternalHierarchy(); |
1084 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); | 1166 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); |
1085 m_graphicsLayer->setNeedsDisplay(); | 1167 m_graphicsLayer->setNeedsDisplay(); |
1086 if (renderer()->view()) | 1168 if (renderer()->view()) |
1087 compositor()->scrollingLayerDidChange(m_owningLayer); | 1169 compositor()->scrollingLayerDidChange(m_owningLayer); |
1088 } | 1170 } |
1089 | 1171 |
1090 return layerChanged; | 1172 return layerChanged; |
1091 } | 1173 } |
1092 | 1174 |
1175 void RenderLayerBacking::updateScrollParent() | |
1176 { | |
1177 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); | |
1178 if (!scrollingCoordinator) | |
1179 return; | |
1180 | |
1181 RenderLayer* scrollParent = 0; | |
1182 if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrolling Parent) | |
1183 scrollParent = m_owningLayer->ancestorScrollingLayer(); | |
1184 | |
1185 scrollingCoordinator->updateScrollParentForLayer(m_owningLayer, scrollParent ); | |
1186 } | |
1187 | |
1188 void RenderLayerBacking::updateClipParent() | |
1189 { | |
1190 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); | |
1191 if (!scrollingCoordinator) | |
1192 return; | |
1193 | |
1194 RenderLayer* clipParent = 0; | |
1195 if (m_owningLayer->compositingReasons() & CompositingReasonOutOfFlowClipping ) { | |
1196 if (RenderObject* containingBlock = m_owningLayer->renderer()->containin gBlock()) | |
enne (OOO)
2013/08/22 20:54:30
Can you help me understand the containing block lo
| |
1197 clipParent = containingBlock->enclosingLayer()->enclosingCompositing Layer(true); | |
1198 } | |
1199 | |
1200 scrollingCoordinator->updateClipParentForLayer(m_owningLayer, clipParent); | |
1201 } | |
1202 | |
1093 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co nst | 1203 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co nst |
1094 { | 1204 { |
1095 unsigned phase = 0; | 1205 unsigned phase = 0; |
1096 if (!m_backgroundLayer) | 1206 if (!m_backgroundLayer) |
1097 phase |= GraphicsLayerPaintBackground; | 1207 phase |= GraphicsLayerPaintBackground; |
1098 if (!m_foregroundLayer) | 1208 if (!m_foregroundLayer) |
1099 phase |= GraphicsLayerPaintForeground; | 1209 phase |= GraphicsLayerPaintForeground; |
1100 if (!m_maskLayer) | 1210 if (!m_maskLayer) |
1101 phase |= GraphicsLayerPaintMask; | 1211 phase |= GraphicsLayerPaintMask; |
1102 | 1212 |
1103 if (m_scrollingContentsLayer) { | 1213 if (m_scrollingContentsLayer) { |
1104 phase &= ~GraphicsLayerPaintForeground; | 1214 phase &= ~GraphicsLayerPaintForeground; |
1105 phase |= GraphicsLayerPaintCompositedScroll; | 1215 phase |= GraphicsLayerPaintCompositedScroll; |
1106 } | 1216 } |
1107 | 1217 |
1218 if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrolling Parent) | |
enne (OOO)
2013/08/22 20:54:30
Use your shiny new unused m_owningLayer->hasScroll
| |
1219 phase |= GraphicsLayerPaintCompositedScroll; | |
1220 | |
1108 return static_cast<GraphicsLayerPaintingPhase>(phase); | 1221 return static_cast<GraphicsLayerPaintingPhase>(phase); |
1109 } | 1222 } |
1110 | 1223 |
1111 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const | 1224 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const |
1112 { | 1225 { |
1113 float finalOpacity = rendererOpacity; | 1226 float finalOpacity = rendererOpacity; |
1114 | 1227 |
1115 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent( )) { | 1228 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent( )) { |
1116 // We only care about parents that are stacking contexts. | 1229 // We only care about parents that are stacking contexts. |
1117 // Recall that opacity creates stacking context. | 1230 // Recall that opacity creates stacking context. |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1435 GraphicsLayer* RenderLayerBacking::parentForSublayers() const | 1548 GraphicsLayer* RenderLayerBacking::parentForSublayers() const |
1436 { | 1549 { |
1437 if (m_scrollingContentsLayer) | 1550 if (m_scrollingContentsLayer) |
1438 return m_scrollingContentsLayer.get(); | 1551 return m_scrollingContentsLayer.get(); |
1439 | 1552 |
1440 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL ayer.get(); | 1553 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL ayer.get(); |
1441 } | 1554 } |
1442 | 1555 |
1443 GraphicsLayer* RenderLayerBacking::childForSuperlayers() const | 1556 GraphicsLayer* RenderLayerBacking::childForSuperlayers() const |
1444 { | 1557 { |
1558 if (m_ancestorScrollClippingLayer) | |
1559 return m_ancestorScrollClippingLayer.get(); | |
1560 | |
1445 if (m_ancestorClippingLayer) | 1561 if (m_ancestorClippingLayer) |
1446 return m_ancestorClippingLayer.get(); | 1562 return m_ancestorClippingLayer.get(); |
1447 | 1563 |
1448 return m_graphicsLayer.get(); | 1564 return m_graphicsLayer.get(); |
1449 } | 1565 } |
1450 | 1566 |
1451 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) | 1567 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) |
1452 { | 1568 { |
1453 if (requiresOwnBacking == m_requiresOwnBackingStore) | 1569 if (requiresOwnBacking == m_requiresOwnBackingStore) |
1454 return; | 1570 return; |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1929 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2045 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
1930 name = "Scrolling Contents Layer"; | 2046 name = "Scrolling Contents Layer"; |
1931 } else { | 2047 } else { |
1932 ASSERT_NOT_REACHED(); | 2048 ASSERT_NOT_REACHED(); |
1933 } | 2049 } |
1934 | 2050 |
1935 return name; | 2051 return name; |
1936 } | 2052 } |
1937 | 2053 |
1938 } // namespace WebCore | 2054 } // namespace WebCore |
OLD | NEW |