| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   217     return false; |   217     return false; | 
|   218 #endif |   218 #endif | 
|   219 } |   219 } | 
|   220  |   220  | 
|   221 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) |   221 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) | 
|   222     : m_renderView(renderView) |   222     : m_renderView(renderView) | 
|   223     , m_hasAcceleratedCompositing(true) |   223     , m_hasAcceleratedCompositing(true) | 
|   224     , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C
      hromeClient::AllTriggers)) |   224     , m_compositingTriggers(static_cast<ChromeClient::CompositingTriggerFlags>(C
      hromeClient::AllTriggers)) | 
|   225     , m_compositedLayerCount(0) |   225     , m_compositedLayerCount(0) | 
|   226     , m_showRepaintCounter(false) |   226     , m_showRepaintCounter(false) | 
|   227     , m_reevaluateCompositingAfterLayout(false) |   227     , m_needsToRecomputeCompositingRequirements(false) | 
 |   228     , m_needsToUpdateLayerTreeGeometry(false) | 
|   228     , m_compositing(false) |   229     , m_compositing(false) | 
|   229     , m_compositingLayersNeedRebuild(false) |   230     , m_compositingLayersNeedRebuild(false) | 
|   230     , m_forceCompositingMode(false) |   231     , m_forceCompositingMode(false) | 
|   231     , m_inPostLayoutUpdate(false) |   232     , m_inPostLayoutUpdate(false) | 
|   232     , m_needsUpdateCompositingRequirementsState(false) |   233     , m_needsUpdateCompositingRequirementsState(false) | 
|   233     , m_isTrackingRepaints(false) |   234     , m_isTrackingRepaints(false) | 
|   234     , m_rootLayerAttachment(RootLayerUnattached) |   235     , m_rootLayerAttachment(RootLayerUnattached) | 
|   235 #if !LOG_DISABLED |   236 #if !LOG_DISABLED | 
|   236     , m_rootLayerUpdateCount(0) |   237     , m_rootLayerUpdateCount(0) | 
|   237     , m_obligateCompositedLayerCount(0) |   238     , m_obligateCompositedLayerCount(0) | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   359         fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom
      (document); |   360         fullscreenElement = FullscreenElementStack::currentFullScreenElementFrom
      (document); | 
|   360     } |   361     } | 
|   361     if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement)) |   362     if (!fullscreenElement || !isHTMLVideoElement(fullscreenElement)) | 
|   362         return 0; |   363         return 0; | 
|   363     RenderObject* renderer = fullscreenElement->renderer(); |   364     RenderObject* renderer = fullscreenElement->renderer(); | 
|   364     if (!renderer) |   365     if (!renderer) | 
|   365         return 0; |   366         return 0; | 
|   366     return toRenderVideo(renderer); |   367     return toRenderVideo(renderer); | 
|   367 } |   368 } | 
|   368  |   369  | 
 |   370 void RenderLayerCompositor::finishCompositingUpdateForFrameTree(Frame* frame) | 
 |   371 { | 
 |   372     for (Frame* child = frame->tree()->firstChild(); child; child = child->tree(
      )->nextSibling()) | 
 |   373         finishCompositingUpdateForFrameTree(child); | 
 |   374  | 
 |   375     // Update compositing for current frame after all descendant frames are upda
      ted. | 
 |   376     if (frame && frame->contentRenderer()) { | 
 |   377         RenderLayerCompositor* frameCompositor = frame->contentRenderer()->compo
      sitor(); | 
 |   378         if (frameCompositor && !frameCompositor->isMainFrame()) | 
 |   379             frame->contentRenderer()->compositor()->updateCompositingLayers(Comp
      ositingUpdateFinishAllDeferredWork); | 
 |   380     } | 
 |   381 } | 
 |   382  | 
|   369 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
      Type, RenderLayer* updateRoot) |   383 void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update
      Type, RenderLayer* updateRoot) | 
