2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
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., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #include "HTMLOListElement.h"
26 #include "CSSPropertyNames.h"
27 #include "CSSValueKeywords.h"
28 #include "HTMLNames.h"
29 #include "RenderListItem.h"
33 using namespace HTMLNames
;
35 HTMLOListElement::HTMLOListElement(Document
* doc
)
36 : HTMLElement(HTMLNames::olTag
, doc
)
41 bool HTMLOListElement::mapToEntry(const QualifiedName
& attrName
, MappedAttributeEntry
& result
) const
43 if (attrName
== typeAttr
) {
44 result
= eListItem
; // Share with <li>
48 return HTMLElement::mapToEntry(attrName
, result
);
51 void HTMLOListElement::parseMappedAttribute(MappedAttribute
* attr
)
53 if (attr
->name() == typeAttr
) {
54 if (attr
->value() == "a")
55 addCSSProperty(attr
, CSSPropertyListStyleType
, CSSValueLowerAlpha
);
56 else if (attr
->value() == "A")
57 addCSSProperty(attr
, CSSPropertyListStyleType
, CSSValueUpperAlpha
);
58 else if (attr
->value() == "i")
59 addCSSProperty(attr
, CSSPropertyListStyleType
, CSSValueLowerRoman
);
60 else if (attr
->value() == "I")
61 addCSSProperty(attr
, CSSPropertyListStyleType
, CSSValueUpperRoman
);
62 else if (attr
->value() == "1")
63 addCSSProperty(attr
, CSSPropertyListStyleType
, CSSValueDecimal
);
64 } else if (attr
->name() == startAttr
) {
65 int s
= !attr
->isNull() ? attr
->value().toInt() : 1;
68 for (RenderObject
* r
= renderer(); r
; r
= r
->nextInPreOrder(renderer()))
70 static_cast<RenderListItem
*>(r
)->updateValue();
73 HTMLElement::parseMappedAttribute(attr
);
76 bool HTMLOListElement::compact() const
78 return !getAttribute(compactAttr
).isNull();
81 void HTMLOListElement::setCompact(bool b
)
83 setAttribute(compactAttr
, b
? "" : 0);
86 void HTMLOListElement::setStart(int start
)
88 setAttribute(startAttr
, String::number(start
));
91 String
HTMLOListElement::type() const
93 return getAttribute(typeAttr
);
96 void HTMLOListElement::setType(const String
& value
)
98 setAttribute(typeAttr
, value
);