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

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

Issue 1769903002: Move preferred stylesheet logic into StyleEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 continue; 55 continue;
56 if (collector.hasVisited(document)) 56 if (collector.hasVisited(document))
57 continue; 57 continue;
58 collector.willVisit(document); 58 collector.willVisit(document);
59 document->styleEngine().updateStyleSheetsInImport(collector); 59 document->styleEngine().updateStyleSheetsInImport(collector);
60 continue; 60 continue;
61 } 61 }
62 62
63 if (candidate.isEnabledAndLoading()) { 63 if (candidate.isEnabledAndLoading()) {
64 // it is loading but we should still decide which style sheet set to use 64 // it is loading but we should still decide which style sheet set to use
65 if (candidate.hasPreferrableName(engine.preferredStylesheetSetName() )) 65 if (candidate.hasPreferrableName())
66 engine.selectStylesheetSetName(candidate.title()); 66 engine.setPreferredStylesheetSetNameIfNotSet(candidate.title());
67 continue; 67 continue;
68 } 68 }
69 69
70 StyleSheet* sheet = candidate.sheet(); 70 StyleSheet* sheet = candidate.sheet();
71 if (!sheet) 71 if (!sheet)
72 continue; 72 continue;
73 73
74 if (candidate.hasPreferrableName(engine.preferredStylesheetSetName())) 74 if (candidate.hasPreferrableName())
75 engine.selectStylesheetSetName(candidate.title()); 75 engine.setPreferredStylesheetSetNameIfNotSet(candidate.title());
76 collector.appendSheetForList(sheet); 76 collector.appendSheetForList(sheet);
77 if (candidate.canBeActivated(engine.preferredStylesheetSetName())) 77 if (candidate.canBeActivated(engine.preferredStylesheetSetName()))
78 collector.appendActiveStyleSheet(toCSSStyleSheet(sheet)); 78 collector.appendActiveStyleSheet(toCSSStyleSheet(sheet));
79 } 79 }
80 } 80 }
81 81
82 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Docum entStyleSheetCollector& collector) 82 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine& engine, Docum entStyleSheetCollector& collector)
83 { 83 {
84 ASSERT(&document().styleEngine() == &engine); 84 ASSERT(&document().styleEngine() == &engine);
85 collector.appendActiveStyleSheets(engine.injectedAuthorStyleSheets()); 85 collector.appendActiveStyleSheets(engine.injectedAuthorStyleSheets());
(...skipping 28 matching lines...) Expand all
114 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets()); 114 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets());
115 } 115 }
116 } 116 }
117 if (change.requiresFullStyleRecalc) 117 if (change.requiresFullStyleRecalc)
118 document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForT racing::create(StyleChangeReason::ActiveStylesheetsUpdate)); 118 document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForT racing::create(StyleChangeReason::ActiveStylesheetsUpdate));
119 119
120 collection.swap(*this); 120 collection.swap(*this);
121 } 121 }
122 122
123 } // namespace blink 123 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698