html_listimpl.cpp Source File (khtml Library)

| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# html_listimpl.cpp

    00001
    00024 #include "html_listimpl.h"
    00025
    00026 using namespace DOM;
    00027
    00028 #include "css/cssproperties.h"
    00029 #include "css/cssvalues.h"
    00030 #include "rendering/render_list.h"
    00031 #include "misc/htmlhashes.h"
    00032 #include "xml/dom_docimpl.h"
    00033
    00034 using namespace khtml;
    00035
    00036 NodeImpl::Id HTMLUListElementImpl::id() const
    00037 {
    00038     return ID_UL;
    00039 }
    00040
    00041 void HTMLUListElementImpl::parseAttribute(AttributeImpl *attr)
    00042 {
    00043     switch(attr->id())
    00044     {
    00045     case ATTR_TYPE:
    00046         addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, attr->value());
    00047         break;
    00048     default:
    00049         HTMLElementImpl::parseAttribute(attr);
    00050     }
    00051 }
    00052
    00053 // -------------------------------------------------------------------------
    00054
    00055 NodeImpl::Id HTMLDirectoryElementImpl::id() const
    00056 {
    00057     return ID_DIR;
    00058 }
    00059
    00060 // -------------------------------------------------------------------------
    00061
    00062 NodeImpl::Id HTMLMenuElementImpl::id() const
    00063 {
    00064     return ID_MENU;
    00065 }
    00066
    00067 // -------------------------------------------------------------------------
    00068
    00069 NodeImpl::Id HTMLOListElementImpl::id() const
    00070 {
    00071     return ID_OL;
    00072 }
    00073
    00074 void HTMLOListElementImpl::parseAttribute(AttributeImpl *attr)
    00075 {
    00076     switch(attr->id())
    00077     {
    00078     case ATTR_TYPE:
    00079         if ( strcmp( attr->value(), "a" ) == 0 )
    00080             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ALPHA);
    00081         else if ( strcmp( attr->value(), "A" ) == 0 )
    00082             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ALPHA);
    00083         else if ( strcmp( attr->value(), "i" ) == 0 )
    00084             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ROMAN);
    00085         else if ( strcmp( attr->value(), "I" ) == 0 )
    00086             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ROMAN);
    00087         else if ( strcmp( attr->value(), "1" ) == 0 )
    00088             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
    00089         break;
    00090     case ATTR_START:
    00091             _start = attr->val() ? attr->val()->toInt() : 1;
    00092     default:
    00093         HTMLUListElementImpl::parseAttribute(attr);
    00094     }
    00095 }
    00096
    00097 // -------------------------------------------------------------------------
    00098
    00099 NodeImpl::Id HTMLLIElementImpl::id() const
    00100 {
    00101     return ID_LI;
    00102 }
    00103
    00104 void HTMLLIElementImpl::parseAttribute(AttributeImpl *attr)
    00105 {
    00106     switch(attr->id())
    00107     {
    00108     case ATTR_VALUE:
    00109         if(m_render && m_render->isListItem() && m_render->style()->display() == LIST_ITEM)
    00110             static_cast<RenderListItem*>(m_render)->setValue(attr->value().toInt());
    00111         break;
    00112     case ATTR_TYPE:
    00113         if ( strcmp( attr->value(), "a" ) == 0 )
    00114             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ALPHA);
    00115         else if ( strcmp( attr->value(), "A" ) == 0 )
    00116             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ALPHA);
    00117         else if ( strcmp( attr->value(), "i" ) == 0 )
    00118             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ROMAN);
    00119         else if ( strcmp( attr->value(), "I" ) == 0 )
    00120             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ROMAN);
    00121         else if ( strcmp( attr->value(), "1" ) == 0 )
    00122             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
    00123         else
    00124             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, attr->value());
    00125         break;
    00126     default:
    00127         HTMLElementImpl::parseAttribute(attr);
    00128     }
    00129 }
    00130
    00131 void HTMLLIElementImpl::attach()
    00132 {
    00133     assert(!attached());
    00134
    00135     HTMLElementImpl::attach();
    00136
    00137     if ( m_render && m_render->style()->display() == LIST_ITEM ) {
    00138         DOMString v = getAttribute(ATTR_VALUE);
    00139         if (!v.isEmpty())
    00140             static_cast<RenderListItem*>(m_render)->setValue(v.implementation()->toInt());
    00141     }
    00142 }
    00143
    00144
    00145 // -------------------------------------------------------------------------
    00146
    00147
    00148 NodeImpl::Id HTMLDListElementImpl::id() const
    00149 {
    00150     return ID_DL;
    00151 }
    00152

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:55 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001