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

Side by Side Diff: sky/engine/core/frame/FrameView.cpp

Issue 853433002: Remove Document::shouldScheduleLayout. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove redundant call. Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/dom/Document.cpp ('k') | no next file » | 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 ASSERT(m_frame->view() == this); 458 ASSERT(m_frame->view() == this);
459 459
460 if (isSubtreeLayout()) { 460 if (isSubtreeLayout()) {
461 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); 461 m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
462 m_layoutSubtreeRoot = 0; 462 m_layoutSubtreeRoot = 0;
463 } 463 }
464 if (!m_layoutSchedulingEnabled) 464 if (!m_layoutSchedulingEnabled)
465 return; 465 return;
466 if (!needsLayout()) 466 if (!needsLayout())
467 return; 467 return;
468 if (!m_frame->document()->shouldScheduleLayout()) 468 if (!m_frame->document()->isActive())
469 return; 469 return;
470 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali dateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); 470 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali dateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get());
471 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack()); 471 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
472 472
473 if (m_hasPendingLayout) 473 if (m_hasPendingLayout)
474 return; 474 return;
475 m_hasPendingLayout = true; 475 m_hasPendingLayout = true;
476 476
477 page()->animator().scheduleVisualUpdate(); 477 page()->animator().scheduleVisualUpdate();
478 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); 478 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean);
479 } 479 }
480 480
481 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant) 481 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de scendant)
482 { 482 {
483 for (RenderObject* r = descendant; r; r = r->container()) { 483 for (RenderObject* r = descendant; r; r = r->container()) {
484 if (r == ancestor) 484 if (r == ancestor)
485 return true; 485 return true;
486 } 486 }
487 return false; 487 return false;
488 } 488 }
489 489
490 void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot) 490 void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
491 { 491 {
492 ASSERT(m_frame->view() == this); 492 ASSERT(m_frame->view() == this);
493 493
494 // FIXME: Should this call shouldScheduleLayout instead?
495 if (!m_frame->document()->isActive()) 494 if (!m_frame->document()->isActive())
496 return; 495 return;
497 496
498 RenderView* renderView = this->renderView(); 497 RenderView* renderView = this->renderView();
499 if (renderView && renderView->needsLayout()) { 498 if (renderView && renderView->needsLayout()) {
500 if (relayoutRoot) 499 if (relayoutRoot)
501 relayoutRoot->markContainingBlocksForLayout(false); 500 relayoutRoot->markContainingBlocksForLayout(false);
502 return; 501 return;
503 } 502 }
504 503
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 539 }
541 540
542 bool FrameView::isInPerformLayout() const 541 bool FrameView::isInPerformLayout() const
543 { 542 {
544 ASSERT(m_inPerformLayout == (lifecycle().state() == DocumentLifecycle::InPer formLayout)); 543 ASSERT(m_inPerformLayout == (lifecycle().state() == DocumentLifecycle::InPer formLayout));
545 return m_inPerformLayout; 544 return m_inPerformLayout;
546 } 545 }
547 546
548 bool FrameView::needsLayout() const 547 bool FrameView::needsLayout() const
549 { 548 {
550 // This can return true in cases where the document does not have a body yet .
551 // Document::shouldScheduleLayout takes care of preventing us from schedulin g
552 // layout in that case.
553
554 RenderView* renderView = this->renderView(); 549 RenderView* renderView = this->renderView();
555 return layoutPending() 550 return layoutPending()
556 || (renderView && renderView->needsLayout()) 551 || (renderView && renderView->needsLayout())
557 || isSubtreeLayout(); 552 || isSubtreeLayout();
558 } 553 }
559 554
560 void FrameView::setNeedsLayout() 555 void FrameView::setNeedsLayout()
561 { 556 {
562 if (RenderView* renderView = this->renderView()) 557 if (RenderView* renderView = this->renderView())
563 renderView->setNeedsLayout(); 558 renderView->setNeedsLayout();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 totalObjects = 0; 922 totalObjects = 0;
928 923
929 for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) { 924 for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) {
930 ++totalObjects; 925 ++totalObjects;
931 if (o->needsLayout()) 926 if (o->needsLayout())
932 ++needsLayoutObjects; 927 ++needsLayoutObjects;
933 } 928 }
934 } 929 }
935 930
936 } // namespace blink 931 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698