|   370 { |   384 { | 
|   371     // Avoid updating the layers with old values. Compositing layers will be upd
      ated after the layout is finished. |   385     // Avoid updating the layers with old values. Compositing layers will be upd
      ated after the layout is finished. | 
|   372     if (m_renderView->needsLayout()) |   386     if (m_renderView->needsLayout()) | 
|   373         return; |   387         return; | 
|   374  |   388  | 
 |   389     if (updateType == CompositingUpdateFinishAllDeferredWork && isMainFrame() &&
       m_renderView->frameView()) | 
 |   390         finishCompositingUpdateForFrameTree(&m_renderView->frameView()->frame())
      ; | 
 |   391  | 
|   375     if (m_forceCompositingMode && !m_compositing) |   392     if (m_forceCompositingMode && !m_compositing) | 
|   376         enableCompositingMode(true); |   393         enableCompositingMode(true); | 
|   377  |   394  | 
|   378     if (!m_reevaluateCompositingAfterLayout && !m_compositing) |   395     if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 
|   379         return; |   396         return; | 
|   380  |   397  | 
|   381     AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()
      .animation()); |   398     AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()
      .animation()); | 
|   382  |   399  | 
|   383     TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); |   400     TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); | 
|   384  |   401  | 
|   385     bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout; |   402     bool needCompositingRequirementsUpdate = false; | 
 |   403     bool needHierarchyAndGeometryUpdate = false; | 
|   386     bool needGeometryUpdate = false; |   404     bool needGeometryUpdate = false; | 
|   387  |   405  | 
 |   406     // CompositingUpdateFinishAllDeferredWork is the only updateType that will a
      ctually do any work in this | 
 |   407     // function. All other updateTypes will simply mark that something needed up
      dating, and defer the actual | 
 |   408     // update. This way we only need to compute all compositing state once for e
      very frame drawn (if needed). | 
|   388     switch (updateType) { |   409     switch (updateType) { | 
|   389     case CompositingUpdateAfterStyleChange: |   410     case CompositingUpdateAfterStyleChange: | 
|   390     case CompositingUpdateAfterLayout: |   411     case CompositingUpdateAfterLayout: | 
|   391         checkForHierarchyUpdate = true; |   412         m_needsToRecomputeCompositingRequirements = true; | 
|   392         break; |   413         break; | 
|   393     case CompositingUpdateOnScroll: |   414     case CompositingUpdateOnScroll: | 
|   394         checkForHierarchyUpdate = true; // Overlap can change with scrolling, so
       need to check for hierarchy updates. |   415         m_needsToRecomputeCompositingRequirements = true; // Overlap can change 
      with scrolling, so need to check for hierarchy updates. | 
|   395         needGeometryUpdate = true; |   416         m_needsToUpdateLayerTreeGeometry = true; | 
|   396         break; |   417         break; | 
|   397     case CompositingUpdateOnCompositedScroll: |   418     case CompositingUpdateOnCompositedScroll: | 
|   398         needGeometryUpdate = true; |   419         m_needsToUpdateLayerTreeGeometry = true; | 
 |   420         break; | 
 |   421     case CompositingUpdateFinishAllDeferredWork: | 
 |   422         needCompositingRequirementsUpdate = m_needsToRecomputeCompositingRequire
      ments; | 
 |   423         needHierarchyAndGeometryUpdate = m_compositingLayersNeedRebuild; | 
 |   424         needGeometryUpdate = m_needsToUpdateLayerTreeGeometry; | 
|   399         break; |   425         break; | 
|   400     } |   426     } | 
|   401  |   427  | 
|   402     if (!checkForHierarchyUpdate && !needGeometryUpdate) |   428     if (!needCompositingRequirementsUpdate && !needHierarchyAndGeometryUpdate &&
       !needGeometryUpdate) | 
|   403         return; |   429         return; | 
|   404  |   430  | 
|   405     bool needHierarchyUpdate = m_compositingLayersNeedRebuild; |   431     ASSERT(updateType == CompositingUpdateFinishAllDeferredWork); | 
 |   432  | 
