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

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: Clear nextTextSibling pointer where there is a LayoutObject between the element and text node 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 m_hasNodesWithPlaceholderStyle = false; 1907 m_hasNodesWithPlaceholderStyle = false;
1906 RefPtr<ComputedStyle> documentStyle = 1908 RefPtr<ComputedStyle> documentStyle =
1907 StyleResolver::styleForDocument(*this); 1909 StyleResolver::styleForDocument(*this);
1908 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff( 1910 StyleRecalcChange localChange = ComputedStyle::stylePropagationDiff(
1909 documentStyle.get(), layoutViewItem().style()); 1911 documentStyle.get(), layoutViewItem().style());
1910 if (localChange != NoChange) 1912 if (localChange != NoChange)
1911 layoutViewItem().setStyle(documentStyle.release()); 1913 layoutViewItem().setStyle(documentStyle.release());
1912 } 1914 }
1913 1915
1914 clearNeedsStyleRecalc(); 1916 clearNeedsStyleRecalc();
1917 clearNeedsReattachLayoutTree();
1915 1918
1916 StyleResolver& resolver = ensureStyleResolver(); 1919 StyleResolver& resolver = ensureStyleResolver();
1917 1920
1918 bool shouldRecordStats; 1921 bool shouldRecordStats;
1919 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats); 1922 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink,blink_style", &shouldRecordStats);
1920 styleEngine().setStatsEnabled(shouldRecordStats); 1923 styleEngine().setStatsEnabled(shouldRecordStats);
1921 1924
1922 if (Element* documentElement = this->documentElement()) { 1925 if (Element* documentElement = this->documentElement()) {
1923 inheritHtmlAndBodyElementStyles(change); 1926 inheritHtmlAndBodyElementStyles(change);
1924 dirtyElementsForLayerUpdate(); 1927 dirtyElementsForLayerUpdate();
1925 if (documentElement->shouldCallRecalcStyle(change)) 1928 if (documentElement->shouldCallRecalcStyle(change))
1926 documentElement->recalcStyle(change); 1929 documentElement->recalcStyle(change);
1927 while (dirtyElementsForLayerUpdate()) 1930 while (dirtyElementsForLayerUpdate())
1928 documentElement->recalcStyle(NoChange); 1931 documentElement->recalcStyle(NoChange);
1929 } 1932 }
1930 1933
1931 view()->recalcOverflowAfterStyleChange(); 1934 view()->recalcOverflowAfterStyleChange();
1932 1935
1933 // Only retain the HashMap for the duration of StyleRecalc and 1936 // Only retain the HashMap for the duration of StyleRecalc and
1934 // LayoutTreeConstruction. 1937 // LayoutTreeConstruction.
1935 m_nonAttachedStyle.clear(); 1938 m_nonAttachedStyle.clear();
1936 clearChildNeedsStyleRecalc(); 1939 clearChildNeedsStyleRecalc();
1940 clearChildNeedsReattachLayoutTree();
1937 1941
1938 resolver.clearStyleSharingList(); 1942 resolver.clearStyleSharingList();
1939 1943
1940 m_wasPrinting = m_printing; 1944 m_wasPrinting = m_printing;
1941 1945
1942 DCHECK(!needsStyleRecalc()); 1946 DCHECK(!needsStyleRecalc());
1943 DCHECK(!childNeedsStyleRecalc()); 1947 DCHECK(!childNeedsStyleRecalc());
1948 DCHECK(!needsReattachLayoutTree());
1949 DCHECK(!childNeedsReattachLayoutTree());
1944 DCHECK(inStyleRecalc()); 1950 DCHECK(inStyleRecalc());
1945 DCHECK_EQ(styleResolver(), &resolver); 1951 DCHECK_EQ(styleResolver(), &resolver);
1946 DCHECK(m_nonAttachedStyle.isEmpty()); 1952 DCHECK(m_nonAttachedStyle.isEmpty());
1947 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); 1953 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean);
1948 if (shouldRecordStats) { 1954 if (shouldRecordStats) {
1949 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", 1955 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
1950 "resolverAccessCount", 1956 "resolverAccessCount",
1951 styleEngine().styleForElementCount() - initialElementCount, 1957 styleEngine().styleForElementCount() - initialElementCount,
1952 "counters", styleEngine().stats()->toTracedValue()); 1958 "counters", styleEngine().stats()->toTracedValue());
1953 } else { 1959 } else {
(...skipping 4448 matching lines...) Expand 10 before | Expand all | Expand 10 after
6402 } 6408 }
6403 6409
6404 void showLiveDocumentInstances() { 6410 void showLiveDocumentInstances() {
6405 WeakDocumentSet& set = liveDocumentSet(); 6411 WeakDocumentSet& set = liveDocumentSet();
6406 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6412 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6407 for (Document* document : set) 6413 for (Document* document : set)
6408 fprintf(stderr, "- Document %p URL: %s\n", document, 6414 fprintf(stderr, "- Document %p URL: %s\n", document,
6409 document->url().getString().utf8().data()); 6415 document->url().getString().utf8().data());
6410 } 6416 }
6411 #endif 6417 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698