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 "CSSPropertyNames.h" | 30 #include "CSSPropertyNames.h" |
31 #include "HTMLNames.h" | 31 #include "HTMLNames.h" |
32 #include "RuntimeEnabledFeatures.h" | 32 #include "RuntimeEnabledFeatures.h" |
33 #include "core/animation/ActiveAnimations.h" | 33 #include "core/animation/ActiveAnimations.h" |
34 #include "core/animation/DocumentAnimations.h" | 34 #include "core/animation/DocumentAnimations.h" |
35 #include "core/dom/FullscreenElementStack.h" | 35 #include "core/dom/FullscreenElementStack.h" |
36 #include "core/dom/NodeList.h" | 36 #include "core/dom/NodeList.h" |
37 #include "core/dom/ScriptForbiddenScope.h" | 37 #include "core/dom/ScriptForbiddenScope.h" |
38 #include "core/frame/DeprecatedScheduleStyleRecalcDuringCompositingUpdate.h" | |
39 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
40 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
41 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
42 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
43 #include "core/html/HTMLIFrameElement.h" | 42 #include "core/html/HTMLIFrameElement.h" |
44 #include "core/html/HTMLMediaElement.h" | 43 #include "core/html/HTMLMediaElement.h" |
45 #include "core/html/canvas/CanvasRenderingContext.h" | 44 #include "core/html/canvas/CanvasRenderingContext.h" |
46 #include "core/inspector/InspectorInstrumentation.h" | 45 #include "core/inspector/InspectorInstrumentation.h" |
47 #include "core/inspector/InspectorNodeIds.h" | 46 #include "core/inspector/InspectorNodeIds.h" |
48 #include "core/page/Chrome.h" | 47 #include "core/page/Chrome.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerEleme
nt()) { | 151 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerEleme
nt()) { |
153 if (RenderPart* renderer = ownerElement->renderPart()) | 152 if (RenderPart* renderer = ownerElement->renderPart()) |
154 renderer->layer()->updateSelfPaintingLayer(); | 153 renderer->layer()->updateSelfPaintingLayer(); |
155 } | 154 } |
156 | 155 |
157 if (m_compositing) | 156 if (m_compositing) |
158 ensureRootLayer(); | 157 ensureRootLayer(); |
159 else | 158 else |
160 destroyRootLayer(); | 159 destroyRootLayer(); |
161 | 160 |
162 notifyIFramesOfCompositingChange(); | 161 // Compositing also affects the answer to RenderIFrame::requiresAcceleratedC
ompositing(), so |
| 162 // we need to schedule a style recalc in our parent document. |
| 163 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerEleme
nt()) |
| 164 ownerElement->setNeedsCompositingUpdate(); |
163 } | 165 } |
164 | 166 |
165 void RenderLayerCompositor::enableCompositingModeIfNeeded() | 167 void RenderLayerCompositor::enableCompositingModeIfNeeded() |
166 { | 168 { |
167 if (!m_rootShouldAlwaysCompositeDirty) | 169 if (!m_rootShouldAlwaysCompositeDirty) |
168 return; | 170 return; |
169 | 171 |
170 m_rootShouldAlwaysCompositeDirty = false; | 172 m_rootShouldAlwaysCompositeDirty = false; |
171 if (m_compositing) | 173 if (m_compositing) |
172 return; | 174 return; |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 LocalFrame& frame = m_renderView.frameView()->frame(); | 1263 LocalFrame& frame = m_renderView.frameView()->frame(); |
1262 Page* page = frame.page(); | 1264 Page* page = frame.page(); |
1263 if (!page) | 1265 if (!page) |
1264 return; | 1266 return; |
1265 page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer())
; | 1267 page->chrome().client().attachRootGraphicsLayer(rootGraphicsLayer())
; |
1266 break; | 1268 break; |
1267 } | 1269 } |
1268 case RootLayerAttachedViaEnclosingFrame: { | 1270 case RootLayerAttachedViaEnclosingFrame: { |
1269 HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement(); | 1271 HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement(); |
1270 ASSERT(ownerElement); | 1272 ASSERT(ownerElement); |
1271 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); | |
1272 // The layer will get hooked up via CompositedLayerMapping::updateGr
aphicsLayerConfiguration() | 1273 // The layer will get hooked up via CompositedLayerMapping::updateGr
aphicsLayerConfiguration() |
1273 // for the frame's renderer in the parent document. | 1274 // for the frame's renderer in the parent document. |
1274 ownerElement->scheduleLayerUpdate(); | 1275 ownerElement->setNeedsCompositingUpdate(); |
1275 break; | 1276 break; |
1276 } | 1277 } |
1277 } | 1278 } |
1278 | 1279 |
1279 m_rootLayerAttachment = attachment; | 1280 m_rootLayerAttachment = attachment; |
1280 } | 1281 } |
1281 | 1282 |
1282 void RenderLayerCompositor::detachRootLayer() | 1283 void RenderLayerCompositor::detachRootLayer() |
1283 { | 1284 { |
1284 if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) | 1285 if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached) |
1285 return; | 1286 return; |
1286 | 1287 |
1287 switch (m_rootLayerAttachment) { | 1288 switch (m_rootLayerAttachment) { |
1288 case RootLayerAttachedViaEnclosingFrame: { | 1289 case RootLayerAttachedViaEnclosingFrame: { |
1289 // The layer will get unhooked up via CompositedLayerMapping::updateGrap
hicsLayerConfiguration() | 1290 // The layer will get unhooked up via CompositedLayerMapping::updateGrap
hicsLayerConfiguration() |
1290 // for the frame's renderer in the parent document. | 1291 // for the frame's renderer in the parent document. |
1291 if (m_overflowControlsHostLayer) | 1292 if (m_overflowControlsHostLayer) |
1292 m_overflowControlsHostLayer->removeFromParent(); | 1293 m_overflowControlsHostLayer->removeFromParent(); |
1293 else | 1294 else |
1294 m_rootContentLayer->removeFromParent(); | 1295 m_rootContentLayer->removeFromParent(); |
1295 | 1296 |
1296 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement()) { | 1297 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerE
lement()) |
1297 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); | 1298 ownerElement->setNeedsCompositingUpdate(); |
1298 ownerElement->scheduleLayerUpdate(); | |
1299 } | |
1300 break; | 1299 break; |
1301 } | 1300 } |
1302 case RootLayerAttachedViaChromeClient: { | 1301 case RootLayerAttachedViaChromeClient: { |
1303 LocalFrame& frame = m_renderView.frameView()->frame(); | 1302 LocalFrame& frame = m_renderView.frameView()->frame(); |
1304 Page* page = frame.page(); | 1303 Page* page = frame.page(); |
1305 if (!page) | 1304 if (!page) |
1306 return; | 1305 return; |
1307 page->chrome().client().attachRootGraphicsLayer(0); | 1306 page->chrome().client().attachRootGraphicsLayer(0); |
1308 } | 1307 } |
1309 break; | 1308 break; |
1310 case RootLayerUnattached: | 1309 case RootLayerUnattached: |
1311 break; | 1310 break; |
1312 } | 1311 } |
1313 | 1312 |
1314 m_rootLayerAttachment = RootLayerUnattached; | 1313 m_rootLayerAttachment = RootLayerUnattached; |
1315 } | 1314 } |
1316 | 1315 |
1317 void RenderLayerCompositor::updateRootLayerAttachment() | 1316 void RenderLayerCompositor::updateRootLayerAttachment() |
1318 { | 1317 { |
1319 ensureRootLayer(); | 1318 ensureRootLayer(); |
1320 } | 1319 } |
1321 | 1320 |
1322 // IFrames are special, because we hook compositing layers together across ifram
e boundaries | |
1323 // when both parent and iframe content are composited. So when this frame become
s composited, we have | |
1324 // to use a synthetic style change to get the iframes into RenderLayers in order
to allow them to composite. | |
1325 void RenderLayerCompositor::notifyIFramesOfCompositingChange() | |
1326 { | |
1327 if (!m_renderView.frameView()) | |
1328 return; | |
1329 LocalFrame& frame = m_renderView.frameView()->frame(); | |
1330 | |
1331 for (LocalFrame* child = frame.tree().firstChild(); child; child = child->tr
ee().traverseNext(&frame)) { | |
1332 if (!child->document()) | |
1333 continue; // FIXME: Can this happen? | |
1334 if (HTMLFrameOwnerElement* ownerElement = child->document()->ownerElemen
t()) { | |
1335 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerEle
ment->document().lifecycle()); | |
1336 ownerElement->scheduleLayerUpdate(); | |
1337 } | |
1338 } | |
1339 | |
1340 // Compositing also affects the answer to RenderIFrame::requiresAcceleratedC
ompositing(), so | |
1341 // we need to schedule a style recalc in our parent document. | |
1342 if (HTMLFrameOwnerElement* ownerElement = m_renderView.document().ownerEleme
nt()) { | |
1343 ownerElement->document().renderView()->compositor()->setNeedsCompositing
Update(CompositingUpdateAfterCompositingInputChange); | |
1344 DeprecatedScheduleStyleRecalcDuringCompositingUpdate marker(ownerElement
->document().lifecycle()); | |
1345 ownerElement->scheduleLayerUpdate(); | |
1346 } | |
1347 } | |
1348 | |
1349 ScrollingCoordinator* RenderLayerCompositor::scrollingCoordinator() const | 1321 ScrollingCoordinator* RenderLayerCompositor::scrollingCoordinator() const |
1350 { | 1322 { |
1351 if (Page* page = this->page()) | 1323 if (Page* page = this->page()) |
1352 return page->scrollingCoordinator(); | 1324 return page->scrollingCoordinator(); |
1353 | 1325 |
1354 return 0; | 1326 return 0; |
1355 } | 1327 } |
1356 | 1328 |
1357 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const | 1329 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const |
1358 { | 1330 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 } else if (graphicsLayer == m_scrollLayer.get()) { | 1367 } else if (graphicsLayer == m_scrollLayer.get()) { |
1396 name = "LocalFrame Scrolling Layer"; | 1368 name = "LocalFrame Scrolling Layer"; |
1397 } else { | 1369 } else { |
1398 ASSERT_NOT_REACHED(); | 1370 ASSERT_NOT_REACHED(); |
1399 } | 1371 } |
1400 | 1372 |
1401 return name; | 1373 return name; |
1402 } | 1374 } |
1403 | 1375 |
1404 } // namespace WebCore | 1376 } // namespace WebCore |
OLD | NEW |