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

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

Issue 23601011: Have StyleResolver / StyleResolverState deal with Document references, not pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update StyleResolverState as well Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.cpp ('k') | Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 goto bailOut; 1646 goto bailOut;
1647 1647
1648 if (styleChangeType() >= SubtreeStyleChange) 1648 if (styleChangeType() >= SubtreeStyleChange)
1649 change = Force; 1649 change = Force;
1650 1650
1651 // Recalculating the root style (on the document) is not needed in the c ommon case. 1651 // Recalculating the root style (on the document) is not needed in the c ommon case.
1652 if ((change == Force) || (shouldDisplaySeamlesslyWithParent() && (change >= Inherit))) { 1652 if ((change == Force) || (shouldDisplaySeamlesslyWithParent() && (change >= Inherit))) {
1653 // style selector may set this again during recalc 1653 // style selector may set this again during recalc
1654 m_hasNodesWithPlaceholderStyle = false; 1654 m_hasNodesWithPlaceholderStyle = false;
1655 1655
1656 RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument( this, m_styleResolver ? m_styleResolver->fontSelector() : 0); 1656 RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument( *this, m_styleResolver ? m_styleResolver->fontSelector() : 0);
1657 StyleChange ch = Node::diff(documentStyle.get(), renderer()->style() , this); 1657 StyleChange ch = Node::diff(documentStyle.get(), renderer()->style() , this);
1658 if (ch != NoChange) 1658 if (ch != NoChange)
1659 renderer()->setStyle(documentStyle.release()); 1659 renderer()->setStyle(documentStyle.release());
1660 } 1660 }
1661 1661
1662 for (Node* n = firstChild(); n; n = n->nextSibling()) { 1662 for (Node* n = firstChild(); n; n = n->nextSibling()) {
1663 if (!n->isElementNode()) 1663 if (!n->isElementNode())
1664 continue; 1664 continue;
1665 Element* element = toElement(n); 1665 Element* element = toElement(n);
1666 if (shouldRecalcStyle(change, element)) 1666 if (shouldRecalcStyle(change, element))
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 1858
1859 setSecurityOrigin(SecurityOrigin::createUnique()); 1859 setSecurityOrigin(SecurityOrigin::createUnique());
1860 didUpdateSecurityOrigin(); 1860 didUpdateSecurityOrigin();
1861 } 1861 }
1862 1862
1863 void Document::createStyleResolver() 1863 void Document::createStyleResolver()
1864 { 1864 {
1865 bool matchAuthorAndUserStyles = true; 1865 bool matchAuthorAndUserStyles = true;
1866 if (Settings* docSettings = settings()) 1866 if (Settings* docSettings = settings())
1867 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); 1867 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled();
1868 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles) ); 1868 m_styleResolver = adoptPtr(new StyleResolver(*this, matchAuthorAndUserStyles ));
1869 m_styleSheetCollections->combineCSSFeatureFlags(m_styleResolver->ruleFeature Set()); 1869 m_styleSheetCollections->combineCSSFeatureFlags(m_styleResolver->ruleFeature Set());
1870 } 1870 }
1871 1871
1872 void Document::clearStyleResolver() 1872 void Document::clearStyleResolver()
1873 { 1873 {
1874 m_styleResolver.clear(); 1874 m_styleResolver.clear();
1875 } 1875 }
1876 1876
1877 void Document::attach(const AttachContext& context) 1877 void Document::attach(const AttachContext& context)
1878 { 1878 {
(...skipping 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after
5294 { 5294 {
5295 return DocumentLifecycleNotifier::create(this); 5295 return DocumentLifecycleNotifier::create(this);
5296 } 5296 }
5297 5297
5298 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5298 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5299 { 5299 {
5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5300 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5301 } 5301 }
5302 5302
5303 } // namespace WebCore 5303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.cpp ('k') | Source/core/html/HTMLLinkElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698