Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |