OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (child->renderer()) | 164 if (child->renderer()) |
165 lastTextNode = 0; | 165 lastTextNode = 0; |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 styleResolver.popParentShadowRoot(*this); | 169 styleResolver.popParentShadowRoot(*this); |
170 | 170 |
171 clearChildNeedsStyleRecalc(); | 171 clearChildNeedsStyleRecalc(); |
172 } | 172 } |
173 | 173 |
174 bool ShadowRoot::isActiveForStyling() const | |
175 { | |
176 if (!youngerShadowRoot()) | |
177 return true; | |
178 | |
179 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) { | |
180 if (point->containingShadowRoot()) | |
181 return true; | |
182 } | |
183 return false; | |
184 } | |
185 | |
186 void ShadowRoot::setApplyAuthorStyles(bool value) | 174 void ShadowRoot::setApplyAuthorStyles(bool value) |
187 { | 175 { |
188 if (isOrphan()) | 176 if (isOrphan()) |
189 return; | 177 return; |
190 | 178 |
191 if (applyAuthorStyles() == value) | 179 if (applyAuthorStyles() == value) |
192 return; | 180 return; |
193 | 181 |
194 m_applyAuthorStyles = value; | 182 m_applyAuthorStyles = value; |
195 if (!isActiveForStyling()) | |
196 return; | |
197 | 183 |
198 ASSERT(host()); | 184 ASSERT(host()); |
199 ASSERT(host()->shadow()); | 185 ASSERT(host()->shadow()); |
200 if (host()->shadow()->didAffectApplyAuthorStyles()) | 186 if (host()->shadow()->didAffectApplyAuthorStyles()) |
201 host()->setNeedsStyleRecalc(SubtreeStyleChange); | 187 host()->setNeedsStyleRecalc(SubtreeStyleChange); |
202 | 188 |
203 // Since styles in shadow trees can select shadow hosts, set shadow host's n
eeds-recalc flag true. | 189 // Since styles in shadow trees can select shadow hosts, set shadow host's n
eeds-recalc flag true. |
204 // FIXME: host->setNeedsStyleRecalc() should take care of all elements in it
s shadow tree. | 190 // FIXME: host->setNeedsStyleRecalc() should take care of all elements in it
s shadow tree. |
205 // However, when host's recalcStyle is skipped (i.e. host's parent has no re
nderer), | 191 // However, when host's recalcStyle is skipped (i.e. host's parent has no re
nderer), |
206 // no recalc style is invoked for any elements in its shadow tree. | 192 // no recalc style is invoked for any elements in its shadow tree. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 362 |
377 StyleSheetList* ShadowRoot::styleSheets() | 363 StyleSheetList* ShadowRoot::styleSheets() |
378 { | 364 { |
379 if (!ensureShadowRootRareData()->styleSheets()) | 365 if (!ensureShadowRootRareData()->styleSheets()) |
380 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 366 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
381 | 367 |
382 return m_shadowRootRareData->styleSheets(); | 368 return m_shadowRootRareData->styleSheets(); |
383 } | 369 } |
384 | 370 |
385 } | 371 } |
OLD | NEW |