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

Side by Side Diff: Source/core/css/CSSStyleSheet.cpp

Issue 27537009: Avoid always style recalc when removing stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // Any existing CSSOM wrappers need to be connected to the copied child rule s. 143 // Any existing CSSOM wrappers need to be connected to the copied child rule s.
144 reattachChildRuleCSSOMWrappers(); 144 reattachChildRuleCSSOMWrappers();
145 } 145 }
146 146
147 void CSSStyleSheet::didMutateRules() 147 void CSSStyleSheet::didMutateRules()
148 { 148 {
149 ASSERT(m_contents->isMutable()); 149 ASSERT(m_contents->isMutable());
150 ASSERT(m_contents->hasOneClient()); 150 ASSERT(m_contents->hasOneClient());
151 151
152 didMutate(); 152 didMutate(PartialRuleUpdate);
153 } 153 }
154 154
155 void CSSStyleSheet::didMutate() 155 void CSSStyleSheet::didMutate(StyleSheetUpdateType updateType)
156 { 156 {
157 Document* owner = ownerDocument(); 157 Document* owner = ownerDocument();
158 if (!owner) 158 if (!owner)
159 return; 159 return;
160 owner->modifiedStyleSheet(this); 160
161 // Need FullStyleUpdate when insertRule or deleteRule,
162 // because StyleSheetCollection::analyzeStyleSheetChange cannot detect parti al rule update.
163 StyleResolverUpdateMode updateMode = updateType != PartialRuleUpdate ? Analy zedStyleUpdate : FullStyleUpdate;
164 owner->modifiedStyleSheet(this, RecalcStyleDeferred, updateMode);
161 } 165 }
162 166
163 void CSSStyleSheet::reattachChildRuleCSSOMWrappers() 167 void CSSStyleSheet::reattachChildRuleCSSOMWrappers()
164 { 168 {
165 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { 169 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {
166 if (!m_childRuleCSSOMWrappers[i]) 170 if (!m_childRuleCSSOMWrappers[i])
167 continue; 171 continue;
168 m_childRuleCSSOMWrappers[i]->reattach(m_contents->ruleAt(i)); 172 m_childRuleCSSOMWrappers[i]->reattach(m_contents->ruleAt(i));
169 } 173 }
170 } 174 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 root = root->parentStyleSheet(); 363 root = root->parentStyleSheet();
360 return root->ownerNode() ? &root->ownerNode()->document() : 0; 364 return root->ownerNode() ? &root->ownerNode()->document() : 0;
361 } 365 }
362 366
363 void CSSStyleSheet::clearChildRuleCSSOMWrappers() 367 void CSSStyleSheet::clearChildRuleCSSOMWrappers()
364 { 368 {
365 m_childRuleCSSOMWrappers.clear(); 369 m_childRuleCSSOMWrappers.clear();
366 } 370 }
367 371
368 } 372 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698