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

Side by Side Diff: Source/WebCore/dom/DocumentStyleSheetCollection.cpp

Issue 11471034: Merge 136878 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years 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
« no previous file with comments | « Source/WebCore/dom/DocumentStyleSheetCollection.h ('k') | Source/WebCore/testing/Internals.h » ('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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DocumentStyleSheetCollection::~DocumentStyleSheetCollection() 74 DocumentStyleSheetCollection::~DocumentStyleSheetCollection()
75 { 75 {
76 if (m_pageUserSheet) 76 if (m_pageUserSheet)
77 m_pageUserSheet->clearOwnerNode(); 77 m_pageUserSheet->clearOwnerNode();
78 for (unsigned i = 0; i < m_injectedUserStyleSheets.size(); ++i) 78 for (unsigned i = 0; i < m_injectedUserStyleSheets.size(); ++i)
79 m_injectedUserStyleSheets[i]->clearOwnerNode(); 79 m_injectedUserStyleSheets[i]->clearOwnerNode();
80 for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i) 80 for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i)
81 m_injectedAuthorStyleSheets[i]->clearOwnerNode(); 81 m_injectedAuthorStyleSheets[i]->clearOwnerNode();
82 for (unsigned i = 0; i < m_userStyleSheets.size(); ++i) 82 for (unsigned i = 0; i < m_userStyleSheets.size(); ++i)
83 m_userStyleSheets[i]->clearOwnerNode(); 83 m_userStyleSheets[i]->clearOwnerNode();
84 for (unsigned i = 0; i < m_authorStyleSheets.size(); ++i)
85 m_authorStyleSheets[i]->clearOwnerNode();
84 } 86 }
85 87
86 void DocumentStyleSheetCollection::combineCSSFeatureFlags() 88 void DocumentStyleSheetCollection::combineCSSFeatureFlags()
87 { 89 {
88 // Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/afte r). 90 // Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/afte r).
89 StyleResolver* styleResolver = m_document->styleResolver(); 91 StyleResolver* styleResolver = m_document->styleResolver();
90 m_usesSiblingRules = m_usesSiblingRules || styleResolver->usesSiblingRules() ; 92 m_usesSiblingRules = m_usesSiblingRules || styleResolver->usesSiblingRules() ;
91 m_usesFirstLineRules = m_usesFirstLineRules || styleResolver->usesFirstLineR ules(); 93 m_usesFirstLineRules = m_usesFirstLineRules || styleResolver->usesFirstLineR ules();
92 m_usesBeforeAfterRules = m_usesBeforeAfterRules || styleResolver->usesBefore AfterRules(); 94 m_usesBeforeAfterRules = m_usesBeforeAfterRules || styleResolver->usesBefore AfterRules();
93 } 95 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 186 }
185 } 187 }
186 } 188 }
187 189
188 void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache() 190 void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache()
189 { 191 {
190 m_injectedStyleSheetCacheValid = false; 192 m_injectedStyleSheetCacheValid = false;
191 m_document->styleResolverChanged(DeferRecalcStyle); 193 m_document->styleResolverChanged(DeferRecalcStyle);
192 } 194 }
193 195
196 void DocumentStyleSheetCollection::addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet)
197 {
198 ASSERT(!authorSheet->isUserStyleSheet());
199 m_authorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_document));
200 m_document->styleResolverChanged(RecalcStyleImmediately);
201 }
202
194 void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> u serSheet) 203 void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> u serSheet)
195 { 204 {
196 ASSERT(userSheet->isUserStyleSheet()); 205 ASSERT(userSheet->isUserStyleSheet());
197 m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document)); 206 m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document));
198 m_document->styleResolverChanged(RecalcStyleImmediately); 207 m_document->styleResolverChanged(RecalcStyleImmediately);
199 } 208 }
200 209
201 // This method is called whenever a top-level stylesheet has finished loading. 210 // This method is called whenever a top-level stylesheet has finished loading.
202 void DocumentStyleSheetCollection::removePendingSheet(RemovePendingSheetNotifica tionType notification) 211 void DocumentStyleSheetCollection::removePendingSheet(RemovePendingSheetNotifica tionType notification)
203 { 212 {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 458
450 } 459 }
451 if (!m_document->renderer() || !m_document->attached()) 460 if (!m_document->renderer() || !m_document->attached())
452 return false; 461 return false;
453 462
454 Vector<RefPtr<StyleSheet> > activeStyleSheets; 463 Vector<RefPtr<StyleSheet> > activeStyleSheets;
455 collectActiveStyleSheets(activeStyleSheets); 464 collectActiveStyleSheets(activeStyleSheets);
456 465
457 Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; 466 Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
458 activeCSSStyleSheets.append(injectedAuthorStyleSheets()); 467 activeCSSStyleSheets.append(injectedAuthorStyleSheets());
468 activeCSSStyleSheets.append(documentAuthorStyleSheets());
459 collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_docum ent); 469 collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, m_docum ent);
460 filterEnabledCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets); 470 filterEnabledCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets);
461 471
462 StyleResolverUpdateType styleResolverUpdateType; 472 StyleResolverUpdateType styleResolverUpdateType;
463 bool requiresFullStyleRecalc; 473 bool requiresFullStyleRecalc;
464 analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, styleResolverUpdat eType, requiresFullStyleRecalc); 474 analyzeStyleSheetChange(updateFlag, activeCSSStyleSheets, styleResolverUpdat eType, requiresFullStyleRecalc);
465 475
466 if (styleResolverUpdateType == Reconstruct) 476 if (styleResolverUpdateType == Reconstruct)
467 m_document->clearStyleResolver(); 477 m_document->clearStyleResolver();
468 else { 478 else {
(...skipping 18 matching lines...) Expand all
487 return requiresFullStyleRecalc; 497 return requiresFullStyleRecalc;
488 } 498 }
489 499
490 void DocumentStyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObj ectInfo) const 500 void DocumentStyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObj ectInfo) const
491 { 501 {
492 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 502 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
493 info.addMember(m_pageUserSheet); 503 info.addMember(m_pageUserSheet);
494 info.addMember(m_injectedUserStyleSheets); 504 info.addMember(m_injectedUserStyleSheets);
495 info.addMember(m_injectedAuthorStyleSheets); 505 info.addMember(m_injectedAuthorStyleSheets);
496 info.addMember(m_userStyleSheets); 506 info.addMember(m_userStyleSheets);
507 info.addMember(m_authorStyleSheets);
497 info.addMember(m_activeAuthorStyleSheets); 508 info.addMember(m_activeAuthorStyleSheets);
498 info.addMember(m_styleSheetsForStyleSheetList); 509 info.addMember(m_styleSheetsForStyleSheetList);
499 info.addMember(m_styleSheetCandidateNodes); 510 info.addMember(m_styleSheetCandidateNodes);
500 info.addMember(m_preferredStylesheetSetName); 511 info.addMember(m_preferredStylesheetSetName);
501 info.addMember(m_selectedStylesheetSetName); 512 info.addMember(m_selectedStylesheetSetName);
502 } 513 }
503 514
504 } 515 }
OLDNEW
« no previous file with comments | « Source/WebCore/dom/DocumentStyleSheetCollection.h ('k') | Source/WebCore/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698