| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (rootShouldAlwaysComposite()) { | 108 if (rootShouldAlwaysComposite()) { |
| 109 // FIXME: Is this needed? It was added in https://bugs.webkit.org/show_b
ug.cgi?id=26651. | 109 // FIXME: Is this needed? It was added in https://bugs.webkit.org/show_b
ug.cgi?id=26651. |
| 110 // No tests fail if it's deleted. | 110 // No tests fail if it's deleted. |
| 111 setNeedsCompositingUpdate(CompositingUpdateRebuildTree); | 111 setNeedsCompositingUpdate(CompositingUpdateRebuildTree); |
| 112 setCompositingModeEnabled(true); | 112 setCompositingModeEnabled(true); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool RenderLayerCompositor::rootShouldAlwaysComposite() const | 116 bool RenderLayerCompositor::rootShouldAlwaysComposite() const |
| 117 { | 117 { |
| 118 #if ENABLE(COMPOSITOR) | |
| 119 return true; | |
| 120 #else | |
| 121 return false; | 118 return false; |
| 122 #endif | |
| 123 } | 119 } |
| 124 | 120 |
| 125 void RenderLayerCompositor::updateAcceleratedCompositingSettings() | 121 void RenderLayerCompositor::updateAcceleratedCompositingSettings() |
| 126 { | 122 { |
| 127 m_compositingReasonFinder.updateTriggers(); | 123 m_compositingReasonFinder.updateTriggers(); |
| 128 m_rootShouldAlwaysCompositeDirty = true; | 124 m_rootShouldAlwaysCompositeDirty = true; |
| 129 } | 125 } |
| 130 | 126 |
| 131 bool RenderLayerCompositor::hasAcceleratedCompositing() const | 127 bool RenderLayerCompositor::hasAcceleratedCompositing() const |
| 132 { | 128 { |
| 133 #if ENABLE(COMPOSITOR) | |
| 134 return true; | |
| 135 #else | |
| 136 return false; | 129 return false; |
| 137 #endif | |
| 138 } | 130 } |
| 139 | 131 |
| 140 bool RenderLayerCompositor::layerSquashingEnabled() const | 132 bool RenderLayerCompositor::layerSquashingEnabled() const |
| 141 { | 133 { |
| 142 if (!RuntimeEnabledFeatures::layerSquashingEnabled()) | 134 if (!RuntimeEnabledFeatures::layerSquashingEnabled()) |
| 143 return false; | 135 return false; |
| 144 return true; | 136 return true; |
| 145 } | 137 } |
| 146 | 138 |
| 147 bool RenderLayerCompositor::preferCompositingToLCDTextEnabled() const | 139 bool RenderLayerCompositor::preferCompositingToLCDTextEnabled() const |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (updateType >= CompositingUpdateAfterCompositingInputChange) | 203 if (updateType >= CompositingUpdateAfterCompositingInputChange) |
| 212 CompositingInputsUpdater(rootRenderLayer()).update(); | 204 CompositingInputsUpdater(rootRenderLayer()).update(); |
| 213 | 205 |
| 214 #if ENABLE(ASSERT) | 206 #if ENABLE(ASSERT) |
| 215 CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(root
RenderLayer()); | 207 CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(root
RenderLayer()); |
| 216 #endif | 208 #endif |
| 217 } | 209 } |
| 218 | 210 |
| 219 void RenderLayerCompositor::updateIfNeeded() | 211 void RenderLayerCompositor::updateIfNeeded() |
| 220 { | 212 { |
| 221 CompositingUpdateType updateType = m_pendingUpdateType; | |
| 222 m_pendingUpdateType = CompositingUpdateNone; | 213 m_pendingUpdateType = CompositingUpdateNone; |
| 223 | |
| 224 if (!hasAcceleratedCompositing()) { | |
| 225 #if ENABLE(COMPOSITOR) | |
| 226 updateWithoutAcceleratedCompositing(updateType); | |
| 227 #endif | |
| 228 return; | |
| 229 } | |
| 230 | |
| 231 if (updateType == CompositingUpdateNone) | |
| 232 return; | |
| 233 | |
| 234 RenderLayer* updateRoot = rootRenderLayer(); | |
| 235 | |
| 236 Vector<RenderLayer*> layersNeedingPaintInvalidation; | |
| 237 | |
| 238 if (updateType >= CompositingUpdateAfterCompositingInputChange) { | |
| 239 CompositingInputsUpdater(updateRoot).update(); | |
| 240 | |
| 241 #if ENABLE(ASSERT) | |
| 242 // FIXME: Move this check to the end of the compositing update. | |
| 243 CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(
updateRoot); | |
| 244 #endif | |
| 245 | |
| 246 CompositingRequirementsUpdater(m_renderView, m_compositingReasonFinder).
update(updateRoot); | |
| 247 | |
| 248 CompositingLayerAssigner layerAssigner(this); | |
| 249 layerAssigner.assign(updateRoot, layersNeedingPaintInvalidation); | |
| 250 | |
| 251 bool layersChanged = layerAssigner.layersChanged(); | |
| 252 | |
| 253 { | |
| 254 TRACE_EVENT0("blink", "RenderLayerCompositor::updateAfterCompositing
Change"); | |
| 255 if (const FrameView::ScrollableAreaSet* scrollableAreas = m_renderVi
ew.frameView()->scrollableAreas()) { | |
| 256 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) | |
| 257 layersChanged |= (*it)->updateAfterCompositingChange(); | |
| 258 } | |
| 259 } | |
| 260 | |
| 261 if (layersChanged) | |
| 262 updateType = std::max(updateType, CompositingUpdateRebuildTree); | |
| 263 } | |
| 264 | |
| 265 if (updateType != CompositingUpdateNone) { | |
| 266 GraphicsLayerUpdater updater; | |
| 267 updater.update(*updateRoot, layersNeedingPaintInvalidation); | |
| 268 | |
| 269 if (updater.needsRebuildTree()) | |
| 270 updateType = std::max(updateType, CompositingUpdateRebuildTree); | |
| 271 | |
| 272 #if ENABLE(ASSERT) | |
| 273 // FIXME: Move this check to the end of the compositing update. | |
| 274 GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updat
eRoot); | |
| 275 #endif | |
| 276 } | |
| 277 | |
| 278 if (updateType >= CompositingUpdateRebuildTree) { | |
| 279 GraphicsLayerTreeBuilder::AncestorInfo ancestorInfo; | |
| 280 GraphicsLayerVector childList; | |
| 281 ancestorInfo.childLayersOfEnclosingCompositedLayer = &childList; | |
| 282 { | |
| 283 TRACE_EVENT0("blink", "GraphicsLayerTreeBuilder::rebuild"); | |
| 284 GraphicsLayerTreeBuilder().rebuild(*updateRoot, ancestorInfo); | |
| 285 } | |
| 286 | |
| 287 if (childList.isEmpty()) | |
| 288 destroyRootLayer(); | |
| 289 else | |
| 290 m_rootContentLayer->setChildren(childList); | |
| 291 } | |
| 292 | |
| 293 if (m_needsUpdateFixedBackground) { | |
| 294 rootFixedBackgroundsChanged(); | |
| 295 m_needsUpdateFixedBackground = false; | |
| 296 } | |
| 297 | |
| 298 for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++) { | |
| 299 RenderLayer* layer = layersNeedingPaintInvalidation[i]; | |
| 300 layer->paintInvalidator().computePaintInvalidationRectsIncludingNonCompo
sitingDescendants(); | |
| 301 | |
| 302 paintInvalidationOnCompositingChange(layer); | |
| 303 } | |
| 304 } | 214 } |
| 305 | 215 |
| 306 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l
ayer, const CompositingStateTransitionType compositedLayerUpdate) | 216 bool RenderLayerCompositor::allocateOrClearCompositedLayerMapping(RenderLayer* l
ayer, const CompositingStateTransitionType compositedLayerUpdate) |
| 307 { | 217 { |
| 308 bool compositedLayerMappingChanged = false; | 218 bool compositedLayerMappingChanged = false; |
| 309 | 219 |
| 310 // FIXME: It would be nice to directly use the layer's compositing reason, | 220 // FIXME: It would be nice to directly use the layer's compositing reason, |
| 311 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing | 221 // but allocateOrClearCompositedLayerMapping also gets called without having
updated compositing |
| 312 // requirements fully. | 222 // requirements fully. |
| 313 switch (compositedLayerUpdate) { | 223 switch (compositedLayerUpdate) { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } else if (graphicsLayer == m_scrollLayer.get()) { | 683 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 774 name = "LocalFrame Scrolling Layer"; | 684 name = "LocalFrame Scrolling Layer"; |
| 775 } else { | 685 } else { |
| 776 ASSERT_NOT_REACHED(); | 686 ASSERT_NOT_REACHED(); |
| 777 } | 687 } |
| 778 | 688 |
| 779 return name; | 689 return name; |
| 780 } | 690 } |
| 781 | 691 |
| 782 } // namespace blink | 692 } // namespace blink |
| OLD | NEW |