Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 1225583004: Revert of Add a FrameView lifecycle method that just updates layout, style and compositing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::updateAllLifecyclePhases() 2486 void FrameView::updateLayoutAndStyleForPainting()
2487 { 2487 {
2488 frame().localFrameRoot()->view()->updateAllLifecyclePhasesInternal(); 2488 frame().localFrameRoot()->view()->updateLayoutAndStyleForPaintingInternal();
2489 } 2489 }
2490 2490
2491 // TODO(chrishtr): add a scrolling update lifecycle phase, after compositing and before invalidation. 2491 void FrameView::updateLayoutAndStyleForPaintingInternal()
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()
2504 { 2492 {
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. 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.
2506 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); 2494 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2507 2495
2508 // Updating layout can run script, which can tear down the FrameView. 2496 // Updating layout can run script, which can tear down the FrameView.
2509 RefPtrWillBeRawPtr<FrameView> protector(this); 2497 RefPtrWillBeRawPtr<FrameView> protector(this);
2510 2498
2511 updateStyleAndLayoutIfNeededRecursive(); 2499 updateLayoutAndStyleIfNeededRecursive();
2512 2500
2513 LayoutView* view = layoutView(); 2501 LayoutView* view = layoutView();
2514 if (view) { 2502 if (view) {
2515 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp dateLayerTreeEvent::data(m_frame.get())); 2503 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp dateLayerTreeEvent::data(m_frame.get()));
2516 2504
2517 view->compositor()->updateIfNeededRecursive(); 2505 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
2518 scrollContentsIfNeededRecursive(); 2515 scrollContentsIfNeededRecursive();
2516
2519 invalidateTreeIfNeededRecursive(); 2517 invalidateTreeIfNeededRecursive();
2520 updatePostLifecycleData();
2521 2518
2522 ASSERT(!view->hasPendingSelection()); 2519 ASSERT(!view->hasPendingSelection());
2523 } 2520 }
2524 2521
2525 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 2522 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
2526 } 2523 }
2527 2524
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
2541 void FrameView::updateFrameTimingRequestsIfNeeded() 2525 void FrameView::updateFrameTimingRequestsIfNeeded()
2542 { 2526 {
2543 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; 2527 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests;
2544 // TODO(mpb) use a 'dirty' bit to not call this every time. 2528 // TODO(mpb) use a 'dirty' bit to not call this every time.
2545 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); 2529 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests);
2546 2530
2547 for (const auto& iter : graphicsLayerTimingRequests) { 2531 for (const auto& iter : graphicsLayerTimingRequests) {
2548 const GraphicsLayer* graphicsLayer = iter.key; 2532 const GraphicsLayer* graphicsLayer = iter.key;
2549 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value); 2533 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value);
2550 } 2534 }
2551 } 2535 }
2552 2536
2553 void FrameView::updateStyleAndLayoutIfNeededRecursive() 2537 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2554 { 2538 {
2555 // We have to crawl our entire subtree looking for any FrameViews that need 2539 // We have to crawl our entire subtree looking for any FrameViews that need
2556 // layout and make sure they are up to date. 2540 // layout and make sure they are up to date.
2557 // Mac actually tests for intersection with the dirty region and tries not t o 2541 // Mac actually tests for intersection with the dirty region and tries not t o
2558 // update layout for frames that are outside the dirty region. Not only doe s this seem 2542 // update layout for frames that are outside the dirty region. Not only doe s this seem
2559 // pointless (since those frames will have set a zero timer to layout anyway ), but 2543 // pointless (since those frames will have set a zero timer to layout anyway ), but
2560 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty 2544 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty
2561 // region but then become included later by the second frame adding rects to the dirty region 2545 // region but then become included later by the second frame adding rects to the dirty region
2562 // when it lays out. 2546 // when it lays out.
2563 2547
2564 m_frame->document()->updateLayoutTreeIfNeeded(); 2548 m_frame->document()->updateLayoutTreeIfNeeded();
2565 2549
2566 if (needsLayout()) 2550 if (needsLayout())
2567 layout(); 2551 layout();
2568 2552
2569 // FIXME: Calling layout() shouldn't trigger script execution or have any 2553 // FIXME: Calling layout() shouldn't trigger script execution or have any
2570 // observable effects on the frame tree but we're not quite there yet. 2554 // observable effects on the frame tree but we're not quite there yet.
2571 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews; 2555 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews;
2572 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { 2556 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2573 if (!child->isLocalFrame()) 2557 if (!child->isLocalFrame())
2574 continue; 2558 continue;
2575 if (FrameView* view = toLocalFrame(child)->view()) 2559 if (FrameView* view = toLocalFrame(child)->view())
2576 frameViews.append(view); 2560 frameViews.append(view);
2577 } 2561 }
2578 2562
2579 for (const auto& frameView : frameViews) 2563 for (const auto& frameView : frameViews)
2580 frameView->updateStyleAndLayoutIfNeededRecursive(); 2564 frameView->updateLayoutAndStyleIfNeededRecursive();
2581 2565
2582 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. 2566 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView.
2583 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another 2567 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another
2584 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. 2568 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated.
2585 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. 2569 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e.
2586 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { 2570 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) {
2587 m_frame->document()->updateLayoutTreeIfNeeded(); 2571 m_frame->document()->updateLayoutTreeIfNeeded();
2588 2572
2589 if (needsLayout()) 2573 if (needsLayout())
2590 layout(); 2574 layout();
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3987 3971
3988 if (!graphicsLayer) 3972 if (!graphicsLayer)
3989 return; 3973 return;
3990 3974
3991 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3975 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3992 3976
3993 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3977 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3994 } 3978 }
3995 3979
3996 } // namespace blink 3980 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698