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/dom/shadow/ElementShadow.h" | 39 #include "core/dom/shadow/ElementShadow.h" |
40 #include "core/dom/shadow/ShadowRoot.h" | 40 #include "core/dom/shadow/ShadowRoot.h" |
41 #include "core/html/HTMLStyleElement.h" | 41 #include "core/html/HTMLStyleElement.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 ContainerNode* ScopedStyleResolver::scopingNodeFor(Document& document, const CSS StyleSheet* sheet) | 45 ContainerNode* ScopedStyleResolver::scopingNodeFor(Document& document, const CSS StyleSheet* sheet) |
46 { | 46 { |
47 ASSERT(sheet); | 47 ASSERT(sheet); |
48 | 48 |
49 Document* sheetDocument = sheet->ownerDocument(); | |
50 if (!sheetDocument) | |
51 return 0; | |
tasak
2014/06/03 05:57:48
I think, this code is not related to style scoped.
kochi
2014/06/03 07:47:05
Thanks for the explanation.
I'll separate changes
| |
52 Node* ownerNode = sheet->ownerNode(); | 49 Node* ownerNode = sheet->ownerNode(); |
53 if (!isHTMLStyleElement(ownerNode)) | 50 if (!isHTMLStyleElement(ownerNode)) |
54 return &document; | 51 return &document; |
55 | 52 |
56 HTMLStyleElement& styleElement = toHTMLStyleElement(*ownerNode); | 53 HTMLStyleElement& styleElement = toHTMLStyleElement(*ownerNode); |
57 if (!styleElement.scoped()) { | 54 if (styleElement.isInShadowTree()) |
tasak
2014/06/03 05:57:48
If we keep isScoped method in HTMLStyleElement, it
kochi
2014/06/03 07:47:05
As I removed isScoepd(), isInShadowTree() is fine
| |
58 if (styleElement.isInShadowTree()) | 55 return styleElement.containingShadowRoot(); |
59 return styleElement.containingShadowRoot(); | |
60 return &document; | |
61 } | |
62 | 56 |
63 ContainerNode* parent = styleElement.parentNode(); | 57 return &document; |
64 if (!parent) | |
65 return 0; | |
66 | |
67 return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0; | |
68 } | 58 } |
69 | 59 |
70 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media QueryEvaluator& medium, StyleResolver* resolver) | 60 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media QueryEvaluator& medium, StyleResolver* resolver) |
71 { | 61 { |
72 m_authorStyleSheets.append(cssSheet); | 62 m_authorStyleSheets.append(cssSheet); |
73 StyleSheetContents* sheet = cssSheet->contents(); | 63 StyleSheetContents* sheet = cssSheet->contents(); |
74 | 64 |
75 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; | 65 AddRuleFlags addRuleFlags = resolver->document().securityOrigin()->canReques t(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; |
76 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); | 66 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); |
77 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ; | 67 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 | 139 |
150 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 140 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
151 { | 141 { |
152 if (!m_scopingNode.isDocumentNode()) | 142 if (!m_scopingNode.isDocumentNode()) |
153 return; | 143 return; |
154 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 144 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
155 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 145 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
156 } | 146 } |
157 | 147 |
158 } // namespace WebCore | 148 } // namespace WebCore |
OLD | NEW |