| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "core/css/resolver/ViewportStyleResolver.h" | 39 #include "core/css/resolver/ViewportStyleResolver.h" |
| 40 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 41 #include "core/dom/StyleEngine.h" | 41 #include "core/dom/StyleEngine.h" |
| 42 #include "core/dom/shadow/ElementShadow.h" | 42 #include "core/dom/shadow/ElementShadow.h" |
| 43 #include "core/dom/shadow/ShadowRoot.h" | 43 #include "core/dom/shadow/ShadowRoot.h" |
| 44 #include "core/html/HTMLStyleElement.h" | 44 #include "core/html/HTMLStyleElement.h" |
| 45 #include "core/svg/SVGStyleElement.h" | 45 #include "core/svg/SVGStyleElement.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 TreeScope* ScopedStyleResolver::treeScopeFor(Document& document, const CSSStyleS
heet* sheet) | |
| 50 { | |
| 51 ASSERT(sheet); | |
| 52 | |
| 53 if (!sheet->ownerDocument()) | |
| 54 return 0; | |
| 55 | |
| 56 Node* ownerNode = sheet->ownerNode(); | |
| 57 if (!isHTMLStyleElement(ownerNode) && !isSVGStyleElement(ownerNode)) | |
| 58 return &document; | |
| 59 | |
| 60 Element& styleElement = toElement(*ownerNode); | |
| 61 if (styleElement.isInShadowTree()) | |
| 62 return styleElement.containingShadowRoot(); | |
| 63 return &document; | |
| 64 } | |
| 65 | |
| 66 ScopedStyleResolver* ScopedStyleResolver::parent() const | 49 ScopedStyleResolver* ScopedStyleResolver::parent() const |
| 67 { | 50 { |
| 68 for (TreeScope* scope = treeScope().parentTreeScope(); scope; scope = scope-
>parentTreeScope()) { | 51 for (TreeScope* scope = treeScope().parentTreeScope(); scope; scope = scope-
>parentTreeScope()) { |
| 69 if (ScopedStyleResolver* resolver = scope->scopedStyleResolver()) | 52 if (ScopedStyleResolver* resolver = scope->scopedStyleResolver()) |
| 70 return resolver; | 53 return resolver; |
| 71 } | 54 } |
| 72 return 0; | 55 return 0; |
| 73 } | 56 } |
| 74 | 57 |
| 75 void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet) | 58 void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet) |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 229 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); |
| 247 } | 230 } |
| 248 | 231 |
| 249 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 232 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
| 250 { | 233 { |
| 251 visitor->trace(m_parentStyleSheet); | 234 visitor->trace(m_parentStyleSheet); |
| 252 visitor->trace(m_ruleSet); | 235 visitor->trace(m_ruleSet); |
| 253 } | 236 } |
| 254 | 237 |
| 255 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |