| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 void FrameView::updateWidgetPositionsIfNeeded() | 2476 void FrameView::updateWidgetPositionsIfNeeded() |
| 2477 { | 2477 { |
| 2478 if (!m_needsUpdateWidgetPositions) | 2478 if (!m_needsUpdateWidgetPositions) |
| 2479 return; | 2479 return; |
| 2480 | 2480 |
| 2481 m_needsUpdateWidgetPositions = false; | 2481 m_needsUpdateWidgetPositions = false; |
| 2482 | 2482 |
| 2483 updateWidgetPositions(); | 2483 updateWidgetPositions(); |
| 2484 } | 2484 } |
| 2485 | 2485 |
| 2486 void FrameView::updateLayoutAndStyleForPainting() | 2486 void FrameView::updateAllLifecyclePhases() |
| 2487 { | 2487 { |
| 2488 frame().localFrameRoot()->view()->updateLayoutAndStyleForPaintingInternal(); | 2488 frame().localFrameRoot()->view()->updateAllLifecyclePhasesInternal(); |
| 2489 } | 2489 } |
| 2490 | 2490 |
| 2491 void FrameView::updateLayoutAndStyleForPaintingInternal() | 2491 // TODO(chrishtr): add a scrolling update lifecycle phase, after compositing and
before invalidation. |
| 2492 void FrameView::updateLifecycleToCompositingCleanPlusScrolling() |
| 2493 { |
| 2494 frame().localFrameRoot()->view()->updateStyleAndLayoutIfNeededRecursive(); |
| 2495 LayoutView* view = layoutView(); |
| 2496 if (view) |
| 2497 view->compositor()->updateIfNeededRecursive(); |
| 2498 scrollContentsIfNeededRecursive(); |
| 2499 |
| 2500 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); |
| 2501 } |
| 2502 |
| 2503 void FrameView::updateAllLifecyclePhasesInternal() |
| 2492 { | 2504 { |
| 2493 // This must be called from the root frame, since it recurses down, not up.
Otherwise the lifecycles of the frames might be out of sync. | 2505 // This must be called from the root frame, since it recurses down, not up.
Otherwise the lifecycles of the frames might be out of sync. |
| 2494 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); | 2506 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF
rame())); |
| 2495 | 2507 |
| 2496 // Updating layout can run script, which can tear down the FrameView. | 2508 // Updating layout can run script, which can tear down the FrameView. |
| 2497 RefPtrWillBeRawPtr<FrameView> protector(this); | 2509 RefPtrWillBeRawPtr<FrameView> protector(this); |
| 2498 | 2510 |
| 2499 updateLayoutAndStyleIfNeededRecursive(); | 2511 updateStyleAndLayoutIfNeededRecursive(); |
| 2500 | 2512 |
| 2501 LayoutView* view = layoutView(); | 2513 LayoutView* view = layoutView(); |
| 2502 if (view) { | 2514 if (view) { |
| 2503 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); | 2515 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp
dateLayerTreeEvent::data(m_frame.get())); |
| 2504 | 2516 |
| 2505 view->compositor()->updateIfNeededRecursive(); | 2517 view->compositor()->updateIfNeededRecursive(); |
| 2506 | |
| 2507 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | |
| 2508 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); | |
| 2509 | |
| 2510 updateCompositedSelectionIfNeeded(); | |
| 2511 | |
| 2512 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) | |
| 2513 updateFrameTimingRequestsIfNeeded(); | |
| 2514 | |
| 2515 scrollContentsIfNeededRecursive(); | 2518 scrollContentsIfNeededRecursive(); |
| 2516 | |
| 2517 invalidateTreeIfNeededRecursive(); | 2519 invalidateTreeIfNeededRecursive(); |
| 2520 updatePostLifecycleData(); |
| 2518 | 2521 |
| 2519 ASSERT(!view->hasPendingSelection()); | 2522 ASSERT(!view->hasPendingSelection()); |
| 2520 } | 2523 } |
| 2521 | 2524 |
| 2522 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2525 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
| 2523 } | 2526 } |
| 2524 | 2527 |
| 2528 void FrameView::updatePostLifecycleData() |
| 2529 { |
| 2530 LayoutView* view = layoutView(); |
| 2531 ASSERT(view); |
| 2532 |
| 2533 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
| 2534 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); |
| 2535 |
| 2536 updateCompositedSelectionIfNeeded(); |
| 2537 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) |
| 2538 updateFrameTimingRequestsIfNeeded(); |
| 2539 } |
| 2540 |
| 2525 void FrameView::updateFrameTimingRequestsIfNeeded() | 2541 void FrameView::updateFrameTimingRequestsIfNeeded() |
| 2526 { | 2542 { |
| 2527 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; | 2543 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; |
| 2528 // TODO(mpb) use a 'dirty' bit to not call this every time. | 2544 // TODO(mpb) use a 'dirty' bit to not call this every time. |
| 2529 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); | 2545 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); |
| 2530 | 2546 |
| 2531 for (const auto& iter : graphicsLayerTimingRequests) { | 2547 for (const auto& iter : graphicsLayerTimingRequests) { |
| 2532 const GraphicsLayer* graphicsLayer = iter.key; | 2548 const GraphicsLayer* graphicsLayer = iter.key; |
| 2533 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value); | 2549 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value); |
| 2534 } | 2550 } |
| 2535 } | 2551 } |
| 2536 | 2552 |
| 2537 void FrameView::updateLayoutAndStyleIfNeededRecursive() | 2553 void FrameView::updateStyleAndLayoutIfNeededRecursive() |
| 2538 { | 2554 { |
| 2539 // We have to crawl our entire subtree looking for any FrameViews that need | 2555 // We have to crawl our entire subtree looking for any FrameViews that need |
| 2540 // layout and make sure they are up to date. | 2556 // layout and make sure they are up to date. |
| 2541 // Mac actually tests for intersection with the dirty region and tries not t
o | 2557 // Mac actually tests for intersection with the dirty region and tries not t
o |
| 2542 // update layout for frames that are outside the dirty region. Not only doe
s this seem | 2558 // update layout for frames that are outside the dirty region. Not only doe
s this seem |
| 2543 // pointless (since those frames will have set a zero timer to layout anyway
), but | 2559 // pointless (since those frames will have set a zero timer to layout anyway
), but |
| 2544 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty | 2560 // it is also incorrect, since if two frames overlap, the first could be exc
luded from the dirty |
| 2545 // region but then become included later by the second frame adding rects to
the dirty region | 2561 // region but then become included later by the second frame adding rects to
the dirty region |
| 2546 // when it lays out. | 2562 // when it lays out. |
| 2547 | 2563 |
| 2548 m_frame->document()->updateLayoutTreeIfNeeded(); | 2564 m_frame->document()->updateLayoutTreeIfNeeded(); |
| 2549 | 2565 |
| 2550 if (needsLayout()) | 2566 if (needsLayout()) |
| 2551 layout(); | 2567 layout(); |
| 2552 | 2568 |
| 2553 // FIXME: Calling layout() shouldn't trigger script execution or have any | 2569 // FIXME: Calling layout() shouldn't trigger script execution or have any |
| 2554 // observable effects on the frame tree but we're not quite there yet. | 2570 // observable effects on the frame tree but we're not quite there yet. |
| 2555 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews; | 2571 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews; |
| 2556 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 2572 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
| 2557 if (!child->isLocalFrame()) | 2573 if (!child->isLocalFrame()) |
| 2558 continue; | 2574 continue; |
| 2559 if (FrameView* view = toLocalFrame(child)->view()) | 2575 if (FrameView* view = toLocalFrame(child)->view()) |
| 2560 frameViews.append(view); | 2576 frameViews.append(view); |
| 2561 } | 2577 } |
| 2562 | 2578 |
| 2563 for (const auto& frameView : frameViews) | 2579 for (const auto& frameView : frameViews) |
| 2564 frameView->updateLayoutAndStyleIfNeededRecursive(); | 2580 frameView->updateStyleAndLayoutIfNeededRecursive(); |
| 2565 | 2581 |
| 2566 // When an <iframe> gets composited, it triggers an extra style recalc in it
s containing FrameView. | 2582 // When an <iframe> gets composited, it triggers an extra style recalc in it
s containing FrameView. |
| 2567 // To avoid pushing an invalid tree for display, we have to check for this c
ase and do another | 2583 // To avoid pushing an invalid tree for display, we have to check for this c
ase and do another |
| 2568 // style recalc. The extra style recalc needs to happen after our child <ifr
ames> were updated. | 2584 // style recalc. The extra style recalc needs to happen after our child <ifr
ames> were updated. |
| 2569 // FIXME: We shouldn't be triggering an extra style recalc in the first plac
e. | 2585 // FIXME: We shouldn't be triggering an extra style recalc in the first plac
e. |
| 2570 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2586 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
| 2571 m_frame->document()->updateLayoutTreeIfNeeded(); | 2587 m_frame->document()->updateLayoutTreeIfNeeded(); |
| 2572 | 2588 |
| 2573 if (needsLayout()) | 2589 if (needsLayout()) |
| 2574 layout(); | 2590 layout(); |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3971 | 3987 |
| 3972 if (!graphicsLayer) | 3988 if (!graphicsLayer) |
| 3973 return; | 3989 return; |
| 3974 | 3990 |
| 3975 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); | 3991 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL
ayoutObject(), paintInvalidationContainer, viewRect); |
| 3976 | 3992 |
| 3977 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); | 3993 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web
Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing
IntRect(viewRect))); |
| 3978 } | 3994 } |
| 3979 | 3995 |
| 3980 } // namespace blink | 3996 } // namespace blink |
| OLD | NEW |