|   406     bool isFullUpdate = !updateRoot; |   433     bool isFullUpdate = !updateRoot; | 
|   407  |   434  | 
|   408     // Only clear the flag if we're updating the entire hierarchy. |   435     // Only clear the flags if we're updating the entire hierarchy. | 
|   409     m_compositingLayersNeedRebuild = false; |   436     m_compositingLayersNeedRebuild = false; | 
 |   437     m_needsToUpdateLayerTreeGeometry = false; | 
|   410     updateRoot = rootRenderLayer(); |   438     updateRoot = rootRenderLayer(); | 
|   411  |   439  | 
|   412     if (isFullUpdate && updateType == CompositingUpdateAfterLayout) |   440     if (isFullUpdate) | 
|   413         m_reevaluateCompositingAfterLayout = false; |   441         m_needsToRecomputeCompositingRequirements = false; | 
|   414  |   442  | 
|   415 #if !LOG_DISABLED |   443 #if !LOG_DISABLED | 
|   416     double startTime = 0; |   444     double startTime = 0; | 
|   417     if (compositingLogEnabled()) { |   445     if (compositingLogEnabled()) { | 
|   418         ++m_rootLayerUpdateCount; |   446         ++m_rootLayerUpdateCount; | 
|   419         startTime = currentTime(); |   447         startTime = currentTime(); | 
|   420     } |   448     } | 
|   421 #endif |   449 #endif | 
|   422  |   450  | 
|   423     if (checkForHierarchyUpdate) { |   451     if (needCompositingRequirementsUpdate) { | 
|   424         // Go through the layers in presentation order, so that we can compute w
      hich RenderLayers need compositing layers. |   452         // Go through the layers in presentation order, so that we can compute w
      hich RenderLayers need compositing layers. | 
|   425         // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
      ut the parenting logic would be more complex. |   453         // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
      ut the parenting logic would be more complex. | 
|   426         CompositingRecursionData recursionData(updateRoot, true); |   454         CompositingRecursionData recursionData(updateRoot, true); | 
|   427         bool layersChanged = false; |   455         bool layersChanged = false; | 
|   428         bool saw3DTransform = false; |   456         bool saw3DTransform = false; | 
|   429         { |   457         { | 
|   430             TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
      sitingRequirements"); |   458             TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
      sitingRequirements"); | 
|   431             OverlapMap overlapTestRequestMap; |   459             OverlapMap overlapTestRequestMap; | 
|   432  |   460  | 
|   433             // FIXME: Passing these unclippedDescendants down and keeping track |   461             // FIXME: Passing these unclippedDescendants down and keeping track | 
|   434             // of them dynamically, we are requiring a full tree walk. This |   462             // of them dynamically, we are requiring a full tree walk. This | 
|   435             // should be removed as soon as proper overlap testing based on |   463             // should be removed as soon as proper overlap testing based on | 
|   436             // scrolling and animation bounds is implemented (crbug.com/252472). |   464             // scrolling and animation bounds is implemented (crbug.com/252472). | 
|   437             Vector<RenderLayer*> unclippedDescendants; |   465             Vector<RenderLayer*> unclippedDescendants; | 
|   438             computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap
      , recursionData, layersChanged, saw3DTransform, unclippedDescendants); |   466             computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap
      , recursionData, layersChanged, saw3DTransform, unclippedDescendants); | 
|   439         } |   467         } | 
|   440         needHierarchyUpdate |= layersChanged; |   468         needHierarchyAndGeometryUpdate |= layersChanged; | 
|   441     } |   469     } | 
|   442  |   470  | 
|   443 #if !LOG_DISABLED |   471 #if !LOG_DISABLED | 
|   444     if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG
      eometryUpdate)) { |   472     if (compositingLogEnabled() && isFullUpdate && (needHierarchyAndGeometryUpda
      te || needGeometryUpdate)) { | 
|   445         m_obligateCompositedLayerCount = 0; |   473         m_obligateCompositedLayerCount = 0; | 
|   446         m_secondaryCompositedLayerCount = 0; |   474         m_secondaryCompositedLayerCount = 0; | 
|   447         m_obligatoryBackingStoreBytes = 0; |   475         m_obligatoryBackingStoreBytes = 0; | 
|   448         m_secondaryBackingStoreBytes = 0; |   476         m_secondaryBackingStoreBytes = 0; | 
|   449  |   477  | 
|   450         Frame& frame = m_renderView->frameView()->frame(); |   478         Frame& frame = m_renderView->frameView()->frame(); | 
|   451         LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF
      rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); |   479         LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF
      rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); | 
