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

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

Issue 1903803002: Do not block painting for in-body CSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed premature script execution Created 4 years, 7 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 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 // For non-HTML there is no body so resume as soon as the sheets are loa ded. 3067 // For non-HTML there is no body so resume as soon as the sheets are loa ded.
3068 beginLifecycleUpdatesIfRenderingReady(); 3068 beginLifecycleUpdatesIfRenderingReady();
3069 } 3069 }
3070 3070
3071 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 3071 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
3072 view()->processUrlFragment(m_url); 3072 view()->processUrlFragment(m_url);
3073 } 3073 }
3074 3074
3075 void Document::executeScriptsWaitingForResources() 3075 void Document::executeScriptsWaitingForResources()
3076 { 3076 {
3077 if (!isRenderingReady()) 3077 if (!isScriptExecutionReady())
3078 return; 3078 return;
3079 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 3079 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
3080 parser->executeScriptsWaitingForResources(); 3080 parser->executeScriptsWaitingForResources();
3081 } 3081 }
3082 3082
3083 CSSStyleSheet& Document::elementSheet() 3083 CSSStyleSheet& Document::elementSheet()
3084 { 3084 {
3085 if (!m_elemSheet) 3085 if (!m_elemSheet)
3086 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 3086 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
3087 return *m_elemSheet; 3087 return *m_elemSheet;
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
5649 nodesToAddToChain[i]->setHovered(true); 5649 nodesToAddToChain[i]->setHovered(true);
5650 } 5650 }
5651 } 5651 }
5652 } 5652 }
5653 5653
5654 bool Document::haveStylesheetsLoaded() const 5654 bool Document::haveStylesheetsLoaded() const
5655 { 5655 {
5656 return m_styleEngine->haveStylesheetsLoaded(); 5656 return m_styleEngine->haveStylesheetsLoaded();
5657 } 5657 }
5658 5658
5659 bool Document::haveRenderBlockingStylesheetsLoaded() const
5660 {
5661 if (RuntimeEnabledFeatures::cssInBodyDoesNotBlockPaintEnabled())
5662 return m_styleEngine->haveRenderBlockingStylesheetsLoaded();
5663 return m_styleEngine->haveStylesheetsLoaded();
5664 }
5665
5659 Locale& Document::getCachedLocale(const AtomicString& locale) 5666 Locale& Document::getCachedLocale(const AtomicString& locale)
5660 { 5667 {
5661 AtomicString localeKey = locale; 5668 AtomicString localeKey = locale;
5662 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr olUIEnabled()) 5669 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr olUIEnabled())
5663 return Locale::defaultLocale(); 5670 return Locale::defaultLocale();
5664 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr); 5671 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr);
5665 if (result.isNewEntry) 5672 if (result.isNewEntry)
5666 result.storedValue->value = Locale::create(localeKey); 5673 result.storedValue->value = Locale::create(localeKey);
5667 return *(result.storedValue->value); 5674 return *(result.storedValue->value);
5668 } 5675 }
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5974 #ifndef NDEBUG 5981 #ifndef NDEBUG
5975 using namespace blink; 5982 using namespace blink;
5976 void showLiveDocumentInstances() 5983 void showLiveDocumentInstances()
5977 { 5984 {
5978 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5985 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5979 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5986 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5980 for (Document* document : set) 5987 for (Document* document : set)
5981 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 5988 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
5982 } 5989 }
5983 #endif 5990 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698