| 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 17 matching lines...) Expand all Loading... |
| 28 #include "core/rendering/compositing/RenderLayerCompositor.h" | 28 #include "core/rendering/compositing/RenderLayerCompositor.h" |
| 29 | 29 |
| 30 #include "core/animation/DocumentAnimations.h" | 30 #include "core/animation/DocumentAnimations.h" |
| 31 #include "core/dom/Fullscreen.h" | 31 #include "core/dom/Fullscreen.h" |
| 32 #include "core/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
| 33 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
| 34 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
| 35 #include "core/html/HTMLIFrameElement.h" | 35 #include "core/html/HTMLIFrameElement.h" |
| 36 #include "core/inspector/InspectorInstrumentation.h" | 36 #include "core/inspector/InspectorInstrumentation.h" |
| 37 #include "core/inspector/InspectorNodeIds.h" | 37 #include "core/inspector/InspectorNodeIds.h" |
| 38 #include "core/loader/FrameLoaderClient.h" |
| 38 #include "core/page/Chrome.h" | 39 #include "core/page/Chrome.h" |
| 39 #include "core/page/ChromeClient.h" | 40 #include "core/page/ChromeClient.h" |
| 40 #include "core/page/Page.h" | 41 #include "core/page/Page.h" |
| 41 #include "core/page/scrolling/ScrollingCoordinator.h" | 42 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 42 #include "core/paint/FramePainter.h" | 43 #include "core/paint/FramePainter.h" |
| 43 #include "core/rendering/RenderEmbeddedObject.h" | 44 #include "core/rendering/RenderEmbeddedObject.h" |
| 44 #include "core/rendering/RenderLayerStackingNode.h" | 45 #include "core/rendering/RenderLayerStackingNode.h" |
| 45 #include "core/rendering/RenderLayerStackingNodeIterator.h" | 46 #include "core/rendering/RenderLayerStackingNodeIterator.h" |
| 46 #include "core/rendering/RenderPart.h" | 47 #include "core/rendering/RenderPart.h" |
| 47 #include "core/rendering/RenderVideo.h" | 48 #include "core/rendering/RenderVideo.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (child->isLocalFrame()) | 218 if (child->isLocalFrame()) |
| 218 toLocalFrame(child)->contentRenderer()->compositor()->assertNoUnreso
lvedDirtyBits(); | 219 toLocalFrame(child)->contentRenderer()->compositor()->assertNoUnreso
lvedDirtyBits(); |
| 219 } | 220 } |
| 220 #endif | 221 #endif |
| 221 } | 222 } |
| 222 | 223 |
| 223 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda
teType) | 224 void RenderLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType upda
teType) |
| 224 { | 225 { |
| 225 ASSERT(updateType != CompositingUpdateNone); | 226 ASSERT(updateType != CompositingUpdateNone); |
| 226 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); | 227 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); |
| 227 page()->animator().scheduleVisualUpdate(); | 228 page()->animator().scheduleVisualUpdate(m_renderView.frame()); |
| 228 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); | 229 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); |
| 229 } | 230 } |
| 230 | 231 |
| 231 void RenderLayerCompositor::didLayout() | 232 void RenderLayerCompositor::didLayout() |
| 232 { | 233 { |
| 233 // FIXME: Technically we only need to do this when the FrameView's | 234 // FIXME: Technically we only need to do this when the FrameView's |
| 234 // isScrollable method would return a different value. | 235 // isScrollable method would return a different value. |
| 235 m_rootShouldAlwaysCompositeDirty = true; | 236 m_rootShouldAlwaysCompositeDirty = true; |
| 236 enableCompositingModeIfNeeded(); | 237 enableCompositingModeIfNeeded(); |
| 237 | 238 |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 m_rootContentLayer = nullptr; | 1071 m_rootContentLayer = nullptr; |
| 1071 m_rootTransformLayer = nullptr; | 1072 m_rootTransformLayer = nullptr; |
| 1072 } | 1073 } |
| 1073 | 1074 |
| 1074 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) | 1075 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) |
| 1075 { | 1076 { |
| 1076 if (!m_rootContentLayer) | 1077 if (!m_rootContentLayer) |
| 1077 return; | 1078 return; |
| 1078 | 1079 |
| 1079 switch (attachment) { | 1080 switch (attachment) { |
| 1080 case RootLayerUnattached: | 1081 case RootLayerUnattached: |
| 1081 ASSERT_NOT_REACHED(); | 1082 ASSERT_NOT_REACHED(); |
| 1082 break; | 1083 break; |
| 1083 case RootLayerAttachedViaChromeClient: { | 1084 case RootLayerAttachedViaChromeClient: { |
| 1084 LocalFrame& frame = m_renderView.frameView()->frame(); | 1085 LocalFrame& frame = m_renderView.frameView()->frame(); |
| 1085 Page* page = frame.page(); | 1086 Page* page = frame.page(); |
| 1086 if (!page) | 1087 if (!page) |
| 1087 return; | 1088 return; |
| 1088 page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer())
; | 1089 page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer(), &fr
ame); |
| 1089 break; | 1090 break; |
| 1090 } | 1091 } |
| 1091 case RootLayerAttachedViaEnclosingFrame: { | 1092 case RootLayerAttachedViaEnclosingFrame: { |
| 1092 HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement(); | 1093 HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerEleme
nt(); |
| 1093 ASSERT(ownerElement); | 1094 ASSERT(ownerElement); |
| 1094 // The layer will get hooked up via CompositedLayerMapping::updateGr
aphicsLayerConfiguration() | 1095 // The layer will get hooked up via CompositedLayerMapping::updateGraphi
csLayerConfiguration() |
| 1095 // for the frame's renderer in the parent document. | 1096 // for the frame's renderer in the parent document. |
| 1096 ownerElement->setNeedsCompositingUpdate(); | 1097 ownerElement->setNeedsCompositingUpdate(); |
| 1097 break; | 1098 break; |
| 1098 } | 1099 } |
| 1099 } | 1100 } |
| 1100 | 1101 |
| 1101 m_rootLayerAttachment = attachment; | 1102 m_rootLayerAttachment = attachment; |
| 1102 } | 1103 } |
| 1103 | 1104 |
| 1104 void RenderLayerCompositor::detachRootLayer() | 1105 void RenderLayerCompositor::detachRootLayer() |
| 1105 { | 1106 { |
| 1106 if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) | 1107 if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) |
| 1107 return; | 1108 return; |
| 1108 | 1109 |
| 1109 switch (m_rootLayerAttachment) { | 1110 switch (m_rootLayerAttachment) { |
| 1110 case RootLayerAttachedViaEnclosingFrame: { | 1111 case RootLayerAttachedViaEnclosingFrame: { |
| 1111 // The layer will get unhooked up via CompositedLayerMapping::updateGrap
hicsLayerConfiguration() | 1112 // The layer will get unhooked up via CompositedLayerMapping::updateGrap
hicsLayerConfiguration() |
| 1112 // for the frame's renderer in the parent document. | 1113 // for the frame's renderer in the parent document. |
| 1113 if (m_overflowControlsHostLayer) | 1114 if (m_overflowControlsHostLayer) |
| 1114 m_overflowControlsHostLayer->removeFromParent(); | 1115 m_overflowControlsHostLayer->removeFromParent(); |
| 1115 else | 1116 else |
| 1116 m_rootContentLayer->removeFromParent(); | 1117 m_rootContentLayer->removeFromParent(); |
| 1117 | 1118 |
| 1118 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement()) | 1119 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement()) |
| 1119 ownerElement->setNeedsCompositingUpdate(); | 1120 ownerElement->setNeedsCompositingUpdate(); |
| 1120 break; | 1121 break; |
| 1121 } | 1122 } |
| 1122 case RootLayerAttachedViaChromeClient: { | 1123 case RootLayerAttachedViaChromeClient: { |
| 1123 LocalFrame& frame = m_renderView.frameView()->frame(); | 1124 LocalFrame& frame = m_renderView.frameView()->frame(); |
| 1124 Page* page = frame.page(); | 1125 Page* page = frame.page(); |
| 1125 if (!page) | 1126 if (!page) |
| 1126 return; | 1127 return; |
| 1127 page->chrome().client().attachRootGraphicsLayer(0); | 1128 page->chrome().client().attachRootGraphicsLayer(0, &frame); |
| 1129 break; |
| 1128 } | 1130 } |
| 1129 break; | |
| 1130 case RootLayerUnattached: | 1131 case RootLayerUnattached: |
| 1131 break; | 1132 break; |
| 1132 } | 1133 } |
| 1133 | 1134 |
| 1134 m_rootLayerAttachment = RootLayerUnattached; | 1135 m_rootLayerAttachment = RootLayerUnattached; |
| 1135 } | 1136 } |
| 1136 | 1137 |
| 1137 void RenderLayerCompositor::updateRootLayerAttachment() | 1138 void RenderLayerCompositor::updateRootLayerAttachment() |
| 1138 { | 1139 { |
| 1139 ensureRootLayer(); | 1140 ensureRootLayer(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 } else if (graphicsLayer == m_scrollLayer.get()) { | 1189 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 1189 name = "LocalFrame Scrolling Layer"; | 1190 name = "LocalFrame Scrolling Layer"; |
| 1190 } else { | 1191 } else { |
| 1191 ASSERT_NOT_REACHED(); | 1192 ASSERT_NOT_REACHED(); |
| 1192 } | 1193 } |
| 1193 | 1194 |
| 1194 return name; | 1195 return name; |
| 1195 } | 1196 } |
| 1196 | 1197 |
| 1197 } // namespace blink | 1198 } // namespace blink |
| OLD | NEW |