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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (applyAuthorStyles() == value) | 201 if (applyAuthorStyles() == value) |
202 return; | 202 return; |
203 | 203 |
204 m_applyAuthorStyles = value; | 204 m_applyAuthorStyles = value; |
205 if (!isActive()) | 205 if (!isActive()) |
206 return; | 206 return; |
207 | 207 |
208 ASSERT(host()); | 208 ASSERT(host()); |
209 ASSERT(host()->shadow()); | 209 ASSERT(host()->shadow()); |
210 if (host()->shadow()->didAffectApplyAuthorStyles()) | 210 if (host()->shadow()->didAffectApplyAuthorStyles()) |
211 host()->setNeedsStyleRecalc(); | 211 host()->setNeedsStyleRecalc(SubtreeStyleChange); |
212 | 212 |
213 // Since styles in shadow trees can select shadow hosts, set shadow host's n
eeds-recalc flag true. | 213 // Since styles in shadow trees can select shadow hosts, set shadow host's n
eeds-recalc flag true. |
214 // FIXME: host->setNeedsStyleRecalc() should take care of all elements in it
s shadow tree. | 214 // FIXME: host->setNeedsStyleRecalc() should take care of all elements in it
s shadow tree. |
215 // However, when host's recalcStyle is skipped (i.e. host's parent has no re
nderer), | 215 // However, when host's recalcStyle is skipped (i.e. host's parent has no re
nderer), |
216 // no recalc style is invoked for any elements in its shadow tree. | 216 // no recalc style is invoked for any elements in its shadow tree. |
217 // This problem occurs when using getComputedStyle() API. | 217 // This problem occurs when using getComputedStyle() API. |
218 // So currently host and shadow root's needsStyleRecalc flags are set to be
true. | 218 // So currently host and shadow root's needsStyleRecalc flags are set to be
true. |
219 setNeedsStyleRecalc(); | 219 setNeedsStyleRecalc(SubtreeStyleChange); |
220 } | 220 } |
221 | 221 |
222 void ShadowRoot::setResetStyleInheritance(bool value) | 222 void ShadowRoot::setResetStyleInheritance(bool value) |
223 { | 223 { |
224 if (isOrphan()) | 224 if (isOrphan()) |
225 return; | 225 return; |
226 | 226 |
227 if (value == resetStyleInheritance()) | 227 if (value == resetStyleInheritance()) |
228 return; | 228 return; |
229 | 229 |
230 m_resetStyleInheritance = value; | 230 m_resetStyleInheritance = value; |
231 if (!isActive()) | 231 if (!isActive()) |
232 return; | 232 return; |
233 | 233 |
234 setNeedsStyleRecalc(); | 234 setNeedsStyleRecalc(SubtreeStyleChange); |
235 } | 235 } |
236 | 236 |
237 void ShadowRoot::attach(const AttachContext& context) | 237 void ShadowRoot::attach(const AttachContext& context) |
238 { | 238 { |
239 StyleResolver& styleResolver = document().ensureStyleResolver(); | 239 StyleResolver& styleResolver = document().ensureStyleResolver(); |
240 styleResolver.pushParentShadowRoot(*this); | 240 styleResolver.pushParentShadowRoot(*this); |
241 DocumentFragment::attach(context); | 241 DocumentFragment::attach(context); |
242 styleResolver.popParentShadowRoot(*this); | 242 styleResolver.popParentShadowRoot(*this); |
243 } | 243 } |
244 | 244 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 StyleSheetList* ShadowRoot::styleSheets() | 402 StyleSheetList* ShadowRoot::styleSheets() |
403 { | 403 { |
404 if (!ensureShadowRootRareData()->styleSheets()) | 404 if (!ensureShadowRootRareData()->styleSheets()) |
405 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 405 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
406 | 406 |
407 return m_shadowRootRareData->styleSheets(); | 407 return m_shadowRootRareData->styleSheets(); |
408 } | 408 } |
409 | 409 |
410 } | 410 } |
OLD | NEW |