Chromium Code Reviews| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 , m_hasAcceleratedCompositing(true) | 111 , m_hasAcceleratedCompositing(true) |
| 112 , m_showRepaintCounter(false) | 112 , m_showRepaintCounter(false) |
| 113 , m_needsToRecomputeCompositingRequirements(false) | 113 , m_needsToRecomputeCompositingRequirements(false) |
| 114 , m_compositing(false) | 114 , m_compositing(false) |
| 115 , m_compositingLayersNeedRebuild(false) | 115 , m_compositingLayersNeedRebuild(false) |
| 116 , m_forceCompositingMode(false) | 116 , m_forceCompositingMode(false) |
| 117 , m_needsUpdateCompositingRequirementsState(false) | 117 , m_needsUpdateCompositingRequirementsState(false) |
| 118 , m_isTrackingRepaints(false) | 118 , m_isTrackingRepaints(false) |
| 119 , m_rootLayerAttachment(RootLayerUnattached) | 119 , m_rootLayerAttachment(RootLayerUnattached) |
| 120 { | 120 { |
| 121 updateAcceleratedCompositingSettings(); | |
| 121 } | 122 } |
| 122 | 123 |
| 123 RenderLayerCompositor::~RenderLayerCompositor() | 124 RenderLayerCompositor::~RenderLayerCompositor() |
| 124 { | 125 { |
| 125 ASSERT(m_rootLayerAttachment == RootLayerUnattached); | 126 ASSERT(m_rootLayerAttachment == RootLayerUnattached); |
| 126 } | 127 } |
| 127 | 128 |
| 128 void RenderLayerCompositor::enableCompositingMode(bool enable) | 129 void RenderLayerCompositor::enableCompositingMode(bool enable) |
| 129 { | 130 { |
| 130 if (enable == m_compositing) | 131 if (enable == m_compositing) |
| 131 return; | 132 return; |
| 132 | 133 |
| 133 m_compositing = enable; | 134 m_compositing = enable; |
| 134 | 135 |
| 135 if (m_compositing) | 136 if (m_compositing) |
| 136 ensureRootLayer(); | 137 ensureRootLayer(); |
| 137 else | 138 else |
| 138 destroyRootLayer(); | 139 destroyRootLayer(); |
| 139 | 140 |
| 140 notifyIFramesOfCompositingChange(); | 141 notifyIFramesOfCompositingChange(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 void RenderLayerCompositor::cacheAcceleratedCompositingFlags() | 144 void RenderLayerCompositor::updateForceCompositingMode() |
| 145 { | |
| 146 // FIXME: Can settings really be null here? | |
|
esprehn
2014/04/11 02:49:19
I don't think so, if you have a RenderView you sho
ojan
2014/04/11 03:08:48
Yup. That's what I was thinking, but I wanted to f
| |
| 147 if (Settings* settings = m_renderView.document().settings()) { | |
| 148 bool forceCompositingMode = settings->forceCompositingMode() && m_hasAcc eleratedCompositing; | |
| 149 if (forceCompositingMode && !isMainFrame()) | |
| 150 forceCompositingMode = m_compositingReasonFinder.requiresCompositing ForScrollableFrame(); | |
| 151 if (forceCompositingMode != m_forceCompositingMode) { | |
| 152 setCompositingLayersNeedRebuild(); | |
| 153 m_forceCompositingMode = forceCompositingMode; | |
| 154 } | |
| 155 } | |
| 156 } | |
| 157 | |
| 158 void RenderLayerCompositor::updateAcceleratedCompositingSettings() | |
| 144 { | 159 { |
| 145 bool hasAcceleratedCompositing = false; | 160 bool hasAcceleratedCompositing = false; |
| 146 bool showRepaintCounter = false; | 161 bool showRepaintCounter = false; |
| 147 bool forceCompositingMode = false; | |
| 148 | 162 |
| 163 // FIXME: Can settings really be null here? | |
| 149 if (Settings* settings = m_renderView.document().settings()) { | 164 if (Settings* settings = m_renderView.document().settings()) { |
| 150 hasAcceleratedCompositing = settings->acceleratedCompositingEnabled(); | 165 hasAcceleratedCompositing = settings->acceleratedCompositingEnabled(); |
| 151 | 166 |
| 152 // We allow the chrome to override the settings, in case the page is ren dered | 167 // We allow the chrome to override the settings, in case the page is ren dered |
| 153 // on a chrome that doesn't allow accelerated compositing. | 168 // on a chrome that doesn't allow accelerated compositing. |
| 154 if (hasAcceleratedCompositing) { | 169 if (hasAcceleratedCompositing) { |
| 155 if (page()) { | 170 if (page()) { |
| 156 m_compositingReasonFinder.updateTriggers(); | 171 m_compositingReasonFinder.updateTriggers(); |
| 157 hasAcceleratedCompositing = m_compositingReasonFinder.hasTrigger s(); | 172 hasAcceleratedCompositing = m_compositingReasonFinder.hasTrigger s(); |
| 158 } | 173 } |
| 159 } | 174 } |
| 160 | 175 |
| 161 showRepaintCounter = settings->showRepaintCounter(); | 176 showRepaintCounter = settings->showRepaintCounter(); |
| 162 forceCompositingMode = settings->forceCompositingMode() && hasAccelerate dCompositing; | |
| 163 | |
| 164 if (forceCompositingMode && !isMainFrame()) | |
| 165 forceCompositingMode = m_compositingReasonFinder.requiresCompositing ForScrollableFrame(); | |
| 166 } | 177 } |
| 167 | 178 |
| 168 if (hasAcceleratedCompositing != m_hasAcceleratedCompositing || showRepaintC ounter != m_showRepaintCounter || forceCompositingMode != m_forceCompositingMode ) | 179 if (hasAcceleratedCompositing != m_hasAcceleratedCompositing || showRepaintC ounter != m_showRepaintCounter) |
| 169 setCompositingLayersNeedRebuild(); | 180 setCompositingLayersNeedRebuild(); |
| 170 | 181 |
| 171 m_hasAcceleratedCompositing = hasAcceleratedCompositing; | 182 m_hasAcceleratedCompositing = hasAcceleratedCompositing; |
| 172 m_showRepaintCounter = showRepaintCounter; | 183 m_showRepaintCounter = showRepaintCounter; |
| 173 m_forceCompositingMode = forceCompositingMode; | 184 |
| 185 updateForceCompositingMode(); | |
| 174 } | 186 } |
| 175 | 187 |
| 176 bool RenderLayerCompositor::layerSquashingEnabled() const | 188 bool RenderLayerCompositor::layerSquashingEnabled() const |
| 177 { | 189 { |
| 178 if (RuntimeEnabledFeatures::bleedingEdgeFastPathsEnabled()) | 190 if (RuntimeEnabledFeatures::bleedingEdgeFastPathsEnabled()) |
| 179 return true; | 191 return true; |
| 180 if (Settings* settings = m_renderView.document().settings()) | 192 if (Settings* settings = m_renderView.document().settings()) |
| 181 return settings->layerSquashingEnabled(); | 193 return settings->layerSquashingEnabled(); |
| 182 | 194 |
| 183 return false; | 195 return false; |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1647 } else if (graphicsLayer == m_scrollLayer.get()) { | 1659 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 1648 name = "LocalFrame Scrolling Layer"; | 1660 name = "LocalFrame Scrolling Layer"; |
| 1649 } else { | 1661 } else { |
| 1650 ASSERT_NOT_REACHED(); | 1662 ASSERT_NOT_REACHED(); |
| 1651 } | 1663 } |
| 1652 | 1664 |
| 1653 return name; | 1665 return name; |
| 1654 } | 1666 } |
| 1655 | 1667 |
| 1656 } // namespace WebCore | 1668 } // namespace WebCore |
| OLD | NEW |