|   452     } |   480     } | 
|   453 #endif |   481 #endif | 
|   454  |   482  | 
|   455     if (needHierarchyUpdate) { |   483     if (needHierarchyAndGeometryUpdate) { | 
|   456         // Update the hierarchy of the compositing layers. |   484         // Update the hierarchy of the compositing layers. | 
|   457         Vector<GraphicsLayer*> childList; |   485         Vector<GraphicsLayer*> childList; | 
|   458         { |   486         { | 
|   459             TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
      sitingLayerTree"); |   487             TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
      sitingLayerTree"); | 
|   460             rebuildCompositingLayerTree(updateRoot, childList, 0); |   488             rebuildCompositingLayerTree(updateRoot, childList, 0); | 
|   461         } |   489         } | 
|   462  |   490  | 
|   463         // Host the document layer in the RenderView's root layer. |   491         // Host the document layer in the RenderView's root layer. | 
|   464         if (isFullUpdate) { |   492         if (isFullUpdate) { | 
|   465             if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai
      nFrame()) { |   493             if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && isMai
      nFrame()) { | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|   479             else |   507             else | 
|   480                 m_rootContentLayer->setChildren(childList); |   508                 m_rootContentLayer->setChildren(childList); | 
|   481         } |   509         } | 
|   482     } else if (needGeometryUpdate) { |   510     } else if (needGeometryUpdate) { | 
|   483         // We just need to do a geometry update. This is only used for position:
      fixed scrolling; |   511         // We just need to do a geometry update. This is only used for position:
      fixed scrolling; | 
|   484         // most of the time, geometry is updated via RenderLayer::styleChanged()
      . |   512         // most of the time, geometry is updated via RenderLayer::styleChanged()
      . | 
|   485         updateLayerTreeGeometry(updateRoot, 0); |   513         updateLayerTreeGeometry(updateRoot, 0); | 
|   486     } |   514     } | 
|   487  |   515  | 
|   488 #if !LOG_DISABLED |   516 #if !LOG_DISABLED | 
|   489     if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG
      eometryUpdate)) { |   517     if (compositingLogEnabled() && isFullUpdate && (needHierarchyAndGeometryUpda
      te || needGeometryUpdate)) { | 
|   490         double endTime = currentTime(); |   518         double endTime = currentTime(); | 
|   491         LOG(Compositing, "Total layers   primary   secondary   obligatory backin
      g (KB)   secondary backing(KB)   total backing (KB)  update time (ms)\n"); |   519         LOG(Compositing, "Total layers   primary   secondary   obligatory backin
      g (KB)   secondary backing(KB)   total backing (KB)  update time (ms)\n"); | 
|   492  |   520  | 
|   493         LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", |   521         LOG(Compositing, "%8d %11d %9d %20.2f %22.2f %22.2f %18.2f\n", | 
|   494             m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_
      obligateCompositedLayerCount, |   522             m_obligateCompositedLayerCount + m_secondaryCompositedLayerCount, m_
      obligateCompositedLayerCount, | 
|   495             m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102
      4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon
      daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); |   523             m_secondaryCompositedLayerCount, m_obligatoryBackingStoreBytes / 102
      4, m_secondaryBackingStoreBytes / 1024, (m_obligatoryBackingStoreBytes + m_secon
      daryBackingStoreBytes) / 1024, 1000.0 * (endTime - startTime)); | 
|   496     } |   524     } | 
|   497 #endif |   525 #endif | 
|   498     ASSERT(updateRoot || !m_compositingLayersNeedRebuild); |   526     ASSERT(updateRoot || !m_compositingLayersNeedRebuild); | 
|   499  |   527  | 
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1121  |  1149  | 
|  1122         if (!layer->parent()) |  1150         if (!layer->parent()) | 
|  1123             updateRootLayerPosition(); |  1151             updateRootLayerPosition(); | 
|  1124  |  1152  | 
|  1125 #if !LOG_DISABLED |  1153 #if !LOG_DISABLED | 
|  1126         logLayerInfo(layer, depth); |  1154         logLayerInfo(layer, depth); | 
|  1127 #else |  1155 #else | 
|  1128         UNUSED_PARAM(depth); |  1156         UNUSED_PARAM(depth); | 
|  1129 #endif |  1157 #endif | 
|  1130         if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers
      ()) |  1158         if (currentCompositedLayerMapping->hasUnpositionedOverflowControlsLayers
      ()) | 
