| 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, 2008, 2009, 2010, 2012 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserv
ed. |
| 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_MEDIALIST_H_ | 21 #ifndef SKY_ENGINE_CORE_CSS_MEDIALIST_H_ |
| 22 #define SKY_ENGINE_CORE_CSS_MEDIALIST_H_ | 22 #define SKY_ENGINE_CORE_CSS_MEDIALIST_H_ |
| 23 | 23 |
| 24 #include "sky/engine/bindings/core/v8/ScriptWrappable.h" | |
| 25 #include "sky/engine/core/dom/ExceptionCode.h" | 24 #include "sky/engine/core/dom/ExceptionCode.h" |
| 26 #include "sky/engine/platform/heap/Handle.h" | 25 #include "sky/engine/platform/heap/Handle.h" |
| 27 #include "sky/engine/wtf/Forward.h" | 26 #include "sky/engine/wtf/Forward.h" |
| 28 #include "sky/engine/wtf/PassRefPtr.h" | 27 #include "sky/engine/wtf/PassRefPtr.h" |
| 29 #include "sky/engine/wtf/RefCounted.h" | 28 #include "sky/engine/wtf/RefCounted.h" |
| 30 #include "sky/engine/wtf/Vector.h" | 29 #include "sky/engine/wtf/Vector.h" |
| 31 #include "sky/engine/wtf/text/WTFString.h" | 30 #include "sky/engine/wtf/text/WTFString.h" |
| 32 | 31 |
| 33 namespace blink { | 32 namespace blink { |
| 34 | 33 |
| 35 class CSSRule; | |
| 36 class CSSStyleSheet; | 34 class CSSStyleSheet; |
| 37 class Document; | 35 class Document; |
| 38 class ExceptionState; | 36 class ExceptionState; |
| 39 class MediaList; | 37 class MediaList; |
| 40 class MediaQuery; | 38 class MediaQuery; |
| 41 | 39 |
| 42 class MediaQuerySet : public RefCounted<MediaQuerySet> { | 40 class MediaQuerySet : public RefCounted<MediaQuerySet> { |
| 43 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(MediaQuerySet); | 41 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(MediaQuerySet); |
| 44 public: | 42 public: |
| 45 static PassRefPtr<MediaQuerySet> create() | 43 static PassRefPtr<MediaQuerySet> create() |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 | 59 |
| 62 PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*
this)); } | 60 PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*
this)); } |
| 63 | 61 |
| 64 private: | 62 private: |
| 65 MediaQuerySet(); | 63 MediaQuerySet(); |
| 66 MediaQuerySet(const MediaQuerySet&); | 64 MediaQuerySet(const MediaQuerySet&); |
| 67 | 65 |
| 68 Vector<OwnPtr<MediaQuery> > m_queries; | 66 Vector<OwnPtr<MediaQuery> > m_queries; |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 class MediaList : public RefCounted<MediaList>, public ScriptWrappable { | 69 class MediaList : public RefCounted<MediaList> { |
| 72 DEFINE_WRAPPERTYPEINFO(); | |
| 73 public: | 70 public: |
| 74 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSStyleShe
et* parentSheet) | 71 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSStyleShe
et* parentSheet) |
| 75 { | 72 { |
| 76 return adoptRef(new MediaList(mediaQueries, parentSheet)); | 73 return adoptRef(new MediaList(mediaQueries, parentSheet)); |
| 77 } | 74 } |
| 78 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSRule* pa
rentRule) | |
| 79 { | |
| 80 return adoptRef(new MediaList(mediaQueries, parentRule)); | |
| 81 } | |
| 82 | 75 |
| 83 ~MediaList(); | 76 ~MediaList(); |
| 84 | 77 |
| 85 unsigned length() const { return m_mediaQueries->queryVector().size(); } | 78 unsigned length() const { return m_mediaQueries->queryVector().size(); } |
| 86 String item(unsigned index) const; | |
| 87 void deleteMedium(const String& oldMedium, ExceptionState&); | |
| 88 void appendMedium(const String& newMedium, ExceptionState&); | |
| 89 | 79 |
| 90 String mediaText() const { return m_mediaQueries->mediaText(); } | 80 String mediaText() const { return m_mediaQueries->mediaText(); } |
| 91 void setMediaText(const String&); | |
| 92 | 81 |
| 93 // Not part of CSSOM. | 82 // Not part of CSSOM. |
| 94 CSSRule* parentRule() const { return m_parentRule; } | |
| 95 CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } | 83 CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } |
| 96 | 84 |
| 97 #if !ENABLE(OILPAN) | 85 #if !ENABLE(OILPAN) |
| 98 void clearParentStyleSheet() { ASSERT(m_parentStyleSheet); m_parentStyleShee
t = nullptr; } | 86 void clearParentStyleSheet() { ASSERT(m_parentStyleSheet); m_parentStyleShee
t = nullptr; } |
| 99 void clearParentRule() { ASSERT(m_parentRule); m_parentRule = nullptr; } | |
| 100 #endif | 87 #endif |
| 101 | 88 |
| 102 const MediaQuerySet* queries() const { return m_mediaQueries.get(); } | 89 const MediaQuerySet* queries() const { return m_mediaQueries.get(); } |
| 103 | 90 |
| 104 void reattach(MediaQuerySet*); | |
| 105 | |
| 106 private: | 91 private: |
| 107 MediaList(MediaQuerySet*, CSSStyleSheet* parentSheet); | 92 MediaList(MediaQuerySet*, CSSStyleSheet* parentSheet); |
| 108 MediaList(MediaQuerySet*, CSSRule* parentRule); | |
| 109 | 93 |
| 110 RefPtr<MediaQuerySet> m_mediaQueries; | 94 RefPtr<MediaQuerySet> m_mediaQueries; |
| 111 // Cleared in ~CSSStyleSheet destructor when oilpan is not enabled. | 95 // Cleared in ~CSSStyleSheet destructor when oilpan is not enabled. |
| 112 RawPtr<CSSStyleSheet> m_parentStyleSheet; | 96 RawPtr<CSSStyleSheet> m_parentStyleSheet; |
| 113 // Cleared in the ~CSSMediaRule destructors when oilpan is not enabled. | |
| 114 RawPtr<CSSRule> m_parentRule; | |
| 115 }; | 97 }; |
| 116 | 98 |
| 117 // Adds message to inspector console whenever dpi or dpcm values are used for "s
creen" media. | 99 // Adds message to inspector console whenever dpi or dpcm values are used for "s
creen" media. |
| 118 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*); | 100 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*); |
| 119 | 101 |
| 120 } // namespace blink | 102 } // namespace blink |
| 121 | 103 |
| 122 #endif // SKY_ENGINE_CORE_CSS_MEDIALIST_H_ | 104 #endif // SKY_ENGINE_CORE_CSS_MEDIALIST_H_ |
| OLD | NEW |