| 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, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "wtf/text/WTFString.h" | 29 #include "wtf/text/WTFString.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 class CSSRule; | 33 class CSSRule; |
| 34 class CSSStyleSheet; | 34 class CSSStyleSheet; |
| 35 class Document; | 35 class Document; |
| 36 class MediaList; | 36 class MediaList; |
| 37 class MediaQuery; | 37 class MediaQuery; |
| 38 | 38 |
| 39 enum MediaQueryParserMode { | |
| 40 MediaQueryNormalMode, | |
| 41 MediaQueryStrictMode, | |
| 42 }; | |
| 43 | |
| 44 class MediaQuerySet : public RefCounted<MediaQuerySet> { | 39 class MediaQuerySet : public RefCounted<MediaQuerySet> { |
| 45 public: | 40 public: |
| 46 static PassRefPtr<MediaQuerySet> create() | 41 static PassRefPtr<MediaQuerySet> create() |
| 47 { | 42 { |
| 48 return adoptRef(new MediaQuerySet()); | 43 return adoptRef(new MediaQuerySet()); |
| 49 } | 44 } |
| 50 static PassRefPtr<MediaQuerySet> create(const String& mediaString) | 45 static PassRefPtr<MediaQuerySet> create(const String& mediaString); |
| 51 { | |
| 52 return adoptRef(new MediaQuerySet(mediaString, MediaQueryNormalMode)); | |
| 53 } | |
| 54 ~MediaQuerySet(); | 46 ~MediaQuerySet(); |
| 55 | 47 |
| 56 bool set(const String&); | 48 bool set(const String&); |
| 57 bool add(const String&); | 49 bool add(const String&); |
| 58 bool remove(const String&); | 50 bool remove(const String&); |
| 59 | 51 |
| 60 void addMediaQuery(PassOwnPtr<MediaQuery>); | 52 void addMediaQuery(PassOwnPtr<MediaQuery>); |
| 61 | 53 |
| 62 const Vector<OwnPtr<MediaQuery> >& queryVector() const { return m_queries; } | 54 const Vector<OwnPtr<MediaQuery> >& queryVector() const { return m_queries; } |
| 63 | 55 |
| 64 int lastLine() const { return m_lastLine; } | 56 int lastLine() const { return m_lastLine; } |
| 65 void setLastLine(int lastLine) { m_lastLine = lastLine; } | 57 void setLastLine(int lastLine) { m_lastLine = lastLine; } |
| 66 | 58 |
| 67 String mediaText() const; | 59 String mediaText() const; |
| 68 | 60 |
| 69 PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*
this)); } | 61 PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*
this)); } |
| 70 | 62 |
| 71 void reportMemoryUsage(MemoryObjectInfo*) const; | 63 void reportMemoryUsage(MemoryObjectInfo*) const; |
| 72 | 64 |
| 73 private: | 65 private: |
| 74 MediaQuerySet(); | 66 MediaQuerySet(); |
| 75 MediaQuerySet(const String& mediaQuery, MediaQueryParserMode); | |
| 76 MediaQuerySet(const MediaQuerySet&); | 67 MediaQuerySet(const MediaQuerySet&); |
| 77 | 68 |
| 78 PassOwnPtr<MediaQuery> parseMediaQuery(const String&, MediaQueryParserMode); | 69 unsigned m_lastLine; |
| 79 void parseMediaQueryList(const String&, MediaQueryParserMode, Vector<OwnPtr<
MediaQuery> >& result); | |
| 80 | |
| 81 MediaQueryParserMode parserMode() const { return static_cast<MediaQueryParse
rMode>(m_parserMode); } | |
| 82 | |
| 83 unsigned m_parserMode : 2; | |
| 84 unsigned m_lastLine : 30; | |
| 85 Vector<OwnPtr<MediaQuery> > m_queries; | 70 Vector<OwnPtr<MediaQuery> > m_queries; |
| 86 }; | 71 }; |
| 87 | 72 |
| 88 class MediaList : public RefCounted<MediaList> { | 73 class MediaList : public RefCounted<MediaList> { |
| 89 public: | 74 public: |
| 90 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSStyleShe
et* parentSheet) | 75 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSStyleShe
et* parentSheet) |
| 91 { | 76 { |
| 92 return adoptRef(new MediaList(mediaQueries, parentSheet)); | 77 return adoptRef(new MediaList(mediaQueries, parentSheet)); |
| 93 } | 78 } |
| 94 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSRule* pa
rentRule) | 79 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSRule* pa
rentRule) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 CSSStyleSheet* m_parentStyleSheet; | 111 CSSStyleSheet* m_parentStyleSheet; |
| 127 CSSRule* m_parentRule; | 112 CSSRule* m_parentRule; |
| 128 }; | 113 }; |
| 129 | 114 |
| 130 // Adds message to inspector console whenever dpi or dpcm values are used for "s
creen" media. | 115 // Adds message to inspector console whenever dpi or dpcm values are used for "s
creen" media. |
| 131 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*); | 116 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*); |
| 132 | 117 |
| 133 } // namespace | 118 } // namespace |
| 134 | 119 |
| 135 #endif | 120 #endif |
| OLD | NEW |