| 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. |
| 1692 if (!node.isElementNode() |
| 1693 && !node.isTextNode() |
| 1694 && !node.isShadowRoot() |
| 1695 && !node.isDocumentNode()) |
| 1696 continue; |
| 1697 |
| 1698 ASSERT(!node.needsStyleRecalc()); |
| 1699 ASSERT(!node.childNeedsStyleRecalc()); |
| 1700 ASSERT(!node.childNeedsDistributionRecalc()); |
| 1701 ASSERT(!node.needsStyleInvalidation()); |
| 1702 ASSERT(!node.childNeedsStyleInvalidation()); |
| 1703 |
| 1704 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha
dowRoot = shadowRoot->olderShadowRoot()) |
| 1705 assertLayoutTreeUpdated(*shadowRoot); |
| 1706 } |
| 1707 } |
| 1708 #endif |
| 1709 |
| 1686 void Document::updateLayoutTree(StyleRecalcChange change) | 1710 void Document::updateLayoutTree(StyleRecalcChange change) |
| 1687 { | 1711 { |
| 1688 ASSERT(isMainThread()); | 1712 ASSERT(isMainThread()); |
| 1689 | 1713 |
| 1690 ScriptForbiddenScope forbidScript; | 1714 ScriptForbiddenScope forbidScript; |
| 1691 | 1715 |
| 1692 if (!view() || !isActive()) | 1716 if (!view() || !isActive()) |
| 1693 return; | 1717 return; |
| 1694 | 1718 |
| 1695 if (change != Force && !needsLayoutTreeUpdate()) | 1719 if (change != Force && !needsLayoutTreeUpdate()) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event | 1765 // detached (for example, by setting display:none in the :hover style), sche
dule another mouseMove event |
| 1742 // to check if any other elements ended up under the mouse pointer due to re
-layout. | 1766 // to check if any other elements ended up under the mouse pointer due to re
-layout. |
| 1743 if (hoverNode() && !hoverNode()->layoutObject() && frame()) | 1767 if (hoverNode() && !hoverNode()->layoutObject() && frame()) |
| 1744 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); | 1768 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); |
| 1745 | 1769 |
| 1746 if (m_focusedElement && !m_focusedElement->isFocusable()) | 1770 if (m_focusedElement && !m_focusedElement->isFocusable()) |
| 1747 clearFocusedElementSoon(); | 1771 clearFocusedElementSoon(); |
| 1748 | 1772 |
| 1749 ASSERT(!m_timeline->hasOutdatedAnimation()); | 1773 ASSERT(!m_timeline->hasOutdatedAnimation()); |
| 1750 | 1774 |
| 1775 #if ENABLE(ASSERT) |
| 1776 assertLayoutTreeUpdated(*this); |
| 1777 #endif |
| 1778 |
| 1751 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalculat
eStyles", "elementCount", m_styleRecalcElementCounter); | 1779 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalculat
eStyles", "elementCount", m_styleRecalcElementCounter); |
| 1752 TRACE_EVENT_END1("blink", "Document::updateLayoutTree", "elementCount", m_st
yleRecalcElementCounter); | 1780 TRACE_EVENT_END1("blink", "Document::updateLayoutTree", "elementCount", m_st
yleRecalcElementCounter); |
| 1753 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
unter); | 1781 InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
unter); |
| 1754 } | 1782 } |
| 1755 | 1783 |
| 1756 void Document::updateStyle(StyleRecalcChange change) | 1784 void Document::updateStyle(StyleRecalcChange change) |
| 1757 { | 1785 { |
| 1758 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); | 1786 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); |
| 1759 unsigned initialResolverAccessCount = styleEngine().resolverAccessCount(); | 1787 unsigned initialResolverAccessCount = styleEngine().resolverAccessCount(); |
| 1760 | 1788 |
| (...skipping 3926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5687 #ifndef NDEBUG | 5715 #ifndef NDEBUG |
| 5688 using namespace blink; | 5716 using namespace blink; |
| 5689 void showLiveDocumentInstances() | 5717 void showLiveDocumentInstances() |
| 5690 { | 5718 { |
| 5691 WeakDocumentSet& set = liveDocumentSet(); | 5719 WeakDocumentSet& set = liveDocumentSet(); |
| 5692 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5720 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5693 for (Document* document : set) | 5721 for (Document* document : set) |
| 5694 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5722 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
| 5695 } | 5723 } |
| 5696 #endif | 5724 #endif |
| OLD | NEW |