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.
23 #include "html_listimpl.h"
27 #include "css/cssproperties.h"
28 #include "css/cssvalues.h"
29 #include "rendering/render_list.h"
30 #include "misc/htmlhashes.h"
31 #include "xml/dom_docimpl.h"
33 using namespace khtml
;
35 NodeImpl::Id
HTMLUListElementImpl::id() const
40 void HTMLUListElementImpl::parseAttribute(AttributeImpl
*attr
)
45 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, attr
->value());
48 HTMLElementImpl::parseAttribute(attr
);
52 // -------------------------------------------------------------------------
54 NodeImpl::Id
HTMLDirectoryElementImpl::id() const
59 // -------------------------------------------------------------------------
61 NodeImpl::Id
HTMLMenuElementImpl::id() const
66 // -------------------------------------------------------------------------
68 NodeImpl::Id
HTMLOListElementImpl::id() const
73 void HTMLOListElementImpl::parseAttribute(AttributeImpl
*attr
)
78 if ( strcmp( attr
->value(), "a" ) == 0 )
79 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_LOWER_ALPHA
);
80 else if ( strcmp( attr
->value(), "A" ) == 0 )
81 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_UPPER_ALPHA
);
82 else if ( strcmp( attr
->value(), "i" ) == 0 )
83 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_LOWER_ROMAN
);
84 else if ( strcmp( attr
->value(), "I" ) == 0 )
85 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_UPPER_ROMAN
);
86 else if ( strcmp( attr
->value(), "1" ) == 0 )
87 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_DECIMAL
);
90 _start
= attr
->val() ? attr
->val()->toInt() : 1;
93 HTMLUListElementImpl::parseAttribute(attr
);
97 // -------------------------------------------------------------------------
99 NodeImpl::Id
HTMLLIElementImpl::id() const
104 void HTMLLIElementImpl::parseAttribute(AttributeImpl
*attr
)
109 if(m_render
&& m_render
->isListItem() && m_render
->style()->display() == LIST_ITEM
)
110 static_cast<RenderListItem
*>(m_render
)->setValue(attr
->value().toInt());
113 if ( strcmp( attr
->value(), "a" ) == 0 )
114 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_LOWER_ALPHA
);
115 else if ( strcmp( attr
->value(), "A" ) == 0 )
116 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_UPPER_ALPHA
);
117 else if ( strcmp( attr
->value(), "i" ) == 0 )
118 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_LOWER_ROMAN
);
119 else if ( strcmp( attr
->value(), "I" ) == 0 )
120 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_UPPER_ROMAN
);
121 else if ( strcmp( attr
->value(), "1" ) == 0 )
122 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, CSS_VAL_DECIMAL
);
124 addCSSProperty(CSS_PROP_LIST_STYLE_TYPE
, attr
->value());
127 HTMLElementImpl::parseAttribute(attr
);
131 void HTMLLIElementImpl::attach()
135 HTMLElementImpl::attach();
137 if ( m_render
&& m_render
->style()->display() == LIST_ITEM
) {
138 RenderListItem
* render
= static_cast<RenderListItem
*>( renderer() );
139 NodeImpl
* listNode
= 0;
140 NodeImpl
* n
= parentNode();
141 while ( !listNode
&& n
) {
151 // if we are not in a list, then position us inside
152 // can't use addCSSProperty cause its inherited attribute
153 render
->setInsideList( listNode
);
155 DOMString v
= getAttribute(ATTR_VALUE
);
157 render
->setValue( v
.implementation()->toInt() );
162 // -------------------------------------------------------------------------
165 NodeImpl::Id
HTMLDListElementImpl::id() const