| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 #if !ASSERT_DISABLED | 65 #if !ASSERT_DISABLED |
| 66 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) | 66 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) |
| 67 { | 67 { |
| 68 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. | 68 // Only these nodes can be parents of StyleSheets, and they need to call cle
arOwnerNode() when moved out of document. |
| 69 return !parentNode | 69 return !parentNode |
| 70 || parentNode->isDocumentNode() | 70 || parentNode->isDocumentNode() |
| 71 || parentNode->hasTagName(HTMLNames::linkTag) | 71 || parentNode->hasTagName(HTMLNames::linkTag) |
| 72 || parentNode->hasTagName(HTMLNames::styleTag) | 72 || parentNode->hasTagName(HTMLNames::styleTag) |
| 73 || parentNode->hasTagName(SVGNames::styleTag) | 73 || parentNode->hasTagName(SVGNames::styleTag) |
| 74 || parentNode->hasTagName(HTMLNames::metaTag) |
| 74 || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; | 75 || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE; |
| 75 } | 76 } |
| 76 #endif | 77 #endif |
| 77 | 78 |
| 78 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, CSSImportRule* ownerRule) | 79 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, CSSImportRule* ownerRule) |
| 79 { | 80 { |
| 80 return adoptRef(new CSSStyleSheet(sheet, ownerRule)); | 81 return adoptRef(new CSSStyleSheet(sheet, ownerRule)); |
| 81 } | 82 } |
| 82 | 83 |
| 83 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, Node* ownerNode) | 84 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, Node* ownerNode) |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (!rule) { | 281 if (!rule) { |
| 281 ec = SyntaxError; | 282 ec = SyntaxError; |
| 282 return 0; | 283 return 0; |
| 283 } | 284 } |
| 284 RuleMutationScope mutationScope(this); | 285 RuleMutationScope mutationScope(this); |
| 285 | 286 |
| 286 bool success = m_contents->wrapperInsertRule(rule, index); | 287 bool success = m_contents->wrapperInsertRule(rule, index); |
| 287 if (!success) { | 288 if (!success) { |
| 288 ec = HierarchyRequestError; | 289 ec = HierarchyRequestError; |
| 289 return 0; | 290 return 0; |
| 290 } | 291 } |
| 291 if (!m_childRuleCSSOMWrappers.isEmpty()) | 292 if (!m_childRuleCSSOMWrappers.isEmpty()) |
| 292 m_childRuleCSSOMWrappers.insert(index, RefPtr<CSSRule>()); | 293 m_childRuleCSSOMWrappers.insert(index, RefPtr<CSSRule>()); |
| 293 | 294 |
| 294 return index; | 295 return index; |
| 295 } | 296 } |
| 296 | 297 |
| 297 void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec) | 298 void CSSStyleSheet::deleteRule(unsigned index, ExceptionCode& ec) |
| 298 { | 299 { |
| 299 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); | 300 ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size()
== m_contents->ruleCount()); |
| 300 | 301 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 root = root->parentStyleSheet(); | 382 root = root->parentStyleSheet(); |
| 382 return root->ownerNode() ? root->ownerNode()->document() : 0; | 383 return root->ownerNode() ? root->ownerNode()->document() : 0; |
| 383 } | 384 } |
| 384 | 385 |
| 385 void CSSStyleSheet::clearChildRuleCSSOMWrappers() | 386 void CSSStyleSheet::clearChildRuleCSSOMWrappers() |
| 386 { | 387 { |
| 387 m_childRuleCSSOMWrappers.clear(); | 388 m_childRuleCSSOMWrappers.clear(); |
| 388 } | 389 } |
| 389 | 390 |
| 390 } | 391 } |
| OLD | NEW |