| 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, 2008, 2009, 2010, 2012 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 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 #ifndef SKY_ENGINE_CORE_CSS_CSSSTYLESHEET_H_ | 21 #ifndef SKY_ENGINE_CORE_CSS_CSSSTYLESHEET_H_ |
| 22 #define SKY_ENGINE_CORE_CSS_CSSSTYLESHEET_H_ | 22 #define SKY_ENGINE_CORE_CSS_CSSSTYLESHEET_H_ |
| 23 | 23 |
| 24 #include "sky/engine/wtf/Noncopyable.h" | 24 #include "sky/engine/wtf/Noncopyable.h" |
| 25 #include "sky/engine/wtf/RefCounted.h" | 25 #include "sky/engine/wtf/RefCounted.h" |
| 26 #include "sky/engine/wtf/text/TextPosition.h" | 26 #include "sky/engine/wtf/text/TextPosition.h" |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class BisonCSSParser; | |
| 31 class CSSStyleSheet; | 30 class CSSStyleSheet; |
| 32 class Document; | 31 class Document; |
| 33 class ExceptionState; | |
| 34 class KURL; | 32 class KURL; |
| 35 class MediaQuerySet; | 33 class MediaQuerySet; |
| 36 class Node; | 34 class Node; |
| 37 class StyleSheetContents; | 35 class StyleSheetContents; |
| 38 | 36 |
| 39 enum StyleSheetUpdateType { | |
| 40 PartialRuleUpdate, | |
| 41 EntireStyleSheetUpdate | |
| 42 }; | |
| 43 | |
| 44 class CSSStyleSheet final : public RefCounted<CSSStyleSheet> { | 37 class CSSStyleSheet final : public RefCounted<CSSStyleSheet> { |
| 45 public: | 38 public: |
| 46 static PassRefPtr<CSSStyleSheet> createInline(Node*, const KURL&, const Text
Position& startPosition = TextPosition::minimumPosition()); | 39 static PassRefPtr<CSSStyleSheet> create(Node*, const KURL&); |
| 47 static PassRefPtr<CSSStyleSheet> createInline(PassRefPtr<StyleSheetContents>
, Node* ownerNode, const TextPosition& startPosition = TextPosition::minimumPosi
tion()); | 40 static PassRefPtr<CSSStyleSheet> create(PassRefPtr<StyleSheetContents>, Node
* ownerNode); |
| 48 | 41 |
| 49 ~CSSStyleSheet(); | 42 ~CSSStyleSheet(); |
| 50 | 43 |
| 51 Node* ownerNode() const { return m_ownerNode; } | 44 Node* ownerNode() const { return m_ownerNode; } |
| 52 | 45 |
| 53 unsigned length() const; | 46 unsigned length() const; |
| 54 | 47 |
| 55 void clearOwnerNode(); | 48 void clearOwnerNode(); |
| 56 | 49 |
| 57 KURL baseURL() const; | |
| 58 | |
| 59 Document* ownerDocument() const; | 50 Document* ownerDocument() const; |
| 60 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } | 51 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } |
| 61 void setMediaQueries(PassRefPtr<MediaQuerySet>); | 52 void setMediaQueries(PassRefPtr<MediaQuerySet>); |
| 62 | 53 |
| 63 StyleSheetContents* contents() const { return m_contents.get(); } | 54 StyleSheetContents* contents() const { return m_contents.get(); } |
| 64 | 55 |
| 65 bool isInline() const { return m_isInlineStylesheet; } | |
| 66 TextPosition startPositionInSource() const { return m_startPosition; } | |
| 67 | |
| 68 // TODO(esprehn): Remove this. | |
| 69 String type() const { return "text/css"; } | |
| 70 | |
| 71 private: | 56 private: |
| 72 CSSStyleSheet(PassRefPtr<StyleSheetContents>); | 57 CSSStyleSheet(PassRefPtr<StyleSheetContents>, Node* ownerNode); |
| 73 CSSStyleSheet(PassRefPtr<StyleSheetContents>, Node* ownerNode, bool isInline
Stylesheet, const TextPosition& startPosition); | |
| 74 | 58 |
| 75 RefPtr<StyleSheetContents> m_contents; | 59 RefPtr<StyleSheetContents> m_contents; |
| 76 bool m_isInlineStylesheet; | |
| 77 RefPtr<MediaQuerySet> m_mediaQueries; | 60 RefPtr<MediaQuerySet> m_mediaQueries; |
| 78 | 61 |
| 79 Node* m_ownerNode; | 62 Node* m_ownerNode; |
| 80 | |
| 81 TextPosition m_startPosition; | |
| 82 }; | 63 }; |
| 83 | 64 |
| 84 } // namespace blink | 65 } // namespace blink |
| 85 | 66 |
| 86 #endif // SKY_ENGINE_CORE_CSS_CSSSTYLESHEET_H_ | 67 #endif // SKY_ENGINE_CORE_CSS_CSSSTYLESHEET_H_ |
| OLD | NEW |