|  1131             layer->positionNewlyCreatedOverflowControls(); |  1159             layer->positionOverflowControls(); | 
|  1132  |  1160  | 
|  1133         pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->
      size().width(); |  1161         pixelsWithoutPromotingAllTransitions += layer->size().height() * layer->
      size().width(); | 
|  1134     } else { |  1162     } else { | 
|  1135         if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit
      y) || |  1163         if ((layer->renderer()->style()->transitionForProperty(CSSPropertyOpacit
      y) || | 
|  1136              layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit
      Transform)) && |  1164              layer->renderer()->style()->transitionForProperty(CSSPropertyWebkit
      Transform)) && | 
|  1137             m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) |  1165             m_renderView->viewRect().intersects(layer->absoluteBoundingBox())) | 
|  1138             pixelsAddedByPromotingAllTransitions += layer->size().height() * lay
      er->size().width(); |  1166             pixelsAddedByPromotingAllTransitions += layer->size().height() * lay
      er->size().width(); | 
|  1139     } |  1167     } | 
|  1140  |  1168  | 
|  1141     // If this layer has a compositedLayerMapping, then that is where we place s
      ubsequent children GraphicsLayers. |  1169     // If this layer has a compositedLayerMapping, then that is where we place s
      ubsequent children GraphicsLayers. | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1317  |  1345  | 
|  1318 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) |  1346 bool RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer) | 
|  1319 { |  1347 { | 
|  1320     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
      )) |  1348     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
      )) | 
|  1321         return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s
      crollableArea()); |  1349         return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->s
      crollableArea()); | 
|  1322     return false; |  1350     return false; | 
|  1323 } |  1351 } | 
|  1324  |  1352  | 
|  1325 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) |  1353 String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags) | 
|  1326 { |  1354 { | 
|  1327     updateCompositingLayers(CompositingUpdateAfterLayout); |  1355     // Before dumping the layer tree, finish any pending compositing update. | 
 |  1356     updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | 
|  1328  |  1357  | 
|  1329     if (!m_rootContentLayer) |  1358     if (!m_rootContentLayer) | 
|  1330         return String(); |  1359         return String(); | 
|  1331  |  1360  | 
|  1332     // We skip dumping the scroll and clip layers to keep layerTreeAsText output |  1361     // We skip dumping the scroll and clip layers to keep layerTreeAsText output | 
|  1333     // similar between platforms (unless we explicitly request dumping from the |  1362     // similar between platforms (unless we explicitly request dumping from the | 
|  1334     // root. |  1363     // root. | 
|  1335     GraphicsLayer* rootLayer = m_rootContentLayer.get(); |  1364     GraphicsLayer* rootLayer = m_rootContentLayer.get(); | 
|  1336     if (flags & LayerTreeIncludesRootLayer) |  1365     if (flags & LayerTreeIncludesRootLayer) | 
|  1337         rootLayer = rootGraphicsLayer(); |  1366         rootLayer = rootGraphicsLayer(); | 
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1915  |  1944  | 
|  1916 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer)
       const |  1945 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderObject* renderer)
       const | 
