| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "sky/engine/core/css/CSSStyleSheet.h" | 21 #include "sky/engine/core/css/CSSStyleSheet.h" |
| 22 | 22 |
| 23 #include "sky/engine/core/css/MediaList.h" | 23 #include "sky/engine/core/css/MediaList.h" |
| 24 #include "sky/engine/core/css/StyleSheetContents.h" | 24 #include "sky/engine/core/css/StyleSheetContents.h" |
| 25 #include "sky/engine/core/dom/Document.h" | 25 #include "sky/engine/core/dom/Document.h" |
| 26 #include "sky/engine/core/dom/Node.h" | 26 #include "sky/engine/core/dom/Node.h" |
| 27 #include "sky/engine/core/html/HTMLStyleElement.h" | |
| 28 | 27 |
| 29 namespace blink { | 28 namespace blink { |
| 30 | 29 |
| 31 #if ENABLE(ASSERT) | 30 #if ENABLE(ASSERT) |
| 32 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) | 31 static bool isAcceptableCSSStyleSheetParent(Node* parentNode) |
| 33 { | 32 { |
| 34 // Only these nodes can be parents of StyleSheets, and they need to call | 33 // Only these nodes can be parents of StyleSheets, and they need to call |
| 35 // clearOwnerNode() when moved out of document. | 34 // clearOwnerNode() when moved out of document. |
| 36 // Destruction of the style sheet counts as being "moved out of the | 35 // Destruction of the style sheet counts as being "moved out of the |
| 37 // document", but only in the non-oilpan version of blink. I.e. don't call | 36 // document", but only in the non-oilpan version of blink. I.e. don't call |
| 38 // clearOwnerNode() in the owner's destructor in oilpan. | 37 // clearOwnerNode() in the owner's destructor in oilpan. |
| 39 return !parentNode | 38 return !parentNode |
| 40 || parentNode->isDocumentNode() | 39 || parentNode->isDocumentNode(); |
| 41 || isHTMLStyleElement(*parentNode); | |
| 42 } | 40 } |
| 43 #endif | 41 #endif |
| 44 | 42 |
| 45 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, Node* ownerNode) | 43 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
heet, Node* ownerNode) |
| 46 { | 44 { |
| 47 ASSERT(sheet); | 45 ASSERT(sheet); |
| 48 return adoptRef(new CSSStyleSheet(sheet, ownerNode)); | 46 return adoptRef(new CSSStyleSheet(sheet, ownerNode)); |
| 49 } | 47 } |
| 50 | 48 |
| 51 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(Node* ownerNode, const KURL& bas
eURL) | 49 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(Node* ownerNode, const KURL& bas
eURL) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 80 owner->styleResolverChanged(); | 78 owner->styleResolverChanged(); |
| 81 m_ownerNode = nullptr; | 79 m_ownerNode = nullptr; |
| 82 } | 80 } |
| 83 | 81 |
| 84 Document* CSSStyleSheet::ownerDocument() const | 82 Document* CSSStyleSheet::ownerDocument() const |
| 85 { | 83 { |
| 86 return ownerNode() ? &ownerNode()->document() : 0; | 84 return ownerNode() ? &ownerNode()->document() : 0; |
| 87 } | 85 } |
| 88 | 86 |
| 89 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |