| 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 { | 46 { |
| 52 return adoptRef(new MediaQuerySet(mediaString, MediaQueryNormalMode)); | 47 return adoptRef(new MediaQuerySet(mediaString)); |
| 53 } | 48 } |
| 54 ~MediaQuerySet(); | 49 ~MediaQuerySet(); |
| 55 | 50 |
| 56 bool set(const String&); | 51 bool set(const String&); |
| 57 bool add(const String&); | 52 bool add(const String&); |
| 58 bool remove(const String&); | 53 bool remove(const String&); |
| 59 | 54 |
| 60 void addMediaQuery(PassOwnPtr<MediaQuery>); | 55 void addMediaQuery(PassOwnPtr<MediaQuery>); |
| 61 | 56 |
| 62 const Vector<OwnPtr<MediaQuery> >& queryVector() const { return m_queries; } | 57 const Vector<OwnPtr<MediaQuery> >& queryVector() const { return m_queries; } |
| 63 | 58 |
| 64 int lastLine() const { return m_lastLine; } | 59 int lastLine() const { return m_lastLine; } |
| 65 void setLastLine(int lastLine) { m_lastLine = lastLine; } | 60 void setLastLine(int lastLine) { m_lastLine = lastLine; } |
| 66 | 61 |
| 67 String mediaText() const; | 62 String mediaText() const; |
| 68 | 63 |
| 69 PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*
this)); } | 64 PassRefPtr<MediaQuerySet> copy() const { return adoptRef(new MediaQuerySet(*
this)); } |
| 70 | 65 |
| 71 void reportMemoryUsage(MemoryObjectInfo*) const; | 66 void reportMemoryUsage(MemoryObjectInfo*) const; |
| 72 | 67 |
| 73 private: | 68 private: |
| 74 MediaQuerySet(); | 69 MediaQuerySet(); |
| 75 MediaQuerySet(const String& mediaQuery, MediaQueryParserMode); | 70 MediaQuerySet(const String& mediaQuery); |
| 76 MediaQuerySet(const MediaQuerySet&); | 71 MediaQuerySet(const MediaQuerySet&); |
| 77 | 72 |
| 78 PassOwnPtr<MediaQuery> parseMediaQuery(const String&, MediaQueryParserMode); | 73 PassRefPtr<MediaQuerySet> parseMediaQueryList(const String& mediaString); |
| 79 void parseMediaQueryList(const String&, MediaQueryParserMode, Vector<OwnPtr<
MediaQuery> >& result); | |
| 80 | 74 |
| 81 MediaQueryParserMode parserMode() const { return static_cast<MediaQueryParse
rMode>(m_parserMode); } | 75 unsigned m_lastLine; |
| 82 | |
| 83 unsigned m_parserMode : 2; | |
| 84 unsigned m_lastLine : 30; | |
| 85 Vector<OwnPtr<MediaQuery> > m_queries; | 76 Vector<OwnPtr<MediaQuery> > m_queries; |
| 86 }; | 77 }; |
| 87 | 78 |
| 88 class MediaList : public RefCounted<MediaList> { | 79 class MediaList : public RefCounted<MediaList> { |
| 89 public: | 80 public: |
| 90 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSStyleShe
et* parentSheet) | 81 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSStyleShe
et* parentSheet) |
| 91 { | 82 { |
| 92 return adoptRef(new MediaList(mediaQueries, parentSheet)); | 83 return adoptRef(new MediaList(mediaQueries, parentSheet)); |
| 93 } | 84 } |
| 94 static PassRefPtr<MediaList> create(MediaQuerySet* mediaQueries, CSSRule* pa
rentRule) | 85 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; | 117 CSSStyleSheet* m_parentStyleSheet; |
| 127 CSSRule* m_parentRule; | 118 CSSRule* m_parentRule; |
| 128 }; | 119 }; |
| 129 | 120 |
| 130 // Adds message to inspector console whenever dpi or dpcm values are used for "s
creen" media. | 121 // Adds message to inspector console whenever dpi or dpcm values are used for "s
creen" media. |
| 131 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*); | 122 void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*); |
| 132 | 123 |
| 133 } // namespace | 124 } // namespace |
| 134 | 125 |
| 135 #endif | 126 #endif |
| OLD | NEW |