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