| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); | 49 Document* sheetDocument = sheet->ownerDocument(); |
| 50 if (!sheetDocument) | 50 if (!sheetDocument) |
| 51 return 0; | 51 return 0; |
| 52 Node* ownerNode = sheet->ownerNode(); | 52 Node* ownerNode = sheet->ownerNode(); |
| 53 if (!ownerNode || !ownerNode->hasTagName(HTMLNames::styleTag)) | 53 if (!isHTMLStyleElement(ownerNode)) |
| 54 return &document; | 54 return &document; |
| 55 | 55 |
| 56 HTMLStyleElement* styleElement = toHTMLStyleElement(ownerNode); | 56 HTMLStyleElement& styleElement = toHTMLStyleElement(*ownerNode); |
| 57 if (!styleElement->scoped()) { | 57 if (!styleElement.scoped()) { |
| 58 if (styleElement->isInShadowTree()) | 58 if (styleElement.isInShadowTree()) |
| 59 return styleElement->containingShadowRoot(); | 59 return styleElement.containingShadowRoot(); |
| 60 return &document; | 60 return &document; |
| 61 } | 61 } |
| 62 | 62 |
| 63 ContainerNode* parent = styleElement->parentNode(); | 63 ContainerNode* parent = styleElement.parentNode(); |
| 64 if (!parent) | 64 if (!parent) |
| 65 return 0; | 65 return 0; |
| 66 | 66 |
| 67 return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0; | 67 return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media
QueryEvaluator& medium, StyleResolver* resolver) | 70 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media
QueryEvaluator& medium, StyleResolver* resolver) |
| 71 { | 71 { |
| 72 m_authorStyleSheets.append(cssSheet); | 72 m_authorStyleSheets.append(cssSheet); |
| 73 StyleSheetContents* sheet = cssSheet->contents(); | 73 StyleSheetContents* sheet = cssSheet->contents(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 147 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
| 148 { | 148 { |
| 149 if (!m_scopingNode.isDocumentNode()) | 149 if (!m_scopingNode.isDocumentNode()) |
| 150 return; | 150 return; |
| 151 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 151 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 152 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 152 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace WebCore | 155 } // namespace WebCore |
| OLD | NEW |