[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:24:13 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit dc1f1af40e3599f981754c581db812926a8fd2d0
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 27 19:08:34 2004 +0000

    	Add a new AtomicString type (that is really just a KJS::Identifier).  Define a Name class that will eventually
    	be used for element and attribute names.
    
    	Atomize the CSS selector's "value" field, used to hold class names, identifier names, attribute values, and
    	pseudo-element names.
    
            Reviewed by rjw
    
            * ForwardingHeaders/kjs/identifier.h: Added.
            * WebCore.pbproj/project.pbxproj:
            * khtml/css/css_base.cpp:
            (CSSSelector::print):
            (CSSSelector::specificity):
            (CSSSelector::extractPseudoType):
            (CSSSelector::selectorText):
            * khtml/css/css_base.h:
            (DOM::CSSSelector::):
            * khtml/css/cssparser.cpp:
            (ParseString::lower):
            * khtml/css/cssparser.h:
            (DOM::atomicString):
            * khtml/css/cssstyleselector.cpp:
            (khtml::CSSStyleSelector::checkOneSelector):
            * khtml/css/parser.cpp:
            * khtml/css/parser.y:
            * khtml/html/html_elementimpl.cpp:
            (:NamedAttrMapImpl):
            (HTMLNamedAttrMapImpl::clearAttributes):
            (HTMLNamedAttrMapImpl::isHTMLAttributeMap):
            (HTMLNamedAttrMapImpl::parseClassAttribute):
            (HTMLNamedAttrMapImpl::matchesCSSClass):
            (HTMLElementImpl::parseAttribute):
            (HTMLElementImpl::createAttributeMap):
            (HTMLElementImpl::matchesCSSClass):
            * khtml/html/html_elementimpl.h:
            * khtml/html/html_objectimpl.cpp:
            (HTMLObjectElementImpl::recalcStyle):
            * khtml/html/htmltokenizer.h:
            (khtml::Token::addAttribute):
            * khtml/xml/dom_elementimpl.cpp:
            (ElementImpl::matchesCSSClass):
            (NamedAttrMapImpl::isHTMLAttributeMap):
            (NamedAttrMapImpl::operator=):
            * khtml/xml/dom_elementimpl.h:
            * khtml/xml/dom_nameimpl.cpp: Added.
            (DOM::AtomicStringList::clone):
            (DOM::operator==):
            (DOM::equalsIgnoreCase):
            * khtml/xml/dom_nameimpl.h: Added.
            (DOM::AtomicStringList:::m_next):
            (DOM::AtomicStringList::m_next):
            (DOM::AtomicStringList::~AtomicStringList):
            (DOM::AtomicStringList::next):
            (DOM::AtomicStringList::setNext):
            (DOM::AtomicStringList::string):
            (DOM::AtomicStringList::setString):
            (DOM::AtomicStringList::clear):
            (DOM::Name::Name):
            (DOM::Name::m_localName):
            (DOM::Name::namespaceURI):
            (DOM::Name::localName):
            (DOM::operator==):
            (DOM::operator!=):
            * khtml/xml/dom_nodeimpl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5991 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 23649d3..cadfd71 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,70 @@
+2004-01-27  David Hyatt  <hyatt at apple.com>
+
+	Add a new AtomicString type (that is really just a KJS::Identifier).  Define a Name class that will eventually
+	be used for element and attribute names.
+
+	Atomize the CSS selector's "value" field, used to hold class names, identifier names, attribute values, and
+	pseudo-element names.
+	
+        Reviewed by rjw
+
+        * ForwardingHeaders/kjs/identifier.h: Added.
+        * WebCore.pbproj/project.pbxproj:
+        * khtml/css/css_base.cpp:
+        (CSSSelector::print):
+        (CSSSelector::specificity):
+        (CSSSelector::extractPseudoType):
+        (CSSSelector::selectorText):
+        * khtml/css/css_base.h:
+        (DOM::CSSSelector::):
+        * khtml/css/cssparser.cpp:
+        (ParseString::lower):
+        * khtml/css/cssparser.h:
+        (DOM::atomicString):
+        * khtml/css/cssstyleselector.cpp:
+        (khtml::CSSStyleSelector::checkOneSelector):
+        * khtml/css/parser.cpp:
+        * khtml/css/parser.y:
+        * khtml/html/html_elementimpl.cpp:
+        (:NamedAttrMapImpl):
+        (HTMLNamedAttrMapImpl::clearAttributes):
+        (HTMLNamedAttrMapImpl::isHTMLAttributeMap):
+        (HTMLNamedAttrMapImpl::parseClassAttribute):
+        (HTMLNamedAttrMapImpl::matchesCSSClass):
+        (HTMLElementImpl::parseAttribute):
+        (HTMLElementImpl::createAttributeMap):
+        (HTMLElementImpl::matchesCSSClass):
+        * khtml/html/html_elementimpl.h:
+        * khtml/html/html_objectimpl.cpp:
+        (HTMLObjectElementImpl::recalcStyle):
+        * khtml/html/htmltokenizer.h:
+        (khtml::Token::addAttribute):
+        * khtml/xml/dom_elementimpl.cpp:
+        (ElementImpl::matchesCSSClass):
+        (NamedAttrMapImpl::isHTMLAttributeMap):
+        (NamedAttrMapImpl::operator=):
+        * khtml/xml/dom_elementimpl.h:
+        * khtml/xml/dom_nameimpl.cpp: Added.
+        (DOM::AtomicStringList::clone):
+        (DOM::operator==):
+        (DOM::equalsIgnoreCase):
+        * khtml/xml/dom_nameimpl.h: Added.
+        (DOM::AtomicStringList:::m_next):
+        (DOM::AtomicStringList::m_next):
+        (DOM::AtomicStringList::~AtomicStringList):
+        (DOM::AtomicStringList::next):
+        (DOM::AtomicStringList::setNext):
+        (DOM::AtomicStringList::string):
+        (DOM::AtomicStringList::setString):
+        (DOM::AtomicStringList::clear):
+        (DOM::Name::Name):
+        (DOM::Name::m_localName):
+        (DOM::Name::namespaceURI):
+        (DOM::Name::localName):
+        (DOM::operator==):
+        (DOM::operator!=):
+        * khtml/xml/dom_nodeimpl.h:
+
 2004-01-27  Darin Adler  <darin at apple.com>
 
         Reviewed by Ken.
diff --git a/WebCore/ForwardingHeaders/kjs/identifier.h b/WebCore/ForwardingHeaders/kjs/identifier.h
new file mode 100644
index 0000000..2471c99
--- /dev/null
+++ b/WebCore/ForwardingHeaders/kjs/identifier.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/identifier.h>
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index fc8dc74..6311b84 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -522,6 +522,7 @@
 				BEB1DD3205C1980700DD1F43,
 				BEB1DD3E05C1982000DD1F43,
 				BC7FDE3405C1D9AB0070A902,
+				BC7E782205C5EB700088A50F,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -796,6 +797,7 @@
 				BEB1DD3105C1980700DD1F43,
 				BEB1DD3D05C1982000DD1F43,
 				BC7FDE3305C1D9AB0070A902,
+				BC7E782105C5EB700088A50F,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -2103,6 +2105,34 @@
 			settings = {
 			};
 		};
+		BC7E781F05C5EB700088A50F = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.cpp.cpp;
+			path = dom_nameimpl.cpp;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BC7E782005C5EB700088A50F = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.c.h;
+			path = dom_nameimpl.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BC7E782105C5EB700088A50F = {
+			fileRef = BC7E781F05C5EB700088A50F;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		BC7E782205C5EB700088A50F = {
+			fileRef = BC7E782005C5EB700088A50F;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		BC7FDE3105C1D9AB0070A902 = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -5917,6 +5947,8 @@
 				F523D2F502DE4476018635CA,
 				F523D2F702DE4476018635CA,
 				F523D2F802DE4476018635CA,
+				BC7E781F05C5EB700088A50F,
+				BC7E782005C5EB700088A50F,
 				F523D2F902DE4476018635CA,
 				F523D2FA02DE4476018635CA,
 				F523D2FB02DE4476018635CA,
diff --git a/WebCore/khtml/css/css_base.cpp b/WebCore/khtml/css/css_base.cpp
index 24abaff..9a17f5b 100644
--- a/WebCore/khtml/css/css_base.cpp
+++ b/WebCore/khtml/css/css_base.cpp
@@ -123,7 +123,7 @@ StyleListImpl::~StyleListImpl()
 void CSSSelector::print(void)
 {
     kdDebug( 6080 ) << "[Selector: tag = " <<       tag << ", attr = \"" << attr << "\", match = \"" << match
-		    << "\" value = \"" << value.string().latin1() << "\" relation = " << (int)relation
+		    << "\" value = \"" << value.qstring().latin1() << "\" relation = " << (int)relation
 		    << "]" << endl;
     if ( tagHistory )
         tagHistory->print();
@@ -142,6 +142,7 @@ unsigned int CSSSelector::specificity()
 	s += 0x10000;
 	break;
     case Exact:
+    case Class:
     case Set:
     case List:
     case Hyphen:
@@ -163,74 +164,65 @@ void CSSSelector::extractPseudoType() const
 {
     if (match != Pseudo)
         return;
+    
+    static AtomicString active("active");
+    static AtomicString after("after");
+    static AtomicString before("before");
+    static AtomicString empty("empty");
+    static AtomicString firstChild("first-child");
+    static AtomicString firstLetter("first-letter");
+    static AtomicString firstLine("first-line");
+    static AtomicString focus("focus");
+    static AtomicString hover("hover");
+    static AtomicString link("link");
+    static AtomicString lang("lang(");
+    static AtomicString lastChild("last-child");
+    static AtomicString notStr("not(");
+    static AtomicString onlyChild("only-child");
+    static AtomicString root("root");
+    static AtomicString selection("selection");
+    static AtomicString target("target");
+    static AtomicString visited("visited");
+    
     _pseudoType = PseudoOther;
-    if (!value.isEmpty()) {
-        value = value.lower();
-        switch (value[0]) {
-            case 'a':
-                if (value == "active")
-                    _pseudoType = PseudoActive;
-                else if (value == "after")
-                    _pseudoType = PseudoAfter;
-                break;
-            case 'b':
-                if (value == "before")
-                    _pseudoType = PseudoBefore;
-                break;
-            case 'e':
-                if (value == "empty")
-                    _pseudoType = PseudoEmpty;
-                break;
-            case 'f':
-                if (value == "first-child")
-                    _pseudoType = PseudoFirstChild;
-                else if (value == "first-letter")
-                    _pseudoType = PseudoFirstLetter;
-                else if (value == "first-line")
-                    _pseudoType = PseudoFirstLine;
-                else if (value == "focus")
-                    _pseudoType = PseudoFocus;
-                break;
-            case 'h':
-                if (value == "hover")
-                    _pseudoType = PseudoHover;
-                break;
-            case 'l':
-                if (value == "link")
-                    _pseudoType = PseudoLink;
-                else if (value == "lang(")
-                    _pseudoType = PseudoLang;
-                else if (value == "last-child")
-                    _pseudoType = PseudoLastChild;
-                break;
-            case 'n':
-                if (value == "not(")
-                    _pseudoType = PseudoNot;
-                break;
-            case 'o':
-                if (value == "only-child")
-                    _pseudoType = PseudoOnlyChild;
-                break;
-            case 'r':
-                if (value == "root")
-                    _pseudoType = PseudoRoot;
-                break;
-            case 's':
-                if (value == "selection")
-                    _pseudoType = PseudoSelection;
-                break;
-            case 't':
-                if (value == "target")
-                    _pseudoType = PseudoTarget;
-                break;
-            case 'v':
-                if (value == "visited")
-                    _pseudoType = PseudoVisited;
-                break;
-        }
-    }
-
-    value = DOMString();
+    if (value == active)
+        _pseudoType = PseudoActive;
+    else if (value == after)
+        _pseudoType = PseudoAfter;
+    else if (value == before)
+        _pseudoType = PseudoBefore;
+    else if (value == empty)
+        _pseudoType = PseudoEmpty;
+    else if (value == firstChild)
+        _pseudoType = PseudoFirstChild;
+    else if (value == firstLetter)
+        _pseudoType = PseudoFirstLetter;
+    else if (value == firstLine)
+        _pseudoType = PseudoFirstLine;
+    else if (value == focus)
+        _pseudoType = PseudoFocus;
+    else if (value == hover)
+        _pseudoType = PseudoHover;
+    else if (value == link)
+        _pseudoType = PseudoLink;
+    else if (value == lang)
+        _pseudoType = PseudoLang;
+    else if (value == lastChild)
+        _pseudoType = PseudoLastChild;
+    else if (value == notStr)
+        _pseudoType = PseudoNot;
+    else if (value == onlyChild)
+        _pseudoType = PseudoOnlyChild;
+    else if (value == root)
+        _pseudoType = PseudoRoot;
+    else if (value == selection)
+        _pseudoType = PseudoSelection;
+    else if (value == target)
+        _pseudoType = PseudoTarget;
+    else if (value == visited)
+        _pseudoType = PseudoVisited;
+    
+    value = AtomicString::null();
 }
 
 
@@ -264,17 +256,17 @@ DOMString CSSSelector::selectorText() const
     if ( tag == anyLocalName && cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
     {
         str = "#";
-        str += cs->value;
+        str += cs->value.qstring();
     }
     else if ( tag == anyLocalName && cs->attr == ATTR_CLASS && cs->match == CSSSelector::List )
     {
         str = ".";
-        str += cs->value;
+        str += cs->value.qstring();
     }
     else if ( tag == anyLocalName && cs->match == CSSSelector::Pseudo )
     {
         str = ":";
-        str += cs->value;
+        str += cs->value.qstring();
     }
     else
     {
@@ -285,17 +277,17 @@ DOMString CSSSelector::selectorText() const
         if ( cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
         {
             str += "#";
-            str += cs->value;
+            str += cs->value.qstring();
         }
         else if ( cs->attr == ATTR_CLASS && cs->match == CSSSelector::List )
         {
             str += ".";
-            str += cs->value;
+            str += cs->value.qstring();
         }
         else if ( cs->match == CSSSelector::Pseudo )
         {
             str += ":";
-            str += cs->value;
+            str += cs->value.qstring();
         }
         // optional attribute
         if ( cs->attr ) {
@@ -328,7 +320,7 @@ DOMString CSSSelector::selectorText() const
                 kdWarning(6080) << "Unhandled case in CSSStyleRuleImpl::selectorText : match=" << cs->match << endl;
             }
             str += "\"";
-            str += cs->value;
+            str += cs->value.qstring();
             str += "\"]";
         }
     }
diff --git a/WebCore/khtml/css/css_base.h b/WebCore/khtml/css/css_base.h
index 60bfde9..e307386 100644
--- a/WebCore/khtml/css/css_base.h
+++ b/WebCore/khtml/css/css_base.h
@@ -105,6 +105,7 @@ namespace DOM {
 	{
 	    None = 0,
 	    Id,
+            Class,
 	    Exact,
 	    Set,
 	    List,
@@ -154,7 +155,7 @@ namespace DOM {
 		return _pseudoType;
 	    }
 
-	mutable DOM::DOMString value;
+	mutable DOM::AtomicString value;
 	CSSSelector *tagHistory;
         CSSSelector* simpleSelector; // Used for :not.
 	Q_UINT32     attr;
diff --git a/WebCore/khtml/css/cssparser.cpp b/WebCore/khtml/css/cssparser.cpp
index 5c8d37a..237f177 100644
--- a/WebCore/khtml/css/cssparser.cpp
+++ b/WebCore/khtml/css/cssparser.cpp
@@ -128,6 +128,12 @@ CSSParser::~CSSParser()
 
 }
 
+void ParseString::lower()
+{
+    for (int i = 0; i < length; i++)
+        string[i] = QChar(string[i]).lower();
+}
+
 void CSSParser::parseSheet( CSSStyleSheetImpl *sheet, const DOMString &string )
 {
     styleElement = sheet;
diff --git a/WebCore/khtml/css/cssparser.h b/WebCore/khtml/css/cssparser.h
index fc4c987..0774a27 100644
--- a/WebCore/khtml/css/cssparser.h
+++ b/WebCore/khtml/css/cssparser.h
@@ -25,6 +25,7 @@
 
 #include <qstring.h>
 #include <dom/dom_string.h>
+#include "dom_nameimpl.h"
 
 namespace DOM {
     class StyleListImpl;
@@ -43,6 +44,8 @@ namespace DOM {
     struct ParseString {
 	unsigned short *string;
 	int length;
+        
+        void lower();
     };
 
     struct Value;
@@ -72,7 +75,10 @@ namespace DOM {
     static inline DOMString domString( const ParseString &ps ) {
 	return DOMString( (QChar *)ps.string, ps.length );
     }
-
+    static inline AtomicString atomicString( const ParseString &ps ) {
+	return AtomicString( (AtomicChar*)ps.string, ps.length );
+    }
+    
     class ValueList {
     public:
 	ValueList();
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 8203a36..e4f8ca5 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -869,20 +869,23 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
             return false;
     }
 
-    if(sel->attr)
-    {
+    if (sel->attr) {
+        if (sel->match == CSSSelector::Class && e->hasClass())
+            return e->matchesCSSClass(sel->value, strictParsing);
+        
         DOMString value = e->getAttribute(sel->attr);
-        if(value.isNull()) return false; // attribute is not set
+        if (value.isNull()) return false; // attribute is not set
 
-        switch(sel->match)
-        {
-        case CSSSelector::Exact:
+        switch(sel->match) {
         case CSSSelector::Id:
-	    if( (isXMLDoc && strcmp(sel->value, value) ) ||
-                (!isXMLDoc && strcasecmp(sel->value, value)))
+            if ((strictParsing && sel->value != value) ||
+                (!strictParsing && !equalsIgnoreCase(sel->value, value)))
                 return false;
             break;
-        case CSSSelector::Set:
+        case CSSSelector::Exact:
+	    if ((isXMLDoc && sel->value != value) ||
+                (!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
+                return false;
             break;
         case CSSSelector::List:
         {
@@ -891,19 +894,19 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
                 // There is no list, just a single item.  We can avoid
                 // allocing QStrings and just treat this as an exact
                 // match check.
-                if( (isXMLDoc && strcmp(sel->value, value) ) ||
-                     (!isXMLDoc && strcasecmp(sel->value, value)))
+                if ((isXMLDoc && sel->value != value) ||
+                    (!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
                     return false;
                 break;
             }
 
             // The selector's value can't contain a space, or it's totally bogus.
-            spacePos = sel->value.find(' ');
+            spacePos = sel->value.ustring().find(' ');
             if (spacePos != -1)
                 return false;
-            
+
             QString str = value.string();
-            QString selStr = sel->value.string();
+            QString selStr = sel->value.qstring();
             int startSearchAt = 0;
             while (true) {
                 int foundPos = str.find(selStr, startSearchAt, isXMLDoc);
@@ -924,7 +927,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for contains match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.string();
+            QString selStr = sel->value.qstring();
             int pos = str.find(selStr, 0, isXMLDoc);
             if(pos == -1) return false;
             break;
@@ -933,7 +936,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for beginswith match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.string();
+            QString selStr = sel->value.qstring();
             int pos = str.find(selStr, 0, isXMLDoc);
             if(pos != 0) return false;
             break;
@@ -942,7 +945,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for endswith match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.string();
+            QString selStr = sel->value.qstring();
 	    if (isXMLDoc && !str.endsWith(selStr)) return false;
 	    if (!isXMLDoc) {
 	        int pos = str.length() - selStr.length();
@@ -955,7 +958,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for hyphen match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.string();
+            QString selStr = sel->value.qstring();
             if(str.length() < selStr.length()) return false;
             // Check if str begins with selStr:
             if(str.find(selStr, 0, isXMLDoc) != 0) return false;
@@ -966,6 +969,8 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         }
         case CSSSelector::Pseudo:
         case CSSSelector::None:
+        case CSSSelector::Class:
+        case CSSSelector::Set:
             break;
         }
     }
diff --git a/WebCore/khtml/css/parser.cpp b/WebCore/khtml/css/parser.cpp
index e25a333..13fd9a1 100644
--- a/WebCore/khtml/css/parser.cpp
+++ b/WebCore/khtml/css/parser.cpp
@@ -315,14 +315,14 @@ static const short yyrline[] = { 0,
    537,   543,   547,   570,   576,   578,   579,   582,   587,   592,
    597,   604,   613,   624,   641,   646,   651,   661,   667,   674,
    675,   676,   679,   688,   708,   714,   720,   728,   739,   743,
-   746,   749,   752,   755,   760,   762,   765,   771,   777,   785,
-   789,   794,   797,   803,   811,   815,   818,   824,   830,   835,
-   841,   849,   872,   876,   884,   889,   896,   903,   905,   908,
-   913,   926,   932,   936,   939,   944,   946,   947,   948,   955,
-   956,   957,   958,   959,   960,   962,   967,   969,   970,   971,
-   972,   973,   974,   975,   976,   977,   978,   979,   980,   981,
-   982,   983,   984,   985,   989,   997,  1012,  1019,  1026,  1034,
-  1060,  1062,  1065,  1067
+   746,   749,   752,   755,   760,   762,   765,   772,   779,   788,
+   792,   797,   800,   806,   814,   818,   821,   827,   833,   838,
+   844,   852,   875,   879,   887,   892,   899,   906,   908,   911,
+   916,   929,   935,   939,   942,   947,   949,   950,   951,   958,
+   959,   960,   961,   962,   963,   965,   970,   972,   973,   974,
+   975,   976,   977,   978,   979,   980,   981,   982,   983,   984,
+   985,   986,   987,   988,   992,  1000,  1015,  1022,  1029,  1037,
+  1063,  1065,  1068,  1070
 };
 #endif
 
@@ -1610,16 +1610,16 @@ case 79:
 	yyval.selector = new CSSSelector();
 	yyval.selector->match = CSSSelector::Id;
 	yyval.selector->attr = ATTR_ID;
-	yyval.selector->value = domString(yyvsp[0].string);
+	yyval.selector->value = atomicString(yyvsp[0].string);
     ;
     break;}
 case 83:
 #line 680 "parser.y"
 {
 	yyval.selector = new CSSSelector();
-	yyval.selector->match = CSSSelector::List;
+	yyval.selector->match = CSSSelector::Class;
 	yyval.selector->attr = ATTR_CLASS;
-	yyval.selector->value = domString(yyvsp[0].string);
+	yyval.selector->value = atomicString(yyvsp[0].string);
     ;
     break;}
 case 84:
@@ -1656,7 +1656,7 @@ case 86:
 	yyval.selector = new CSSSelector();
 	yyval.selector->attr = yyvsp[-5].attribute;
 	yyval.selector->match = (CSSSelector::Match)yyvsp[-4].val;
-	yyval.selector->value = domString(yyvsp[-2].string);
+	yyval.selector->value = atomicString(yyvsp[-2].string);
     ;
     break;}
 case 87:
@@ -1676,7 +1676,7 @@ case 88:
         yyval.selector = new CSSSelector();
         yyval.selector->attr = yyvsp[-5].attribute;
         yyval.selector->match = (CSSSelector::Match)yyvsp[-4].val;
-        yyval.selector->value = domString(yyvsp[-2].string);
+        yyval.selector->value = atomicString(yyvsp[-2].string);
         CSSParser *p = static_cast<CSSParser *>(parser);
         if (p->styleElement && p->styleElement->isCSSStyleSheet())
             static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(yyval.selector->attr, domString(yyvsp[-7].string));
@@ -1723,34 +1723,37 @@ case 97:
 {
         yyval.selector = new CSSSelector();
         yyval.selector->match = CSSSelector::Pseudo;
-        yyval.selector->value = domString(yyvsp[0].string);
+        yyvsp[0].string.lower();
+        yyval.selector->value = atomicString(yyvsp[0].string);
     ;
     break;}
 case 98:
-#line 772 "parser.y"
+#line 773 "parser.y"
 {
         yyval.selector = new CSSSelector();
         yyval.selector->match = CSSSelector::Pseudo;
-        yyval.selector->value = domString(yyvsp[0].string);
+        yyvsp[0].string.lower();
+        yyval.selector->value = atomicString(yyvsp[0].string);
     ;
     break;}
 case 99:
-#line 777 "parser.y"
+#line 779 "parser.y"
 {
         yyval.selector = new CSSSelector();
         yyval.selector->match = CSSSelector::Pseudo;
         yyval.selector->simpleSelector = yyvsp[-2].selector;
-        yyval.selector->value = domString(yyvsp[-4].string);
+        yyvsp[-4].string.lower();
+        yyval.selector->value = atomicString(yyvsp[-4].string);
     ;
     break;}
 case 100:
-#line 786 "parser.y"
+#line 789 "parser.y"
 {
 	yyval.ok = yyvsp[0].ok;
     ;
     break;}
 case 101:
-#line 789 "parser.y"
+#line 792 "parser.y"
 {
 	yyval.ok = yyvsp[-1].ok;
 	if ( yyvsp[0].ok )
@@ -1758,13 +1761,13 @@ case 101:
     ;
     break;}
 case 102:
-#line 794 "parser.y"
+#line 797 "parser.y"
 {
 	yyval.ok = yyvsp[0].ok;
     ;
     break;}
 case 103:
-#line 797 "parser.y"
+#line 800 "parser.y"
 {
 	yyval.ok = false;
 #ifdef CSS_DEBUG
@@ -1773,7 +1776,7 @@ case 103:
     ;
     break;}
 case 104:
-#line 803 "parser.y"
+#line 806 "parser.y"
 {
 	yyval.ok = false;
 #ifdef CSS_DEBUG
@@ -1782,19 +1785,19 @@ case 104:
     ;
     break;}
 case 105:
-#line 812 "parser.y"
+#line 815 "parser.y"
 {
 	yyval.ok = yyvsp[-2].ok;
     ;
     break;}
 case 106:
-#line 815 "parser.y"
+#line 818 "parser.y"
 {
         yyval.ok = false;
     ;
     break;}
 case 107:
-#line 818 "parser.y"
+#line 821 "parser.y"
 {
 	yyval.ok = false;
 #ifdef CSS_DEBUG
@@ -1803,7 +1806,7 @@ case 107:
     ;
     break;}
 case 108:
-#line 824 "parser.y"
+#line 827 "parser.y"
 {
 	yyval.ok = false;
 #ifdef CSS_DEBUG
@@ -1812,7 +1815,7 @@ case 108:
     ;
     break;}
 case 109:
-#line 830 "parser.y"
+#line 833 "parser.y"
 {
 	yyval.ok = yyvsp[-3].ok;
 	if ( yyvsp[-2].ok )
@@ -1820,7 +1823,7 @@ case 109:
     ;
     break;}
 case 110:
-#line 835 "parser.y"
+#line 838 "parser.y"
 {
 	yyval.ok = yyvsp[-3].ok;
 #ifdef CSS_DEBUG
@@ -1829,7 +1832,7 @@ case 110:
     ;
     break;}
 case 111:
-#line 841 "parser.y"
+#line 844 "parser.y"
 {
 	yyval.ok = yyvsp[-5].ok;
 #ifdef CSS_DEBUG
@@ -1838,7 +1841,7 @@ case 111:
     ;
     break;}
 case 112:
-#line 850 "parser.y"
+#line 853 "parser.y"
 {
 	yyval.ok = false;
 	CSSParser *p = static_cast<CSSParser *>(parser);
@@ -1863,13 +1866,13 @@ case 112:
     ;
     break;}
 case 113:
-#line 873 "parser.y"
+#line 876 "parser.y"
 {
         yyval.ok = false;
     ;
     break;}
 case 114:
-#line 877 "parser.y"
+#line 880 "parser.y"
 {
         /* The default movable type template has letter-spacing: .none;  Handle this by looking for
         error tokens at the start of an expr, recover the expr and then treat as an error, cleaning
@@ -1879,43 +1882,43 @@ case 114:
     ;
     break;}
 case 115:
-#line 885 "parser.y"
+#line 888 "parser.y"
 {
         /* Handle this case: div { text-align: center; !important } Just reduce away the stray !important. */
         yyval.ok = false;
     ;
     break;}
 case 116:
-#line 890 "parser.y"
+#line 893 "parser.y"
 {
         /* div { font-family: } Just reduce away this property with no value. */
         yyval.ok = false;
     ;
     break;}
 case 117:
-#line 897 "parser.y"
+#line 900 "parser.y"
 {
 	QString str = qString(yyvsp[-1].string);
 	yyval.prop_id = getPropertyID( str.lower().latin1(), str.length() );
     ;
     break;}
 case 118:
-#line 904 "parser.y"
+#line 907 "parser.y"
 { yyval.b = true; ;
     break;}
 case 119:
-#line 905 "parser.y"
+#line 908 "parser.y"
 { yyval.b = false; ;
     break;}
 case 120:
-#line 909 "parser.y"
+#line 912 "parser.y"
 {
 	yyval.valueList = new ValueList;
 	yyval.valueList->addValue( yyvsp[0].value );
     ;
     break;}
 case 121:
-#line 913 "parser.y"
+#line 916 "parser.y"
 {
         yyval.valueList = yyvsp[-2].valueList;
 	if ( yyval.valueList ) {
@@ -1931,44 +1934,44 @@ case 121:
     ;
     break;}
 case 122:
-#line 926 "parser.y"
+#line 929 "parser.y"
 {
         delete yyvsp[-1].valueList;
         yyval.valueList = 0;
     ;
     break;}
 case 123:
-#line 933 "parser.y"
+#line 936 "parser.y"
 {
 	yyval.tok = '/';
     ;
     break;}
 case 124:
-#line 936 "parser.y"
+#line 939 "parser.y"
 {
 	yyval.tok = ',';
     ;
     break;}
 case 125:
-#line 939 "parser.y"
+#line 942 "parser.y"
 {
         yyval.tok = 0;
   ;
     break;}
 case 126:
-#line 945 "parser.y"
+#line 948 "parser.y"
 { yyval.value = yyvsp[0].value; ;
     break;}
 case 127:
-#line 946 "parser.y"
+#line 949 "parser.y"
 { yyval.value = yyvsp[0].value; yyval.value.fValue *= yyvsp[-1].val; ;
     break;}
 case 128:
-#line 947 "parser.y"
+#line 950 "parser.y"
 { yyval.value.id = 0; yyval.value.string = yyvsp[-1].string; yyval.value.unit = CSSPrimitiveValue::CSS_STRING; ;
     break;}
 case 129:
-#line 948 "parser.y"
+#line 951 "parser.y"
 {
       QString str = qString( yyvsp[-1].string );
       yyval.value.id = getValueID( str.lower().latin1(), str.length() );
@@ -1977,109 +1980,109 @@ case 129:
   ;
     break;}
 case 130:
-#line 955 "parser.y"
+#line 958 "parser.y"
 { yyval.value.id = 0; yyval.value.string = yyvsp[-1].string; yyval.value.unit = CSSPrimitiveValue::CSS_DIMENSION ;
     break;}
 case 131:
-#line 956 "parser.y"
+#line 959 "parser.y"
 { yyval.value.id = 0; yyval.value.string = yyvsp[-1].string; yyval.value.unit = CSSPrimitiveValue::CSS_DIMENSION ;
     break;}
 case 132:
-#line 957 "parser.y"
+#line 960 "parser.y"
 { yyval.value.id = 0; yyval.value.string = yyvsp[-1].string; yyval.value.unit = CSSPrimitiveValue::CSS_URI; ;
     break;}
 case 133:
-#line 958 "parser.y"
+#line 961 "parser.y"
 { yyval.value.id = 0; yyval.value.iValue = 0; yyval.value.unit = CSSPrimitiveValue::CSS_UNKNOWN;/* ### */ ;
     break;}
 case 134:
-#line 959 "parser.y"
+#line 962 "parser.y"
 { yyval.value.id = 0; yyval.value.string = yyvsp[0].string; yyval.value.unit = CSSPrimitiveValue::CSS_RGBCOLOR; ;
     break;}
 case 135:
-#line 960 "parser.y"
+#line 963 "parser.y"
 { yyval.value.id = 0; yyval.value.string = ParseString(); yyval.value.unit = CSSPrimitiveValue::CSS_RGBCOLOR; ;
     break;}
 case 136:
-#line 962 "parser.y"
+#line 965 "parser.y"
 {
       yyval.value = yyvsp[0].value;
   ;
     break;}
 case 137:
-#line 968 "parser.y"
+#line 971 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_NUMBER; ;
     break;}
 case 138:
-#line 969 "parser.y"
+#line 972 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_PERCENTAGE; ;
     break;}
 case 139:
-#line 970 "parser.y"
+#line 973 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_PX; ;
     break;}
 case 140:
-#line 971 "parser.y"
+#line 974 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_CM; ;
     break;}
 case 141:
-#line 972 "parser.y"
+#line 975 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_MM; ;
     break;}
 case 142:
-#line 973 "parser.y"
+#line 976 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_IN; ;
     break;}
 case 143:
-#line 974 "parser.y"
+#line 977 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_PT; ;
     break;}
 case 144:
-#line 975 "parser.y"
+#line 978 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_PC; ;
     break;}
 case 145:
-#line 976 "parser.y"
+#line 979 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_DEG; ;
     break;}
 case 146:
-#line 977 "parser.y"
+#line 980 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_RAD; ;
     break;}
 case 147:
-#line 978 "parser.y"
+#line 981 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_GRAD; ;
     break;}
 case 148:
-#line 979 "parser.y"
+#line 982 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_MS; ;
     break;}
 case 149:
-#line 980 "parser.y"
+#line 983 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_S; ;
     break;}
 case 150:
-#line 981 "parser.y"
+#line 984 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_HZ; ;
     break;}
 case 151:
-#line 982 "parser.y"
+#line 985 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_KHZ; ;
     break;}
 case 152:
-#line 983 "parser.y"
+#line 986 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_EMS; ;
     break;}
 case 153:
-#line 984 "parser.y"
+#line 987 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = Value::Q_EMS; ;
     break;}
 case 154:
-#line 985 "parser.y"
+#line 988 "parser.y"
 { yyval.value.id = 0; yyval.value.fValue = yyvsp[-1].val; yyval.value.unit = CSSPrimitiveValue::CSS_EXS; ;
     break;}
 case 155:
-#line 990 "parser.y"
+#line 993 "parser.y"
 {
       Function *f = new Function;
       f->name = yyvsp[-4].string;
@@ -2090,7 +2093,7 @@ case 155:
   ;
     break;}
 case 156:
-#line 998 "parser.y"
+#line 1001 "parser.y"
 {
       Function *f = new Function;
       f->name = yyvsp[-2].string;
@@ -2101,11 +2104,11 @@ case 156:
   ;
     break;}
 case 157:
-#line 1013 "parser.y"
+#line 1016 "parser.y"
 { yyval.string = yyvsp[-1].string; ;
     break;}
 case 158:
-#line 1020 "parser.y"
+#line 1023 "parser.y"
 {
 	yyval.rule = 0;
 #ifdef CSS_DEBUG
@@ -2114,7 +2117,7 @@ case 158:
     ;
     break;}
 case 159:
-#line 1026 "parser.y"
+#line 1029 "parser.y"
 {
 	yyval.rule = 0;
 #ifdef CSS_DEBUG
@@ -2123,7 +2126,7 @@ case 159:
     ;
     break;}
 case 160:
-#line 1035 "parser.y"
+#line 1038 "parser.y"
 {
 	yyval.rule = 0;
 #ifdef CSS_DEBUG
@@ -2353,6 +2356,6 @@ yyerrhandle:
     }
   return 1;
 }
-#line 1070 "parser.y"
+#line 1073 "parser.y"
 
 
diff --git a/WebCore/khtml/css/parser.y b/WebCore/khtml/css/parser.y
index a4dc817..35b1f56 100644
--- a/WebCore/khtml/css/parser.y
+++ b/WebCore/khtml/css/parser.y
@@ -669,7 +669,7 @@ specifier:
 	$$ = new CSSSelector();
 	$$->match = CSSSelector::Id;
 	$$->attr = ATTR_ID;
-	$$->value = domString($1);
+	$$->value = atomicString($1);
     }
   | class
   | attrib
@@ -679,9 +679,9 @@ specifier:
 class:
     '.' IDENT {
 	$$ = new CSSSelector();
-	$$->match = CSSSelector::List;
+	$$->match = CSSSelector::Class;
 	$$->attr = ATTR_CLASS;
-	$$->value = domString($2);
+	$$->value = atomicString($2);
     }
   ;
 
@@ -715,7 +715,7 @@ attrib:
 	$$ = new CSSSelector();
 	$$->attr = $3;
 	$$->match = (CSSSelector::Match)$4;
-	$$->value = domString($6);
+	$$->value = atomicString($6);
     }
     | '[' maybe_space namespace_selector '|' attrib_id ']' {
         $$ = new CSSSelector();
@@ -729,7 +729,7 @@ attrib:
         $$ = new CSSSelector();
         $$->attr = $5;
         $$->match = (CSSSelector::Match)$6;
-        $$->value = domString($8);
+        $$->value = atomicString($8);
         CSSParser *p = static_cast<CSSParser *>(parser);
         if (p->styleElement && p->styleElement->isCSSStyleSheet())
             static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
@@ -766,19 +766,22 @@ pseudo:
     ':' IDENT {
         $$ = new CSSSelector();
         $$->match = CSSSelector::Pseudo;
-        $$->value = domString($2);
+        $2.lower();
+        $$->value = atomicString($2);
     }
     |
     ':' ':' IDENT {
         $$ = new CSSSelector();
         $$->match = CSSSelector::Pseudo;
-        $$->value = domString($3);
+        $3.lower();
+        $$->value = atomicString($3);
     }
     | ':' FUNCTION maybe_space simple_selector maybe_space ')' {
         $$ = new CSSSelector();
         $$->match = CSSSelector::Pseudo;
         $$->simpleSelector = $4;
-        $$->value = domString($2);
+        $2.lower();
+        $$->value = atomicString($2);
     }
   ;
 
diff --git a/WebCore/khtml/html/html_elementimpl.cpp b/WebCore/khtml/html/html_elementimpl.cpp
index ffbf819..dc7f73e 100644
--- a/WebCore/khtml/html/html_elementimpl.cpp
+++ b/WebCore/khtml/html/html_elementimpl.cpp
@@ -53,6 +53,67 @@
 using namespace DOM;
 using namespace khtml;
 
+HTMLNamedAttrMapImpl::HTMLNamedAttrMapImpl(ElementImpl *e)
+:NamedAttrMapImpl(e)
+{}
+
+void HTMLNamedAttrMapImpl::clearAttributes()
+{
+    m_classList.clear();
+}
+
+bool HTMLNamedAttrMapImpl::isHTMLAttributeMap() const
+{
+    return true;
+}
+
+void HTMLNamedAttrMapImpl::parseClassAttribute(const DOMString& classAttr)
+{
+    m_classList.clear();
+    if (!element->hasClass())
+        return;
+    
+    if (classAttr.find(' ') == -1)
+        m_classList.setString(AtomicString(classAttr));
+    else {
+        QString val = classAttr.string();
+        QStringList list = QStringList::split(' ', val);
+        
+        AtomicStringList* curr = 0;
+        for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
+        {
+            const QString& singleClass = *it;
+            if (!singleClass.isEmpty()) {
+                if (curr) {
+                    curr->setNext(new AtomicStringList(AtomicString(singleClass)));
+                    curr = curr->next();
+                }
+                else {
+                    m_classList.setString(AtomicString(singleClass));
+                    curr = &m_classList;
+                }
+            }
+        }
+    }
+}
+
+bool HTMLNamedAttrMapImpl::matchesCSSClass(const AtomicString& c, bool caseSensitive) const
+{
+    for (const AtomicStringList* curr = &m_classList; curr; curr = curr->next()) {
+        if (caseSensitive) {
+            if (c == curr->string())
+                return true;
+        }
+        else {
+            if (equalsIgnoreCase(c, curr->string()))
+                return true;
+        }
+    }
+    return false;
+}
+
+// ------------------------------------------------------------------
+
 HTMLElementImpl::HTMLElementImpl(DocumentPtr *doc)
     : ElementImpl(doc)
 {
@@ -128,6 +189,7 @@ void HTMLElementImpl::parseAttribute(AttributeImpl *attr)
     case ATTR_CLASS:
         // class
         setHasClass(attr->val());
+        if (namedAttrMap) static_cast<HTMLNamedAttrMapImpl*>(namedAttrMap)->parseClassAttribute(attr->value());
         setChanged();
         break;
     case ATTR_CONTENTEDITABLE:
@@ -217,6 +279,17 @@ void HTMLElementImpl::parseAttribute(AttributeImpl *attr)
     }
 }
 
