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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 232013002: Rewind the DocumentLifecycle when dirtying state (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address Ojan's comments Created 6 years, 8 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/dom/Document.h ('k') | Source/core/dom/DocumentLifecycle.h » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 return true; 1573 return true;
1574 } 1574 }
1575 1575
1576 void Document::scheduleRenderTreeUpdate() 1576 void Document::scheduleRenderTreeUpdate()
1577 { 1577 {
1578 ASSERT(!hasPendingStyleRecalc()); 1578 ASSERT(!hasPendingStyleRecalc());
1579 ASSERT(shouldScheduleRenderTreeUpdate()); 1579 ASSERT(shouldScheduleRenderTreeUpdate());
1580 ASSERT(needsRenderTreeUpdate()); 1580 ASSERT(needsRenderTreeUpdate());
1581 1581
1582 page()->animator().scheduleVisualUpdate(); 1582 page()->animator().scheduleVisualUpdate();
1583 m_lifecycle.advanceTo(DocumentLifecycle::StyleRecalcPending); 1583 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending);
1584 1584
1585 InspectorInstrumentation::didScheduleStyleRecalculation(this); 1585 InspectorInstrumentation::didScheduleStyleRecalculation(this);
1586 } 1586 }
1587 1587
1588 bool Document::hasPendingForcedStyleRecalc() const 1588 bool Document::hasPendingForcedStyleRecalc() const
1589 { 1589 {
1590 return hasPendingStyleRecalc() && !inStyleRecalc() && styleChangeType() >= S ubtreeStyleChange; 1590 return hasPendingStyleRecalc() && !inStyleRecalc() && styleChangeType() >= S ubtreeStyleChange;
1591 } 1591 }
1592 1592
1593 void Document::updateDistributionIfNeeded() 1593 void Document::updateDistributionIfNeeded()
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 m_elementDataCache = ElementDataCache::create(); 2623 m_elementDataCache = ElementDataCache::create();
2624 } 2624 }
2625 2625
2626 bool Document::shouldScheduleLayout() const 2626 bool Document::shouldScheduleLayout() const
2627 { 2627 {
2628 // This function will only be called when FrameView thinks a layout is neede d. 2628 // This function will only be called when FrameView thinks a layout is neede d.
2629 // This enforces a couple extra rules. 2629 // This enforces a couple extra rules.
2630 // 2630 //
2631 // (a) Only schedule a layout once the stylesheets are loaded. 2631 // (a) Only schedule a layout once the stylesheets are loaded.
2632 // (b) Only schedule layout once we have a body element. 2632 // (b) Only schedule layout once we have a body element.
2633 if (!isActive())
2634 return false;
2633 2635
2634 return (isRenderingReady() && body()) 2636 if (isRenderingReady() && body())
2635 || (documentElement() && !isHTMLHtmlElement(*documentElement())); 2637 return true;
2638
2639 if (documentElement() && !isHTMLHtmlElement(*documentElement()))
2640 return true;
2641
2642 return false;
2636 } 2643 }
2637 2644
2638 int Document::elapsedTime() const 2645 int Document::elapsedTime() const
2639 { 2646 {
2640 return static_cast<int>((currentTime() - m_startTime) * 1000); 2647 return static_cast<int>((currentTime() - m_startTime) * 1000);
2641 } 2648 }
2642 2649
2643 void Document::write(const SegmentedString& text, Document* ownerDocument) 2650 void Document::write(const SegmentedString& text, Document* ownerDocument)
2644 { 2651 {
2645 NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth); 2652 NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth);
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after
5507 (*it)->invalidateCache(attrName); 5514 (*it)->invalidateCache(attrName);
5508 } 5515 }
5509 5516
5510 void Document::trace(Visitor* visitor) 5517 void Document::trace(Visitor* visitor)
5511 { 5518 {
5512 Supplementable<Document>::trace(visitor); 5519 Supplementable<Document>::trace(visitor);
5513 ContainerNode::trace(visitor); 5520 ContainerNode::trace(visitor);
5514 } 5521 }
5515 5522
5516 } // namespace WebCore 5523 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentLifecycle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698