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

Side by Side Diff: sky/engine/core/css/CSSStyleSheet.cpp

Issue 718873003: Remove most of config.h (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/css/CSSRule.cpp ('k') | sky/engine/core/css/CSSValue.cpp » ('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 * (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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 virtual void trace(Visitor* visitor) override 48 virtual void trace(Visitor* visitor) override
49 { 49 {
50 visitor->trace(m_styleSheet); 50 visitor->trace(m_styleSheet);
51 CSSRuleList::trace(visitor); 51 CSSRuleList::trace(visitor);
52 } 52 }
53 53
54 private: 54 private:
55 StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } 55 StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { }
56 56
57 #if !ENABLE(OILPAN)
58 virtual void ref() override { m_styleSheet->ref(); } 57 virtual void ref() override { m_styleSheet->ref(); }
59 virtual void deref() override { m_styleSheet->deref(); } 58 virtual void deref() override { m_styleSheet->deref(); }
60 #endif
61 59
62 virtual unsigned length() const override { return m_styleSheet->length(); } 60 virtual unsigned length() const override { return m_styleSheet->length(); }
63 virtual CSSRule* item(unsigned index) const override { return m_styleSheet-> item(index); } 61 virtual CSSRule* item(unsigned index) const override { return m_styleSheet-> item(index); }
64 62
65 virtual CSSStyleSheet* styleSheet() const override { return m_styleSheet; } 63 virtual CSSStyleSheet* styleSheet() const override { return m_styleSheet; }
66 64
67 RawPtr<CSSStyleSheet> m_styleSheet; 65 RawPtr<CSSStyleSheet> m_styleSheet;
68 }; 66 };
69 67
70 #if ENABLE(ASSERT) 68 #if ENABLE(ASSERT)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 ASSERT(isAcceptableCSSStyleSheetParent(ownerNode)); 115 ASSERT(isAcceptableCSSStyleSheetParent(ownerNode));
118 m_contents->registerClient(this); 116 m_contents->registerClient(this);
119 } 117 }
120 118
121 CSSStyleSheet::~CSSStyleSheet() 119 CSSStyleSheet::~CSSStyleSheet()
122 { 120 {
123 // With oilpan the parent style sheet pointer is strong and the sheet and 121 // With oilpan the parent style sheet pointer is strong and the sheet and
124 // its RuleCSSOMWrappers die together and we don't need to clear them here. 122 // its RuleCSSOMWrappers die together and we don't need to clear them here.
125 // Also with oilpan the StyleSheetContents client pointers are weak and 123 // Also with oilpan the StyleSheetContents client pointers are weak and
126 // therefore do not need to be cleared here. 124 // therefore do not need to be cleared here.
127 #if !ENABLE(OILPAN)
128 // For style rules outside the document, .parentStyleSheet can become null e ven if the style rule 125 // For style rules outside the document, .parentStyleSheet can become null e ven if the style rule
129 // is still observable from JavaScript. This matches the behavior of .parent Node for nodes, but 126 // is still observable from JavaScript. This matches the behavior of .parent Node for nodes, but
130 // it's not ideal because it makes the CSSOM's behavior depend on the timing of garbage collection. 127 // it's not ideal because it makes the CSSOM's behavior depend on the timing of garbage collection.
131 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) { 128 for (unsigned i = 0; i < m_childRuleCSSOMWrappers.size(); ++i) {
132 if (m_childRuleCSSOMWrappers[i]) 129 if (m_childRuleCSSOMWrappers[i])
133 m_childRuleCSSOMWrappers[i]->setParentStyleSheet(0); 130 m_childRuleCSSOMWrappers[i]->setParentStyleSheet(0);
134 } 131 }
135 132
136 if (m_mediaCSSOMWrapper) 133 if (m_mediaCSSOMWrapper)
137 m_mediaCSSOMWrapper->clearParentStyleSheet(); 134 m_mediaCSSOMWrapper->clearParentStyleSheet();
138 135
139 m_contents->unregisterClient(this); 136 m_contents->unregisterClient(this);
140 #endif
141 } 137 }
142 138
143 void CSSStyleSheet::willMutateRules() 139 void CSSStyleSheet::willMutateRules()
144 { 140 {
145 // If we are the only client it is safe to mutate. 141 // If we are the only client it is safe to mutate.
146 if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) { 142 if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) {
147 m_contents->clearRuleSet(); 143 m_contents->clearRuleSet();
148 if (Document* document = ownerDocument()) 144 if (Document* document = ownerDocument())
149 m_contents->removeSheetFromCache(document); 145 m_contents->removeSheetFromCache(document);
150 m_contents->setMutable(); 146 m_contents->setMutable();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 visitor->trace(m_contents); 352 visitor->trace(m_contents);
357 visitor->trace(m_mediaQueries); 353 visitor->trace(m_mediaQueries);
358 visitor->trace(m_ownerNode); 354 visitor->trace(m_ownerNode);
359 visitor->trace(m_mediaCSSOMWrapper); 355 visitor->trace(m_mediaCSSOMWrapper);
360 visitor->trace(m_childRuleCSSOMWrappers); 356 visitor->trace(m_childRuleCSSOMWrappers);
361 visitor->trace(m_ruleListCSSOMWrapper); 357 visitor->trace(m_ruleListCSSOMWrapper);
362 StyleSheet::trace(visitor); 358 StyleSheet::trace(visitor);
363 } 359 }
364 360
365 } // namespace blink 361 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSRule.cpp ('k') | sky/engine/core/css/CSSValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698