+void HTMLElementImpl::createAttributeMap() const
+{
+    namedAttrMap = new HTMLNamedAttrMapImpl(const_cast<HTMLElementImpl*>(this));
+    namedAttrMap->ref();
+}
+
+bool HTMLElementImpl::matchesCSSClass(const AtomicString& c, bool cs) const
+{
+    return namedAttrMap ? static_cast<HTMLNamedAttrMapImpl*>(namedAttrMap)->matchesCSSClass(c, cs) : false;
+}
+
 void HTMLElementImpl::addCSSProperty(int id, const DOMString &value)
 {
     if(!m_styleDecls) createDecl();
diff --git a/WebCore/khtml/html/html_elementimpl.h b/WebCore/khtml/html/html_elementimpl.h
index f844be8..bc1a039 100644
--- a/WebCore/khtml/html/html_elementimpl.h
+++ b/WebCore/khtml/html/html_elementimpl.h
@@ -32,6 +32,22 @@ class CSSStyleDeclarationImpl;
 class HTMLFormElementImpl;
 class DocumentFragmentImpl;
 
+class HTMLNamedAttrMapImpl : public NamedAttrMapImpl
+{
+public:
+    HTMLNamedAttrMapImpl(ElementImpl *e);
+
+    virtual void clearAttributes();
+    
+    virtual bool isHTMLAttributeMap() const;
+    
+    virtual void parseClassAttribute(const DOMString& classAttr);
+    bool matchesCSSClass(const AtomicString& c, bool caseSensitive) const;
+    
+private:
+    AtomicStringList m_classList;
+};
+    
 class HTMLElementImpl : public ElementImpl
 {
 public:
@@ -46,6 +62,9 @@ public:
     virtual Id id() const = 0;
 
     virtual void parseAttribute(AttributeImpl *token);
+    virtual void createAttributeMap() const;
+
+    virtual bool matchesCSSClass(const AtomicString& c, bool caseSensitive) const;
 
     void addCSSLength(int id, const DOMString &value); // value will be parsed by the CSS parser
     void addCSSProperty(int id, const DOMString &value); // value will be parsed by the CSS parser
diff --git a/WebCore/khtml/html/html_objectimpl.cpp b/WebCore/khtml/html/html_objectimpl.cpp
index 2aa8090..9e869cd 100644
--- a/WebCore/khtml/html/html_objectimpl.cpp
+++ b/WebCore/khtml/html/html_objectimpl.cpp
@@ -436,7 +436,7 @@ void HTMLObjectElementImpl::detach()
 void HTMLObjectElementImpl::recalcStyle( StyleChange ch )
 {
     if (needWidgetUpdate) {
-        if(m_render && strcmp( m_render->renderName(),  "RenderPartObject" ) == 0 )
+        if(m_render && std::strcmp( m_render->renderName(),  "RenderPartObject" ) == 0 )
             static_cast<RenderPartObject*>(m_render)->updateWidget();
         needWidgetUpdate = false;
     }
diff --git a/WebCore/khtml/html/htmltokenizer.h b/WebCore/khtml/html/htmltokenizer.h
index 49e2d4e..7def202 100644
--- a/WebCore/khtml/html/htmltokenizer.h
+++ b/WebCore/khtml/html/htmltokenizer.h
@@ -42,7 +42,7 @@ class HTMLTokenizer;
 #include "misc/stringit.h"
 #include "xml/dom_stringimpl.h"
 #include "xml/xml_tokenizer.h"
-#include "xml/dom_elementimpl.h"
+#include "html/html_elementimpl.h"
 #include "xml/dom_docimpl.h"
 
 #if APPLE_CHANGES
@@ -94,7 +94,7 @@ namespace khtml {
 
             if (a) {
                 if(!attrs) {
-                    attrs = new DOM::NamedAttrMapImpl(0);
+                    attrs = new DOM::HTMLNamedAttrMapImpl(0);
                     attrs->ref();
                 }
                 attrs->insertAttribute(a);
@@ -113,7 +113,7 @@ namespace khtml {
             }
             flat = false;
         }
-        DOM::NamedAttrMapImpl* attrs;
+        DOM::HTMLNamedAttrMapImpl* attrs;
         DOM::DOMStringImpl* text;
         ushort id;
         bool flat;
diff --git a/WebCore/khtml/xml/dom_elementimpl.cpp b/WebCore/khtml/xml/dom_elementimpl.cpp
index 5e1fb8b..298e175 100644
--- a/WebCore/khtml/xml/dom_elementimpl.cpp
+++ b/WebCore/khtml/xml/dom_elementimpl.cpp
@@ -229,6 +229,13 @@ unsigned short ElementImpl::nodeType() const
     return Node::ELEMENT_NODE;
 }
 
+bool ElementImpl::matchesCSSClass(const AtomicString& c, bool caseSensitive) const
+{
+    // Class is not supported on random XML elements.  A language (e.g., HTML, SVG) should indicate
+    // support using a subclass override.
+    return false;
+}
+
 DOMString ElementImpl::getAttribute(NodeImpl::Id id) const
 {
     if (!namedAttrMap) return DOMString();
@@ -737,6 +744,10 @@ NamedAttrMapImpl::~NamedAttrMapImpl()
     clearAttributes();
 }
 
+bool NamedAttrMapImpl::isHTMLAttributeMap() const
+{
+    return false;
+}
 
 AttrImpl *NamedAttrMapImpl::getNamedItem ( NodeImpl::Id id ) const
 {
@@ -920,6 +931,8 @@ NamedAttrMapImpl& NamedAttrMapImpl::operator=(const NamedAttrMapImpl& other)
         attrs[i]->ref();
     }
 
+    // The derived class, HTMLNamedAttrMapImpl, which manages a parsed class list for the CLASS attribute,
+    // will update its member variable when parse attribute is called.
     for(uint i = 0; i < len; i++)
         element->parseAttribute(attrs[i]);
 
diff --git a/WebCore/khtml/xml/dom_elementimpl.h b/WebCore/khtml/xml/dom_elementimpl.h
index 3d0d21e..c309e2f 100644
--- a/WebCore/khtml/xml/dom_elementimpl.h
+++ b/WebCore/khtml/xml/dom_elementimpl.h
@@ -161,6 +161,9 @@ public:
     ElementImpl(DocumentPtr *doc);
     ~ElementImpl();
 
+    // Used to quickly determine whether or not an element has a given CSS class.
+    virtual bool matchesCSSClass(const AtomicString& c, bool caseSensitive) const;
+    
     DOMString getAttribute( NodeImpl::Id id ) const;
     DOMString getAttribute(const DOMString& localName) const { return getAttributeNS(QString::null, localName); }
     DOMString getAttributeNS(const DOMString &namespaceURI,
@@ -230,7 +233,7 @@ public:
     static Element createInstance(ElementImpl *impl);
 #endif
 protected:
-    void createAttributeMap() const;
+    virtual void createAttributeMap() const;
     void createDecl();
     DOMString openTagStartToString() const;
 
@@ -304,12 +307,14 @@ public:
             newAttribute->deref();
     }
 
+    virtual bool isHTMLAttributeMap() const;
+
 private:
     // this method is internal, does no error checking at all
     void addAttribute(AttributeImpl* newAttribute);
     // this method is internal, does no error checking at all
     void removeAttribute(NodeImpl::Id id);
-    void clearAttributes();
+    virtual void clearAttributes();
     void detachFromElement();
 
 protected:
diff --git a/WebCore/khtml/xml/dom_nameimpl.cpp b/WebCore/khtml/xml/dom_nameimpl.cpp
new file mode 100644
index 0000000..e19ac63
--- /dev/null
+++ b/WebCore/khtml/xml/dom_nameimpl.cpp
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "dom/dom_string.h"
+#include "dom_nameimpl.h"
+
+namespace DOM {
+
+AtomicStringList* AtomicStringList::clone()
+{
+    return new AtomicStringList(m_string, m_next ? m_next->clone() : 0);
+}
+
+bool operator==(const AtomicString &a, const DOMString &b)
+{
+    unsigned l = a.size();
+    if (l != b.length()) return false;
+    
+    if (!memcmp(a.ustring().data(), b.unicode(), l*sizeof(unsigned short)))
+	return true;
+    return false;
+    
+}
+   
+bool equalsIgnoreCase(const AtomicString &as, const DOMString &bs)
+{
+    // returns true when equal, false otherwise (ignoring case)
+    unsigned l = as.size();
+    if (l != bs.length()) return false;
+    
+    const QChar *a = reinterpret_cast<const QChar*>(as.ustring().data());
+    const QChar *b = bs.unicode();
+    if (a == b)  return true;
+    if (!(a && b))  return false;
+    while (l--) {
+        if (*a != *b && a->lower() != b->lower()) return false;
+	a++,b++;
+    }
+    return true;
+}
+
+bool equalsIgnoreCase(const AtomicString &as, const AtomicString &bs)
+{
+    // returns true when equal, false otherwise (ignoring case)
+    int l = as.size();
+    if (l != bs.size()) return false;
+    
+    const QChar *a = reinterpret_cast<const QChar*>(as.ustring().data());
+    const QChar *b = reinterpret_cast<const QChar*>(bs.ustring().data());
+    if ( a == b )  return true;
+    if ( !( a && b ) )  return false;
+    while ( l-- ) {
+        if ( *a != *b && a->lower() != b->lower() ) return false;
+	a++,b++;
+    }
+    return true;    
+}
+
+}
diff --git a/WebCore/khtml/xml/dom_nameimpl.h b/WebCore/khtml/xml/dom_nameimpl.h
new file mode 100644
index 0000000..3b6f47d
--- /dev/null
+++ b/WebCore/khtml/xml/dom_nameimpl.h
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#ifndef _DOM_NameImpl_h_
+#define _DOM_NameImpl_h_
+
+#include <kjs/identifier.h>
+
+namespace DOM {
+
+typedef KJS::Identifier AtomicString;
+typedef KJS::UChar AtomicChar;
+
+class AtomicStringList {
+public:
+    AtomicStringList() :m_next(0) {}
+    AtomicStringList(const AtomicString& str, AtomicStringList* n = 0) :m_string(str), m_next(n) {}
+    ~AtomicStringList() { delete m_next; }
+    
+    AtomicStringList* next() const { return m_next; }
+    void setNext(AtomicStringList* n) { m_next = n; }
+    AtomicString string() const { return m_string; }
+    void setString(const AtomicString& str) { m_string = str; }
+
+    AtomicStringList* clone();
+    void clear() { m_string = AtomicString::null(); delete m_next; m_next = 0; }
+    
+private:
+    AtomicString m_string;
+    AtomicStringList* m_next;
+};
+
+class Name {
+public:
+    Name() {};
+    Name(const AtomicString& namespaceURI, const AtomicString& localName)
+        :m_namespaceURI(namespaceURI), m_localName(localName) {}
+
+    AtomicString namespaceURI() const { return m_namespaceURI; }
+    AtomicString localName() const { return m_localName; }
+
+private:
+    AtomicString m_namespaceURI;
+    AtomicString m_localName;
+    
+    friend bool operator==(const Name& a, const Name& b);
+};
+
+inline bool operator==(const Name& a, const Name& b)
+{
+    return a.m_namespaceURI == b.m_namespaceURI && a.m_localName == b.m_localName;
+}
+
+inline bool operator!=(const Name& a, const Name& b)
+{
+    return !(a == b);
+}
+
+bool operator==(const AtomicString &a, const DOMString &b);
+inline bool operator!=(const AtomicString &a, const DOMString &b) { return !(a == b); }
+
+bool equalsIgnoreCase(const AtomicString &a, const DOMString &b);
+bool equalsIgnoreCase(const AtomicString &a, const AtomicString &b);
+}
+#endif
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index eaa57ee..70758e1 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -30,6 +30,7 @@
 #include "dom/dom_node.h"
 #include "misc/helper.h"
 #include "misc/shared.h"
+#include "dom_nameimpl.h"
 
 class QPainter;
 template <class type> class QPtrList;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list