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

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

Issue 2398293003: Move Layout Tree Construction code into Element::rebuildLayoutTree() (Closed)
Patch Set: Bugs' comments Created 4 years, 2 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
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 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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { 1772 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
1773 // We leave some nodes with dirty bits in the tree because they don't 1773 // We leave some nodes with dirty bits in the tree because they don't
1774 // matter like Comment and ProcessingInstruction nodes. 1774 // matter like Comment and ProcessingInstruction nodes.
1775 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the 1775 // TODO(esprehn): Don't even mark those nodes as needing recalcs in the
1776 // first place. 1776 // first place.
1777 if (!node.isElementNode() && !node.isTextNode() && !node.isShadowRoot() && 1777 if (!node.isElementNode() && !node.isTextNode() && !node.isShadowRoot() &&
1778 !node.isDocumentNode()) 1778 !node.isDocumentNode())
1779 continue; 1779 continue;
1780 DCHECK(!node.needsStyleRecalc()); 1780 DCHECK(!node.needsStyleRecalc());
1781 DCHECK(!node.childNeedsStyleRecalc()); 1781 DCHECK(!node.childNeedsStyleRecalc());
1782 DCHECK(!node.needsReattachLayoutTree());
1783 DCHECK(!node.childNeedsReattachLayoutTree());
1782 DCHECK(!node.childNeedsDistributionRecalc()); 1784 DCHECK(!node.childNeedsDistributionRecalc());
1783 DCHECK(!node.needsStyleInvalidation()); 1785 DCHECK(!node.needsStyleInvalidation());
1784 DCHECK(!node.childNeedsStyleInvalidation()); 1786 DCHECK(!node.childNeedsStyleInvalidation());
1785 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; 1787 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot;
1786 shadowRoot = shadowRoot->olderShadowRoot()) 1788 shadowRoot = shadowRoot->olderShadowRoot())
1787 assertLayoutTreeUpdated(*shadowRoot); 1789 assertLayoutTreeUpdated(*shadowRoot);
1788 } 1790 }
1789 } 1791 }
1790 #endif 1792 #endif
1791 1793
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 m_hasNodesWithPlaceholderStyle = false; 1906 m_hasNodesWithPlaceholderStyle = false;
1905 RefPtr<ComputedStyle> documentStyle = 1907 RefPtr<ComputedStyle> documentStyle =
1906 StyleResolver::styleForDocument(*this); 1908 StyleResolver::styleForDocument(*this);
1907 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff( 1909 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(
1908 documentStyle.get(), layoutViewItem().style()); 1910 documentStyle.get(), layoutViewItem().style());
1909 if (localChange != NoChange) 1911 if (localChange != NoChange)
1910 layoutViewItem().setStyle(documentStyle.release()); 1912 layoutViewItem().setStyle(documentStyle.release());
1911 } 1913 }
1912 1914
1913 clearNeedsStyleRecalc(); 1915 clearNeedsStyleRecalc();
1916 clearNeedsReattachLayoutTree();
1914 1917
1915 StyleResolver& resolver = ensureStyleResolver(); 1918 StyleResolver& resolver = ensureStyleResolver();
1916 1919
1917 bool shouldRecordStats; 1920 bool shouldRecordStats;
1918 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); 1921 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
1919 styleEngine().setStatsEnabled(shouldRecordStats); 1922 styleEngine().setStatsEnabled(shouldRecordStats);
1920 1923
1921 if (Element* documentElement = this->documentElement()) { 1924 if (Element* documentElement = this->documentElement()) {
1922 inheritHtmlAndBodyElementStyles(change); 1925 inheritHtmlAndBodyElementStyles(change);
1923 dirtyElementsForLayerUpdate(); 1926 dirtyElementsForLayerUpdate();
1924 if (documentElement->shouldCallRecalcStyle(change)) 1927 if (documentElement->shouldCallRecalcStyle(change))
1925 documentElement->recalcStyle(change); 1928 documentElement->recalcStyle(change);
1926 while (dirtyElementsForLayerUpdate()) 1929 while (dirtyElementsForLayerUpdate())
1927 documentElement->recalcStyle(NoChange); 1930 documentElement->recalcStyle(NoChange);
1928 } 1931 }
1929 1932
1930 view()->recalcOverflowAfterStyleChange(); 1933 view()->recalcOverflowAfterStyleChange();
1931 1934
1932 // Only retain the HashMap for the duration of StyleRecalc and 1935 // Only retain the HashMap for the duration of StyleRecalc and
1933 // LayoutTreeConstruction. 1936 // LayoutTreeConstruction.
1934 m_nonAttachedStyle.clear(); 1937 m_nonAttachedStyle.clear();
1935 clearChildNeedsStyleRecalc(); 1938 clearChildNeedsStyleRecalc();
1939 clearChildNeedsReattachLayoutTree();
1936 1940
1937 resolver.clearStyleSharingList(); 1941 resolver.clearStyleSharingList();
1938 1942
1939 m_wasPrinting = m_printing; 1943 m_wasPrinting = m_printing;
1940 1944
1941 DCHECK(!needsStyleRecalc()); 1945 DCHECK(!needsStyleRecalc());
1942 DCHECK(!childNeedsStyleRecalc()); 1946 DCHECK(!childNeedsStyleRecalc());
1947 DCHECK(!needsReattachLayoutTree());
1948 DCHECK(!childNeedsReattachLayoutTree());
1943 DCHECK(inStyleRecalc()); 1949 DCHECK(inStyleRecalc());
1944 DCHECK_EQ(styleResolver(), &resolver); 1950 DCHECK_EQ(styleResolver(), &resolver);
1945 DCHECK(m_nonAttachedStyle.isEmpty()); 1951 DCHECK(m_nonAttachedStyle.isEmpty());
1946 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 1952 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
1947 if (shouldRecordStats) { 1953 if (shouldRecordStats) {
1948 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", 1954 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
1949 "resolverAccessCount", 1955 "resolverAccessCount",
1950 styleEngine().styleForElementCount() - initialElementCount, 1956 styleEngine().styleForElementCount() - initialElementCount,
1951 "counters", styleEngine().stats()->toTracedValue()); 1957 "counters", styleEngine().stats()->toTracedValue());
1952 } else { 1958 } else {
(...skipping 4448 matching lines...) Expand 10 before | Expand all | Expand 10 after
6401 } 6407 }
6402 6408
6403 void showLiveDocumentInstances() { 6409 void showLiveDocumentInstances() {
6404 WeakDocumentSet& set = liveDocumentSet(); 6410 WeakDocumentSet& set = liveDocumentSet();
6405 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6411 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6406 for (Document* document : set) 6412 for (Document* document : set)
6407 fprintf(stderr, "- Document %p URL: %s\n", document, 6413 fprintf(stderr, "- Document %p URL: %s\n", document,
6408 document->url().getString().utf8().data()); 6414 document->url().getString().utf8().data());
6409 } 6415 }
6410 #endif 6416 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698