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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (!shadowRoot->containsShadowElements()) | 205 if (!shadowRoot->containsShadowElements()) |
206 return false; | 206 return false; |
207 return true; | 207 return true; |
208 } | 208 } |
209 | 209 |
210 void ShadowRoot::setApplyAuthorStyles(bool value) | 210 void ShadowRoot::setApplyAuthorStyles(bool value) |
211 { | 211 { |
212 if (isOrphan()) | 212 if (isOrphan()) |
213 return; | 213 return; |
214 | 214 |
215 if (m_applyAuthorStyles == value) | 215 if (applyAuthorStyles() == value) |
216 return; | 216 return; |
217 | 217 |
218 m_applyAuthorStyles = value; | 218 m_applyAuthorStyles = value; |
219 if (!isActive()) | 219 if (!isActive()) |
220 return; | 220 return; |
221 | 221 |
222 ASSERT(host()); | 222 ASSERT(host()); |
223 ASSERT(host()->shadow()); | 223 ASSERT(host()->shadow()); |
224 if (host()->shadow()->didAffectApplyAuthorStyles()) | 224 if (host()->shadow()->didAffectApplyAuthorStyles()) |
225 host()->setNeedsStyleRecalc(); | 225 host()->setNeedsStyleRecalc(); |
226 | 226 |
227 // Since styles in shadow trees can select shadow hosts, set shadow host's n
eeds-recalc flag true. | 227 // Since styles in shadow trees can select shadow hosts, set shadow host's n
eeds-recalc flag true. |
228 // FIXME: host->setNeedsStyleRecalc() should take care of all elements in it
s shadow tree. | 228 // FIXME: host->setNeedsStyleRecalc() should take care of all elements in it
s shadow tree. |
229 // However, when host's recalcStyle is skipped (i.e. host's parent has no re
nderer), | 229 // However, when host's recalcStyle is skipped (i.e. host's parent has no re
nderer), |
230 // no recalc style is invoked for any elements in its shadow tree. | 230 // no recalc style is invoked for any elements in its shadow tree. |
231 // This problem occurs when using getComputedStyle() API. | 231 // This problem occurs when using getComputedStyle() API. |
232 // So currently host and shadow root's needsStyleRecalc flags are set to be
true. | 232 // So currently host and shadow root's needsStyleRecalc flags are set to be
true. |
233 setNeedsStyleRecalc(); | 233 setNeedsStyleRecalc(); |
234 } | 234 } |
235 | 235 |
236 void ShadowRoot::setResetStyleInheritance(bool value) | 236 void ShadowRoot::setResetStyleInheritance(bool value) |
237 { | 237 { |
238 if (isOrphan()) | 238 if (isOrphan()) |
239 return; | 239 return; |
240 | 240 |
241 if (value == m_resetStyleInheritance) | 241 if (value == resetStyleInheritance()) |
242 return; | 242 return; |
243 | 243 |
244 m_resetStyleInheritance = value; | 244 m_resetStyleInheritance = value; |
245 if (!isActive()) | 245 if (!isActive()) |
246 return; | 246 return; |
247 | 247 |
248 setNeedsStyleRecalc(); | 248 setNeedsStyleRecalc(); |
249 } | 249 } |
250 | 250 |
251 void ShadowRoot::attach(const AttachContext& context) | 251 void ShadowRoot::attach(const AttachContext& context) |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 415 |
416 StyleSheetList* ShadowRoot::styleSheets() | 416 StyleSheetList* ShadowRoot::styleSheets() |
417 { | 417 { |
418 if (!ensureShadowRootRareData()->styleSheets()) | 418 if (!ensureShadowRootRareData()->styleSheets()) |
419 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); | 419 m_shadowRootRareData->setStyleSheets(StyleSheetList::create(this)); |
420 | 420 |
421 return m_shadowRootRareData->styleSheets(); | 421 return m_shadowRootRareData->styleSheets(); |
422 } | 422 } |
423 | 423 |
424 } | 424 } |
OLD | NEW |