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/html/HTMLIFrameElement.h" | 33 #include "core/html/HTMLIFrameElement.h" |
34 #include "core/html/HTMLMediaElement.h" | 34 #include "core/html/HTMLMediaElement.h" |
35 #include "core/html/canvas/CanvasRenderingContext.h" | 35 #include "core/html/canvas/CanvasRenderingContext.h" |
36 #include "core/inspector/InspectorInstrumentation.h" | 36 #include "core/inspector/InspectorInstrumentation.h" |
37 #include "core/loader/cache/CachedImage.h" | 37 #include "core/loader/cache/CachedImage.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(const String&
name, CompositingReasons reasons) | 184 PassOwnPtr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String&
name, CompositingReasons reasons) |
184 { | 185 { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 | 423 |
423 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning
Layer))) | 424 if (updateForegroundLayer(compositor->needsContentsCompositingLayer(m_owning
Layer))) |
424 layerConfigChanged = true; | 425 layerConfigChanged = true; |
425 | 426 |
426 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants
(m_owningLayer); | 427 bool needsDescendentsClippingLayer = compositor->clipsCompositingDescendants
(m_owningLayer); |
427 | 428 |
428 // Our scrolling layer will clip. | 429 // Our scrolling layer will clip. |
429 if (m_owningLayer->needsCompositedScrolling()) | 430 if (m_owningLayer->needsCompositedScrolling()) |
430 needsDescendentsClippingLayer = false; | 431 needsDescendentsClippingLayer = false; |
431 | 432 |
432 if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), needs
DescendentsClippingLayer)) | 433 bool needsAncestorClip = compositor->clippedByAncestor(m_owningLayer); |
| 434 bool needsScrollClip = compositor->clippedByScrollingAncestor(m_owningLayer)
; |
| 435 if (updateClippingLayers(needsAncestorClip, needsDescendentsClippingLayer, n
eedsScrollClip)) |
433 layerConfigChanged = true; | 436 layerConfigChanged = true; |
434 | 437 |
435 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require
sVerticalScrollbarLayer(), requiresScrollCornerLayer())) | 438 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require
sVerticalScrollbarLayer(), requiresScrollCornerLayer())) |
436 layerConfigChanged = true; | 439 layerConfigChanged = true; |
437 | 440 |
438 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling())) | 441 if (updateScrollingLayers(m_owningLayer->needsCompositedScrolling())) |
439 layerConfigChanged = true; | 442 layerConfigChanged = true; |
440 | 443 |
| 444 updateScrollParent(); |
| 445 |
| 446 // If the clip we want to ignore is established by a stacking sibling, it wo
n't affect us. |
| 447 // We've already made sure that we don't get a troublesome m_ancestorClippin
gLayer in this case. |
| 448 if (!needsAncestorClip) |
| 449 updateClipParent(); |
| 450 |
441 if (layerConfigChanged) | 451 if (layerConfigChanged) |
442 updateInternalHierarchy(); | 452 updateInternalHierarchy(); |
443 | 453 |
444 if (updateMaskLayer(renderer->hasMask())) | 454 if (updateMaskLayer(renderer->hasMask())) |
445 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); | 455 m_graphicsLayer->setMaskLayer(m_maskLayer.get()); |
446 | 456 |
447 if (m_owningLayer->hasReflection()) { | 457 if (m_owningLayer->hasReflection()) { |
448 if (m_owningLayer->reflectionLayer()->backing()) { | 458 if (m_owningLayer->reflectionLayer()->backing()) { |
449 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->b
acking()->graphicsLayer(); | 459 GraphicsLayer* reflectionLayer = m_owningLayer->reflectionLayer()->b
acking()->graphicsLayer(); |
450 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); | 460 m_graphicsLayer->setReplicatedByLayer(reflectionLayer); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 else | 557 else |
548 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio
n(); | 558 graphicsLayerParentLocation = renderer()->view()->documentRect().locatio
n(); |
549 | 559 |
550 if (compAncestor && compAncestor->needsCompositedScrolling()) { | 560 if (compAncestor && compAncestor->needsCompositedScrolling()) { |
551 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); | 561 RenderBox* renderBox = toRenderBox(compAncestor->renderer()); |
552 IntSize scrollOffset = compAncestor->scrolledContentOffset(); | 562 IntSize scrollOffset = compAncestor->scrolledContentOffset(); |
553 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); | 563 IntPoint scrollOrigin(renderBox->borderLeft(), renderBox->borderTop()); |
554 graphicsLayerParentLocation = scrollOrigin - scrollOffset; | 564 graphicsLayerParentLocation = scrollOrigin - scrollOffset; |
555 } | 565 } |
556 | 566 |
| 567 RenderLayer* scrollAncestor = 0; |
| 568 if (compAncestor && m_ancestorScrollClippingLayer) { |
| 569 scrollAncestor = m_owningLayer->ancestorScrollingLayer(); |
| 570 ASSERT(scrollAncestor); |
| 571 RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, Temporar
yClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip, scrollAncestor); |
| 572 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundCl
ipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. |
| 573 ASSERT(parentClipRect != PaintInfo::infiniteRect()); |
| 574 |
| 575 m_ancestorScrollClippingLayer->setPosition(FloatPoint(parentClipRect.loc
ation() - graphicsLayerParentLocation)); |
| 576 m_ancestorScrollClippingLayer->setSize(parentClipRect.size()); |
| 577 |
| 578 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY
to get back to local coords. |
| 579 m_ancestorScrollClippingLayer->setOffsetFromRenderer(parentClipRect.loca
tion() - delta); |
| 580 |
| 581 graphicsLayerParentLocation = parentClipRect.location(); |
| 582 } |
| 583 |
557 if (compAncestor && m_ancestorClippingLayer) { | 584 if (compAncestor && m_ancestorClippingLayer) { |
558 // Call calculateRects to get the backgroundRect which is what is used t
o clip the contents of this | 585 // Call calculateRects to get the backgroundRect which is what is used t
o clip the contents of this |
559 // layer. Note that we call it with temporaryClipRects = true because no
rmally when computing clip rects | 586 // layer. Note that we call it with temporaryClipRects = true because no
rmally when computing clip rects |
560 // for a compositing layer, rootLayer is the layer itself. | 587 // for a compositing layer, rootLayer is the layer itself. Also note tha
t if we have an ancestor clipping |
561 RenderLayer::ClipRectsContext clipRectsContext(compAncestor, 0, Temporar
yClipRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip); | 588 // layer, then we have a scroll parent. As such, we consider ourself unc
lipped with respect to that |
| 589 // scroll parent -- it's as if we are contained within a large, unclippe
d scrolling layer that moves |
| 590 // beneath the clip established by our scroll parent. If we did not do t
his, we would be completely |
| 591 // clipped and ignored when we slid outside our scroll parent's clip, pr
eventing us from being |
| 592 // prepainted, etc. |
| 593 RenderLayer* clipRoot = compAncestor; |
| 594 IntPoint scrollToCompAncestorOffset; |
| 595 IntPoint compToScrollAncestorOffset; |
| 596 if (m_ancestorScrollClippingLayer) { |
| 597 ASSERT(m_owningLayer->renderer()->containingBlock()->enclosingLayer(
) != scrollAncestor); |
| 598 ASSERT(scrollAncestor && scrollAncestor->hasAncestor(compAncestor)); |
| 599 clipRoot = scrollAncestor; |
| 600 scrollAncestor->convertToPixelSnappedLayerCoords(compAncestor, compT
oScrollAncestorOffset); |
| 601 scrollToCompAncestorOffset = -compToScrollAncestorOffset; |
| 602 } |
| 603 |
| 604 RenderLayer::ClipRectsContext clipRectsContext(clipRoot, 0, TemporaryCli
pRects, IgnoreOverlayScrollbarSize, IgnoreOverflowClip); |
562 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundCl
ipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. | 605 IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundCl
ipRect(clipRectsContext).rect()); // FIXME: Incorrect for CSS regions. |
| 606 |
563 ASSERT(parentClipRect != PaintInfo::infiniteRect()); | 607 ASSERT(parentClipRect != PaintInfo::infiniteRect()); |
564 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location(
) - graphicsLayerParentLocation)); | 608 |
| 609 // If we have an ancestor scroll clipping layer, then our clip rects wil
l already be in our scroll |
| 610 // parent's space (it would be the clip root), so there is no need to ad
just the position of the |
| 611 // ancestor clip's graphics layer. Otherwise, our clip is with respect t
o compAncestor, so we must |
| 612 // adjust here. |
| 613 IntPoint positionOffset; |
| 614 if (!m_ancestorScrollClippingLayer) |
| 615 positionOffset = graphicsLayerParentLocation; |
| 616 |
| 617 m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location(
) - positionOffset)); |
565 m_ancestorClippingLayer->setSize(parentClipRect.size()); | 618 m_ancestorClippingLayer->setSize(parentClipRect.size()); |
566 | 619 |
567 // backgroundRect is relative to compAncestor, so subtract deltaX/deltaY
to get back to local coords. | 620 // backgroundRect is relative to clipRoot, so subtract deltaX/deltaY and
the scrollToCompAncestorOffset to get back to local coords. |
568 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location()
- delta); | 621 IntPoint clipToLocalOffset = delta + scrollToCompAncestorOffset; |
| 622 m_ancestorClippingLayer->setOffsetFromRenderer(parentClipRect.location()
- clipToLocalOffset); |
569 | 623 |
570 // The primary layer is then parented in, and positioned relative to thi
s clipping layer. | 624 // The primary layer is then parented in, and positioned relative to thi
s clipping layer. |
571 graphicsLayerParentLocation = parentClipRect.location(); | 625 graphicsLayerParentLocation = parentClipRect.location() + compToScrollAn
cestorOffset; |
572 } | 626 } |
573 | 627 |
574 FloatSize contentsSize = relativeCompositingBounds.size(); | 628 FloatSize contentsSize = relativeCompositingBounds.size(); |
575 | 629 |
576 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location()
- graphicsLayerParentLocation)); | 630 m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location()
- graphicsLayerParentLocation)); |
577 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca
tion())); | 631 m_graphicsLayer->setOffsetFromRenderer(toIntSize(localCompositingBounds.loca
tion())); |
578 | 632 |
579 FloatSize oldSize = m_graphicsLayer->size(); | 633 FloatSize oldSize = m_graphicsLayer->size(); |
580 if (oldSize != contentsSize) { | 634 if (oldSize != contentsSize) { |
581 m_graphicsLayer->setSize(contentsSize); | 635 m_graphicsLayer->setSize(contentsSize); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 | 807 |
754 // Page scale is applied as a transform on the root render view layer. Becau
se the scroll | 808 // Page scale is applied as a transform on the root render view layer. Becau
se the scroll |
755 // layer is further up in the hierarchy, we need to avoid marking the root r
ender view | 809 // layer is further up in the hierarchy, we need to avoid marking the root r
ender view |
756 // layer as a container. | 810 // layer as a container. |
757 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa
yer(); | 811 bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLa
yer(); |
758 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSupe
rlayers(), isContainer); | 812 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSupe
rlayers(), isContainer); |
759 } | 813 } |
760 | 814 |
761 void RenderLayerBacking::updateInternalHierarchy() | 815 void RenderLayerBacking::updateInternalHierarchy() |
762 { | 816 { |
| 817 if (m_ancestorScrollClippingLayer) |
| 818 m_ancestorScrollClippingLayer->removeAllChildren(); |
| 819 |
763 // m_foregroundLayer has to be inserted in the correct order with child laye
rs, | 820 // m_foregroundLayer has to be inserted in the correct order with child laye
rs, |
764 // so it's not inserted here. | 821 // so it's not inserted here. |
765 if (m_ancestorClippingLayer) | 822 if (m_ancestorClippingLayer) |
766 m_ancestorClippingLayer->removeAllChildren(); | 823 m_ancestorClippingLayer->removeAllChildren(); |
767 | 824 |
768 m_graphicsLayer->removeFromParent(); | 825 m_graphicsLayer->removeFromParent(); |
769 | 826 |
770 if (m_ancestorClippingLayer) | 827 if (m_ancestorClippingLayer) |
771 m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); | 828 m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); |
772 | 829 |
| 830 if (m_ancestorScrollClippingLayer) { |
| 831 if (m_ancestorClippingLayer) |
| 832 m_ancestorScrollClippingLayer->addChild(m_ancestorClippingLayer.get(
)); |
| 833 else |
| 834 m_ancestorScrollClippingLayer->addChild(m_graphicsLayer.get()); |
| 835 } |
| 836 |
773 if (m_childContainmentLayer) { | 837 if (m_childContainmentLayer) { |
774 m_childContainmentLayer->removeFromParent(); | 838 m_childContainmentLayer->removeFromParent(); |
775 m_graphicsLayer->addChild(m_childContainmentLayer.get()); | 839 m_graphicsLayer->addChild(m_childContainmentLayer.get()); |
776 } | 840 } |
777 | 841 |
778 if (m_scrollingLayer) { | 842 if (m_scrollingLayer) { |
779 GraphicsLayer* superlayer = m_childContainmentLayer ? m_childContainment
Layer.get() : m_graphicsLayer.get(); | 843 GraphicsLayer* superlayer = m_childContainmentLayer ? m_childContainment
Layer.get() : m_graphicsLayer.get(); |
780 m_scrollingLayer->removeFromParent(); | 844 m_scrollingLayer->removeFromParent(); |
781 superlayer->addChild(m_scrollingLayer.get()); | 845 superlayer->addChild(m_scrollingLayer.get()); |
782 } | 846 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 // FIXME: we could refine this to only allocate backing for one of these lay
ers if possible. | 906 // FIXME: we could refine this to only allocate backing for one of these lay
ers if possible. |
843 m_graphicsLayer->setDrawsContent(hasPaintedContent); | 907 m_graphicsLayer->setDrawsContent(hasPaintedContent); |
844 if (m_foregroundLayer) | 908 if (m_foregroundLayer) |
845 m_foregroundLayer->setDrawsContent(hasPaintedContent); | 909 m_foregroundLayer->setDrawsContent(hasPaintedContent); |
846 | 910 |
847 if (m_backgroundLayer) | 911 if (m_backgroundLayer) |
848 m_backgroundLayer->setDrawsContent(hasPaintedContent); | 912 m_backgroundLayer->setDrawsContent(hasPaintedContent); |
849 } | 913 } |
850 | 914 |
851 // Return true if the layers changed. | 915 // Return true if the layers changed. |
852 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
DescendantClip) | 916 bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs
DescendantClip, bool needsScrollClip) |
853 { | 917 { |
| 918 TRACE_EVENT_INSTANT2( |
| 919 "comp-scroll", |
| 920 "RenderLayerBacking::updateClippingLayers", |
| 921 "needsAncestorClip", needsAncestorClip, |
| 922 "needsScrollClip", needsScrollClip); |
| 923 |
854 bool layersChanged = false; | 924 bool layersChanged = false; |
855 | 925 |
856 if (needsAncestorClip) { | 926 if (needsAncestorClip) { |
857 if (!m_ancestorClippingLayer) { | 927 if (!m_ancestorClippingLayer) { |
858 m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Lay
er", CompositingReasonLayerForClip); | 928 m_ancestorClippingLayer = createGraphicsLayer("Ancestor clipping Lay
er", CompositingReasonLayerForClip); |
859 m_ancestorClippingLayer->setMasksToBounds(true); | 929 m_ancestorClippingLayer->setMasksToBounds(true); |
860 layersChanged = true; | 930 layersChanged = true; |
861 } | 931 } |
862 } else if (m_ancestorClippingLayer) { | 932 } else if (m_ancestorClippingLayer) { |
863 m_ancestorClippingLayer->removeFromParent(); | 933 m_ancestorClippingLayer->removeFromParent(); |
864 m_ancestorClippingLayer = nullptr; | 934 m_ancestorClippingLayer = nullptr; |
865 layersChanged = true; | 935 layersChanged = true; |
866 } | 936 } |
867 | 937 |
868 if (needsDescendantClip) { | 938 if (needsDescendantClip) { |
869 // We don't need a child containment layer if we're the main frame rende
r view | 939 // We don't need a child containment layer if we're the main frame rende
r view |
870 // layer. It's redundant as the frame clip above us will handle this cli
pping. | 940 // layer. It's redundant as the frame clip above us will handle this cli
pping. |
871 if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) { | 941 if (!m_childContainmentLayer && !m_isMainFrameRenderViewLayer) { |
872 m_childContainmentLayer = createGraphicsLayer("Child clipping Layer"
, CompositingReasonLayerForClip); | 942 m_childContainmentLayer = createGraphicsLayer("Child clipping Layer"
, CompositingReasonLayerForClip); |
873 m_childContainmentLayer->setMasksToBounds(true); | 943 m_childContainmentLayer->setMasksToBounds(true); |
874 layersChanged = true; | 944 layersChanged = true; |
875 } | 945 } |
876 } else if (hasClippingLayer()) { | 946 } else if (hasClippingLayer()) { |
877 m_childContainmentLayer->removeFromParent(); | 947 m_childContainmentLayer->removeFromParent(); |
878 m_childContainmentLayer = nullptr; | 948 m_childContainmentLayer = nullptr; |
879 layersChanged = true; | 949 layersChanged = true; |
880 } | 950 } |
881 | 951 |
| 952 if (needsScrollClip) { |
| 953 if (!m_ancestorScrollClippingLayer) { |
| 954 m_ancestorScrollClippingLayer = createGraphicsLayer("Ancestor scroll
clipping Layer", CompositingReasonLayerForClip); |
| 955 m_ancestorScrollClippingLayer->setMasksToBounds(true); |
| 956 layersChanged = true; |
| 957 } |
| 958 } else if (m_ancestorScrollClippingLayer) { |
| 959 m_ancestorScrollClippingLayer->removeFromParent(); |
| 960 m_ancestorScrollClippingLayer = nullptr; |
| 961 layersChanged = true; |
| 962 } |
| 963 |
882 return layersChanged; | 964 return layersChanged; |
883 } | 965 } |
884 | 966 |
885 void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgr
oundLayerPaintsFixedRootBackground) | 967 void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgr
oundLayerPaintsFixedRootBackground) |
886 { | 968 { |
887 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB
ackground; | 969 m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootB
ackground; |
888 } | 970 } |
889 | 971 |
890 bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
barLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) | 972 bool RenderLayerBacking::updateOverflowControlsLayers(bool needsHorizontalScroll
barLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer) |
891 { | 973 { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 updateInternalHierarchy(); | 1184 updateInternalHierarchy(); |
1103 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); | 1185 m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); |
1104 m_graphicsLayer->setNeedsDisplay(); | 1186 m_graphicsLayer->setNeedsDisplay(); |
1105 if (renderer()->view()) | 1187 if (renderer()->view()) |
1106 compositor()->scrollingLayerDidChange(m_owningLayer); | 1188 compositor()->scrollingLayerDidChange(m_owningLayer); |
1107 } | 1189 } |
1108 | 1190 |
1109 return layerChanged; | 1191 return layerChanged; |
1110 } | 1192 } |
1111 | 1193 |
| 1194 void RenderLayerBacking::updateScrollParent() |
| 1195 { |
| 1196 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); |
| 1197 if (!scrollingCoordinator) |
| 1198 return; |
| 1199 |
| 1200 RenderLayer* scrollParent = 0; |
| 1201 if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrolling
Parent) |
| 1202 scrollParent = m_owningLayer->ancestorScrollingLayer(); |
| 1203 |
| 1204 scrollingCoordinator->updateScrollParentForLayer(m_owningLayer, scrollParent
); |
| 1205 } |
| 1206 |
| 1207 void RenderLayerBacking::updateClipParent() |
| 1208 { |
| 1209 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m
_owningLayer); |
| 1210 if (!scrollingCoordinator) |
| 1211 return; |
| 1212 |
| 1213 RenderLayer* clipParent = 0; |
| 1214 if (m_owningLayer->compositingReasons() & CompositingReasonOutOfFlowClipping
) { |
| 1215 if (RenderObject* containingBlock = m_owningLayer->renderer()->containin
gBlock()) |
| 1216 clipParent = containingBlock->enclosingLayer()->enclosingCompositing
Layer(true); |
| 1217 } |
| 1218 |
| 1219 scrollingCoordinator->updateClipParentForLayer(m_owningLayer, clipParent); |
| 1220 } |
| 1221 |
1112 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co
nst | 1222 GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() co
nst |
1113 { | 1223 { |
1114 unsigned phase = 0; | 1224 unsigned phase = 0; |
1115 if (!m_backgroundLayer) | 1225 if (!m_backgroundLayer) |
1116 phase |= GraphicsLayerPaintBackground; | 1226 phase |= GraphicsLayerPaintBackground; |
1117 if (!m_foregroundLayer) | 1227 if (!m_foregroundLayer) |
1118 phase |= GraphicsLayerPaintForeground; | 1228 phase |= GraphicsLayerPaintForeground; |
1119 if (!m_maskLayer) | 1229 if (!m_maskLayer) |
1120 phase |= GraphicsLayerPaintMask; | 1230 phase |= GraphicsLayerPaintMask; |
1121 | 1231 |
1122 if (m_scrollingContentsLayer) { | 1232 if (m_scrollingContentsLayer) { |
1123 phase &= ~GraphicsLayerPaintForeground; | 1233 phase &= ~GraphicsLayerPaintForeground; |
1124 phase |= GraphicsLayerPaintCompositedScroll; | 1234 phase |= GraphicsLayerPaintCompositedScroll; |
1125 } | 1235 } |
1126 | 1236 |
| 1237 if (m_owningLayer->compositingReasons() & CompositingReasonOverflowScrolling
Parent) |
| 1238 phase |= GraphicsLayerPaintCompositedScroll; |
| 1239 |
1127 return static_cast<GraphicsLayerPaintingPhase>(phase); | 1240 return static_cast<GraphicsLayerPaintingPhase>(phase); |
1128 } | 1241 } |
1129 | 1242 |
1130 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const | 1243 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const |
1131 { | 1244 { |
1132 float finalOpacity = rendererOpacity; | 1245 float finalOpacity = rendererOpacity; |
1133 | 1246 |
1134 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent(
)) { | 1247 for (RenderLayer* curr = m_owningLayer->parent(); curr; curr = curr->parent(
)) { |
1135 // We only care about parents that are stacking contexts. | 1248 // We only care about parents that are stacking contexts. |
1136 // Recall that opacity creates stacking context. | 1249 // Recall that opacity creates stacking context. |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 GraphicsLayer* RenderLayerBacking::parentForSublayers() const | 1567 GraphicsLayer* RenderLayerBacking::parentForSublayers() const |
1455 { | 1568 { |
1456 if (m_scrollingContentsLayer) | 1569 if (m_scrollingContentsLayer) |
1457 return m_scrollingContentsLayer.get(); | 1570 return m_scrollingContentsLayer.get(); |
1458 | 1571 |
1459 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL
ayer.get(); | 1572 return m_childContainmentLayer ? m_childContainmentLayer.get() : m_graphicsL
ayer.get(); |
1460 } | 1573 } |
1461 | 1574 |
1462 GraphicsLayer* RenderLayerBacking::childForSuperlayers() const | 1575 GraphicsLayer* RenderLayerBacking::childForSuperlayers() const |
1463 { | 1576 { |
| 1577 if (m_ancestorScrollClippingLayer) |
| 1578 return m_ancestorScrollClippingLayer.get(); |
| 1579 |
1464 if (m_ancestorClippingLayer) | 1580 if (m_ancestorClippingLayer) |
1465 return m_ancestorClippingLayer.get(); | 1581 return m_ancestorClippingLayer.get(); |
1466 | 1582 |
1467 return m_graphicsLayer.get(); | 1583 return m_graphicsLayer.get(); |
1468 } | 1584 } |
1469 | 1585 |
1470 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) | 1586 void RenderLayerBacking::setRequiresOwnBackingStore(bool requiresOwnBacking) |
1471 { | 1587 { |
1472 if (requiresOwnBacking == m_requiresOwnBackingStore) | 1588 if (requiresOwnBacking == m_requiresOwnBackingStore) |
1473 return; | 1589 return; |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 if (m_layerForVerticalScrollbar) | 2032 if (m_layerForVerticalScrollbar) |
1917 backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate
(); | 2033 backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate
(); |
1918 | 2034 |
1919 if (m_layerForScrollCorner) | 2035 if (m_layerForScrollCorner) |
1920 backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate(); | 2036 backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate(); |
1921 | 2037 |
1922 return backingMemory; | 2038 return backingMemory; |
1923 } | 2039 } |
1924 | 2040 |
1925 } // namespace WebCore | 2041 } // namespace WebCore |
OLD | NEW |