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

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

Issue 1649983003: Remove the forced layout in getComputedStyle for elements in Shadow DOM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Look at ShadowRoots when walking up the tree in updateLayoutTreeForNodeIfNeeded. Created 4 years, 10 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 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 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 return; 1895 return;
1896 1896
1897 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange); 1897 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange);
1898 1898
1899 layoutView()->handleSubtreeModifications(); 1899 layoutView()->handleSubtreeModifications();
1900 ASSERT(!layoutView()->wasNotifiedOfSubtreeChange()); 1900 ASSERT(!layoutView()->wasNotifiedOfSubtreeChange());
1901 1901
1902 m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean); 1902 m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean);
1903 } 1903 }
1904 1904
1905 static bool nodeMayNeedStyleRecalc(const ContainerNode& node)
rune 2016/02/01 09:24:23 Should we now use anonymous namespace instead of s
1906 {
1907 return node.needsStyleRecalc() || node.needsStyleInvalidation() || node.need sAdjacentStyleRecalc();
1908 }
1909
1910 static bool nodeMayNeedStyleRecalc(const ContainerNode* node)
1911 {
1912 return node && nodeMayNeedStyleRecalc(*node);
1913 }
1914
1905 void Document::updateLayoutTreeForNodeIfNeeded(Node* node) 1915 void Document::updateLayoutTreeForNodeIfNeeded(Node* node)
1906 { 1916 {
1907 ASSERT(node); 1917 ASSERT(node);
1908 if (!node->canParticipateInComposedTree()) 1918 if (!node->canParticipateInComposedTree())
1909 return; 1919 return;
1910 if (!needsLayoutTreeUpdate()) 1920 if (!needsLayoutTreeUpdate())
1911 return; 1921 return;
1912 if (!node->inDocument()) 1922 if (!node->inDocument())
1913 return; 1923 return;
1914 1924
1915 bool needsRecalc = needsFullLayoutTreeUpdate() || node->needsStyleRecalc() | | node->needsStyleInvalidation(); 1925 bool needsRecalc = needsFullLayoutTreeUpdate() || node->needsStyleRecalc() | | node->needsStyleInvalidation();
1916 1926
1917 if (!needsRecalc) { 1927 if (!needsRecalc) {
1918 for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::parent( *node); ancestor && !needsRecalc; ancestor = LayoutTreeBuilderTraversal::parent( *ancestor)) 1928 LayoutTreeBuilderTraversal::ParentDetails parentDetails;
1919 needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleIn validation() || ancestor->needsAdjacentStyleRecalc(); 1929 for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::parent( *node, &parentDetails); ancestor && !needsRecalc; ancestor = LayoutTreeBuilderTr aversal::parent(*ancestor, &parentDetails)) {
1930 needsRecalc = nodeMayNeedStyleRecalc(*ancestor) || nodeMayNeedStyleR ecalc(parentDetails.shadowRoot());
1931 parentDetails.reset();
1932 }
1933 // We may have bailed out of the loop because there's no ancestor in the
1934 // composed tree, but we still need to check the shadow root.
1935 needsRecalc = needsRecalc || nodeMayNeedStyleRecalc(parentDetails.shadow Root());
rune 2016/02/01 09:24:23 How could that happen? Won't every shadow root hav
1920 } 1936 }
1921 1937
1922 if (needsRecalc) 1938 if (needsRecalc)
1923 updateLayoutTreeIfNeeded(); 1939 updateLayoutTreeIfNeeded();
1924 } 1940 }
1925 1941
1926 void Document::updateLayout() 1942 void Document::updateLayout()
1927 { 1943 {
1928 ASSERT(isMainThread()); 1944 ASSERT(isMainThread());
1929 1945
(...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after
5926 #ifndef NDEBUG 5942 #ifndef NDEBUG
5927 using namespace blink; 5943 using namespace blink;
5928 void showLiveDocumentInstances() 5944 void showLiveDocumentInstances()
5929 { 5945 {
5930 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5946 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5931 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5947 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5932 for (Document* document : set) 5948 for (Document* document : set)
5933 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5949 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5934 } 5950 }
5935 #endif 5951 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698