|  1917 { |  1946 { | 
|  1918     if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) |  1947     if (!(m_compositingTriggers & ChromeClient::PluginTrigger)) | 
|  1919         return false; |  1948         return false; | 
|  1920  |  1949  | 
|  1921     bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
      erer)->allowsAcceleratedCompositing(); |  1950     bool composite = renderer->isEmbeddedObject() && toRenderEmbeddedObject(rend
      erer)->allowsAcceleratedCompositing(); | 
|  1922     if (!composite) |  1951     if (!composite) | 
|  1923         return false; |  1952         return false; | 
|  1924  |  1953  | 
|  1925     m_reevaluateCompositingAfterLayout = true; |  1954     // FIXME: this seems bogus. If we don't know the layout position/size of the
       plugin yet, would't that be handled elsewhere? | 
 |  1955     m_needsToRecomputeCompositingRequirements = true; | 
|  1926  |  1956  | 
|  1927     RenderWidget* pluginRenderer = toRenderWidget(renderer); |  1957     RenderWidget* pluginRenderer = toRenderWidget(renderer); | 
|  1928     // If we can't reliably know the size of the plugin yet, don't change compos
      iting state. |  1958     // If we can't reliably know the size of the plugin yet, don't change compos
      iting state. | 
|  1929     if (pluginRenderer->needsLayout()) |  1959     if (pluginRenderer->needsLayout()) | 
|  1930         return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited
      LayerMapping(); |  1960         return pluginRenderer->hasLayer() && pluginRenderer->layer()->composited
      LayerMapping(); | 
|  1931  |  1961  | 
|  1932     // Don't go into compositing mode if height or width are zero, or size is 1x
      1. |  1962     // Don't go into compositing mode if height or width are zero, or size is 1x
      1. | 
|  1933     IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); |  1963     IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect()); | 
|  1934     return contentBox.height() * contentBox.width() > 1; |  1964     return contentBox.height() * contentBox.width() > 1; | 
|  1935 } |  1965 } | 
|  1936  |  1966  | 
|  1937 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) 
      const |  1967 bool RenderLayerCompositor::requiresCompositingForFrame(RenderObject* renderer) 
      const | 
|  1938 { |  1968 { | 
|  1939     if (!renderer->isRenderPart()) |  1969     if (!renderer->isRenderPart()) | 
|  1940         return false; |  1970         return false; | 
|  1941  |  1971  | 
|  1942     RenderPart* frameRenderer = toRenderPart(renderer); |  1972     RenderPart* frameRenderer = toRenderPart(renderer); | 
|  1943  |  1973  | 
|  1944     if (!frameRenderer->requiresAcceleratedCompositing()) |  1974     if (!frameRenderer->requiresAcceleratedCompositing()) | 
|  1945         return false; |  1975         return false; | 
|  1946  |  1976  | 
|  1947     m_reevaluateCompositingAfterLayout = true; |  1977     // FIXME: this seems bogus. If we don't know the layout position/size of the
       frame yet, wouldn't that be handled elsehwere? | 
 |  1978     m_needsToRecomputeCompositingRequirements = true; | 
|  1948  |  1979  | 
|  1949     RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
      er); |  1980     RenderLayerCompositor* innerCompositor = frameContentsCompositor(frameRender
      er); | 
|  1950     if (!innerCompositor) |  1981     if (!innerCompositor) | 
|  1951         return false; |  1982         return false; | 
|  1952  |  1983  | 
|  1953     // If we can't reliably know the size of the iframe yet, don't change compos
      iting state. |  1984     // If we can't reliably know the size of the iframe yet, don't change compos
      iting state. | 
|  1954     if (renderer->needsLayout()) |  1985     if (renderer->needsLayout()) | 
|  1955         return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa
      yerMapping(); |  1986         return frameRenderer->hasLayer() && frameRenderer->layer()->compositedLa
      yerMapping(); | 
|  1956  |  1987  | 
|  1957     // Don't go into compositing mode if height or width are zero. |  1988     // Don't go into compositing mode if height or width are zero. | 
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2074         if (!settings->acceleratedCompositingForFixedPositionEnabled()) |  2105         if (!settings->acceleratedCompositingForFixedPositionEnabled()) | 
|  2075             return false; |  2106             return false; | 
|  2076     } |  2107     } | 
|  2077  |  2108  | 
|  2078     if (isSticky) |  2109     if (isSticky) | 
|  2079         return true; |  2110         return true; | 
|  2080  |  2111  | 
|  2081     RenderObject* container = renderer->container(); |  2112     RenderObject* container = renderer->container(); | 
|  2082     // If the renderer is not hooked up yet then we have to wait until it is. |  2113     // If the renderer is not hooked up yet then we have to wait until it is. | 
|  2083     if (!container) { |  2114     if (!container) { | 
|  2084         m_reevaluateCompositingAfterLayout = true; |  2115         m_needsToRecomputeCompositingRequirements = true; | 
|  2085         return false; |  2116         return false; | 
|  2086     } |  2117     } | 
|  2087  |  2118  | 
|  2088     // Don't promote fixed position elements that are descendants of a non-view 
      container, e.g. transformed elements. |  2119     // Don't promote fixed position elements that are descendants of a non-view 
      container, e.g. transformed elements. | 
