| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { | 1757 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
| 1758 // We leave some nodes with dirty bits in the tree because they don't | 1758 // We leave some nodes with dirty bits in the tree because they don't |
| 1759 // matter like Comment and ProcessingInstruction nodes. | 1759 // matter like Comment and ProcessingInstruction nodes. |
| 1760 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the | 1760 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the |
| 1761 // first place. | 1761 // first place. |
| 1762 if (!node.isElementNode() && !node.isTextNode() && !node.isShadowRoot() && | 1762 if (!node.isElementNode() && !node.isTextNode() && !node.isShadowRoot() && |
| 1763 !node.isDocumentNode()) | 1763 !node.isDocumentNode()) |
| 1764 continue; | 1764 continue; |
| 1765 DCHECK(!node.needsStyleRecalc()); | 1765 DCHECK(!node.needsStyleRecalc()); |
| 1766 DCHECK(!node.childNeedsStyleRecalc()); | 1766 DCHECK(!node.childNeedsStyleRecalc()); |
| 1767 DCHECK(!node.needsReattachLayoutTree()); | |
| 1768 DCHECK(!node.childNeedsReattachLayoutTree()); | |
| 1769 DCHECK(!node.childNeedsDistributionRecalc()); | 1767 DCHECK(!node.childNeedsDistributionRecalc()); |
| 1770 DCHECK(!node.needsStyleInvalidation()); | 1768 DCHECK(!node.needsStyleInvalidation()); |
| 1771 DCHECK(!node.childNeedsStyleInvalidation()); | 1769 DCHECK(!node.childNeedsStyleInvalidation()); |
| 1772 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; | 1770 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; |
| 1773 shadowRoot = shadowRoot->olderShadowRoot()) | 1771 shadowRoot = shadowRoot->olderShadowRoot()) |
| 1774 assertLayoutTreeUpdated(*shadowRoot); | 1772 assertLayoutTreeUpdated(*shadowRoot); |
| 1775 } | 1773 } |
| 1776 } | 1774 } |
| 1777 #endif | 1775 #endif |
| 1778 | 1776 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 m_hasNodesWithPlaceholderStyle = false; | 1889 m_hasNodesWithPlaceholderStyle = false; |
| 1892 RefPtr<ComputedStyle> documentStyle = | 1890 RefPtr<ComputedStyle> documentStyle = |
| 1893 StyleResolver::styleForDocument(*this); | 1891 StyleResolver::styleForDocument(*this); |
| 1894 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff( | 1892 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff( |
| 1895 documentStyle.get(), layoutViewItem().style()); | 1893 documentStyle.get(), layoutViewItem().style()); |
| 1896 if (localChange != NoChange) | 1894 if (localChange != NoChange) |
| 1897 layoutViewItem().setStyle(documentStyle.release()); | 1895 layoutViewItem().setStyle(documentStyle.release()); |
| 1898 } | 1896 } |
| 1899 | 1897 |
| 1900 clearNeedsStyleRecalc(); | 1898 clearNeedsStyleRecalc(); |
| 1901 clearNeedsReattachLayoutTree(); | |
| 1902 | 1899 |
| 1903 StyleResolver& resolver = ensureStyleResolver(); | 1900 StyleResolver& resolver = ensureStyleResolver(); |
| 1904 | 1901 |
| 1905 bool shouldRecordStats; | 1902 bool shouldRecordStats; |
| 1906 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); | 1903 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); |
| 1907 styleEngine().setStatsEnabled(shouldRecordStats); | 1904 styleEngine().setStatsEnabled(shouldRecordStats); |
| 1908 | 1905 |
| 1909 if (Element* documentElement = this->documentElement()) { | 1906 if (Element* documentElement = this->documentElement()) { |
| 1910 inheritHtmlAndBodyElementStyles(change); | 1907 inheritHtmlAndBodyElementStyles(change); |
| 1911 dirtyElementsForLayerUpdate(); | 1908 dirtyElementsForLayerUpdate(); |
| 1912 if (documentElement->shouldCallRecalcStyle(change)) | 1909 if (documentElement->shouldCallRecalcStyle(change)) |
| 1913 documentElement->recalcStyle(change); | 1910 documentElement->recalcStyle(change); |
| 1914 while (dirtyElementsForLayerUpdate()) | 1911 while (dirtyElementsForLayerUpdate()) |
| 1915 documentElement->recalcStyle(NoChange); | 1912 documentElement->recalcStyle(NoChange); |
| 1916 } | 1913 } |
| 1917 | 1914 |
| 1918 view()->recalcOverflowAfterStyleChange(); | 1915 view()->recalcOverflowAfterStyleChange(); |
| 1919 | 1916 |
| 1920 // Only retain the HashMap for the duration of StyleRecalc and | 1917 // Only retain the HashMap for the duration of StyleRecalc and |
| 1921 // LayoutTreeConstruction. | 1918 // LayoutTreeConstruction. |
| 1922 m_nonAttachedStyle.clear(); | 1919 m_nonAttachedStyle.clear(); |
| 1923 clearChildNeedsStyleRecalc(); | 1920 clearChildNeedsStyleRecalc(); |
| 1924 clearChildNeedsReattachLayoutTree(); | |
| 1925 | 1921 |
| 1926 resolver.clearStyleSharingList(); | 1922 resolver.clearStyleSharingList(); |
| 1927 | 1923 |
| 1928 DCHECK(!needsStyleRecalc()); | 1924 DCHECK(!needsStyleRecalc()); |
| 1929 DCHECK(!childNeedsStyleRecalc()); | 1925 DCHECK(!childNeedsStyleRecalc()); |
| 1930 DCHECK(!needsReattachLayoutTree()); | |
| 1931 DCHECK(!childNeedsReattachLayoutTree()); | |
| 1932 DCHECK(inStyleRecalc()); | 1926 DCHECK(inStyleRecalc()); |
| 1933 DCHECK_EQ(styleResolver(), &resolver); | 1927 DCHECK_EQ(styleResolver(), &resolver); |
| 1934 DCHECK(m_nonAttachedStyle.isEmpty()); | 1928 DCHECK(m_nonAttachedStyle.isEmpty()); |
| 1935 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 1929 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
| 1936 if (shouldRecordStats) { | 1930 if (shouldRecordStats) { |
| 1937 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", | 1931 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", |
| 1938 "resolverAccessCount", | 1932 "resolverAccessCount", |
| 1939 styleEngine().styleForElementCount() - initialElementCount, | 1933 styleEngine().styleForElementCount() - initialElementCount, |
| 1940 "counters", styleEngine().stats()->toTracedValue()); | 1934 "counters", styleEngine().stats()->toTracedValue()); |
| 1941 } else { | 1935 } else { |
| (...skipping 4455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6397 } | 6391 } |
| 6398 | 6392 |
| 6399 void showLiveDocumentInstances() { | 6393 void showLiveDocumentInstances() { |
| 6400 WeakDocumentSet& set = liveDocumentSet(); | 6394 WeakDocumentSet& set = liveDocumentSet(); |
| 6401 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6395 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6402 for (Document* document : set) | 6396 for (Document* document : set) |
| 6403 fprintf(stderr, "- Document %p URL: %s\n", document, | 6397 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6404 document->url().getString().utf8().data()); | 6398 document->url().getString().utf8().data()); |
| 6405 } | 6399 } |
| 6406 #endif | 6400 #endif |
| OLD | NEW |