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

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

Issue 1156273002: Add assert that updateLayoutTree clears dirty bits. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Just asserts?? Created 5 years, 6 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 | « no previous file | 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) 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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF orTracing::create(StyleChangeReason::WritingModeChange)); 1676 body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonF orTracing::create(StyleChangeReason::WritingModeChange));
1677 } 1677 }
1678 } 1678 }
1679 1679
1680 if (const ComputedStyle* style = documentElement()->computedStyle()) { 1680 if (const ComputedStyle* style = documentElement()->computedStyle()) {
1681 if (style->direction() != rootDirection || style->writingMode() != rootW ritingMode) 1681 if (style->direction() != rootDirection || style->writingMode() != rootW ritingMode)
1682 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan geReasonForTracing::create(StyleChangeReason::WritingModeChange)); 1682 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChan geReasonForTracing::create(StyleChangeReason::WritingModeChange));
1683 } 1683 }
1684 } 1684 }
1685 1685
1686 #if ENABLE(ASSERT)
1687 static void assertLayoutTreeUpdated(Node& root)
1688 {
1689 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
1690 // We leave some nodes with dirty bits in the tree because they don't
1691 // matter like Comment and ProcessingInstruction nodes.
ojan 2015/06/19 03:05:44 Add a FIXME to not dirty these in the first place?
1692 if (!node.isElementNode()
1693 && !node.isTextNode()
1694 && !node.isShadowRoot()
1695 && !node.isDocumentNode())
1696 continue;
1697 ASSERT(!node.needsStyleRecalc());
1698 ASSERT(!node.childNeedsStyleRecalc());
1699 ASSERT(!node.childNeedsDistributionRecalc());
1700 ASSERT(!node.needsStyleInvalidation());
1701 ASSERT(!node.childNeedsStyleInvalidation());
1702 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha dowRoot = shadowRoot->olderShadowRoot())
1703 assertLayoutTreeUpdated(*shadowRoot);
1704 }
1705 }
1706 #endif
1707
1686 void Document::updateLayoutTree(StyleRecalcChange change) 1708 void Document::updateLayoutTree(StyleRecalcChange change)
1687 { 1709 {
1688 ASSERT(isMainThread()); 1710 ASSERT(isMainThread());
1689 1711
1690 ScriptForbiddenScope forbidScript; 1712 ScriptForbiddenScope forbidScript;
1691 1713
1692 if (!view() || !isActive()) 1714 if (!view() || !isActive())
1693 return; 1715 return;
1694 1716
1695 if (change != Force && !needsLayoutTreeUpdate()) 1717 if (change != Force && !needsLayoutTreeUpdate())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 if (hoverNode() && !hoverNode()->layoutObject() && frame()) 1764 if (hoverNode() && !hoverNode()->layoutObject() && frame())
1743 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); 1765 frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
1744 1766
1745 if (m_focusedElement && !m_focusedElement->isFocusable()) 1767 if (m_focusedElement && !m_focusedElement->isFocusable())
1746 clearFocusedElementSoon(); 1768 clearFocusedElementSoon();
1747 1769
1748 ASSERT(!m_timeline->hasOutdatedAnimation()); 1770 ASSERT(!m_timeline->hasOutdatedAnimation());
1749 1771
1750 TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCoun t", m_styleRecalcElementCounter); 1772 TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCoun t", m_styleRecalcElementCounter);
1751 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo unter); 1773 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo unter);
1774
1775 #if ENABLE(ASSERT)
1776 assertLayoutTreeUpdated(*this);
1777 #endif
1752 } 1778 }
1753 1779
1754 void Document::updateStyle(StyleRecalcChange change) 1780 void Document::updateStyle(StyleRecalcChange change)
1755 { 1781 {
1756 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); 1782 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle");
1757 unsigned initialResolverAccessCount = styleEngine().resolverAccessCount(); 1783 unsigned initialResolverAccessCount = styleEngine().resolverAccessCount();
1758 1784
1759 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 1785 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
1760 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); 1786 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc);
1761 1787
(...skipping 3918 matching lines...) Expand 10 before | Expand all | Expand 10 after
5680 #ifndef NDEBUG 5706 #ifndef NDEBUG
5681 using namespace blink; 5707 using namespace blink;
5682 void showLiveDocumentInstances() 5708 void showLiveDocumentInstances()
5683 { 5709 {
5684 WeakDocumentSet& set = liveDocumentSet(); 5710 WeakDocumentSet& set = liveDocumentSet();
5685 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5711 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5686 for (Document* document : set) 5712 for (Document* document : set)
5687 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5713 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5688 } 5714 }
5689 #endif 5715 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698