|  2089     // They will stay fixed wrt the container rather than the enclosing frame. |  2120     // They will stay fixed wrt the container rather than the enclosing frame. | 
|  2090     if (container != m_renderView) { |  2121     if (container != m_renderView) { | 
|  2091         if (viewportConstrainedNotCompositedReason) |  2122         if (viewportConstrainedNotCompositedReason) | 
|  2092             *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
      ForNonViewContainer; |  2123             *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
      ForNonViewContainer; | 
|  2093         return false; |  2124         return false; | 
|  2094     } |  2125     } | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  2114     } |  2145     } | 
|  2115  |  2146  | 
|  2116     if (!hasScrollableAncestor) { |  2147     if (!hasScrollableAncestor) { | 
|  2117         if (viewportConstrainedNotCompositedReason) |  2148         if (viewportConstrainedNotCompositedReason) | 
|  2118             *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
      ForUnscrollableAncestors; |  2149             *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
      ForUnscrollableAncestors; | 
|  2119         return false; |  2150         return false; | 
|  2120     } |  2151     } | 
|  2121  |  2152  | 
|  2122     // Subsequent tests depend on layout. If we can't tell now, just keep things
       the way they are until layout is done. |  2153     // Subsequent tests depend on layout. If we can't tell now, just keep things
       the way they are until layout is done. | 
|  2123     if (!m_inPostLayoutUpdate) { |  2154     if (!m_inPostLayoutUpdate) { | 
|  2124         m_reevaluateCompositingAfterLayout = true; |  2155         m_needsToRecomputeCompositingRequirements = true; | 
|  2125         return layer->compositedLayerMapping(); |  2156         return layer->compositedLayerMapping(); | 
|  2126     } |  2157     } | 
|  2127  |  2158  | 
|  2128     bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
      ant(); |  2159     bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescend
      ant(); | 
|  2129     if (!paintsContent) { |  2160     if (!paintsContent) { | 
|  2130         if (viewportConstrainedNotCompositedReason) |  2161         if (viewportConstrainedNotCompositedReason) | 
|  2131             *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
      ForNoVisibleContent; |  2162             *viewportConstrainedNotCompositedReason = RenderLayer::NotComposited
      ForNoVisibleContent; | 
|  2132         return false; |  2163         return false; | 
|  2133     } |  2164     } | 
|  2134  |  2165  | 
|  2135     // Fixed position elements that are invisible in the current view don't get 
      their own layer. |  2166     // Fixed position elements that are invisible in the current view don't get 
      their own layer. | 
