]>
git.saurik.com Git - iphone-api.git/blob - WebCore/MediaList.h
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
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
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
24 #include "StyleBase.h"
25 #include <wtf/PassRefPtr.h>
26 #include <wtf/Vector.h>
35 typedef int ExceptionCode
;
37 class MediaList
: public StyleBase
{
39 static PassRefPtr
<MediaList
> create()
41 return adoptRef(new MediaList(0, false));
43 static PassRefPtr
<MediaList
> create(CSSImportRule
* parentRule
, const String
& media
)
45 return adoptRef(new MediaList(parentRule
, media
));
47 static PassRefPtr
<MediaList
> create(CSSStyleSheet
* parentSheet
, const String
& media
)
49 return adoptRef(new MediaList(parentSheet
, media
, false));
52 static PassRefPtr
<MediaList
> createAllowingDescriptionSyntax(const String
& mediaQueryOrDescription
)
54 return adoptRef(new MediaList(0, mediaQueryOrDescription
, true));
56 static PassRefPtr
<MediaList
> createAllowingDescriptionSyntax(CSSStyleSheet
* parentSheet
, const String
& mediaQueryOrDescription
)
58 return adoptRef(new MediaList(parentSheet
, mediaQueryOrDescription
, true));
61 static PassRefPtr
<MediaList
> create(const String
& media
, bool allowDescriptionSyntax
)
63 return adoptRef(new MediaList(0, media
, allowDescriptionSyntax
));
68 unsigned length() const { return m_queries
.size(); }
69 String
item(unsigned index
) const;
70 void deleteMedium(const String
& oldMedium
, ExceptionCode
&);
71 void appendMedium(const String
& newMedium
, ExceptionCode
&);
73 String
mediaText() const;
74 void setMediaText(const String
&, ExceptionCode
&xo
);
76 void appendMediaQuery(MediaQuery
*);
77 const Vector
<MediaQuery
*>& mediaQueries() const { return m_queries
; }
80 MediaList(CSSStyleSheet
* parentSheet
, bool fallbackToDescription
);
81 MediaList(CSSStyleSheet
* parentSheet
, const String
& media
, bool fallbackToDescription
);
82 MediaList(CSSImportRule
* parentRule
, const String
& media
);
86 Vector
<MediaQuery
*> m_queries
;
87 bool m_fallback
; // true if failed media query parsing should fallback to media description parsing