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

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

Issue 1126883002: Change all one-off lifecycle callers to FrameView::updateLayoutAndStyleForPainting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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/html/HTMLFormControlElementTest.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 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 if (!m_needsUpdateWidgetPositions) 2510 if (!m_needsUpdateWidgetPositions)
2511 return; 2511 return;
2512 2512
2513 m_needsUpdateWidgetPositions = false; 2513 m_needsUpdateWidgetPositions = false;
2514 2514
2515 updateWidgetPositions(); 2515 updateWidgetPositions();
2516 } 2516 }
2517 2517
2518 void FrameView::updateLayoutAndStyleForPainting() 2518 void FrameView::updateLayoutAndStyleForPainting()
2519 { 2519 {
2520 frame().localFrameRoot()->view()->updateLayoutAndStyleForPaintingInternal();
2521 }
2522
2523 void FrameView::updateLayoutAndStyleForPaintingInternal()
2524 {
2525 // 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.
2526 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2527
2520 // Updating layout can run script, which can tear down the FrameView. 2528 // Updating layout can run script, which can tear down the FrameView.
2521 RefPtrWillBeRawPtr<FrameView> protector(this); 2529 RefPtrWillBeRawPtr<FrameView> protector(this);
2522 2530
2523 updateLayoutAndStyleIfNeededRecursive(); 2531 updateLayoutAndStyleIfNeededRecursive();
2524 2532
2525 LayoutView* view = layoutView(); 2533 LayoutView* view = layoutView();
2526 if (view) { 2534 if (view) {
2527 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get())); 2535 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get()));
2528 2536
2529 view->compositor()->updateIfNeededRecursive(); 2537 view->compositor()->updateIfNeededRecursive();
2530 2538
2531 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) 2539 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
2532 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); 2540 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
2533 2541
2534 updateCompositedSelectionIfNeeded(); 2542 updateCompositedSelectionIfNeeded();
2535 2543
2536 scrollContentsIfNeededRecursive(); 2544 scrollContentsIfNeededRecursive();
2537 2545
2538 invalidateTreeIfNeededRecursive(); 2546 invalidateTreeIfNeededRecursive();
2539 2547
2540 ASSERT(!view->hasPendingSelection()); 2548 ASSERT(!view->hasPendingSelection());
2541 } 2549 }
2542 2550
2543 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 2551 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
2544 } 2552 }
2545 2553
2546 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2554 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2547 { 2555 {
2548 // We have to crawl our entire tree looking for any FrameViews that need 2556 // We have to crawl our entire subtree looking for any FrameViews that need
2549 // layout and make sure they are up to date. 2557 // layout and make sure they are up to date.
2550 // Mac actually tests for intersection with the dirty region and tries not t o 2558 // Mac actually tests for intersection with the dirty region and tries not t o
2551 // update layout for frames that are outside the dirty region. Not only doe s this seem 2559 // update layout for frames that are outside the dirty region. Not only doe s this seem
2552 // pointless (since those frames will have set a zero timer to layout anyway ), but 2560 // pointless (since those frames will have set a zero timer to layout anyway ), but
2553 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty 2561 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty
2554 // region but then become included later by the second frame adding rects to the dirty region 2562 // region but then become included later by the second frame adding rects to the dirty region
2555 // when it lays out. 2563 // when it lays out.
2556 2564
2557 m_frame->document()->updateLayoutTreeIfNeeded(); 2565 m_frame->document()->updateLayoutTreeIfNeeded();
2558 2566
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
3996 LayoutObject* FrameView::viewportLayoutObject() 4004 LayoutObject* FrameView::viewportLayoutObject()
3997 { 4005 {
3998 if (Document* document = frame().document()) { 4006 if (Document* document = frame().document()) {
3999 if (Element* element = document->viewportDefiningElement()) 4007 if (Element* element = document->viewportDefiningElement())
4000 return element->layoutObject(); 4008 return element->layoutObject();
4001 } 4009 }
4002 return nullptr; 4010 return nullptr;
4003 } 4011 }
4004 4012
4005 } // namespace blink 4013 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/html/HTMLFormControlElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698