| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. | 355 // Avoid updating the layers with old values. Compositing layers will be upd
ated after the layout is finished. |
| 356 if (m_renderView->needsLayout()) | 356 if (m_renderView->needsLayout()) |
| 357 return; | 357 return; |
| 358 | 358 |
| 359 if (m_forceCompositingMode && !m_compositing) | 359 if (m_forceCompositingMode && !m_compositing) |
| 360 enableCompositingMode(true); | 360 enableCompositingMode(true); |
| 361 | 361 |
| 362 if (!m_reevaluateCompositingAfterLayout && !m_compositing) | 362 if (!m_reevaluateCompositingAfterLayout && !m_compositing) |
| 363 return; | 363 return; |
| 364 | 364 |
| 365 AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()
->animation()); | 365 AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()
.animation()); |
| 366 | 366 |
| 367 TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); | 367 TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true); |
| 368 | 368 |
| 369 bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout; | 369 bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout; |
| 370 bool needGeometryUpdate = false; | 370 bool needGeometryUpdate = false; |
| 371 | 371 |
| 372 switch (updateType) { | 372 switch (updateType) { |
| 373 case CompositingUpdateAfterStyleChange: | 373 case CompositingUpdateAfterStyleChange: |
| 374 case CompositingUpdateAfterLayout: | 374 case CompositingUpdateAfterLayout: |
| 375 checkForHierarchyUpdate = true; | 375 checkForHierarchyUpdate = true; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 needHierarchyUpdate |= layersChanged; | 424 needHierarchyUpdate |= layersChanged; |
| 425 } | 425 } |
| 426 | 426 |
| 427 #if !LOG_DISABLED | 427 #if !LOG_DISABLED |
| 428 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG
eometryUpdate)) { | 428 if (compositingLogEnabled() && isFullUpdate && (needHierarchyUpdate || needG
eometryUpdate)) { |
| 429 m_obligateCompositedLayerCount = 0; | 429 m_obligateCompositedLayerCount = 0; |
| 430 m_secondaryCompositedLayerCount = 0; | 430 m_secondaryCompositedLayerCount = 0; |
| 431 m_obligatoryBackingStoreBytes = 0; | 431 m_obligatoryBackingStoreBytes = 0; |
| 432 m_secondaryBackingStoreBytes = 0; | 432 m_secondaryBackingStoreBytes = 0; |
| 433 | 433 |
| 434 Frame* frame = m_renderView->frameView()->frame(); | 434 Frame& frame = m_renderView->frameView()->frame(); |
| 435 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF
rame() ? "main frame" : frame->tree()->uniqueName().string().utf8().data()); | 435 LOG(Compositing, "\nUpdate %d of %s.\n", m_rootLayerUpdateCount, isMainF
rame() ? "main frame" : frame.tree()->uniqueName().string().utf8().data()); |
| 436 } | 436 } |
| 437 #endif | 437 #endif |
| 438 | 438 |
| 439 if (needHierarchyUpdate) { | 439 if (needHierarchyUpdate) { |
| 440 // Update the hierarchy of the compositing layers. | 440 // Update the hierarchy of the compositing layers. |
| 441 Vector<GraphicsLayer*> childList; | 441 Vector<GraphicsLayer*> childList; |
| 442 { | 442 { |
| 443 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); | 443 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::rebuildCompo
sitingLayerTree"); |
| 444 rebuildCompositingLayerTree(updateRoot, childList, 0); | 444 rebuildCompositingLayerTree(updateRoot, childList, 0); |
| 445 } | 445 } |
| (...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 return m_isTrackingRepaints; | 2230 return m_isTrackingRepaints; |
| 2231 } | 2231 } |
| 2232 | 2232 |
| 2233 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const | 2233 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const |
| 2234 { | 2234 { |
| 2235 // Nothing to do here yet. | 2235 // Nothing to do here yet. |
| 2236 } | 2236 } |
| 2237 | 2237 |
| 2238 static bool shouldCompositeOverflowControls(FrameView* view) | 2238 static bool shouldCompositeOverflowControls(FrameView* view) |
| 2239 { | 2239 { |
| 2240 if (Page* page = view->frame()->page()) { | 2240 if (Page* page = view->frame().page()) { |
| 2241 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) | 2241 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) |
| 2242 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) | 2242 if (scrollingCoordinator->coordinatesScrollingForFrameView(view)) |
| 2243 return true; | 2243 return true; |
| 2244 } | 2244 } |
| 2245 | 2245 |
| 2246 return true; | 2246 return true; |
| 2247 } | 2247 } |
| 2248 | 2248 |
| 2249 bool RenderLayerCompositor::requiresHorizontalScrollbarLayer() const | 2249 bool RenderLayerCompositor::requiresHorizontalScrollbarLayer() const |
| 2250 { | 2250 { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2457 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) | 2457 void RenderLayerCompositor::attachRootLayer(RootLayerAttachment attachment) |
| 2458 { | 2458 { |
| 2459 if (!m_rootContentLayer) | 2459 if (!m_rootContentLayer) |
| 2460 return; | 2460 return; |
| 2461 | 2461 |
| 2462 switch (attachment) { | 2462 switch (attachment) { |
| 2463 case RootLayerUnattached: | 2463 case RootLayerUnattached: |
| 2464 ASSERT_NOT_REACHED(); | 2464 ASSERT_NOT_REACHED(); |
| 2465 break; | 2465 break; |
| 2466 case RootLayerAttachedViaChromeClient: { | 2466 case RootLayerAttachedViaChromeClient: { |
| 2467 Frame* frame = m_renderView->frameView()->frame(); | 2467 Frame& frame = m_renderView->frameView()->frame(); |
| 2468 Page* page = frame ? frame->page() : 0; | 2468 Page* page = frame.page(); |
| 2469 if (!page) | 2469 if (!page) |
| 2470 return; | 2470 return; |
| 2471 page->chrome().client().attachRootGraphicsLayer(frame, rootGraphicsL
ayer()); | 2471 page->chrome().client().attachRootGraphicsLayer(&frame, rootGraphics
Layer()); |
| 2472 break; | 2472 break; |
| 2473 } | 2473 } |
| 2474 case RootLayerAttachedViaEnclosingFrame: { | 2474 case RootLayerAttachedViaEnclosingFrame: { |
| 2475 // The layer will get hooked up via RenderLayerBacking::updateGraphi
csLayerConfiguration() | 2475 // The layer will get hooked up via RenderLayerBacking::updateGraphi
csLayerConfiguration() |
| 2476 // for the frame's renderer in the parent document. | 2476 // for the frame's renderer in the parent document. |
| 2477 m_renderView->document().ownerElement()->scheduleLayerUpdate(); | 2477 m_renderView->document().ownerElement()->scheduleLayerUpdate(); |
| 2478 break; | 2478 break; |
| 2479 } | 2479 } |
| 2480 } | 2480 } |
| 2481 | 2481 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2494 if (m_overflowControlsHostLayer) | 2494 if (m_overflowControlsHostLayer) |
| 2495 m_overflowControlsHostLayer->removeFromParent(); | 2495 m_overflowControlsHostLayer->removeFromParent(); |
| 2496 else | 2496 else |
| 2497 m_rootContentLayer->removeFromParent(); | 2497 m_rootContentLayer->removeFromParent(); |
| 2498 | 2498 |
| 2499 if (HTMLFrameOwnerElement* ownerElement = m_renderView->document().owner
Element()) | 2499 if (HTMLFrameOwnerElement* ownerElement = m_renderView->document().owner
Element()) |
| 2500 ownerElement->scheduleLayerUpdate(); | 2500 ownerElement->scheduleLayerUpdate(); |
| 2501 break; | 2501 break; |
| 2502 } | 2502 } |
| 2503 case RootLayerAttachedViaChromeClient: { | 2503 case RootLayerAttachedViaChromeClient: { |
| 2504 Frame* frame = m_renderView->frameView()->frame(); | 2504 Frame& frame = m_renderView->frameView()->frame(); |
| 2505 Page* page = frame ? frame->page() : 0; | 2505 Page* page = frame.page(); |
| 2506 if (!page) | 2506 if (!page) |
| 2507 return; | 2507 return; |
| 2508 page->chrome().client().attachRootGraphicsLayer(frame, 0); | 2508 page->chrome().client().attachRootGraphicsLayer(&frame, 0); |
| 2509 } | 2509 } |
| 2510 break; | 2510 break; |
| 2511 case RootLayerUnattached: | 2511 case RootLayerUnattached: |
| 2512 break; | 2512 break; |
| 2513 } | 2513 } |
| 2514 | 2514 |
| 2515 m_rootLayerAttachment = RootLayerUnattached; | 2515 m_rootLayerAttachment = RootLayerUnattached; |
| 2516 } | 2516 } |
| 2517 | 2517 |
| 2518 void RenderLayerCompositor::updateRootLayerAttachment() | 2518 void RenderLayerCompositor::updateRootLayerAttachment() |
| 2519 { | 2519 { |
| 2520 ensureRootLayer(); | 2520 ensureRootLayer(); |
| 2521 } | 2521 } |
| 2522 | 2522 |
| 2523 bool RenderLayerCompositor::isMainFrame() const | 2523 bool RenderLayerCompositor::isMainFrame() const |
| 2524 { | 2524 { |
| 2525 return !m_renderView->document().ownerElement(); | 2525 return !m_renderView->document().ownerElement(); |
| 2526 } | 2526 } |
| 2527 | 2527 |
| 2528 // IFrames are special, because we hook compositing layers together across ifram
e boundaries | 2528 // IFrames are special, because we hook compositing layers together across ifram
e boundaries |
| 2529 // when both parent and iframe content are composited. So when this frame become
s composited, we have | 2529 // when both parent and iframe content are composited. So when this frame become
s composited, we have |
| 2530 // to use a synthetic style change to get the iframes into RenderLayers in order
to allow them to composite. | 2530 // to use a synthetic style change to get the iframes into RenderLayers in order
to allow them to composite. |
| 2531 void RenderLayerCompositor::notifyIFramesOfCompositingChange() | 2531 void RenderLayerCompositor::notifyIFramesOfCompositingChange() |
| 2532 { | 2532 { |
| 2533 Frame* frame = m_renderView->frameView() ? m_renderView->frameView()->frame(
) : 0; | 2533 if (!m_renderView->frameView()) |
| 2534 if (!frame) | |
| 2535 return; | 2534 return; |
| 2535 Frame& frame = m_renderView->frameView()->frame(); |
| 2536 | 2536 |
| 2537 for (Frame* child = frame->tree()->firstChild(); child; child = child->tree(
)->traverseNext(frame)) { | 2537 for (Frame* child = frame.tree()->firstChild(); child; child = child->tree()
->traverseNext(&frame)) { |
| 2538 if (child->document() && child->document()->ownerElement()) | 2538 if (child->document() && child->document()->ownerElement()) |
| 2539 child->document()->ownerElement()->scheduleLayerUpdate(); | 2539 child->document()->ownerElement()->scheduleLayerUpdate(); |
| 2540 } | 2540 } |
| 2541 | 2541 |
| 2542 // Compositing also affects the answer to RenderIFrame::requiresAcceleratedC
ompositing(), so | 2542 // Compositing also affects the answer to RenderIFrame::requiresAcceleratedC
ompositing(), so |
| 2543 // we need to schedule a style recalc in our parent document. | 2543 // we need to schedule a style recalc in our parent document. |
| 2544 if (HTMLFrameOwnerElement* ownerElement = m_renderView->document().ownerElem
ent()) | 2544 if (HTMLFrameOwnerElement* ownerElement = m_renderView->document().ownerElem
ent()) |
| 2545 ownerElement->scheduleLayerUpdate(); | 2545 ownerElement->scheduleLayerUpdate(); |
| 2546 } | 2546 } |
| 2547 | 2547 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2698 | 2698 |
| 2699 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const | 2699 GraphicsLayerFactory* RenderLayerCompositor::graphicsLayerFactory() const |
| 2700 { | 2700 { |
| 2701 if (Page* page = this->page()) | 2701 if (Page* page = this->page()) |
| 2702 return page->chrome().client().graphicsLayerFactory(); | 2702 return page->chrome().client().graphicsLayerFactory(); |
| 2703 return 0; | 2703 return 0; |
| 2704 } | 2704 } |
| 2705 | 2705 |
| 2706 Page* RenderLayerCompositor::page() const | 2706 Page* RenderLayerCompositor::page() const |
| 2707 { | 2707 { |
| 2708 if (Frame* frame = m_renderView->frameView()->frame()) | 2708 return m_renderView->frameView()->frame().page(); |
| 2709 return frame->page(); | |
| 2710 | |
| 2711 return 0; | |
| 2712 } | 2709 } |
| 2713 | 2710 |
| 2714 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) | 2711 String RenderLayerCompositor::debugName(const GraphicsLayer* graphicsLayer) |
| 2715 { | 2712 { |
| 2716 String name; | 2713 String name; |
| 2717 if (graphicsLayer == m_rootContentLayer.get()) { | 2714 if (graphicsLayer == m_rootContentLayer.get()) { |
| 2718 name = "Content Root Layer"; | 2715 name = "Content Root Layer"; |
| 2719 #if ENABLE(RUBBER_BANDING) | 2716 #if ENABLE(RUBBER_BANDING) |
| 2720 } else if (graphicsLayer == m_layerForOverhangAreas.get()) { | 2717 } else if (graphicsLayer == m_layerForOverhangAreas.get()) { |
| 2721 name = "Overhang Areas Layer"; | 2718 name = "Overhang Areas Layer"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2735 } else if (graphicsLayer == m_scrollLayer.get()) { | 2732 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2736 name = "Frame Scrolling Layer"; | 2733 name = "Frame Scrolling Layer"; |
| 2737 } else { | 2734 } else { |
| 2738 ASSERT_NOT_REACHED(); | 2735 ASSERT_NOT_REACHED(); |
| 2739 } | 2736 } |
| 2740 | 2737 |
| 2741 return name; | 2738 return name; |
| 2742 } | 2739 } |
| 2743 | 2740 |
| 2744 } // namespace WebCore | 2741 } // namespace WebCore |
| OLD | NEW |