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

Side by Side Diff: sky/engine/core/dom/DocumentStyleSheetCollection.cpp

Issue 774953002: Always Reconstruct when stylesheets change. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 } 61 }
62 62
63 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Docum entStyleSheetCollector& collector) 63 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* engine, Docum entStyleSheetCollector& collector)
64 { 64 {
65 ASSERT(document().styleEngine() == engine); 65 ASSERT(document().styleEngine() == engine);
66 collector.appendActiveStyleSheets(engine->documentAuthorStyleSheets()); 66 collector.appendActiveStyleSheets(engine->documentAuthorStyleSheets());
67 collectStyleSheetsFromCandidates(engine, collector); 67 collectStyleSheetsFromCandidates(engine, collector);
68 } 68 }
69 69
70 void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine, StyleResolverUpdateMode updateMode) 70 void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine)
71 { 71 {
72 StyleSheetCollection collection; 72 StyleSheetCollection collection;
73 ActiveDocumentStyleSheetCollector collector(collection); 73 ActiveDocumentStyleSheetCollector collector(collection);
74 collectStyleSheets(engine, collector); 74 collectStyleSheets(engine, collector);
75 75
76 StyleSheetChange change; 76 engine->clearMasterResolver();
77 analyzeStyleSheetChange(updateMode, collection, change); 77 // FIMXE: The following depends on whether StyleRuleFontFace was modified or not.
78 // No need to always-clear font cache.
79 engine->clearFontCache();
78 80
79 if (change.styleResolverUpdateType == Reconstruct) { 81 // TODO(esprehn): This is terrible and not needed in Sky, we should mark
80 engine->clearMasterResolver(); 82 // specific tree scopes dirty instead.
81 // FIMXE: The following depends on whether StyleRuleFontFace was modifie d or not. 83 document().setNeedsStyleRecalc(SubtreeStyleChange);
82 // No need to always-clear font cache.
83 engine->clearFontCache();
84 } else if (StyleResolver* styleResolver = engine->resolver()) {
85 if (change.styleResolverUpdateType != Additive) {
86 ASSERT(change.styleResolverUpdateType == Reset);
87 styleResolver->resetAuthorStyle(treeScope());
88 engine->removeFontFaceRules(change.fontFaceRulesToRemove);
89 styleResolver->removePendingAuthorStyleSheets(m_activeAuthorStyleShe ets);
90 styleResolver->lazyAppendAuthorStyleSheets(0, collection.activeAutho rStyleSheets());
91 } else {
92 styleResolver->lazyAppendAuthorStyleSheets(m_activeAuthorStyleSheets .size(), collection.activeAuthorStyleSheets());
93 }
94 }
95 if (change.requiresFullStyleRecalc)
96 document().setNeedsStyleRecalc(SubtreeStyleChange);
97 84
98 collection.swap(*this); 85 collection.swap(*this);
99 86
100 updateUsesRemUnits(); 87 updateUsesRemUnits();
101 } 88 }
102 89
103 } 90 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/DocumentStyleSheetCollection.h ('k') | sky/engine/core/dom/ShadowTreeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698