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

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

Issue 1913833002: Current work-in-progress crbug.com/567021 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed html import issue. Created 4 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 * (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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 m_contents->setMutable(); 152 m_contents->setMutable();
153 153
154 // Any existing CSSOM wrappers need to be connected to the copied child rules. 154 // Any existing CSSOM wrappers need to be connected to the copied child rules.
155 reattachChildRuleCSSOMWrappers(); 155 reattachChildRuleCSSOMWrappers();
156 } 156 }
157 157
158 void CSSStyleSheet::didMutateRules() { 158 void CSSStyleSheet::didMutateRules() {
159 DCHECK(m_contents->isMutable()); 159 DCHECK(m_contents->isMutable());
160 DCHECK_LE(m_contents->clientSize(), 1u); 160 DCHECK_LE(m_contents->clientSize(), 1u);
161 161
162 didMutate(PartialRuleUpdate); 162 didMutate();
163 } 163 }
164 164
165 void CSSStyleSheet::didMutate(StyleSheetUpdateType updateType) { 165 void CSSStyleSheet::didMutate() {
166 Document* owner = ownerDocument(); 166 Document* owner = ownerDocument();
167 if (!owner) 167 if (!owner)
168 return; 168 return;
169 169 if (ownerNode() && ownerNode()->isConnected())
170 // Need FullStyleUpdate when insertRule or deleteRule, 170 owner->styleEngine().setNeedsActiveStyleUpdate(ownerNode()->treeScope());
171 // because StyleSheetCollection::analyzeStyleSheetChange cannot detect partial
172 // rule update.
173 StyleResolverUpdateMode updateMode =
174 updateType != PartialRuleUpdate ? AnalyzedStyleUpdate : FullStyleUpdate;
175 owner->styleEngine().setNeedsActiveStyleUpdate(this, updateMode);
176 } 171 }
177 172
178 void CSSStyleSheet::reattachChildRuleCSSOMWrappers() { 173 void CSSStyleSheet::reattachChildRuleCSSOMWrappers() {
179 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { 174 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {
180 if (!m_childRuleCSSOMWrappers[i]) 175 if (!m_childRuleCSSOMWrappers[i])
181 continue; 176 continue;
182 m_childRuleCSSOMWrappers[i]->reattach(m_contents->ruleAt(i)); 177 m_childRuleCSSOMWrappers[i]->reattach(m_contents->ruleAt(i));
183 } 178 }
184 } 179 }
185 180
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 m_childRuleCSSOMWrappers.grow(ruleCount); 215 m_childRuleCSSOMWrappers.grow(ruleCount);
221 DCHECK_EQ(m_childRuleCSSOMWrappers.size(), ruleCount); 216 DCHECK_EQ(m_childRuleCSSOMWrappers.size(), ruleCount);
222 217
223 Member<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index]; 218 Member<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index];
224 if (!cssRule) 219 if (!cssRule)
225 cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this); 220 cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this);
226 return cssRule.get(); 221 return cssRule.get();
227 } 222 }
228 223
229 void CSSStyleSheet::clearOwnerNode() { 224 void CSSStyleSheet::clearOwnerNode() {
230 didMutate(EntireStyleSheetUpdate); 225 didMutate();
231 if (m_ownerNode) 226 if (m_ownerNode)
232 m_contents->unregisterClient(this); 227 m_contents->unregisterClient(this);
233 m_ownerNode = nullptr; 228 m_ownerNode = nullptr;
234 } 229 }
235 230
236 bool CSSStyleSheet::canAccessRules() const { 231 bool CSSStyleSheet::canAccessRules() const {
237 if (m_isInlineStylesheet) 232 if (m_isInlineStylesheet)
238 return true; 233 return true;
239 KURL baseURL = m_contents->baseURL(); 234 KURL baseURL = m_contents->baseURL();
240 if (baseURL.isEmpty()) 235 if (baseURL.isEmpty())
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 visitor->trace(m_deviceDependentMediaQueryResults); 433 visitor->trace(m_deviceDependentMediaQueryResults);
439 visitor->trace(m_ownerNode); 434 visitor->trace(m_ownerNode);
440 visitor->trace(m_ownerRule); 435 visitor->trace(m_ownerRule);
441 visitor->trace(m_mediaCSSOMWrapper); 436 visitor->trace(m_mediaCSSOMWrapper);
442 visitor->trace(m_childRuleCSSOMWrappers); 437 visitor->trace(m_childRuleCSSOMWrappers);
443 visitor->trace(m_ruleListCSSOMWrapper); 438 visitor->trace(m_ruleListCSSOMWrapper);
444 StyleSheet::trace(visitor); 439 StyleSheet::trace(visitor);
445 } 440 }
446 441
447 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheet.h ('k') | third_party/WebKit/Source/core/css/FontFaceSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698