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

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

Issue 1217943010: 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
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::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 void FrameView::updateLifecycleToCompositingClean()
2492 {
2493 frame().localFrameRoot()->view()->updateStyleAndLayoutIfNeededRecursive();
2494 LayoutView* view = layoutView();
2495 if (view)
2496 view->compositor()->updateIfNeededRecursive();
2497
2498 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean);
2499 }
2500
2501 void FrameView::updateAllLifecyclePhasesInternal()
2492 { 2502 {
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. 2503 // 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())); 2504 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2495 2505
2496 // Updating layout can run script, which can tear down the FrameView. 2506 // Updating layout can run script, which can tear down the FrameView.
2497 RefPtrWillBeRawPtr<FrameView> protector(this); 2507 RefPtrWillBeRawPtr<FrameView> protector(this);
2498 2508
2499 updateLayoutAndStyleIfNeededRecursive(); 2509 updateStyleAndLayoutIfNeededRecursive();
2500 2510
2501 LayoutView* view = layoutView(); 2511 LayoutView* view = layoutView();
2502 if (view) { 2512 if (view) {
2503 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp dateLayerTreeEvent::data(m_frame.get())); 2513 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", InspectorUp dateLayerTreeEvent::data(m_frame.get()));
2504 2514
2505 view->compositor()->updateIfNeededRecursive(); 2515 view->compositor()->updateIfNeededRecursive();
2506 2516
2507 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) 2517 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
2508 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); 2518 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
2509 2519
(...skipping 17 matching lines...) Expand all
2527 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; 2537 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests;
2528 // TODO(mpb) use a 'dirty' bit to not call this every time. 2538 // TODO(mpb) use a 'dirty' bit to not call this every time.
2529 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); 2539 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests);
2530 2540
2531 for (const auto& iter : graphicsLayerTimingRequests) { 2541 for (const auto& iter : graphicsLayerTimingRequests) {
2532 const GraphicsLayer* graphicsLayer = iter.key; 2542 const GraphicsLayer* graphicsLayer = iter.key;
2533 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value); 2543 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value);
2534 } 2544 }
2535 } 2545 }
2536 2546
2537 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2547 void FrameView::updateStyleAndLayoutIfNeededRecursive()
2538 { 2548 {
2539 // We have to crawl our entire subtree looking for any FrameViews that need 2549 // We have to crawl our entire subtree looking for any FrameViews that need
2540 // layout and make sure they are up to date. 2550 // layout and make sure they are up to date.
2541 // Mac actually tests for intersection with the dirty region and tries not t o 2551 // 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 2552 // 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 2553 // 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 2554 // 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 2555 // region but then become included later by the second frame adding rects to the dirty region
2546 // when it lays out. 2556 // when it lays out.
2547 2557
2548 m_frame->document()->updateLayoutTreeIfNeeded(); 2558 m_frame->document()->updateLayoutTreeIfNeeded();
2549 2559
2550 if (needsLayout()) 2560 if (needsLayout())
2551 layout(); 2561 layout();
2552 2562
2553 // FIXME: Calling layout() shouldn't trigger script execution or have any 2563 // 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. 2564 // observable effects on the frame tree but we're not quite there yet.
2555 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews; 2565 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews;
2556 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { 2566 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2557 if (!child->isLocalFrame()) 2567 if (!child->isLocalFrame())
2558 continue; 2568 continue;
2559 if (FrameView* view = toLocalFrame(child)->view()) 2569 if (FrameView* view = toLocalFrame(child)->view())
2560 frameViews.append(view); 2570 frameViews.append(view);
2561 } 2571 }
2562 2572
2563 for (const auto& frameView : frameViews) 2573 for (const auto& frameView : frameViews)
2564 frameView->updateLayoutAndStyleIfNeededRecursive(); 2574 frameView->updateStyleAndLayoutIfNeededRecursive();
2565 2575
2566 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. 2576 // 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 2577 // 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. 2578 // 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. 2579 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e.
2570 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { 2580 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) {
2571 m_frame->document()->updateLayoutTreeIfNeeded(); 2581 m_frame->document()->updateLayoutTreeIfNeeded();
2572 2582
2573 if (needsLayout()) 2583 if (needsLayout())
2574 layout(); 2584 layout();
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3971 3981
3972 if (!graphicsLayer) 3982 if (!graphicsLayer)
3973 return; 3983 return;
3974 3984
3975 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3985 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3976 3986
3977 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3987 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3978 } 3988 }
3979 3989
3980 } // namespace blink 3990 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698