|  2136     if (FrameView* frameView = m_renderView->frameView()) { |  2167     if (FrameView* frameView = m_renderView->frameView()) { | 
|  2137         LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect
      (); |  2168         LayoutRect viewBounds = frameView->viewportConstrainedVisibleContentRect
      (); | 
|  2138         LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(), 
      0, RenderLayer::DefaultCalculateLayerBoundsFlags |  2169         LayoutRect layerBounds = layer->calculateLayerBounds(rootRenderLayer(), 
      0, RenderLayer::DefaultCalculateLayerBoundsFlags | 
|  2139             | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrain
      ForMask | RenderLayer::IncludeCompositedDescendants); |  2170             | RenderLayer::ExcludeHiddenDescendants | RenderLayer::DontConstrain
      ForMask | RenderLayer::IncludeCompositedDescendants); | 
|  2140         if (!viewBounds.intersects(enclosingIntRect(layerBounds))) { |  2171         if (!viewBounds.intersects(enclosingIntRect(layerBounds))) { | 
|  2141             if (viewportConstrainedNotCompositedReason) { |  2172             if (viewportConstrainedNotCompositedReason) { | 
|  2142                 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos
      itedForBoundsOutOfView; |  2173                 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompos
      itedForBoundsOutOfView; | 
|  2143                 m_reevaluateCompositingAfterLayout = true; |  2174                 m_needsToRecomputeCompositingRequirements = true; | 
|  2144             } |  2175             } | 
|  2145             return false; |  2176             return false; | 
|  2146         } |  2177         } | 
|  2147     } |  2178     } | 
|  2148  |  2179  | 
|  2149     return true; |  2180     return true; | 
|  2150 } |  2181 } | 
|  2151  |  2182  | 
|  2152 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const Render
      Layer* layer) const |  2183 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const Render
      Layer* layer) const | 
|  2153 { |  2184 { | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2260 } |  2291 } | 
|  2261  |  2292  | 
|  2262 void RenderLayerCompositor::resetTrackedRepaintRects() |  2293 void RenderLayerCompositor::resetTrackedRepaintRects() | 
|  2263 { |  2294 { | 
|  2264     if (GraphicsLayer* rootLayer = rootGraphicsLayer()) |  2295     if (GraphicsLayer* rootLayer = rootGraphicsLayer()) | 
|  2265         resetTrackedRepaintRectsRecursive(rootLayer); |  2296         resetTrackedRepaintRectsRecursive(rootLayer); | 
|  2266 } |  2297 } | 
|  2267  |  2298  | 
|  2268 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) |  2299 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints) | 
|  2269 { |  2300 { | 
 |  2301     updateCompositingLayers(CompositingUpdateFinishAllDeferredWork); | 
|  2270     m_isTrackingRepaints = tracksRepaints; |  2302     m_isTrackingRepaints = tracksRepaints; | 
|  2271 } |  2303 } | 
|  2272  |  2304  | 
|  2273 bool RenderLayerCompositor::isTrackingRepaints() const |  2305 bool RenderLayerCompositor::isTrackingRepaints() const | 
|  2274 { |  2306 { | 
|  2275     return m_isTrackingRepaints; |  2307     return m_isTrackingRepaints; | 
|  2276 } |  2308 } | 
|  2277  |  2309  | 
|  2278 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const |  2310 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const | 
|  2279 { |  2311 { | 
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2781     } else if (graphicsLayer == m_scrollLayer.get()) { |  2813     } else if (graphicsLayer == m_scrollLayer.get()) { | 
|  2782         name = "Frame Scrolling Layer"; |  2814         name = "Frame Scrolling Layer"; | 
|  2783     } else { |  2815     } else { | 
|  2784         ASSERT_NOT_REACHED(); |  2816         ASSERT_NOT_REACHED(); | 
|  2785     } |  2817     } | 
|  2786  |  2818  | 
|  2787     return name; |  2819     return name; | 
|  2788 } |  2820 } | 
|  2789  |  2821  | 
|  2790 } // namespace WebCore |  2822 } // namespace WebCore | 
| OLD | NEW |