OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // No tests fail if it's deleted. | 132 // No tests fail if it's deleted. |
133 setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 133 setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
134 setCompositingModeEnabled(true); | 134 setCompositingModeEnabled(true); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 bool RenderLayerCompositor::rootShouldAlwaysComposite() const | 138 bool RenderLayerCompositor::rootShouldAlwaysComposite() const |
139 { | 139 { |
140 if (!m_hasAcceleratedCompositing) | 140 if (!m_hasAcceleratedCompositing) |
141 return false; | 141 return false; |
142 return m_renderView.frame()->isMainFrame() || m_compositingReasonFinder.requ
iresCompositingForScrollableFrame(); | 142 return m_renderView.frame()->isLocalRoot() || m_compositingReasonFinder.requ
iresCompositingForScrollableFrame(); |
143 } | 143 } |
144 | 144 |
145 void RenderLayerCompositor::updateAcceleratedCompositingSettings() | 145 void RenderLayerCompositor::updateAcceleratedCompositingSettings() |
146 { | 146 { |
147 m_compositingReasonFinder.updateTriggers(); | 147 m_compositingReasonFinder.updateTriggers(); |
148 m_hasAcceleratedCompositing = m_renderView.document().settings()->accelerate
dCompositingEnabled(); | 148 m_hasAcceleratedCompositing = m_renderView.document().settings()->accelerate
dCompositingEnabled(); |
149 m_rootShouldAlwaysCompositeDirty = true; | 149 m_rootShouldAlwaysCompositeDirty = true; |
150 } | 150 } |
151 | 151 |
152 bool RenderLayerCompositor::layerSquashingEnabled() const | 152 bool RenderLayerCompositor::layerSquashingEnabled() const |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 #endif | 246 #endif |
247 | 247 |
248 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() | 248 void RenderLayerCompositor::applyOverlayFullscreenVideoAdjustment() |
249 { | 249 { |
250 m_inOverlayFullscreenVideo = false; | 250 m_inOverlayFullscreenVideo = false; |
251 if (!m_rootContentLayer) | 251 if (!m_rootContentLayer) |
252 return; | 252 return; |
253 | 253 |
254 bool isMainFrame = m_renderView.frame()->isMainFrame(); | 254 bool isLocalRoot = m_renderView.frame()->isLocalRoot(); |
255 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.document()); | 255 RenderVideo* video = findFullscreenVideoRenderer(m_renderView.document()); |
256 if (!video || !video->layer()->hasCompositedLayerMapping()) { | 256 if (!video || !video->layer()->hasCompositedLayerMapping()) { |
257 if (isMainFrame) { | 257 if (isLocalRoot) { |
258 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer(); | 258 GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer(); |
259 if (backgroundLayer && !backgroundLayer->parent()) | 259 if (backgroundLayer && !backgroundLayer->parent()) |
260 rootFixedBackgroundsChanged(); | 260 rootFixedBackgroundsChanged(); |
261 } | 261 } |
262 return; | 262 return; |
263 } | 263 } |
264 | 264 |
265 GraphicsLayer* videoLayer = video->layer()->compositedLayerMapping()->mainGr
aphicsLayer(); | 265 GraphicsLayer* videoLayer = video->layer()->compositedLayerMapping()->mainGr
aphicsLayer(); |
266 | 266 |
267 // The fullscreen video has layer position equal to its enclosing frame's sc
roll position because fullscreen container is fixed-positioned. | 267 // The fullscreen video has layer position equal to its enclosing frame's sc
roll position because fullscreen container is fixed-positioned. |
268 // We should reset layer position here since we are going to reattach the la
yer at the very top level. | 268 // We should reset layer position here since we are going to reattach the la
yer at the very top level. |
269 videoLayer->setPosition(IntPoint()); | 269 videoLayer->setPosition(IntPoint()); |
270 | 270 |
271 // Only steal fullscreen video layer and clear all other layers if we are th
e main frame. | 271 // Only steal fullscreen video layer and clear all other layers if we are th
e main frame. |
272 if (!isMainFrame) | 272 if (!isLocalRoot) |
273 return; | 273 return; |
274 | 274 |
275 m_rootContentLayer->removeAllChildren(); | 275 m_rootContentLayer->removeAllChildren(); |
276 m_overflowControlsHostLayer->addChild(videoLayer); | 276 m_overflowControlsHostLayer->addChild(videoLayer); |
277 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) | 277 if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer()) |
278 backgroundLayer->removeFromParent(); | 278 backgroundLayer->removeFromParent(); |
279 m_inOverlayFullscreenVideo = true; | 279 m_inOverlayFullscreenVideo = true; |
280 } | 280 } |
281 | 281 |
282 void RenderLayerCompositor::updateIfNeeded() | 282 void RenderLayerCompositor::updateIfNeeded() |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // sorts of compositingState transitions. | 386 // sorts of compositingState transitions. |
387 layer->setLostGroupedMapping(false); | 387 layer->setLostGroupedMapping(false); |
388 layer->setGroupedMapping(0); | 388 layer->setGroupedMapping(0); |
389 | 389 |
390 // If we need to repaint, do so before allocating the compositedLayerMap
ping | 390 // If we need to repaint, do so before allocating the compositedLayerMap
ping |
391 repaintOnCompositingChange(layer); | 391 repaintOnCompositingChange(layer); |
392 layer->ensureCompositedLayerMapping(); | 392 layer->ensureCompositedLayerMapping(); |
393 compositedLayerMappingChanged = true; | 393 compositedLayerMappingChanged = true; |
394 | 394 |
395 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. | 395 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. |
396 if (layer->isRootLayer() && m_renderView.frame()->isMainFrame()) { | 396 if (layer->isRootLayer() && m_renderView.frame()->isLocalRoot()) { |
397 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 397 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
398 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); | 398 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); |
399 } | 399 } |
400 break; | 400 break; |
401 case RemoveOwnCompositedLayerMapping: | 401 case RemoveOwnCompositedLayerMapping: |
402 // PutInSquashingLayer means you might have to remove the composited layer m
apping first. | 402 // PutInSquashingLayer means you might have to remove the composited layer m
apping first. |
403 case PutInSquashingLayer: | 403 case PutInSquashingLayer: |
404 if (layer->hasCompositedLayerMapping()) { | 404 if (layer->hasCompositedLayerMapping()) { |
405 // If we're removing the compositedLayerMapping from a reflection, c
lear the source GraphicsLayer's pointer to | 405 // If we're removing the compositedLayerMapping from a reflection, c
lear the source GraphicsLayer's pointer to |
406 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection | 406 // its replica GraphicsLayer. In practice this should never happen b
ecause reflectee and reflection |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 { | 496 { |
497 FrameView* frameView = m_renderView.frameView(); | 497 FrameView* frameView = m_renderView.frameView(); |
498 IntPoint scrollPosition = frameView->scrollPosition(); | 498 IntPoint scrollPosition = frameView->scrollPosition(); |
499 | 499 |
500 if (!m_scrollLayer) | 500 if (!m_scrollLayer) |
501 return; | 501 return; |
502 | 502 |
503 bool scrollingCoordinatorHandlesOffset = false; | 503 bool scrollingCoordinatorHandlesOffset = false; |
504 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) { | 504 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) { |
505 if (Settings* settings = m_renderView.document().settings()) { | 505 if (Settings* settings = m_renderView.document().settings()) { |
506 if (m_renderView.frame()->isMainFrame() || settings->compositedScrol
lingForFramesEnabled()) | 506 if (m_renderView.frame()->isLocalRoot() || settings->compositedScrol
lingForFramesEnabled()) |
507 scrollingCoordinatorHandlesOffset = scrollingCoordinator->scroll
ableAreaScrollLayerDidChange(frameView); | 507 scrollingCoordinatorHandlesOffset = scrollingCoordinator->scroll
ableAreaScrollLayerDidChange(frameView); |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 // Scroll position = scroll minimum + scroll offset. Adjust the layer's | 511 // Scroll position = scroll minimum + scroll offset. Adjust the layer's |
512 // position to handle whatever the scroll coordinator isn't handling. | 512 // position to handle whatever the scroll coordinator isn't handling. |
513 // The minimum scroll position is non-zero for RTL pages with overflow. | 513 // The minimum scroll position is non-zero for RTL pages with overflow. |
514 if (scrollingCoordinatorHandlesOffset) | 514 if (scrollingCoordinatorHandlesOffset) |
515 m_scrollLayer->setPosition(-frameView->minimumScrollPosition()); | 515 m_scrollLayer->setPosition(-frameView->minimumScrollPosition()); |
516 else | 516 else |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 682 |
683 void RenderLayerCompositor::setIsInWindow(bool isInWindow) | 683 void RenderLayerCompositor::setIsInWindow(bool isInWindow) |
684 { | 684 { |
685 if (!staleInCompositingMode()) | 685 if (!staleInCompositingMode()) |
686 return; | 686 return; |
687 | 687 |
688 if (isInWindow) { | 688 if (isInWindow) { |
689 if (m_rootLayerAttachment != RootLayerUnattached) | 689 if (m_rootLayerAttachment != RootLayerUnattached) |
690 return; | 690 return; |
691 | 691 |
692 RootLayerAttachment attachment = m_renderView.frame()->isMainFrame() ? R
ootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; | 692 RootLayerAttachment attachment = m_renderView.frame()->isLocalRoot() ? R
ootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; |
693 attachRootLayer(attachment); | 693 attachRootLayer(attachment); |
694 } else { | 694 } else { |
695 if (m_rootLayerAttachment == RootLayerUnattached) | 695 if (m_rootLayerAttachment == RootLayerUnattached) |
696 return; | 696 return; |
697 | 697 |
698 detachRootLayer(); | 698 detachRootLayer(); |
699 } | 699 } |
700 } | 700 } |
701 | 701 |
702 void RenderLayerCompositor::updateRootLayerPosition() | 702 void RenderLayerCompositor::updateRootLayerPosition() |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 | 880 |
881 bool RenderLayerCompositor::requiresScrollCornerLayer() const | 881 bool RenderLayerCompositor::requiresScrollCornerLayer() const |
882 { | 882 { |
883 FrameView* view = m_renderView.frameView(); | 883 FrameView* view = m_renderView.frameView(); |
884 return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible(
); | 884 return shouldCompositeOverflowControls(view) && view->isScrollCornerVisible(
); |
885 } | 885 } |
886 | 886 |
887 void RenderLayerCompositor::updateOverflowControlsLayers() | 887 void RenderLayerCompositor::updateOverflowControlsLayers() |
888 { | 888 { |
889 #if USE(RUBBER_BANDING) | 889 #if USE(RUBBER_BANDING) |
890 if (m_renderView.frame()->isMainFrame()) { | 890 if (m_renderView.frame()->isLocalRoot()) { |
891 if (!m_layerForOverhangShadow) { | 891 if (!m_layerForOverhangShadow) { |
892 m_layerForOverhangShadow = GraphicsLayer::create(graphicsLayerFactor
y(), this); | 892 m_layerForOverhangShadow = GraphicsLayer::create(graphicsLayerFactor
y(), this); |
893 OverscrollTheme::theme()->setUpOverhangShadowLayer(m_layerForOverhan
gShadow.get()); | 893 OverscrollTheme::theme()->setUpOverhangShadowLayer(m_layerForOverhan
gShadow.get()); |
894 OverscrollTheme::theme()->updateOverhangShadowLayer(m_layerForOverha
ngShadow.get(), m_rootContentLayer.get()); | 894 OverscrollTheme::theme()->updateOverhangShadowLayer(m_layerForOverha
ngShadow.get(), m_rootContentLayer.get()); |
895 m_scrollLayer->addChild(m_layerForOverhangShadow.get()); | 895 m_scrollLayer->addChild(m_layerForOverhangShadow.get()); |
896 } | 896 } |
897 } else { | 897 } else { |
898 ASSERT(!m_layerForOverhangShadow); | 898 ASSERT(!m_layerForOverhangShadow); |
899 } | 899 } |
900 #endif | 900 #endif |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 } else if (m_layerForScrollCorner) { | 946 } else if (m_layerForScrollCorner) { |
947 m_layerForScrollCorner->removeFromParent(); | 947 m_layerForScrollCorner->removeFromParent(); |
948 m_layerForScrollCorner = nullptr; | 948 m_layerForScrollCorner = nullptr; |
949 } | 949 } |
950 | 950 |
951 m_renderView.frameView()->positionScrollbarLayers(); | 951 m_renderView.frameView()->positionScrollbarLayers(); |
952 } | 952 } |
953 | 953 |
954 void RenderLayerCompositor::ensureRootLayer() | 954 void RenderLayerCompositor::ensureRootLayer() |
955 { | 955 { |
956 RootLayerAttachment expectedAttachment = m_renderView.frame()->isMainFrame()
? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; | 956 RootLayerAttachment expectedAttachment = m_renderView.frame()->isLocalRoot()
? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame; |
957 if (expectedAttachment == m_rootLayerAttachment) | 957 if (expectedAttachment == m_rootLayerAttachment) |
958 return; | 958 return; |
959 | 959 |
960 if (!m_rootContentLayer) { | 960 if (!m_rootContentLayer) { |
961 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this)
; | 961 m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this)
; |
962 IntRect overflowRect = m_renderView.pixelSnappedLayoutOverflowRect(); | 962 IntRect overflowRect = m_renderView.pixelSnappedLayoutOverflowRect(); |
963 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); | 963 m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.
maxY())); |
964 m_rootContentLayer->setPosition(FloatPoint()); | 964 m_rootContentLayer->setPosition(FloatPoint()); |
965 m_rootContentLayer->setOwnerNodeId(InspectorNodeIds::idForNode(m_renderV
iew.generatingNode())); | 965 m_rootContentLayer->setOwnerNodeId(InspectorNodeIds::idForNode(m_renderV
iew.generatingNode())); |
966 | 966 |
967 // Need to clip to prevent transformed content showing outside this fram
e | 967 // Need to clip to prevent transformed content showing outside this fram
e |
968 m_rootContentLayer->setMasksToBounds(true); | 968 m_rootContentLayer->setMasksToBounds(true); |
969 } | 969 } |
970 | 970 |
971 if (!m_overflowControlsHostLayer) { | 971 if (!m_overflowControlsHostLayer) { |
972 ASSERT(!m_scrollLayer); | 972 ASSERT(!m_scrollLayer); |
973 ASSERT(!m_containerLayer); | 973 ASSERT(!m_containerLayer); |
974 | 974 |
975 // Create a layer to host the clipping layer and the overflow controls l
ayers. | 975 // Create a layer to host the clipping layer and the overflow controls l
ayers. |
976 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); | 976 m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory
(), this); |
977 | 977 |
978 // Create a clipping layer if this is an iframe or settings require to c
lip. | 978 // Create a clipping layer if this is an iframe or settings require to c
lip. |
979 m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 979 m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
980 bool containerMasksToBounds = !m_renderView.frame()->isMainFrame(); | 980 bool containerMasksToBounds = !m_renderView.frame()->isLocalRoot(); |
981 if (Settings* settings = m_renderView.document().settings()) { | 981 if (Settings* settings = m_renderView.document().settings()) { |
982 if (settings->mainFrameClipsContent()) | 982 if (settings->mainFrameClipsContent()) |
983 containerMasksToBounds = true; | 983 containerMasksToBounds = true; |
984 } | 984 } |
985 m_containerLayer->setMasksToBounds(containerMasksToBounds); | 985 m_containerLayer->setMasksToBounds(containerMasksToBounds); |
986 | 986 |
987 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); | 987 m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this); |
988 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 988 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
989 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); | 989 scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_sc
rollLayer.get(), true); |
990 | 990 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 } else if (graphicsLayer == m_scrollLayer.get()) { | 1167 } else if (graphicsLayer == m_scrollLayer.get()) { |
1168 name = "LocalFrame Scrolling Layer"; | 1168 name = "LocalFrame Scrolling Layer"; |
1169 } else { | 1169 } else { |
1170 ASSERT_NOT_REACHED(); | 1170 ASSERT_NOT_REACHED(); |
1171 } | 1171 } |
1172 | 1172 |
1173 return name; | 1173 return name; |
1174 } | 1174 } |
1175 | 1175 |
1176 } // namespace WebCore | 1176 } // namespace WebCore |
OLD | NEW |