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

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

Powered by Google App Engine
This is Rietveld 408576698