| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "wtf/TemporaryChange.h" | 69 #include "wtf/TemporaryChange.h" |
| 70 | 70 |
| 71 #ifndef NDEBUG | 71 #ifndef NDEBUG |
| 72 #include "core/rendering/RenderTreeAsText.h" | 72 #include "core/rendering/RenderTreeAsText.h" |
| 73 #endif | 73 #endif |
| 74 | 74 |
| 75 namespace WebCore { | 75 namespace WebCore { |
| 76 | 76 |
| 77 using namespace HTMLNames; | 77 using namespace HTMLNames; |
| 78 | 78 |
| 79 class DeprecatedDirtyCompositingDuringCompositingUpdate { |
| 80 WTF_MAKE_NONCOPYABLE(DeprecatedDirtyCompositingDuringCompositingUpdate); |
| 81 public: |
| 82 DeprecatedDirtyCompositingDuringCompositingUpdate(DocumentLifecycle& lifecyc
le) |
| 83 : m_lifecycle(lifecycle) |
| 84 , m_deprecatedTransition(lifecycle.state(), DocumentLifecycle::LayoutCle
an) |
| 85 , m_originalState(lifecycle.state()) |
| 86 { |
| 87 } |
| 88 |
| 89 ~DeprecatedDirtyCompositingDuringCompositingUpdate() |
| 90 { |
| 91 if (m_originalState != DocumentLifecycle::InCompositingUpdate) |
| 92 return; |
| 93 if (m_lifecycle.state() != m_originalState) { |
| 94 // FIXME: It's crazy that we can trigger a style recalc from inside |
| 95 // the compositing update, but that happens in compositing/visibilit
y/hidden-iframe.html. |
| 96 ASSERT(m_lifecycle.state() == DocumentLifecycle::LayoutClean || m_li
fecycle.state() == DocumentLifecycle::VisualUpdatePending); |
| 97 m_lifecycle.advanceTo(m_originalState); |
| 98 } |
| 99 } |
| 100 |
| 101 private: |
| 102 DocumentLifecycle& m_lifecycle; |
| 103 DocumentLifecycle::DeprecatedTransition m_deprecatedTransition; |
| 104 DocumentLifecycle::State m_originalState; |
| 105 }; |
| 106 |
| 79 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) | 107 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) |
| 80 : m_renderView(renderView) | 108 : m_renderView(renderView) |
| 81 , m_compositingReasonFinder(renderView) | 109 , m_compositingReasonFinder(renderView) |
| 82 , m_pendingUpdateType(CompositingUpdateNone) | 110 , m_pendingUpdateType(CompositingUpdateNone) |
| 83 , m_hasAcceleratedCompositing(true) | 111 , m_hasAcceleratedCompositing(true) |
| 84 , m_showRepaintCounter(false) | 112 , m_showRepaintCounter(false) |
| 85 , m_needsToRecomputeCompositingRequirements(false) | 113 , m_needsToRecomputeCompositingRequirements(false) |
| 86 , m_compositing(false) | 114 , m_compositing(false) |
| 87 , m_compositingLayersNeedRebuild(false) | 115 , m_compositingLayersNeedRebuild(false) |
| 88 , m_forceCompositingMode(false) | 116 , m_forceCompositingMode(false) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 bool RenderLayerCompositor::canRender3DTransforms() const | 201 bool RenderLayerCompositor::canRender3DTransforms() const |
| 174 { | 202 { |
| 175 return hasAcceleratedCompositing() && m_compositingReasonFinder.has3DTransfo
rmTrigger(); | 203 return hasAcceleratedCompositing() && m_compositingReasonFinder.has3DTransfo
rmTrigger(); |
| 176 } | 204 } |
| 177 | 205 |
| 178 void RenderLayerCompositor::setCompositingLayersNeedRebuild() | 206 void RenderLayerCompositor::setCompositingLayersNeedRebuild() |
| 179 { | 207 { |
| 180 // FIXME: crbug,com/332248 ideally this could be merged with setNeedsComposi
tingUpdate(). | 208 // FIXME: crbug,com/332248 ideally this could be merged with setNeedsComposi
tingUpdate(). |
| 181 if (inCompositingMode()) | 209 if (inCompositingMode()) |
| 182 m_compositingLayersNeedRebuild = true; | 210 m_compositingLayersNeedRebuild = true; |
| 211 if (!lifecycle().isActive()) |
| 212 return; |
| 183 page()->animator().scheduleVisualUpdate(); | 213 page()->animator().scheduleVisualUpdate(); |
| 214 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); |
| 184 } | 215 } |
| 185 | 216 |
| 186 void RenderLayerCompositor::updateCompositingRequirementsState() | 217 void RenderLayerCompositor::updateCompositingRequirementsState() |
| 187 { | 218 { |
| 188 if (!m_needsUpdateCompositingRequirementsState) | 219 if (!m_needsUpdateCompositingRequirementsState) |
| 189 return; | 220 return; |
| 190 | 221 |
| 191 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo
mpositingRequirementsState"); | 222 TRACE_EVENT0("blink_rendering,comp-scroll", "RenderLayerCompositor::updateCo
mpositingRequirementsState"); |
| 192 | 223 |
| 193 m_needsUpdateCompositingRequirementsState = false; | 224 m_needsUpdateCompositingRequirementsState = false; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 if (m_renderView.needsLayout()) | 288 if (m_renderView.needsLayout()) |
| 258 return; | 289 return; |
| 259 | 290 |
| 260 if (m_forceCompositingMode && !m_compositing) | 291 if (m_forceCompositingMode && !m_compositing) |
| 261 enableCompositingMode(true); | 292 enableCompositingMode(true); |
| 262 | 293 |
| 263 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 294 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
| 264 return; | 295 return; |
| 265 | 296 |
| 266 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); | 297 m_pendingUpdateType = std::max(m_pendingUpdateType, updateType); |
| 298 |
| 267 page()->animator().scheduleVisualUpdate(); | 299 page()->animator().scheduleVisualUpdate(); |
| 300 lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean); |
| 268 } | 301 } |
| 269 | 302 |
| 270 void RenderLayerCompositor::scheduleAnimationIfNeeded() | 303 void RenderLayerCompositor::scheduleAnimationIfNeeded() |
| 271 { | 304 { |
| 272 LocalFrame* localFrame = &m_renderView.frameView()->frame(); | 305 LocalFrame* localFrame = &m_renderView.frameView()->frame(); |
| 273 for (LocalFrame* currentFrame = localFrame; currentFrame; currentFrame = cur
rentFrame->tree().traverseNext(localFrame)) { | 306 for (LocalFrame* currentFrame = localFrame; currentFrame; currentFrame = cur
rentFrame->tree().traverseNext(localFrame)) { |
| 274 if (currentFrame->contentRenderer()) { | 307 if (currentFrame->contentRenderer()) { |
| 275 RenderLayerCompositor* childCompositor = currentFrame->contentRender
er()->compositor(); | 308 RenderLayerCompositor* childCompositor = currentFrame->contentRender
er()->compositor(); |
| 276 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { | 309 if (childCompositor && childCompositor->hasUnresolvedDirtyBits()) { |
| 277 m_renderView.frameView()->scheduleAnimation(); | 310 m_renderView.frameView()->scheduleAnimation(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 { | 459 { |
| 427 bool compositedLayerMappingChanged = false; | 460 bool compositedLayerMappingChanged = false; |
| 428 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer); | 461 bool nonCompositedReasonChanged = updateLayerIfViewportConstrained(layer); |
| 429 | 462 |
| 430 // FIXME: It would be nice to directly use the layer's compositing reason, | 463 // FIXME: It would be nice to directly use the layer's compositing reason, |
| 431 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing | 464 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing |
| 432 // requirements fully. | 465 // requirements fully. |
| 433 switch (compositedLayerUpdate) { | 466 switch (compositedLayerUpdate) { |
| 434 case AllocateOwnCompositedLayerMapping: | 467 case AllocateOwnCompositedLayerMapping: |
| 435 ASSERT(!layer->hasCompositedLayerMapping()); | 468 ASSERT(!layer->hasCompositedLayerMapping()); |
| 436 enableCompositingMode(); | 469 { |
| 470 DeprecatedDirtyCompositingDuringCompositingUpdate marker(lifecycle()
); |
| 471 enableCompositingMode(); |
| 472 } |
| 437 | 473 |
| 438 // If we need to repaint, do so before allocating the compositedLayerMap
ping | 474 // If we need to repaint, do so before allocating the compositedLayerMap
ping |
| 439 repaintOnCompositingChange(layer); | 475 repaintOnCompositingChange(layer); |
| 440 layer->ensureCompositedLayerMapping(); | 476 layer->ensureCompositedLayerMapping(); |
| 441 compositedLayerMappingChanged = true; | 477 compositedLayerMappingChanged = true; |
| 442 | 478 |
| 443 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. | 479 // At this time, the ScrollingCooridnator only supports the top-level fr
ame. |
| 444 if (layer->isRootLayer() && isMainFrame()) { | 480 if (layer->isRootLayer() && isMainFrame()) { |
| 445 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) | 481 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoor
dinator()) |
| 446 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); | 482 scrollingCoordinator->frameViewRootLayerDidChange(m_renderView.f
rameView()); |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 } else if (graphicsLayer == m_scrollLayer.get()) { | 1645 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 1610 name = "LocalFrame Scrolling Layer"; | 1646 name = "LocalFrame Scrolling Layer"; |
| 1611 } else { | 1647 } else { |
| 1612 ASSERT_NOT_REACHED(); | 1648 ASSERT_NOT_REACHED(); |
| 1613 } | 1649 } |
| 1614 | 1650 |
| 1615 return name; | 1651 return name; |
| 1616 } | 1652 } |
| 1617 | 1653 |
| 1618 } // namespace WebCore | 1654 } // namespace WebCore |
| OLD | NEW |