2 Copyright (C) 2004 Nikolas Zimmermann <wildfox@kde.org>
3 2004 Rob Buis <buis@kde.org>
5 This file is part of the KDE project
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
24 #include <kdom/Shared.h>
26 #include "CSSHelper.h"
27 #include "CSSRuleImpl.h"
28 #include "DOMException.h"
29 #include "CSSStyleSheet.h"
30 #include "DOMExceptionImpl.h"
32 #include "kdom/data/CSSConstants.h"
33 #include "CSSRule.lut.h"
38 @begin CSSRule::s_hashTable 5
39 type CSSRuleConstants::Type DontDelete|ReadOnly
40 cssText CSSRuleConstants::CssText DontDelete|ReadOnly
41 parentStyleSheet CSSRuleConstants::ParentStyleSheet DontDelete|ReadOnly
42 parentRule CSSRuleConstants::ParentRule DontDelete|ReadOnly
46 Value CSSRule::getValueProperty(ExecState *exec, int token) const
50 case CSSRuleConstants::Type:
51 return Number(type());
52 case CSSRuleConstants::CssText:
53 return getDOMString(cssText());
54 case CSSRuleConstants::ParentStyleSheet:
55 return safe_cache<CSSStyleSheet>(exec, parentStyleSheet());
56 case CSSRuleConstants::ParentRule:
57 return getDOMCSSRule(exec, parentRule());
59 kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl;
65 void CSSRule::putValueProperty(ExecState *exec, int token, const Value &value, int)
71 case CSSRuleConstants::CssText:
72 setCssText(toDOMString(exec, value));
75 kdWarning() << "Unhandled token in " << k_funcinfo << " : " << token << endl;
78 KDOM_LEAVE_SAFE(DOMException)
81 CSSRule CSSRule::null;
83 CSSRule::CSSRule() : d(0)
87 CSSRule::CSSRule(CSSRuleImpl *i) : d(i)
93 CSSRule::CSSRule(const CSSRule &other) : d(0)
98 KDOM_IMPL_DTOR_ASSIGN_OP(CSSRule)
100 unsigned short CSSRule::type() const
108 void CSSRule::setCssText(const DOMString &text)
114 DOMString CSSRule::cssText() const
122 CSSStyleSheet CSSRule::parentStyleSheet() const
125 return CSSStyleSheet::null;
127 return CSSStyleSheet(d->parentStyleSheet());
130 CSSRule CSSRule::parentRule() const
133 return CSSRule::null;
135 return CSSRule(d->parentRule());