| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 #if !ASSERT_DISABLED | 57 #if !ASSERT_DISABLED |
| 58 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) | 58 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) |
| 59 { | 59 { |
| 60 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. | 60 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. |
| 61 return !parentNode | 61 return !parentNode |
| 62 || parentNode->isDocumentNode() | 62 || parentNode->isDocumentNode() |
| 63 || parentNode->hasTagName(HTMLNames::linkTag) | 63 || parentNode->hasTagName(HTMLNames::linkTag) |
| 64 || parentNode->hasTagName(HTMLNames::styleTag) | 64 || parentNode->hasTagName(HTMLNames::styleTag) |
| 65 || parentNode->hasTagName(SVGNames::styleTag) | 65 || parentNode->hasTagName(SVGNames::styleTag) |
| 66 || parentNode->hasTagName(HTMLNames::metaTag) |
| 66 || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; | 67 || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; |
| 67 } | 68 } |
| 68 #endif | 69 #endif |
| 69 | 70 |
| 70 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, CSSImportRule* ownerRule) | 71 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, CSSImportRule* ownerRule) |
| 71 { | 72 { |
| 72 return adoptRef(new CSSStyleSheet(sheet, ownerRule)); | 73 return adoptRef(new CSSStyleSheet(sheet, ownerRule)); |
| 73 } | 74 } |
| 74 | 75 |
| 75 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, Node* ownerNode) | 76 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, Node* ownerNode) |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 if (!rule) { | 260 if (!rule) { |
| 260 ec = SyntaxError; | 261 ec = SyntaxError; |
| 261 return 0; | 262 return 0; |
| 262 } | 263 } |
| 263 RuleMutationScope mutationScope(this); | 264 RuleMutationScope mutationScope(this); |
| 264 | 265 |
| 265 bool success = m_contents->wrapperInsertRule(rule, index); | 266 bool success = m_contents->wrapperInsertRule(rule, index); |
| 266 if (!success) { | 267 if (!success) { |
| 267 ec = HierarchyRequestError; | 268 ec = HierarchyRequestError; |
| 268 return 0; | 269 return 0; |
| 269 } | 270 } |
| 270 if (!m_childRuleCSSOMWrappers.isEmpty()) | 271 if (!m_childRuleCSSOMWrappers.isEmpty()) |
| 271 m_childRuleCSSOMWrappers.insert(index, RefPtr<CSSRule>()); | 272 m_childRuleCSSOMWrappers.insert(index, RefPtr<CSSRule>()); |
| 272 | 273 |
| 273 return index; | 274 return index; |
| 274 } | 275 } |
| 275 | 276 |
| 276 void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec) | 277 void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec) |
| 277 { | 278 { |
| 278 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); | 279 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); |
| 279 | 280 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 root = root->parentStyleSheet(); | 361 root = root->parentStyleSheet(); |
| 361 return root->ownerNode() ? root->ownerNode()->document() : 0; | 362 return root->ownerNode() ? root->ownerNode()->document() : 0; |
| 362 } | 363 } |
| 363 | 364 |
| 364 void CSSStyleSheet::clearChildRuleCSSOMWrappers() | 365 void CSSStyleSheet::clearChildRuleCSSOMWrappers() |
| 365 { | 366 { |
| 366 m_childRuleCSSOMWrappers.clear(); | 367 m_childRuleCSSOMWrappers.clear(); |
| 367 } | 368 } |
| 368 | 369 |
| 369 } | 370 } |
| OLD | NEW |