[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:42 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 8f4119b0543d407b0898614443ea99907250a3cb
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 30 07:44:45 2004 +0000

    	Atomize font families (KWQFontFamily) and all attribute values.  Move atomic string into separate files.
    
    	In my testing, this patch yields the same score as Safari-125 in tests and recovers all lost performance
    	(mostly from excess copying of AtomicStrings where DOMStringImpl* used to be returned).
    
            Reviewed by darin
    
            * ForwardingHeaders/xml/dom_atomicstring.h: Added.
            * WebCore.pbproj/project.pbxproj:
            * khtml/css/css_base.cpp:
            (CSSSelector::print):
            (CSSSelector::extractPseudoType):
            (CSSSelector::selectorText):
            * khtml/css/css_valueimpl.cpp:
            (FontFamilyValueImpl::FontFamilyValueImpl):
            * khtml/css/cssparser.cpp:
            (CSSParser::parseFontFamily):
            * khtml/css/cssparser.h:
            * khtml/css/cssstyleselector.cpp:
            (khtml::checkPseudoState):
            (khtml::CSSStyleSelector::checkOneSelector):
            (khtml::CSSStyleSelector::applyRule):
            * khtml/dom/dom_element.cpp:
            (Element::getAttributeNS):
            * khtml/dom/dom_string.cpp:
            (DOMString::toInt):
            (DOMString::toLengthArray):
            (DOM::operator==):
            * khtml/dom/dom_string.h:
            (DOM::operator==):
            (DOM::operator!=):
            * khtml/ecma/kjs_navigator.cpp:
            (Plugins::get):
            (MimeTypes::get):
            (Plugin::get):
            * khtml/html/html_baseimpl.cpp:
            (HTMLBodyElementImpl::parseAttribute):
            (HTMLFrameElementImpl::isURLAllowed):
            (HTMLFrameElementImpl::openURL):
            (HTMLFrameElementImpl::parseAttribute):
            (HTMLFrameElementImpl::attach):
            (HTMLFrameElementImpl::setLocation):
            (HTMLFrameSetElementImpl::parseAttribute):
            (HTMLIFrameElementImpl::attach):
            * khtml/html/html_baseimpl.h:
            * khtml/html/html_blockimpl.cpp:
            (HTMLHRElementImpl::parseAttribute):
            (HTMLHRElementImpl::attach):
            (HTMLMarqueeElementImpl::parseAttribute):
            * khtml/html/html_documentimpl.cpp:
            (HTMLDocumentImpl::documentElement):
            * khtml/html/html_documentimpl.h:
            * khtml/html/html_elementimpl.cpp:
            (HTMLElementImpl::parseAttribute):
            (HTMLElementImpl::addCSSLength):
            (HTMLElementImpl::addHTMLAlignment):
            * khtml/html/html_elementimpl.h:
            * khtml/html/html_formimpl.cpp:
            (HTMLGenericFormElementImpl::parseAttribute):
            (HTMLInputElementImpl::parseAttribute):
            (HTMLInputElementImpl::attach):
            (HTMLSelectElementImpl::parseAttribute):
            (HTMLKeygenElementImpl::parseAttribute):
            (HTMLKeygenElementImpl::encoding):
            (HTMLOptionElementImpl::parseAttribute):
            (HTMLTextAreaElementImpl::parseAttribute):
            * khtml/html/html_formimpl.h:
            * khtml/html/html_headimpl.cpp:
            (HTMLLinkElementImpl::parseAttribute):
            (HTMLStyleElementImpl::parseAttribute):
            * khtml/html/html_imageimpl.cpp:
            (HTMLImageElementImpl::parseAttribute):
            (HTMLAreaElementImpl::parseAttribute):
            * khtml/html/html_inlineimpl.cpp:
            (HTMLAnchorElementImpl::parseAttribute):
            * khtml/html/html_listimpl.cpp:
            (HTMLOListElementImpl::parseAttribute):
            (HTMLLIElementImpl::parseAttribute):
            * khtml/html/html_miscimpl.cpp:
            (HTMLCollectionImpl::getNamedItem):
            (HTMLFormCollectionImpl::getNamedFormItem):
            (HTMLFormCollectionImpl::getNamedImgItem):
            * khtml/html/html_objectimpl.cpp:
            (HTMLEmbedElementImpl::parseAttribute):
            (HTMLObjectElementImpl::parseAttribute):
            (HTMLParamElementImpl::HTMLParamElementImpl):
            (HTMLParamElementImpl::~HTMLParamElementImpl):
            (HTMLParamElementImpl::parseAttribute):
            * khtml/html/html_objectimpl.h:
            (DOM::HTMLParamElementImpl::name):
            (DOM::HTMLParamElementImpl::value):
            * khtml/html/html_tableimpl.cpp:
            (HTMLTableElementImpl::parseAttribute):
            (HTMLTablePartElementImpl::parseAttribute):
            (HTMLTableCellElementImpl::parseAttribute):
            (HTMLTableColElementImpl::parseAttribute):
            * khtml/html/htmlparser.cpp:
            (KHTMLParser::insertNode):
            (KHTMLParser::handleIsindex):
            * khtml/html/htmltokenizer.cpp:
            (HTMLTokenizer::parseTag):
            * khtml/html/htmltokenizer.h:
            (khtml::Token::addAttribute):
            * khtml/khtml_part.cpp:
            (KHTMLPart::init):
            * khtml/khtmlview.cpp:
            (KHTMLToolTip::maybeTip):
            * khtml/xml/dom_atomicstring.cpp: Added.
            (DOM::AtomicStringStatisticsExitLogger::~AtomicStringStatisticsExitLogger):
            (DOM::AtomicString::equal):
            (DOM::AtomicString::add):
            (DOM::AtomicString::insert):
            (DOM::AtomicString::remove):
            (DOM::AtomicString::expand):
            (DOM::AtomicString::shrink):
            (DOM::AtomicString::rehash):
            (DOM::AtomicString::init):
            (DOM::operator==):
            (DOM::equalsIgnoreCase):
            * khtml/xml/dom_atomicstring.h: Added.
            (DOM::AtomicString::AtomicString):
            (DOM::AtomicString:::m_string):
            (DOM::AtomicString::operator const DOMString&):
            (DOM::AtomicString::domString):
            (DOM::AtomicString::string):
            (DOM::AtomicString::implementation):
            (DOM::AtomicString::unicode):
            (DOM::AtomicString::length):
            (DOM::AtomicString::ascii):
            (DOM::AtomicString::find):
            (DOM::AtomicString::toInt):
            (DOM::AtomicString::percentage):
            (DOM::AtomicString::toLengthArray):
            (DOM::AtomicString::isNull):
            (DOM::AtomicString::isEmpty):
            (DOM::AtomicString::equal):
            (DOM::operator==):
            (DOM::operator!=):
            * khtml/xml/dom_atomicstringlist.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::clone):
            (DOM::AtomicStringList::clear):
            * khtml/xml/dom_docimpl.h:
            * khtml/xml/dom_elementimpl.cpp:
            (AttrImpl::nodeValue):
            (AttrImpl::cloneNode):
            (ElementImpl::getAttribute):
            (ElementImpl::getAttributeNS):
            (ElementImpl::setAttribute):
            (ElementImpl::setAttributeMap):
            (ElementImpl::attach):
            (ElementImpl::detach):
            (ElementImpl::updateId):
            (NamedAttrMapImpl::setNamedItem):
            (NamedAttrMapImpl::removeNamedItem):
            (NamedAttrMapImpl::getAttributeItem):
            (NamedAttrMapImpl::operator=):
            (NamedAttrMapImpl::removeAttribute):
            * khtml/xml/dom_elementimpl.h:
            (DOM::AttributeImpl::AttributeImpl):
            (DOM::AttributeImpl::value):
            (DOM::AttributeImpl::prefix):
            (DOM::AttributeImpl::isNull):
            (DOM::AttributeImpl::isEmpty):
            (DOM::AttributeImpl::setValue):
            (DOM::AttributeImpl::setPrefix):
            (DOM::ElementImpl::getAttribute):
            * khtml/xml/dom_nameimpl.cpp: Removed.
            * khtml/xml/dom_nameimpl.h:
            (DOM::Name::namespaceURI):
            (DOM::Name::localName):
            * khtml/xml/dom_nodeimpl.h:
            * khtml/xml/dom_stringimpl.cpp:
            * kwq/KWQFont.mm:
            (QFont::family):
            * kwq/KWQFontFamily.h:
            (KWQFontFamily::family):
            * kwq/KWQFontFamily.mm:
            (retainDOMStringImpl):
            (releaseDOMStringImpl):
            (KWQFontFamily::getNSFamily):
            (KWQFontFamily::setFamily):
            (KWQFontFamily::operator==):
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::fileWrapperForElement):
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge elementAtPoint:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6007 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index fe604a1..edcbc01 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,199 @@
+2004-01-29  David Hyatt  <hyatt at apple.com>
+
+	Atomize font families (KWQFontFamily) and all attribute values.  Move atomic string into separate files.
+
+	In my testing, this patch yields the same score as Safari-125 in tests and recovers all lost performance
+	(mostly from excess copying of AtomicStrings where DOMStringImpl* used to be returned).
+	
+        Reviewed by darin
+
+        * ForwardingHeaders/xml/dom_atomicstring.h: Added.
+        * WebCore.pbproj/project.pbxproj:
+        * khtml/css/css_base.cpp:
+        (CSSSelector::print):
+        (CSSSelector::extractPseudoType):
+        (CSSSelector::selectorText):
+        * khtml/css/css_valueimpl.cpp:
+        (FontFamilyValueImpl::FontFamilyValueImpl):
+        * khtml/css/cssparser.cpp:
+        (CSSParser::parseFontFamily):
+        * khtml/css/cssparser.h:
+        * khtml/css/cssstyleselector.cpp:
+        (khtml::checkPseudoState):
+        (khtml::CSSStyleSelector::checkOneSelector):
+        (khtml::CSSStyleSelector::applyRule):
+        * khtml/dom/dom_element.cpp:
+        (Element::getAttributeNS):
+        * khtml/dom/dom_string.cpp:
+        (DOMString::toInt):
+        (DOMString::toLengthArray):
+        (DOM::operator==):
+        * khtml/dom/dom_string.h:
+        (DOM::operator==):
+        (DOM::operator!=):
+        * khtml/ecma/kjs_navigator.cpp:
+        (Plugins::get):
+        (MimeTypes::get):
+        (Plugin::get):
+        * khtml/html/html_baseimpl.cpp:
+        (HTMLBodyElementImpl::parseAttribute):
+        (HTMLFrameElementImpl::isURLAllowed):
+        (HTMLFrameElementImpl::openURL):
+        (HTMLFrameElementImpl::parseAttribute):
+        (HTMLFrameElementImpl::attach):
+        (HTMLFrameElementImpl::setLocation):
+        (HTMLFrameSetElementImpl::parseAttribute):
+        (HTMLIFrameElementImpl::attach):
+        * khtml/html/html_baseimpl.h:
+        * khtml/html/html_blockimpl.cpp:
+        (HTMLHRElementImpl::parseAttribute):
+        (HTMLHRElementImpl::attach):
+        (HTMLMarqueeElementImpl::parseAttribute):
+        * khtml/html/html_documentimpl.cpp:
+        (HTMLDocumentImpl::documentElement):
+        * khtml/html/html_documentimpl.h:
+        * khtml/html/html_elementimpl.cpp:
+        (HTMLElementImpl::parseAttribute):
+        (HTMLElementImpl::addCSSLength):
+        (HTMLElementImpl::addHTMLAlignment):
+        * khtml/html/html_elementimpl.h:
+        * khtml/html/html_formimpl.cpp:
+        (HTMLGenericFormElementImpl::parseAttribute):
+        (HTMLInputElementImpl::parseAttribute):
+        (HTMLInputElementImpl::attach):
+        (HTMLSelectElementImpl::parseAttribute):
+        (HTMLKeygenElementImpl::parseAttribute):
+        (HTMLKeygenElementImpl::encoding):
+        (HTMLOptionElementImpl::parseAttribute):
+        (HTMLTextAreaElementImpl::parseAttribute):
+        * khtml/html/html_formimpl.h:
+        * khtml/html/html_headimpl.cpp:
+        (HTMLLinkElementImpl::parseAttribute):
+        (HTMLStyleElementImpl::parseAttribute):
+        * khtml/html/html_imageimpl.cpp:
+        (HTMLImageElementImpl::parseAttribute):
+        (HTMLAreaElementImpl::parseAttribute):
+        * khtml/html/html_inlineimpl.cpp:
+        (HTMLAnchorElementImpl::parseAttribute):
+        * khtml/html/html_listimpl.cpp:
+        (HTMLOListElementImpl::parseAttribute):
+        (HTMLLIElementImpl::parseAttribute):
+        * khtml/html/html_miscimpl.cpp:
+        (HTMLCollectionImpl::getNamedItem):
+        (HTMLFormCollectionImpl::getNamedFormItem):
+        (HTMLFormCollectionImpl::getNamedImgItem):
+        * khtml/html/html_objectimpl.cpp:
+        (HTMLEmbedElementImpl::parseAttribute):
+        (HTMLObjectElementImpl::parseAttribute):
+        (HTMLParamElementImpl::HTMLParamElementImpl):
+        (HTMLParamElementImpl::~HTMLParamElementImpl):
+        (HTMLParamElementImpl::parseAttribute):
+        * khtml/html/html_objectimpl.h:
+        (DOM::HTMLParamElementImpl::name):
+        (DOM::HTMLParamElementImpl::value):
+        * khtml/html/html_tableimpl.cpp:
+        (HTMLTableElementImpl::parseAttribute):
+        (HTMLTablePartElementImpl::parseAttribute):
+        (HTMLTableCellElementImpl::parseAttribute):
+        (HTMLTableColElementImpl::parseAttribute):
+        * khtml/html/htmlparser.cpp:
+        (KHTMLParser::insertNode):
+        (KHTMLParser::handleIsindex):
+        * khtml/html/htmltokenizer.cpp:
+        (HTMLTokenizer::parseTag):
+        * khtml/html/htmltokenizer.h:
+        (khtml::Token::addAttribute):
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::init):
+        * khtml/khtmlview.cpp:
+        (KHTMLToolTip::maybeTip):
+        * khtml/xml/dom_atomicstring.cpp: Added.
+        (DOM::AtomicStringStatisticsExitLogger::~AtomicStringStatisticsExitLogger):
+        (DOM::AtomicString::equal):
+        (DOM::AtomicString::add):
+        (DOM::AtomicString::insert):
+        (DOM::AtomicString::remove):
+        (DOM::AtomicString::expand):
+        (DOM::AtomicString::shrink):
+        (DOM::AtomicString::rehash):
+        (DOM::AtomicString::init):
+        (DOM::operator==):
+        (DOM::equalsIgnoreCase):
+        * khtml/xml/dom_atomicstring.h: Added.
+        (DOM::AtomicString::AtomicString):
+        (DOM::AtomicString:::m_string):
+        (DOM::AtomicString::operator const DOMString&):
+        (DOM::AtomicString::domString):
+        (DOM::AtomicString::string):
+        (DOM::AtomicString::implementation):
+        (DOM::AtomicString::unicode):
+        (DOM::AtomicString::length):
+        (DOM::AtomicString::ascii):
+        (DOM::AtomicString::find):
+        (DOM::AtomicString::toInt):
+        (DOM::AtomicString::percentage):
+        (DOM::AtomicString::toLengthArray):
+        (DOM::AtomicString::isNull):
+        (DOM::AtomicString::isEmpty):
+        (DOM::AtomicString::equal):
+        (DOM::operator==):
+        (DOM::operator!=):
+        * khtml/xml/dom_atomicstringlist.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::clone):
+        (DOM::AtomicStringList::clear):
+        * khtml/xml/dom_docimpl.h:
+        * khtml/xml/dom_elementimpl.cpp:
+        (AttrImpl::nodeValue):
+        (AttrImpl::cloneNode):
+        (ElementImpl::getAttribute):
+        (ElementImpl::getAttributeNS):
+        (ElementImpl::setAttribute):
+        (ElementImpl::setAttributeMap):
+        (ElementImpl::attach):
+        (ElementImpl::detach):
+        (ElementImpl::updateId):
+        (NamedAttrMapImpl::setNamedItem):
+        (NamedAttrMapImpl::removeNamedItem):
+        (NamedAttrMapImpl::getAttributeItem):
+        (NamedAttrMapImpl::operator=):
+        (NamedAttrMapImpl::removeAttribute):
+        * khtml/xml/dom_elementimpl.h:
+        (DOM::AttributeImpl::AttributeImpl):
+        (DOM::AttributeImpl::value):
+        (DOM::AttributeImpl::prefix):
+        (DOM::AttributeImpl::isNull):
+        (DOM::AttributeImpl::isEmpty):
+        (DOM::AttributeImpl::setValue):
+        (DOM::AttributeImpl::setPrefix):
+        (DOM::ElementImpl::getAttribute):
+        * khtml/xml/dom_nameimpl.cpp: Removed.
+        * khtml/xml/dom_nameimpl.h:
+        (DOM::Name::namespaceURI):
+        (DOM::Name::localName):
+        * khtml/xml/dom_nodeimpl.h:
+        * khtml/xml/dom_stringimpl.cpp:
+        * kwq/KWQFont.mm:
+        (QFont::family):
+        * kwq/KWQFontFamily.h:
+        (KWQFontFamily::family):
+        * kwq/KWQFontFamily.mm:
+        (retainDOMStringImpl):
+        (releaseDOMStringImpl):
+        (KWQFontFamily::getNSFamily):
+        (KWQFontFamily::setFamily):
+        (KWQFontFamily::operator==):
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::fileWrapperForElement):
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge elementAtPoint:]):
+
 2004-01-29  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: <rdar://problem/3543619>: copied HTML is strangely formatted, random whitespace and return characters
diff --git a/WebCore/ForwardingHeaders/xml/dom_atomicstring.h b/WebCore/ForwardingHeaders/xml/dom_atomicstring.h
new file mode 100644
index 0000000..26fb83e
--- /dev/null
+++ b/WebCore/ForwardingHeaders/xml/dom_atomicstring.h
@@ -0,0 +1 @@
+#include <dom_atomicstring.h>
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 6311b84..0522d36 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -523,6 +523,8 @@
 				BEB1DD3E05C1982000DD1F43,
 				BC7FDE3405C1D9AB0070A902,
 				BC7E782205C5EB700088A50F,
+				BC3B364905C9D5E200E42902,
+				BC3B364A05C9D5E200E42902,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -797,7 +799,7 @@
 				BEB1DD3105C1980700DD1F43,
 				BEB1DD3D05C1982000DD1F43,
 				BC7FDE3305C1D9AB0070A902,
-				BC7E782105C5EB700088A50F,
+				BC3B364805C9D5E200E42902,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1852,6 +1854,48 @@
 			settings = {
 			};
 		};
+		BC3B364505C9D5E200E42902 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.cpp.cpp;
+			path = dom_atomicstring.cpp;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BC3B364605C9D5E200E42902 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.c.h;
+			path = dom_atomicstring.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BC3B364705C9D5E200E42902 = {
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			lastKnownFileType = sourcecode.c.h;
+			path = dom_atomicstringlist.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		BC3B364805C9D5E200E42902 = {
+			fileRef = BC3B364505C9D5E200E42902;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		BC3B364905C9D5E200E42902 = {
+			fileRef = BC3B364605C9D5E200E42902;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		BC3B364A05C9D5E200E42902 = {
+			fileRef = BC3B364705C9D5E200E42902;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		BC41978B059293BE0016347F = {
 			children = (
 				BC41978E059293F30016347F,
@@ -2105,14 +2149,6 @@
 			settings = {
 			};
 		};
-		BC7E781F05C5EB700088A50F = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			lastKnownFileType = sourcecode.cpp.cpp;
-			path = dom_nameimpl.cpp;
-			refType = 4;
-			sourceTree = "<group>";
-		};
 		BC7E782005C5EB700088A50F = {
 			fileEncoding = 30;
 			isa = PBXFileReference;
@@ -2121,12 +2157,6 @@
 			refType = 4;
 			sourceTree = "<group>";
 		};
-		BC7E782105C5EB700088A50F = {
-			fileRef = BC7E781F05C5EB700088A50F;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		BC7E782205C5EB700088A50F = {
 			fileRef = BC7E782005C5EB700088A50F;
 			isa = PBXBuildFile;
@@ -5943,11 +5973,13 @@
 		};
 		F523D32402DE4478018635CA = {
 			children = (
+				BC3B364505C9D5E200E42902,
+				BC3B364605C9D5E200E42902,
+				BC3B364705C9D5E200E42902,
 				F523D2F402DE4476018635CA,
 				F523D2F502DE4476018635CA,
 				F523D2F702DE4476018635CA,
 				F523D2F802DE4476018635CA,
-				BC7E781F05C5EB700088A50F,
 				BC7E782005C5EB700088A50F,
 				F523D2F902DE4476018635CA,
 				F523D2FA02DE4476018635CA,
diff --git a/WebCore/khtml/css/css_base.cpp b/WebCore/khtml/css/css_base.cpp
index 9a17f5b..56f0573 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.qstring().latin1() << "\" relation = " << (int)relation
+		    << "\" value = \"" << value.string().latin1() << "\" relation = " << (int)relation
 		    << "]" << endl;
     if ( tagHistory )
         tagHistory->print();
@@ -222,7 +222,7 @@ void CSSSelector::extractPseudoType() const
     else if (value == visited)
         _pseudoType = PseudoVisited;
     
-    value = AtomicString::null();
+    value = nullAtom;
 }
 
 
@@ -256,17 +256,17 @@ DOMString CSSSelector::selectorText() const
     if ( tag == anyLocalName && cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
     {
         str = "#";
-        str += cs->value.qstring();
+        str += cs->value.string();
     }
     else if ( tag == anyLocalName && cs->attr == ATTR_CLASS && cs->match == CSSSelector::List )
     {
         str = ".";
-        str += cs->value.qstring();
+        str += cs->value.string();
     }
     else if ( tag == anyLocalName && cs->match == CSSSelector::Pseudo )
     {
         str = ":";
-        str += cs->value.qstring();
+        str += cs->value.string();
     }
     else
     {
@@ -277,17 +277,17 @@ DOMString CSSSelector::selectorText() const
         if ( cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
         {
             str += "#";
-            str += cs->value.qstring();
+            str += cs->value.string();
         }
         else if ( cs->attr == ATTR_CLASS && cs->match == CSSSelector::List )
         {
             str += ".";
-            str += cs->value.qstring();
+            str += cs->value.string();
         }
         else if ( cs->match == CSSSelector::Pseudo )
         {
             str += ":";
-            str += cs->value.qstring();
+            str += cs->value.string();
         }
         // optional attribute
         if ( cs->attr ) {
@@ -320,7 +320,7 @@ DOMString CSSSelector::selectorText() const
                 kdWarning(6080) << "Unhandled case in CSSStyleRuleImpl::selectorText : match=" << cs->match << endl;
             }
             str += "\"";
-            str += cs->value.qstring();
+            str += cs->value.string();
             str += "\"]";
         }
     }
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index e1b9bb8..3dc2528 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -886,7 +886,7 @@ khtml::CachedImage* CSSImageValueImpl::image()
 // ------------------------------------------------------------------------
 
 FontFamilyValueImpl::FontFamilyValueImpl( const QString &string)
-: CSSPrimitiveValueImpl( DOMString(string), CSSPrimitiveValue::CSS_STRING)
+: CSSPrimitiveValueImpl( DOMString(), CSSPrimitiveValue::CSS_STRING)
 {
     static const QRegExp parenReg(" \\(.*\\)$");
     static const QRegExp braceReg(" \\[.*\\]$");
diff --git a/WebCore/khtml/css/cssparser.cpp b/WebCore/khtml/css/cssparser.cpp
index 237f177..7050a80 100644
--- a/WebCore/khtml/css/cssparser.cpp
+++ b/WebCore/khtml/css/cssparser.cpp
@@ -1610,7 +1610,7 @@ CSSValueListImpl *CSSParser::parseFontFamily()
             else if (nextValBreaksFont || !nextValIsFontName)
                 list->append(new CSSPrimitiveValueImpl(value->id));
             else
-                list->append(currFamily = new FontFamilyValueImpl(qString( value->string)));
+                list->append(currFamily = new FontFamilyValueImpl(qString(value->string)));
         }
         else if (value->unit == CSSPrimitiveValue::CSS_STRING) {
             // Strings never share in a family name.
diff --git a/WebCore/khtml/css/cssparser.h b/WebCore/khtml/css/cssparser.h
index c516500..55d1669 100644
--- a/WebCore/khtml/css/cssparser.h
+++ b/WebCore/khtml/css/cssparser.h
@@ -25,7 +25,7 @@
 
 #include <qstring.h>
 #include <dom/dom_string.h>
-#include "dom_nameimpl.h"
+#include "xml/dom_atomicstring.h"
 
 namespace DOM {
     class StyleListImpl;
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index d94598b..e4c9a8f 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -706,11 +706,11 @@ static void cleanpath(QString &path)
 
 static void checkPseudoState( DOM::ElementImpl *e )
 {
-    if( e->id() != ID_A ) {
+    if (!e->hasAnchor()) {
         pseudoState = PseudoNone;
         return;
     }
-    DOMString attr = e->getAttribute(ATTR_HREF);
+    const AtomicString& attr = e->getAttribute(ATTR_HREF);
     if( attr.isNull() ) {
         pseudoState = PseudoNone;
         return;
@@ -870,18 +870,19 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
     }
 
     if (sel->attr) {
-        if (sel->match == CSSSelector::Class && e->hasClass())
-            return e->matchesCSSClass(sel->value, strictParsing);
-        
-        DOMString value = e->getAttribute(sel->attr);
+        if (sel->match == CSSSelector::Class)
+            return e->hasClass() && e->matchesCSSClass(sel->value, strictParsing);
+        else if (sel->match == CSSSelector::Id) {
+            if (!e->hasID()) return false;
+            const AtomicString& value = e->getAttribute(sel->attr);
+            return !((strictParsing && sel->value != value) ||
+                     (!strictParsing && !equalsIgnoreCase(sel->value, value)));
+        }
+
+        const AtomicString& value = e->getAttribute(sel->attr);
         if (value.isNull()) return false; // attribute is not set
 
         switch(sel->match) {
-        case CSSSelector::Id:
-            if ((strictParsing && sel->value != value) ||
-                (!strictParsing && !equalsIgnoreCase(sel->value, value)))
-                return false;
-            break;
         case CSSSelector::Exact:
 	    if ((isXMLDoc && sel->value != value) ||
                 (!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
@@ -906,7 +907,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
                 return false;
 
             QString str = value.string();
-            QString selStr = sel->value.qstring();
+            QString selStr = sel->value.string();
             int startSearchAt = 0;
             while (true) {
                 int foundPos = str.find(selStr, startSearchAt, isXMLDoc);
@@ -927,7 +928,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for contains match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.qstring();
+            QString selStr = sel->value.string();
             int pos = str.find(selStr, 0, isXMLDoc);
             if(pos == -1) return false;
             break;
@@ -936,7 +937,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for beginswith match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.qstring();
+            QString selStr = sel->value.string();
             int pos = str.find(selStr, 0, isXMLDoc);
             if(pos != 0) return false;
             break;
@@ -945,7 +946,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for endswith match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.qstring();
+            QString selStr = sel->value.string();
 	    if (isXMLDoc && !str.endsWith(selStr)) return false;
 	    if (!isXMLDoc) {
 	        int pos = str.length() - selStr.length();
@@ -958,7 +959,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
         {
             //kdDebug( 6080 ) << "checking for hyphen match" << endl;
             QString str = value.string();
-            QString selStr = sel->value.qstring();
+            QString selStr = sel->value.string();
             if(str.length() < selStr.length()) return false;
             // Check if str begins with selStr:
             if(str.find(selStr, 0, isXMLDoc) != 0) return false;
@@ -967,10 +968,7 @@ bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl
                 && str[selStr.length()] != '-') return false;
             break;
         }
-        case CSSSelector::Pseudo:
-        case CSSSelector::None:
-        case CSSSelector::Class:
-        case CSSSelector::Set:
+        default:
             break;
         }
     }
@@ -2900,7 +2898,6 @@ void CSSStyleSelector::applyRule( int id, DOM::CSSValueImpl *value )
         FontDef fontDef = style->htmlFont().fontDef;
         CSSValueListImpl *list = static_cast<CSSValueListImpl *>(value);
         int len = list->length();
-        QString family;
         KWQFontFamily &firstFamily = fontDef.firstFamily();
         KWQFontFamily *currFamily = 0;
         
diff --git a/WebCore/khtml/dom/dom_element.cpp b/WebCore/khtml/dom/dom_element.cpp
index 3a5ce0a..890ee78 100644
--- a/WebCore/khtml/dom/dom_element.cpp
+++ b/WebCore/khtml/dom/dom_element.cpp
@@ -203,7 +203,7 @@ DOMString Element::getAttributeNS( const DOMString &namespaceURI,
                                    const DOMString &localName)
 {
     if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
-    return static_cast<ElementImpl*>(impl)->getAttributeNS(namespaceURI, localName);
+    return static_cast<ElementImpl*>(impl)->getAttributeNS(namespaceURI, localName).domString();
 }
 
 void Element::setAttributeNS( const DOMString &namespaceURI,
diff --git a/WebCore/khtml/dom/dom_string.cpp b/WebCore/khtml/dom/dom_string.cpp
index 5f6f822..9b579b5 100644
--- a/WebCore/khtml/dom/dom_string.cpp
+++ b/WebCore/khtml/dom/dom_string.cpp
@@ -225,7 +225,7 @@ int DOMString::toInt() const
 {
     if(!impl) return 0;
 
-    return QConstString(impl->s, impl->l).string().toInt();
+    return impl->toInt();
 }
 
 DOMString DOMString::copy() const
@@ -272,10 +272,18 @@ bool DOMString::isEmpty() const
     return (!impl || impl->l == 0);
 }
 
+khtml::Length* DOMString::toLengthArray(int& len) const 
+{ 
+    return impl ? impl->toLengthArray(len) : 0;
+}
+
 //-----------------------------------------------------------------------------
 
 bool DOM::operator==( const DOMString &a, const DOMString &b )
 {
+    if (a.impl == b.impl)
+        return true;
+    
     unsigned int l = a.length();
 
     if( l != b.length() ) return false;
diff --git a/WebCore/khtml/dom/dom_string.h b/WebCore/khtml/dom/dom_string.h
index 2e896d5..f013cf7 100644
--- a/WebCore/khtml/dom/dom_string.h
+++ b/WebCore/khtml/dom/dom_string.h
@@ -24,6 +24,10 @@
 
 #include <qstring.h>
 
+namespace khtml {
+    class Length;
+}
+
 namespace DOM {
 
 class DOMStringImpl;
@@ -41,6 +45,7 @@ class DOMString
 {
     friend class CharacterDataImpl;
     friend bool operator==( const DOMString &a, const char *b );
+    friend bool operator==( const DOMString &a, const DOMString &b );
 public:
     /**
      * default constructor. Gives an empty DOMString
@@ -97,6 +102,7 @@ public:
     QString string() const;
 
     int toInt() const;
+    khtml::Length* toLengthArray(int& len) const;
     bool percentage(int &_percentage) const;
 
     DOMString copy() const;
@@ -114,12 +120,15 @@ protected:
     DOMStringImpl *impl;
 };
 
-bool operator==( const DOMString &a, const DOMString &b );
 bool operator==( const DOMString &a, const QString &b );
 bool operator==( const DOMString &a, const char *b );
-inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); };
-inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); };
-inline bool operator!=( const DOMString &a, const char *b )  { return !(a==b); };
+inline bool operator==( const QString &b, const DOMString &a ) { return a == b; }
+inline bool operator==( const char *b, const DOMString &a ) { return a == b; }
+inline bool operator!=( const DOMString &a, const DOMString &b ) { return !(a==b); }
+inline bool operator!=( const DOMString &a, const QString &b ) { return !(a==b); }
+inline bool operator!=( const DOMString &a, const char *b )  { return !(a==b); }
+inline bool operator!=( const QString &b, const DOMString &a ) { return !(a==b); }
+inline bool operator!=( const char *b, const DOMString &a )  { return !(a==b); }
 inline bool strcmp( const DOMString &a, const DOMString &b ) { return a != b; }
 
 // returns false when equal, true otherwise (ignoring case)
diff --git a/WebCore/khtml/ecma/kjs_navigator.cpp b/WebCore/khtml/ecma/kjs_navigator.cpp
index 12fff62..fa47d5a 100644
--- a/WebCore/khtml/ecma/kjs_navigator.cpp
+++ b/WebCore/khtml/ecma/kjs_navigator.cpp
@@ -357,7 +357,7 @@ Value Plugins::get(ExecState *exec, const Identifier &propertyName) const
 
         // plugin[name]
         for ( PluginInfo *pl = plugins->first(); pl!=0; pl = plugins->next() ) {
-            if ( pl->name==propertyName.string() )
+            if ( pl->name==propertyName.qstring() )
                 return Value( new Plugin( exec, pl ) );
         }
     }
@@ -386,7 +386,7 @@ Value MimeTypes::get(ExecState *exec, const Identifier &propertyName) const
         //kdDebug(6070) << "MimeTypes[" << propertyName.ascii() << "]" << endl;
         for ( MimeClassInfo *m=mimes->first(); m!=0; m=mimes->next() ) {
             //kdDebug(6070) << "m->type=" << m->type.ascii() << endl;
-            if ( m->type == propertyName.string() )
+            if ( m->type == propertyName.qstring() )
                 return Value( new MimeType( exec, m ) );
         }
     }
@@ -425,7 +425,7 @@ Value Plugin::get(ExecState *exec, const Identifier &propertyName) const
         // plugin["name"]
         for ( MimeClassInfo *m=m_info->mimes.first();
               m!=0; m=m_info->mimes.next() ) {
-            if ( m->type==propertyName.string() )
+            if ( m->type==propertyName.qstring() )
                 return Value(new MimeType(exec, m));
         }
 
diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp
index f93cc46..7b121d0 100644
--- a/WebCore/khtml/html/html_baseimpl.cpp
+++ b/WebCore/khtml/html/html_baseimpl.cpp
@@ -97,11 +97,11 @@ void HTMLBodyElementImpl::parseAttribute(AttributeImpl *attr)
         break;
     case ATTR_BGCOLOR:
         addHTMLColor(CSS_PROP_BACKGROUND_COLOR, attr->value());
-        m_bgSet = !attr->value().isNull();
+        m_bgSet = !attr->isNull();
         break;
     case ATTR_TEXT:
         addHTMLColor(CSS_PROP_COLOR, attr->value());
-        m_fgSet = !attr->value().isNull();
+        m_fgSet = !attr->isNull();
         break;
     case ATTR_BGPROPERTIES:
         if ( strcasecmp( attr->value(), "fixed" ) == 0)
@@ -204,7 +204,7 @@ NodeImpl::Id HTMLFrameElementImpl::id() const
     return ID_FRAME;
 }
 
-bool HTMLFrameElementImpl::isURLAllowed(const DOMString &URLString) const
+bool HTMLFrameElementImpl::isURLAllowed(const AtomicString &URLString) const
 {
     if (URLString.isEmpty()) {
         return true;
@@ -281,7 +281,7 @@ void HTMLFrameElementImpl::openURL()
         return;
     }
     
-    DOMString relativeURL = url;
+    AtomicString relativeURL = url;
     if (relativeURL.isEmpty()) {
         relativeURL = "about:blank";
     }
@@ -302,7 +302,7 @@ void HTMLFrameElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_SRC:
-        setLocation(khtml::parseURL(attr->val()));
+        setLocation(khtml::parseURL(attr->value()));
         break;
     case ATTR_ID:
     case ATTR_NAME:
@@ -314,16 +314,16 @@ void HTMLFrameElementImpl::parseAttribute(AttributeImpl *attr)
     case ATTR_FRAMEBORDER:
     {
         frameBorder = attr->value().toInt();
-        frameBorderSet = ( attr->val() != 0 );
+        frameBorderSet = !attr->isNull();
         // FIXME: If we are already attached, this has no effect.
     }
     break;
     case ATTR_MARGINWIDTH:
-        marginWidth = attr->val()->toInt();
+        marginWidth = attr->value().toInt();
         // FIXME: If we are already attached, this has no effect.
         break;
     case ATTR_MARGINHEIGHT:
-        marginHeight = attr->val()->toInt();
+        marginHeight = attr->value().toInt();
         // FIXME: If we are already attached, this has no effect.
         break;
     case ATTR_NORESIZE:
@@ -399,14 +399,14 @@ void HTMLFrameElementImpl::attach()
 
     part->incrementFrameCount();
     
-    DOMString relativeURL = url;
+    AtomicString relativeURL = url;
     if (relativeURL.isEmpty()) {
         relativeURL = "about:blank";
     }
 
     // we need a unique name for every frame in the frameset. Hope that's unique enough.
-    if(name.isEmpty() || part->frameExists( name.string() ) )
-      name = DOMString(part->requestFrameName());
+    if (name.isEmpty() || part->frameExists( name.string() ) )
+      name = AtomicString(part->requestFrameName());
 
     // load the frame contents
     part->requestFrame( static_cast<RenderFrame*>(m_render), relativeURL.string(), name.string() );
@@ -429,7 +429,7 @@ void HTMLFrameElementImpl::detach()
 void HTMLFrameElementImpl::setLocation( const DOMString& str )
 {
     if (url == str) return;
-    url = str;
+    url = AtomicString(str);
     updateForNewURL();
 }
 
@@ -501,15 +501,15 @@ void HTMLFrameSetElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_ROWS:
-        if (!attr->val()) break;
+        if (attr->isNull()) break;
         if (m_rows) delete [] m_rows;
-        m_rows = attr->val()->toLengthArray(m_totalRows);
+        m_rows = attr->value().toLengthArray(m_totalRows);
         setChanged();
     break;
     case ATTR_COLS:
-        if (!attr->val()) break;
+        if (attr->isNull()) break;
         delete [] m_cols;
-        m_cols = attr->val()->toLengthArray(m_totalCols);
+        m_cols = attr->value().toLengthArray(m_totalCols);
         setChanged();
     break;
     case ATTR_FRAMEBORDER:
@@ -524,7 +524,7 @@ void HTMLFrameSetElementImpl::parseAttribute(AttributeImpl *attr)
         noresize = true;
         break;
     case ATTR_BORDER:
-        m_border = attr->val()->toInt();
+        m_border = attr->value().toInt();
         if(!m_border)
             frameborder = false;
         break;
@@ -690,7 +690,7 @@ void HTMLIFrameElementImpl::attach()
         // we need a unique name for every frame in the frameset. Hope that's unique enough.
 	part->incrementFrameCount();
         if(name.isEmpty() || part->frameExists( name.string() ))
-            name = DOMString(part->requestFrameName());
+            name = AtomicString(part->requestFrameName());
 
         static_cast<RenderPartObject*>(m_render)->updateWidget();
         needWidgetUpdate = false;
diff --git a/WebCore/khtml/html/html_baseimpl.h b/WebCore/khtml/html/html_baseimpl.h
index f948af1..3ad3805 100644
--- a/WebCore/khtml/html/html_baseimpl.h
+++ b/WebCore/khtml/html/html_baseimpl.h
@@ -102,11 +102,11 @@ public:
 #endif
 
 protected:
-    bool isURLAllowed(const DOMString &) const;
+    bool isURLAllowed(const AtomicString &) const;
     virtual void openURL();
 
-    DOMString url;
-    DOMString name;
+    AtomicString url;
+    AtomicString name;
 
     int marginWidth;
     int marginHeight;
diff --git a/WebCore/khtml/html/html_blockimpl.cpp b/WebCore/khtml/html/html_blockimpl.cpp
index 365e4c2..00f34aa 100644
--- a/WebCore/khtml/html/html_blockimpl.cpp
+++ b/WebCore/khtml/html/html_blockimpl.cpp
@@ -125,11 +125,11 @@ void HTMLHRElementImpl::parseAttribute(AttributeImpl *attr)
     }
     case ATTR_WIDTH:
     {
-        if(!attr->val()) break;
+        if (attr->isNull()) break;
         // cheap hack to cause linebreaks
         // khtmltests/html/strange_hr.html
         bool ok;
-        int v = attr->val()->toInt(&ok);
+        int v = attr->value().implementation()->toInt(&ok);
         if(ok && !v)
             addCSSLength(CSS_PROP_WIDTH, "1");
         else
@@ -146,10 +146,9 @@ void HTMLHRElementImpl::attach()
 {
     if (attributes(true /* readonly */)) {
         // there are some attributes, lets check
-        DOMString color = getAttribute(ATTR_COLOR);
+        const AtomicString& color = getAttribute(ATTR_COLOR);
         DOMStringImpl* si = getAttribute(ATTR_SIZE).implementation();
         int _s =  si ? si->toInt() : -1;
-        DOMString n("1");
         if (!color.isNull()) {
             addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_SOLID);
             addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_SOLID);
@@ -161,6 +160,7 @@ void HTMLHRElementImpl::attach()
         }
         else {
             if (_s > 1 && getAttribute(ATTR_NOSHADE).isNull()) {
+                DOMString n("1");
                 addCSSProperty(CSS_PROP_BORDER_BOTTOM_WIDTH, n);
                 addCSSProperty(CSS_PROP_BORDER_TOP_WIDTH, n);
                 addCSSProperty(CSS_PROP_BORDER_LEFT_WIDTH, n);
@@ -173,7 +173,7 @@ void HTMLHRElementImpl::attach()
             }
         }
         if (_s == 0)
-            addCSSProperty(CSS_PROP_MARGIN_BOTTOM, n);
+            addCSSProperty(CSS_PROP_MARGIN_BOTTOM, DOMString("1"));
     }
 
     HTMLElementImpl::attach();
@@ -331,7 +331,7 @@ void HTMLMarqueeElementImpl::parseAttribute(AttributeImpl *attr)
                 removeCSSProperty(CSS_PROP__KHTML_MARQUEE_DIRECTION);
             break;
         case ATTR_TRUESPEED:
-            m_minimumDelay = attr->val() ? 0 : defaultMinimumDelay;
+            m_minimumDelay = !attr->isNull() ? 0 : defaultMinimumDelay;
             break;
         default:
             HTMLElementImpl::parseAttribute(attr);
diff --git a/WebCore/khtml/html/html_documentimpl.cpp b/WebCore/khtml/html/html_documentimpl.cpp
index 31e7a4c..38fac7f 100644
--- a/WebCore/khtml/html/html_documentimpl.cpp
+++ b/WebCore/khtml/html/html_documentimpl.cpp
@@ -128,6 +128,11 @@ HTMLDocumentImpl::~HTMLDocumentImpl()
 {
 }
 
+ElementImpl* HTMLDocumentImpl::documentElement() const
+{
+    return static_cast<ElementImpl*>(_first);
+}
+
 DOMString HTMLDocumentImpl::referrer() const
 {
     if ( part() )
diff --git a/WebCore/khtml/html/html_documentimpl.h b/WebCore/khtml/html/html_documentimpl.h
index e8317a4..7f45d4b 100644
--- a/WebCore/khtml/html/html_documentimpl.h
+++ b/WebCore/khtml/html/html_documentimpl.h
@@ -54,6 +54,7 @@ public:
     ~HTMLDocumentImpl();
 
     virtual bool isHTMLDocument() const { return true; }
+    virtual ElementImpl *documentElement() const;
 
     DOMString referrer() const;
     DOMString lastModified() const;
diff --git a/WebCore/khtml/html/html_elementimpl.cpp b/WebCore/khtml/html/html_elementimpl.cpp
index dc7f73e..b467a56 100644
--- a/WebCore/khtml/html/html_elementimpl.cpp
+++ b/WebCore/khtml/html/html_elementimpl.cpp
@@ -171,7 +171,7 @@ void HTMLElementImpl::parseAttribute(AttributeImpl *attr)
     switch( attr->id() )
     {
     case ATTR_ALIGN:
-        if (attr->val()) {
+        if (!attr->isNull()) {
             if ( strcasecmp(attr->value(), "middle" ) == 0 )
                 addCSSProperty( CSS_PROP_TEXT_ALIGN, "center" );
             else
@@ -183,19 +183,18 @@ void HTMLElementImpl::parseAttribute(AttributeImpl *attr)
 // the core attributes...
     case ATTR_ID:
         // unique id
-        setHasID(attr->val());
+        setHasID(!attr->isNull());
         setChanged();
         break;
     case ATTR_CLASS:
         // class
-        setHasClass(attr->val());
+        setHasClass(!attr->isNull());
         if (namedAttrMap) static_cast<HTMLNamedAttrMapImpl*>(namedAttrMap)->parseClassAttribute(attr->value());
         setChanged();
         break;
     case ATTR_CONTENTEDITABLE:
-        if (attr->val()) {
+        if (attr->isNull())
             setContentEditable(attr->value());
-        }
         else
             removeCSSProperty(CSS_PROP__KHTML_USER_MODIFY);
         break;
@@ -320,6 +319,8 @@ void HTMLElementImpl::addCSSImageProperty(int id, const DOMString &URL)
 
 void HTMLElementImpl::addCSSLength(int id, const DOMString &value)
 {
+    // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
+    // length unit and make the appropriate parsed value.
     if(!m_styleDecls) createDecl();
 
     // strip attribute garbage..
@@ -624,7 +625,7 @@ DOMString HTMLElementImpl::namespaceURI() const
         return XHTML_NAMESPACE;
 }
 
-void HTMLElementImpl::addHTMLAlignment( DOMString alignment )
+void HTMLElementImpl::addHTMLAlignment( const DOMString& alignment )
 {
     //qDebug("alignment is %s", alignment.string().latin1() );
     // vertical alignment with respect to the current baseline of the text
diff --git a/WebCore/khtml/html/html_elementimpl.h b/WebCore/khtml/html/html_elementimpl.h
index bc1a039..9c35b2a 100644
--- a/WebCore/khtml/html/html_elementimpl.h
+++ b/WebCore/khtml/html/html_elementimpl.h
@@ -24,6 +24,7 @@
 #define HTML_ELEMENTIMPL_H
 
 #include "xml/dom_elementimpl.h"
+#include "dom_atomicstringlist.h"
 
 namespace DOM {
 
@@ -66,7 +67,7 @@ public:
 
     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 addCSSLength(int id, const DOMString &value); // FIXME: value will be parsed by the CSS parser
     void addCSSProperty(int id, const DOMString &value); // value will be parsed by the CSS parser
     void addCSSProperty(int id, int value);
     void addCSSStringProperty(int id, const DOMString &value, DOM::CSSPrimitiveValue::UnitTypes = DOM::CSSPrimitiveValue::CSS_STRING);
@@ -97,7 +98,7 @@ public:
 
 protected:
     // for IMG, OBJECT and APPLET
-    void addHTMLAlignment( DOMString alignment );
+    void addHTMLAlignment( const DOMString& alignment );
 };
 
 class HTMLGenericElementImpl : public HTMLElementImpl
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 22289b8..1d42226 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -725,12 +725,12 @@ void HTMLGenericFormElementImpl::parseAttribute(AttributeImpl *attr)
     case ATTR_NAME:
         break;
     case ATTR_DISABLED:
-        setDisabled( attr->val() != 0 );
+        setDisabled( !attr->isNull() );
         break;
     case ATTR_READONLY:
     {
         bool m_oldreadOnly = m_readOnly;
-        m_readOnly = attr->val() != 0;
+        m_readOnly = !attr->isNull();
         if (m_oldreadOnly != m_readOnly) setChanged();
         break;
     }
@@ -1373,16 +1373,16 @@ void HTMLInputElementImpl::parseAttribute(AttributeImpl *attr)
             setChanged();     // at the default value right now.
         break;
     case ATTR_CHECKED:
-        m_defaultChecked = attr->val();
+        m_defaultChecked = !attr->isNull();
         if (m_useDefaultChecked)   // We only need to setChanged if the form is looking
             setChanged();          // at the default checked state right now.
         break;
     case ATTR_MAXLENGTH:
-        m_maxLen = attr->val() ? attr->val()->toInt() : -1;
+        m_maxLen = !attr->isNull() ? attr->value().toInt() : -1;
         setChanged();
         break;
     case ATTR_SIZE:
-        m_size = attr->val() ? attr->val()->toInt() : 20;
+        m_size = !attr->isNull() ? attr->value().toInt() : 20;
         break;
     case ATTR_ALT:
     case ATTR_SRC:
@@ -1493,7 +1493,7 @@ void HTMLInputElementImpl::attach()
                 setAttribute(ATTR_VALUE, nvalue);
         }
 
-        m_defaultChecked = (getAttribute(ATTR_CHECKED) != 0);
+        m_defaultChecked = (!getAttribute(ATTR_CHECKED).isNull());
         
         m_inited = true;
     }
@@ -2176,13 +2176,13 @@ void HTMLSelectElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_SIZE:
-        m_size = QMAX( attr->val()->toInt(), 1 );
+        m_size = QMAX( attr->value().toInt(), 1 );
         break;
     case ATTR_WIDTH:
-        m_minwidth = QMAX( attr->val()->toInt(), 0 );
+        m_minwidth = QMAX( attr->value().toInt(), 0 );
         break;
     case ATTR_MULTIPLE:
-        m_multiple = (attr->val() != 0);
+        m_multiple = (!attr->isNull());
         break;
     case ATTR_ACCESSKEY:
         // ### ignore for the moment
@@ -2415,10 +2415,10 @@ void HTMLKeygenElementImpl::parseAttribute(AttributeImpl* attr)
     switch(attr->id())
     {
     case ATTR_CHALLENGE:
-        m_challenge = attr->val();
+        m_challenge = attr->value();
         break;
     case ATTR_KEYTYPE:
-        m_keyType = attr->val();
+        m_keyType = attr->value();
         break;
     default:
         // skip HTMLSelectElementImpl parsing!
@@ -2433,7 +2433,7 @@ bool HTMLKeygenElementImpl::encoding(const QTextCodec* codec, khtml::encodingLis
 
 #if APPLE_CHANGES
     // Only RSA is supported at this time.
-    if (!m_keyType.isNull() && m_keyType.lower() != "rsa") {
+    if (!m_keyType.isNull() && !strcasecmp(m_keyType, "rsa")) {
         return false;
     }
     QString value = KSSLKeyGen::signedPublicKeyAndChallengeString((unsigned)selectedIndex(), m_challenge.string(), getDocument()->part()->baseURL());
@@ -2616,7 +2616,7 @@ void HTMLOptionElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_SELECTED:
-        m_selected = (attr->val() != 0);
+        m_selected = (!attr->isNull());
         break;
     case ATTR_VALUE:
         m_value = attr->value();
@@ -2717,10 +2717,10 @@ void HTMLTextAreaElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_ROWS:
-        m_rows = attr->val() ? attr->val()->toInt() : 3;
+        m_rows = !attr->isNull() ? attr->value().toInt() : 3;
         break;
     case ATTR_COLS:
-        m_cols = attr->val() ? attr->val()->toInt() : 60;
+        m_cols = !attr->isNull() ? attr->value().toInt() : 60;
         break;
     case ATTR_WRAP:
         // virtual / physical is Netscape extension of HTML 3.0, now deprecated
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index 171562e..156752c 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -488,8 +488,8 @@ public:
     virtual void parseAttribute(AttributeImpl *attr);
     virtual bool encoding(const QTextCodec*, khtml::encodingList&, bool);
 protected:
-    DOMString m_challenge;
-    DOMString m_keyType;
+    AtomicString m_challenge;
+    AtomicString m_keyType;
 };
 
 // -------------------------------------------------------------------------
diff --git a/WebCore/khtml/html/html_headimpl.cpp b/WebCore/khtml/html/html_headimpl.cpp
index 7009e3f..80d7824 100644
--- a/WebCore/khtml/html/html_headimpl.cpp
+++ b/WebCore/khtml/html/html_headimpl.cpp
@@ -186,7 +186,7 @@ void HTMLLinkElementImpl::parseAttribute(AttributeImpl *attr)
         process();
         break;
     case ATTR_DISABLED:
-        setDisabledState(attr->val() != 0);
+        setDisabledState(!attr->isNull());
         break;
     default:
         HTMLElementImpl::parseAttribute(attr);
@@ -385,7 +385,7 @@ void HTMLStyleElementImpl::parseAttribute(AttributeImpl *attr)
     switch (attr->id())
     {
     case ATTR_TYPE:
-        m_type = attr->value().lower();
+        m_type = attr->value().domString().lower();
         break;
     case ATTR_MEDIA:
         m_media = attr->value().string().lower();
diff --git a/WebCore/khtml/html/html_imageimpl.cpp b/WebCore/khtml/html/html_imageimpl.cpp
index b32207e..3d148d5 100644
--- a/WebCore/khtml/html/html_imageimpl.cpp
+++ b/WebCore/khtml/html/html_imageimpl.cpp
@@ -109,7 +109,7 @@ void HTMLImageElementImpl::parseAttribute(AttributeImpl *attr)
 	addCSSProperty(CSS_PROP_VERTICAL_ALIGN, attr->value());
         break;
     case ATTR_USEMAP:
-        if ( attr->value()[0] == '#' )
+        if ( attr->value().domString()[0] == '#' )
             usemap = attr->value();
         else {
             QString url = getDocument()->completeURL( khtml::parseURL( attr->value() ).string() );
@@ -117,7 +117,7 @@ void HTMLImageElementImpl::parseAttribute(AttributeImpl *attr)
             // the map is on the same html page....
             usemap = url;
         }
-        m_hasAnchor = attr->val() != 0;
+        m_hasAnchor = !attr->isNull();
     case ATTR_ISMAP:
         ismap = true;
         break;
@@ -392,13 +392,13 @@ void HTMLAreaElementImpl::parseAttribute(AttributeImpl *attr)
         break;
     case ATTR_COORDS:
         if (m_coords) delete [] m_coords;
-        m_coords = attr->val()->toLengthArray(m_coordsLen);
+        m_coords = attr->value().toLengthArray(m_coordsLen);
         break;
     case ATTR_NOHREF:
-        nohref = attr->val() != 0;
+        nohref = !attr->isNull();
         break;
     case ATTR_TARGET:
-        m_hasTarget = attr->val() != 0;
+        m_hasTarget = !attr->isNull();
         break;
     case ATTR_ALT:
         break;
diff --git a/WebCore/khtml/html/html_inlineimpl.cpp b/WebCore/khtml/html/html_inlineimpl.cpp
index a8c2920..61d2b8b 100644
--- a/WebCore/khtml/html/html_inlineimpl.cpp
+++ b/WebCore/khtml/html/html_inlineimpl.cpp
@@ -215,10 +215,10 @@ void HTMLAnchorElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_HREF:
-        m_hasAnchor = attr->val() != 0;
+        m_hasAnchor = !attr->isNull();
         break;
     case ATTR_TARGET:
-        m_hasTarget = attr->val() != 0;
+        m_hasTarget = !attr->isNull();
         break;
     case ATTR_NAME:
     case ATTR_TITLE:
diff --git a/WebCore/khtml/html/html_listimpl.cpp b/WebCore/khtml/html/html_listimpl.cpp
index 0dd3578..90fb64d 100644
--- a/WebCore/khtml/html/html_listimpl.cpp
+++ b/WebCore/khtml/html/html_listimpl.cpp
@@ -87,7 +87,7 @@ void HTMLOListElementImpl::parseAttribute(AttributeImpl *attr)
             addCSSProperty(CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
         break;
     case ATTR_START:
-            _start = attr->val() ? attr->val()->toInt() : 1;
+            _start = !attr->isNull() ? attr->value().toInt() : 1;
     default:
         HTMLUListElementImpl::parseAttribute(attr);
     }
@@ -107,7 +107,7 @@ void HTMLLIElementImpl::parseAttribute(AttributeImpl *attr)
     {
     case ATTR_VALUE:
         isValued = true;
-        requestedValue = attr->val() ? attr->val()->toInt() : 0;
+        requestedValue = !attr->isNull() ? attr->value().toInt() : 0;
 
         if(m_render && m_render->isListItem())
         {
diff --git a/WebCore/khtml/html/html_miscimpl.cpp b/WebCore/khtml/html/html_miscimpl.cpp
index 1513d54..f1b4e72 100644
--- a/WebCore/khtml/html/html_miscimpl.cpp
+++ b/WebCore/khtml/html/html_miscimpl.cpp
@@ -347,7 +347,7 @@ NodeImpl *HTMLCollectionImpl::getNamedItem( NodeImpl *current, int attr_id,
                 if (caseSensitive)
                     found = e->getAttribute(attr_id) == name;
                 else
-                    found = e->getAttribute(attr_id).lower() == name.lower();
+                    found = e->getAttribute(attr_id).domString().lower() == name.lower();
                 if (found) {
                     //kdDebug( 6030 ) << "found node: " << e << " " << current << " " << e->id() << " " << e->tagName().string() << endl;
                     return current;
@@ -505,7 +505,7 @@ NodeImpl* HTMLFormCollectionImpl::getNamedFormItem(int attr_id, const DOMString&
                     if (caseSensitive)
                         found = e->getAttribute(attr_id) == name;
                     else
-                        found = e->getAttribute(attr_id).lower() == name.lower();
+                        found = e->getAttribute(attr_id).domString().lower() == name.lower();
                     if (found) {
                         if (!duplicateNumber)
                             return e;
@@ -534,7 +534,7 @@ NodeImpl* HTMLFormCollectionImpl::getNamedImgItem(NodeImpl* current, int attr_id
                 if (caseSensitive)
                     found = e->getAttribute(attr_id) == name;
                 else
-                    found = e->getAttribute(attr_id).lower() == name.lower();
+                    found = e->getAttribute(attr_id).domString().lower() == name.lower();
                 if (found)
                 {
                     if (!duplicateNumber)
diff --git a/WebCore/khtml/html/html_objectimpl.cpp b/WebCore/khtml/html/html_objectimpl.cpp
index 9e869cd..d53e5f0 100644
--- a/WebCore/khtml/html/html_objectimpl.cpp
+++ b/WebCore/khtml/html/html_objectimpl.cpp
@@ -216,10 +216,8 @@ NodeImpl::Id HTMLEmbedElementImpl::id() const
 
 void HTMLEmbedElementImpl::parseAttribute(AttributeImpl *attr)
 {
-  DOM::DOMStringImpl *stringImpl = attr->val();
-  QConstString cval(stringImpl->s, stringImpl->l);
-  QString val = cval.string();
-
+  QString val = attr->value().string();
+  
   int pos;
   switch ( attr->id() )
   {
@@ -231,7 +229,7 @@ void HTMLEmbedElementImpl::parseAttribute(AttributeImpl *attr)
         break;
      case ATTR_CODE:
      case ATTR_SRC:
-         url = khtml::parseURL(attr->val()).string();
+         url = khtml::parseURL(attr->value()).string();
          break;
      case ATTR_WIDTH:
         addCSSLength( CSS_PROP_WIDTH, attr->value() );
@@ -326,8 +324,7 @@ HTMLFormElementImpl *HTMLObjectElementImpl::form() const
 
 void HTMLObjectElementImpl::parseAttribute(AttributeImpl *attr)
 {
-  DOM::DOMStringImpl *stringImpl = attr->val();
-  QString val = QConstString( stringImpl->s, stringImpl->l ).string();
+  QString val = attr->value().string();
   int pos;
   switch ( attr->id() )
   {
@@ -448,14 +445,10 @@ void HTMLObjectElementImpl::recalcStyle( StyleChange ch )
 HTMLParamElementImpl::HTMLParamElementImpl(DocumentPtr *doc)
     : HTMLElementImpl(doc)
 {
-    m_name = 0;
-    m_value = 0;
 }
 
 HTMLParamElementImpl::~HTMLParamElementImpl()
 {
-    if(m_name) m_name->deref();
-    if(m_value) m_value->deref();
 }
 
 NodeImpl::Id HTMLParamElementImpl::id() const
@@ -471,12 +464,10 @@ void HTMLParamElementImpl::parseAttribute(AttributeImpl *attr)
         if (getDocument()->htmlMode() != DocumentImpl::XHtml) break;
         // fall through
     case ATTR_NAME:
-        m_name = attr->val();
-        if (m_name) m_name->ref();
+        m_name = attr->value();
         break;
     case ATTR_VALUE:
-        m_value = attr->val();
-        if (m_value) m_value->ref();
+        m_value = attr->value();
         break;
     }
 }
diff --git a/WebCore/khtml/html/html_objectimpl.h b/WebCore/khtml/html/html_objectimpl.h
index 230f73c..2a38122 100644
--- a/WebCore/khtml/html/html_objectimpl.h
+++ b/WebCore/khtml/html/html_objectimpl.h
@@ -137,12 +137,12 @@ public:
 
     virtual void parseAttribute(AttributeImpl *token);
 
-    QString name() const { if(!m_name) return QString::null; return QString(m_name->s, m_name->l); }
-    QString value() const { if(!m_value) return QString::null; return QString(m_value->s, m_value->l); }
+    QString name() const { return m_name.string(); }
+    QString value() const { return m_value.string(); }
 
  protected:
-    DOMStringImpl *m_name;
-    DOMStringImpl *m_value;
+    AtomicString m_name;
+    AtomicString m_value;
 };
 
 };
diff --git a/WebCore/khtml/html/html_tableimpl.cpp b/WebCore/khtml/html/html_tableimpl.cpp
index 954b999..920b623 100644
--- a/WebCore/khtml/html/html_tableimpl.cpp
+++ b/WebCore/khtml/html/html_tableimpl.cpp
@@ -398,12 +398,12 @@ void HTMLTableElementImpl::parseAttribute(AttributeImpl *attr)
         int border;
         // ### this needs more work, as the border value is not only
         //     the border of the box, but also between the cells
-        if(!attr->val())
+        if (attr->isNull())
             border = 0;
-        else if(attr->val()->l == 0)
+        else if(attr->isEmpty())
             border = 1;
         else
-            border = attr->val()->toInt();
+            border = attr->value().toInt();
 #ifdef DEBUG_DRAW_BORDER
         border=1;
 #endif
@@ -559,7 +559,7 @@ void HTMLTablePartElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_BGCOLOR:
-        if (attr->val())
+        if (!attr->isNull())
             addHTMLColor(CSS_PROP_BACKGROUND_COLOR, attr->value() );
         else
             removeCSSProperty(CSS_PROP_BACKGROUND_COLOR);
@@ -848,25 +848,25 @@ void HTMLTableCellElementImpl::parseAttribute(AttributeImpl *attr)
         break;
     case ATTR_ROWSPAN:
         // ###
-        rSpan = attr->val() ? attr->val()->toInt() : 1;
+        rSpan = !attr->isNull() ? attr->value().toInt() : 1;
         // limit this to something not causing an overflow with short int
         if(rSpan < 1 || rSpan > 1024) rSpan = 1;
         break;
     case ATTR_COLSPAN:
         // ###
-        cSpan = attr->val() ? attr->val()->toInt() : 1;
+        cSpan = !attr->isNull() ? attr->value().toInt() : 1;
         // limit this to something not causing an overflow with short int
         if(cSpan < 1 || cSpan > 1024) cSpan = 1;
         break;
     case ATTR_NOWRAP:
-        if (attr->val() != 0)
+        if (!attr->isNull())
             addCSSProperty(CSS_PROP_WHITE_SPACE, CSS_VAL__KHTML_NOWRAP);
         else
             removeCSSProperty(CSS_PROP_WHITE_SPACE);
         break;
     case ATTR_WIDTH:
         if (!attr->value().isEmpty()) {
-            int widthInt = attr->val()->toInt();
+            int widthInt = attr->value().toInt();
             if (widthInt > 0) // width="0" is ignored for compatibility with WinIE.
                 addCSSLength( CSS_PROP_WIDTH, attr->value() );
         }
@@ -875,7 +875,7 @@ void HTMLTableCellElementImpl::parseAttribute(AttributeImpl *attr)
         break;
     case ATTR_HEIGHT:
         if (!attr->value().isEmpty()) {
-            int heightInt = attr->val()->toInt();
+            int heightInt = attr->value().toInt();
             if (heightInt > 0) // height="0" is ignored for compatibility with WinIE.
                 addCSSLength( CSS_PROP_HEIGHT, attr->value() );
         }
@@ -938,7 +938,7 @@ void HTMLTableColElementImpl::parseAttribute(AttributeImpl *attr)
     switch(attr->id())
     {
     case ATTR_SPAN:
-        _span = attr->val() ? attr->val()->toInt() : 1;
+        _span = !attr->isNull() ? attr->value().toInt() : 1;
         break;
     case ATTR_WIDTH:
         if (!attr->value().isEmpty())
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index 642b52d..85d0bae 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -399,7 +399,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
 		    for (unsigned long l = 0; map && l < map->length(); ++l) {
 			AttributeImpl* it = map->attributeItem(l);
 			changed = !bmap->getAttributeItem(it->id());
-			bmap->insertAttribute(new AttributeImpl(it->id(), it->val()));
+			bmap->insertAttribute(new AttributeImpl(it->id(), it->value()));
 		    }
 		    if ( changed )
 			doc()->recalcStyle( NodeImpl::Inherit );
@@ -445,7 +445,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
                 for (unsigned long l = 0; map && l < map->length(); ++l) {
                     AttributeImpl* it = map->attributeItem(l);
                     changed = !bmap->getAttributeItem(it->id());
-                    bmap->insertAttribute(new AttributeImpl(it->id(), it->val()));
+                    bmap->insertAttribute(new AttributeImpl(it->id(), it->value()));
                 }
                 if ( changed )
                     doc()->recalcStyle( NodeImpl::Inherit );
@@ -1601,7 +1601,7 @@ NodeImpl *KHTMLParser::handleIsindex( Token *t )
     DOMString text = i18n("This is a searchable index. Enter search keywords: ");
 #endif
     if (a)
-        text = a->value() + " ";
+        text = DOMString(a->value()) + " ";
     child = new TextImpl(document, text);
     n->addChild( child );
     child = new HTMLIsIndexElementImpl(document, myform);
diff --git a/WebCore/khtml/html/htmltokenizer.cpp b/WebCore/khtml/html/htmltokenizer.cpp
index 7891436..36f6fac 100644
--- a/WebCore/khtml/html/htmltokenizer.cpp
+++ b/WebCore/khtml/html/htmltokenizer.cpp
@@ -1080,8 +1080,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
                         attrNamePresent = false;
                     }
                     else {
-                        DOMString v("");
-                        currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, v);
+                        currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, emptyAtom);
                         dest = buffer;
                         tag = SearchAttribute;
                     }
@@ -1131,7 +1130,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
                     // unmatched quotes among attributes that have names. -dwh
                     while(dest > buffer+1 && (*(dest-1) == '\n' || *(dest-1) == '\r'))
                         dest--; // remove trailing newlines
-                    DOMString v(buffer+1, dest-buffer-1);
+                    AtomicString v(buffer+1, dest-buffer-1);
                     attrName.setUnicode(buffer+1,dest-buffer-1); 
                     currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, v);
                     tag = SearchAttribute;
@@ -1154,7 +1153,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
                         // some <input type=hidden> rely on trailing spaces. argh
                         while(dest > buffer+1 && (*(dest-1) == '\n' || *(dest-1) == '\r'))
                             dest--; // remove trailing newlines
-                        DOMString v(buffer+1, dest-buffer-1);
+                        AtomicString v(buffer+1, dest-buffer-1);
                         if (!attrNamePresent)
                             attrName.setUnicode(buffer+1,dest-buffer-1); 
                         currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, v);
@@ -1194,7 +1193,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
                     // '/' does not delimit in IE!
                     if ( curchar <= ' ' || curchar == '>' )
                     {
-                        DOMString v(buffer+1, dest-buffer-1);
+                        AtomicString v(buffer+1, dest-buffer-1);
                         currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, v);
                         dest = buffer;
                         tag = SearchAttribute;
diff --git a/WebCore/khtml/html/htmltokenizer.h b/WebCore/khtml/html/htmltokenizer.h
index 7def202..c111403 100644
--- a/WebCore/khtml/html/htmltokenizer.h
+++ b/WebCore/khtml/html/htmltokenizer.h
@@ -83,14 +83,14 @@ namespace khtml {
             if(attrs) attrs->deref();
             if(text) text->deref();
         }
-        void addAttribute(DOM::DocumentImpl* doc, QChar* buffer, const QString& attrName, const DOM::DOMString& v)
+        void addAttribute(DOM::DocumentImpl* doc, QChar* buffer, const QString& attrName, const DOM::AtomicString& v)
         {
             DOM::AttributeImpl* a = 0;
             if(buffer->unicode())
-                a = new DOM::AttributeImpl(buffer->unicode(), v.implementation());
+                a = new DOM::AttributeImpl(buffer->unicode(), v);
             else if ( !attrName.isEmpty() && attrName != "/" )
                 a = new DOM::AttributeImpl(doc->attrId(0, DOM::DOMString(attrName).implementation(), false),
-                                           v.implementation());
+                                           v);
 
             if (a) {
                 if(!attrs) {
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 512e41f..944552b 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -172,6 +172,7 @@ KHTMLPart::KHTMLPart( KHTMLView *view, QObject *parent, const char *name, GUIPro
 
 void KHTMLPart::init( KHTMLView *view, GUIProfile prof )
 {
+  AtomicString::init();
   if ( prof == DefaultGUI )
     setXMLFile( "khtml.rc" );
   else if ( prof == BrowserViewGUI )
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 06e206c..7b5f47c 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -213,10 +213,10 @@ void KHTMLToolTip::maybeTip(const QPoint& /*p*/)
     DOM::NodeImpl *node = m_viewprivate->underMouse;
     while ( node ) {
         if ( node->isElementNode() ) {
-            QString s = static_cast<DOM::ElementImpl*>( node )->getAttribute( ATTR_TITLE ).string();
-            if ( !s.isEmpty() ) {
+            AtomicString s = static_cast<DOM::ElementImpl*>( node )->getAttribute(ATTR_TITLE);
+            if (!s.isEmpty()) {
                 QRect r( m_view->contentsToViewport( node->getRect().topLeft() ), node->getRect().size() );
-                tip( r,  s );
+                tip( r,  s.string() );
             }
             break;
         }
diff --git a/WebCore/khtml/xml/dom_nameimpl.cpp b/WebCore/khtml/xml/dom_atomicstring.cpp
similarity index 93%
rename from WebCore/khtml/xml/dom_nameimpl.cpp
rename to WebCore/khtml/xml/dom_atomicstring.cpp
index 6f86a7b..8cc4a27 100644
--- a/WebCore/khtml/xml/dom_nameimpl.cpp
+++ b/WebCore/khtml/xml/dom_atomicstring.cpp
@@ -20,28 +20,25 @@
  *
  */
 
-#include "dom/dom_string.h"
-#include "xml/dom_stringimpl.h"
-#include "dom_nameimpl.h"
-
-namespace DOM {
-
 // For KHTML we need to avoid having static constructors.
 // Our strategy is to declare the global objects with a different type (initialized to 0)
 // and then use placement new to initialize the global objects later. This is not completely
 // portable, and it would be good to figure out a 100% clean way that still avoids code that
 // runs at init time.
-    
+
 #if APPLE_CHANGES
 #define AVOID_STATIC_CONSTRUCTORS 1
 #endif
-    
+
 #if AVOID_STATIC_CONSTRUCTORS
 #define KHTML_ATOMICSTRING_HIDE_GLOBALS 1
 #endif
-    
-#include "dom_nameimpl.h"
-    
+
+#include "dom_atomicstring.h"
+#include "xml/dom_stringimpl.h"
+
+namespace DOM {
+   
 #define DUMP_STATISTICS 0
 
 #if DUMP_STATISTICS
@@ -303,22 +300,22 @@ void AtomicString::rehash(int newTableSize)
     free(oldTable);
 }
 
-const AtomicString &AtomicString::null()
-{
-    static AtomicString null;
-    return null;
-}
-
 // Global constants for property name strings.
 
 #if !AVOID_STATIC_CONSTRUCTORS
     // Define an AtomicString in the normal way.
-    #define DEFINE_GLOBAL(name, string) extern const AtomicString name ## PropertyName(string);
+    #define DEFINE_GLOBAL(name, string) extern const AtomicString name ## Atom(string);
+
+    extern const AtomicString nullAtom;
+    extern const AtomicString emptyAtom;
 #else
     // Define an AtomicString-sized array of pointers to avoid static initialization.
     // Use an array of pointers instead of an array of char in case there is some alignment issue.
     #define DEFINE_GLOBAL(name, string) \
-        void * name ## PropertyName[(sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *)];
+        void * name ## Atom[(sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *)];
+
+    DEFINE_GLOBAL(null, ignored)
+    DEFINE_GLOBAL(empty, ignored)
 #endif
 
 #define CALL_DEFINE_GLOBAL(name) DEFINE_GLOBAL(name, #name)
@@ -330,6 +327,9 @@ void AtomicString::init()
     static bool initialized;
     if (!initialized) {
         // Use placement new to initialize the globals.
+        new (&nullAtom) AtomicString;
+        new (&emptyAtom) AtomicString("");
+        
         #define PLACEMENT_NEW_GLOBAL(name, string) new (&name ## PropertyName) AtomicString(string);
         #define CALL_PLACEMENT_NEW_GLOBAL(name) PLACEMENT_NEW_GLOBAL(name, #name)
         KHTML_ATOMICSTRING_EACH_GLOBAL(CALL_PLACEMENT_NEW_GLOBAL)
@@ -338,20 +338,15 @@ void AtomicString::init()
 #endif
 }
 
-AtomicStringList* AtomicStringList::clone()
-{
-    return new AtomicStringList(m_string, m_next ? m_next->clone() : 0);
-}
-
 bool operator==(const AtomicString &a, const DOMString &b)
 {
-    return a.string() == b;    
+    return a.domString() == b;    
 }
    
 bool equalsIgnoreCase(const AtomicString &as, const DOMString &bs)
 {
     // returns true when equal, false otherwise (ignoring case)
-    return !strcasecmp(as.string(), bs);
+    return !strcasecmp(as.domString(), bs);
 }
 
 bool equalsIgnoreCase(const AtomicString &as, const AtomicString &bs)
@@ -359,7 +354,7 @@ bool equalsIgnoreCase(const AtomicString &as, const AtomicString &bs)
     // returns true when equal, false otherwise (ignoring case)
     if (as == bs)
         return true;
-    return !strcasecmp(as.string(), bs.string());
+    return !strcasecmp(as.domString(), bs.domString());
 }
 
 }
diff --git a/WebCore/khtml/xml/dom_nameimpl.h b/WebCore/khtml/xml/dom_atomicstring.h
similarity index 72%
copy from WebCore/khtml/xml/dom_nameimpl.h
copy to WebCore/khtml/xml/dom_atomicstring.h
index e11e5bd..b54f370 100644
--- a/WebCore/khtml/xml/dom_nameimpl.h
+++ b/WebCore/khtml/xml/dom_atomicstring.h
@@ -19,8 +19,8 @@
  * Boston, MA 02111-1307, USA.
  *
  */
-#ifndef _DOM_NameImpl_h_
-#define _DOM_NameImpl_h_
+#ifndef _DOM_AtomicString_h_
+#define _DOM_AtomicString_h_
 
 #include "dom/dom_string.h"
 
@@ -34,13 +34,15 @@ public:
     AtomicString(const char *s) : m_string(add(s)) { }
     AtomicString(const QChar *s, int length) : m_string(add(s, length)) { }
     AtomicString(const unsigned short* s, int length) : m_string(add((QChar*)s, length)) { }
+    AtomicString(const QString& s) :m_string(add(s.unicode(), s.length())) { }
     AtomicString(DOMStringImpl* imp) :m_string(add(imp)) { }
     explicit AtomicString(const DOMString &s) : m_string(add(s.implementation())) { }
     
-    const DOMString& string() const { return m_string; };
-    QString qstring() const { return m_string.string(); };
+    operator const DOMString&() const { return m_string; }
+    const DOMString& domString() const { return m_string; };
+    QString string() const { return m_string.string(); };
     
-    const DOMStringImpl* implementation() { return m_string.implementation(); }
+    DOMStringImpl* implementation() const { return m_string.implementation(); }
     
     const QChar *unicode() const { return m_string.unicode(); }
     int length() const { return m_string.length(); }
@@ -49,11 +51,13 @@ public:
 
     int find(const QChar c, int start = 0) const { return m_string.find(c, start); }
     
+    int toInt() const { return m_string.toInt(); }
+    bool percentage(int &_percentage) const { return m_string.percentage(_percentage); }
+    khtml::Length* toLengthArray(int& len) const { return m_string.toLengthArray(len); }
+    
     bool isNull() const { return m_string.isNull(); }
     bool isEmpty() const { return m_string.isEmpty(); }
 
-    static const AtomicString &null();
-    
     friend bool operator==(const AtomicString &, const AtomicString &);
     friend bool operator!=(const AtomicString &, const AtomicString &);
     
@@ -104,57 +108,14 @@ inline bool operator==(const AtomicString &a, const char *b)
 
     // Define external global variables for all property names above (and one more).
 #if !KHTML_ATOMICSTRING_HIDE_GLOBALS
+    extern const AtomicString nullAtom;
+    extern const AtomicString emptyAtom;
 #define KHTML_ATOMICSTRING_DECLARE_GLOBAL(name) extern const AtomicString name ## PropertyName;
     KHTML_ATOMICSTRING_EACH_GLOBAL(KHTML_ATOMICSTRING_DECLARE_GLOBAL)
     KHTML_ATOMICSTRING_DECLARE_GLOBAL(specialPrototype)
 #undef KHTML_ATOMICSTRING_DECLARE_GLOBAL
 #endif
         
-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); }
 
diff --git a/WebCore/khtml/xml/xml_namespace_table.h b/WebCore/khtml/xml/dom_atomicstringlist.h
similarity index 53%
copy from WebCore/khtml/xml/xml_namespace_table.h
copy to WebCore/khtml/xml/dom_atomicstringlist.h
index 100effa..a7e9932 100644
--- a/WebCore/khtml/xml/xml_namespace_table.h
+++ b/WebCore/khtml/xml/dom_atomicstringlist.h
@@ -1,4 +1,4 @@
-/**
+/*
  * This file is part of the DOM implementation for KDE.
  *
  * Copyright (C) 2004 Apple Computer, Inc.
@@ -17,30 +17,34 @@
  * 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_AtomicStringList_h_
+#define _DOM_AtomicStringList_h_
 
-#include <qdict.h>
 #include "dom/dom_string.h"
+#include "dom_atomicstring.h"
 
-namespace DOM
-{    
-struct XmlNamespaceEntry;
+namespace DOM {
 
-class XmlNamespaceTable
-{
+class AtomicStringList {
 public:
-    static int getNamespaceID(const DOMString& uri, bool readonly = true);
-    static DOMString getNamespaceURI(int id);
+    AtomicStringList() :m_next(0) {}
+    AtomicStringList(const AtomicString& str, AtomicStringList* n = 0) :m_string(str), m_next(n) {}
+    ~AtomicStringList() { delete m_next; }
     
-    static QDict<XmlNamespaceEntry>* gNamespaceTable;
-};
+    AtomicStringList* next() const { return m_next; }
+    void setNext(AtomicStringList* n) { m_next = n; }
+    const AtomicString& string() const { return m_string; }
+    void setString(const AtomicString& str) { m_string = str; }
 
-struct XmlNamespaceEntry
-{
-    XmlNamespaceEntry(int id, const DOMString& uri) :m_id(id), m_uri(uri) {}
+    AtomicStringList* clone() { return new AtomicStringList(m_string, m_next ? m_next->clone() : 0); }
+    void clear() { m_string = nullAtom; delete m_next; m_next = 0; }
     
-    int m_id;
-    DOMString m_uri;
+private:
+    AtomicString m_string;
+    AtomicStringList* m_next;
 };
 
 }
+#endif
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index d5a9f97..77886a6 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -157,7 +157,7 @@ public:
     DocumentTypeImpl *doctype() const;
 
     DOMImplementationImpl *implementation() const;
-    ElementImpl *documentElement() const;
+    virtual ElementImpl *documentElement() const;
     virtual ElementImpl *createElement ( const DOMString &tagName, int &exceptioncode );
     DocumentFragmentImpl *createDocumentFragment ();
     TextImpl *createTextNode ( const DOMString &data );
diff --git a/WebCore/khtml/xml/dom_elementimpl.cpp b/WebCore/khtml/xml/dom_elementimpl.cpp
index eb79c22..f7cd0ff 100644
--- a/WebCore/khtml/xml/dom_elementimpl.cpp
+++ b/WebCore/khtml/xml/dom_elementimpl.cpp
@@ -96,7 +96,7 @@ void AttrImpl::setPrefix(const DOMString &_prefix, int &exceptioncode )
 }
 
 DOMString AttrImpl::nodeValue() const {
-    return m_attribute->val();
+    return m_attribute->value();
 }
 
 void AttrImpl::setValue( const DOMString &v, int &exceptioncode )
@@ -133,7 +133,7 @@ void AttrImpl::setNodeValue( const DOMString &v, int &exceptioncode )
 
 NodeImpl *AttrImpl::cloneNode ( bool /*deep*/)
 {
-	return new AttrImpl(0, docPtr(), new AttributeImpl(m_attribute->id(), m_attribute->val()));
+	return new AttrImpl(0, docPtr(), new AttributeImpl(m_attribute->id(), m_attribute->value()));
 }
 
 // DOM Section 1.1.1
@@ -236,26 +236,21 @@ bool ElementImpl::matchesCSSClass(const AtomicString& c, bool caseSensitive) con
     return false;
 }
 
-DOMString ElementImpl::getAttribute(NodeImpl::Id id) const
+const AtomicString& ElementImpl::getAttribute(NodeImpl::Id id) const
 {
-    if (!namedAttrMap) return DOMString();
-    AttributeImpl* a = namedAttrMap->getAttributeItem(id);
-    if (a) return a->val();
-
-    // then search in default attr in case it is not yet set
-    NamedAttrMapImpl* dm = defaultMap();
-    if(!dm) return DOMString();
-    AttributeImpl* defattr = dm->getAttributeItem(id);
-    if (!defattr) return DOMString();
-    return defattr->val();
+    if (namedAttrMap) {
+        AttributeImpl* a = namedAttrMap->getAttributeItem(id);
+        if (a) return a->value();
+    }
+    return nullAtom;
 }
 
-DOMString ElementImpl::getAttributeNS(const DOMString &namespaceURI,
-                                      const DOMString &localName) const
-{
+const AtomicString& ElementImpl::getAttributeNS(const DOMString &namespaceURI,
+                                                const DOMString &localName) const
+{   
     NodeImpl::Id id = getDocument()->attrId(namespaceURI.implementation(),
                                             localName.implementation(), true);
-    if (!id) return DOMString();
+    if (!id) return nullAtom;
     return getAttribute(id);
 }
 
@@ -271,7 +266,7 @@ void ElementImpl::setAttribute(NodeImpl::Id id, DOMStringImpl* value, int &excep
     }
 
     if (id == ATTR_ID) {
-	updateId(old ? old->val() : 0, value);
+	updateId(old ? old->value() : nullAtom, value);
     }
     
     if (old && !value)
@@ -293,7 +288,7 @@ void ElementImpl::setAttributeMap( NamedAttrMapImpl* list )
     AttributeImpl *newId = list ? list->getAttributeItem(ATTR_ID) : 0;
 
     if (oldId || newId) {
-	updateId(oldId ? oldId->val() : 0, newId ? newId->val() : 0);
+	updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
     }
 
     if(namedAttrMap)
@@ -408,11 +403,6 @@ void ElementImpl::defaultEventHandler(EventImpl *evt)
     NodeBaseImpl::defaultEventHandler(evt);
 }
 
-NamedAttrMapImpl* ElementImpl::defaultMap() const
-{
-    return 0;
-}
-
 RenderStyle *ElementImpl::styleForRenderer(RenderObject *parentRenderer)
 {
     return getDocument()->styleSelector()->styleForElement(this);
@@ -436,24 +426,27 @@ void ElementImpl::attach()
 #endif
     NodeBaseImpl::attach();
 
-    NamedAttrMapImpl *attrs = attributes(true);
-    
-    if (attrs) {
-	AttributeImpl *idAttr = attrs->getAttributeItem(ATTR_ID);
-	if (idAttr && idAttr->val()) {
-	    updateId(0, idAttr->val());
-	}
+    if (hasID()) {
+        NamedAttrMapImpl *attrs = attributes(true);
+        if (attrs) {
+            AttributeImpl *idAttr = attrs->getAttributeItem(ATTR_ID);
+            if (idAttr && !idAttr->isNull()) {
+                updateId(nullAtom, idAttr->value());
+            }
+        }
     }
 }
 
 void ElementImpl::detach()
 {
-    NamedAttrMapImpl *attrs = attributes(true);
-    if (attrs) {
-	AttributeImpl *idAttr = attrs->getAttributeItem(ATTR_ID);
-	if (idAttr && idAttr->val()) {
-	    updateId(idAttr->val(), 0);
-	}
+    if (hasID()) {
+        NamedAttrMapImpl *attrs = attributes(true);
+        if (attrs) {
+            AttributeImpl *idAttr = attrs->getAttributeItem(ATTR_ID);
+            if (idAttr && !idAttr->isNull()) {
+                updateId(idAttr->value(), nullAtom);
+            }
+        }
     }
 
     NodeBaseImpl::detach();
@@ -629,7 +622,7 @@ DOMString ElementImpl::toString() const
     return result;
 }
 
-void ElementImpl::updateId(DOMStringImpl* oldId, DOMStringImpl* newId)
+void ElementImpl::updateId(const AtomicString& oldId, const AtomicString& newId)
 {
     if (!attached())
 	return;
@@ -637,19 +630,11 @@ void ElementImpl::updateId(DOMStringImpl* oldId, DOMStringImpl* newId)
     if (oldId == newId)
 	return;
 
-    DOMString oldIdStr(oldId);
-    DOMString newIdStr(newId);
-
     DocumentImpl* doc = getDocument();
-
-    if (oldIdStr == newIdStr)
-	return;
-
-    if (!oldIdStr.isEmpty())
-	doc->removeElementById(oldIdStr, this);
-
-    if (!newIdStr.isEmpty())
-	doc->addElementById(newIdStr, this);
+    if (!oldId.isEmpty())
+	doc->removeElementById(oldId, this);
+    if (!newId.isEmpty())
+	doc->addElementById(newId, this);
 }
 
 #ifndef NDEBUG
@@ -802,7 +787,7 @@ Node NamedAttrMapImpl::setNamedItem ( NodeImpl* arg, int &exceptioncode )
     }
 
     if (a->id() == ATTR_ID) {
-	element->updateId(old ? old->val() : 0, a->val());
+	element->updateId(old ? old->value() : nullAtom, a->value());
     }
 
     // ### slightly inefficient - resizes attribute array twice.
@@ -840,7 +825,7 @@ Node NamedAttrMapImpl::removeNamedItem ( NodeImpl::Id id, int &exceptioncode )
     Node r(a->attrImpl());
 
     if (id == ATTR_ID) {
-	element->updateId(a->val(), 0);
+	element->updateId(a->value(), nullAtom);
     }
 
     removeAttribute(id);
@@ -867,12 +852,12 @@ AttributeImpl* NamedAttrMapImpl::getAttributeItem(NodeImpl::Id id) const
 {
     bool matchAnyNamespace = (namespacePart(id) == anyNamespace);
     for (unsigned long i = 0; i < len; ++i) {
-        if (matchAnyNamespace) {
+        if (attrs[i]->id() == id)
+            return attrs[i];
+        else if (matchAnyNamespace) {
             if (localNamePart(attrs[i]->id()) == localNamePart(id))
                 return attrs[i];
         }
-        else if (attrs[i]->id() == id)
-            return attrs[i];
     }
     return 0;
 }
@@ -921,7 +906,7 @@ NamedAttrMapImpl& NamedAttrMapImpl::operator=(const NamedAttrMapImpl& other)
     AttributeImpl *newId = other.getAttributeItem(ATTR_ID);
 
     if (oldId || newId) {
-	element->updateId(oldId ? oldId->val() : 0, newId ? newId->val() : 0);
+	element->updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
     }
 
     clearAttributes();
@@ -931,7 +916,7 @@ NamedAttrMapImpl& NamedAttrMapImpl::operator=(const NamedAttrMapImpl& other)
     // first initialize attrs vector, then call parseAttribute on it
     // this allows parseAttribute to use getAttribute
     for (uint i = 0; i < len; i++) {
-        attrs[i] = new AttributeImpl(other.attrs[i]->id(), other.attrs[i]->val());
+        attrs[i] = new AttributeImpl(other.attrs[i]->id(), other.attrs[i]->value());
         attrs[i]->ref();
     }
 
@@ -1003,9 +988,9 @@ void NamedAttrMapImpl::removeAttribute(NodeImpl::Id id)
 
     // Notify the element that the attribute has been removed
     // dispatch appropriate mutation events
-    if (element && attr->_value) {
-        DOMStringImpl* value = attr->_value;
-        attr->_value = 0;
+    if (element && !attr->_value.isNull()) {
+        AtomicString value = attr->_value;
+        attr->_value = nullAtom;
         element->parseAttribute(attr);
         attr->_value = value;
     }
diff --git a/WebCore/khtml/xml/dom_elementimpl.h b/WebCore/khtml/xml/dom_elementimpl.h
index c309e2f..89ee295 100644
--- a/WebCore/khtml/xml/dom_elementimpl.h
+++ b/WebCore/khtml/xml/dom_elementimpl.h
@@ -60,39 +60,31 @@ class AttributeImpl : public khtml::Shared<AttributeImpl>
 
 public:
     // null value is forbidden !
-    AttributeImpl(NodeImpl::Id id, DOMStringImpl* value)
-        : m_id(id), _prefix(0), _value(value), _impl(0)
-        { _value->ref(); };
-    ~AttributeImpl() {
-        if (_prefix) _prefix->deref();
-        if (_value) _value->deref();
-        // assert : _impl == 0
-    }
+    AttributeImpl(NodeImpl::Id id, const AtomicString& value)
+        : m_id(id), _value(value), _impl(0)
+        { };
 
-    DOMString value() const { return _value; }
-    DOMStringImpl* val() const { return _value; }
-    DOMStringImpl* prefix() const { return _prefix; }
+    const AtomicString& value() const { return _value; }
+    const AtomicString& prefix() const { return _prefix; }
     NodeImpl::Id id() const { return m_id; }
     AttrImpl* attrImpl() const { return _impl; }
 
+    bool isNull() const { return _value.isNull(); }
+    bool isEmpty() const { return _value.isEmpty(); }
+    
 private:
-    // null pointers can never happen here
-    void setValue(DOMStringImpl* value) {
-        _value->deref();
+    void setValue(const AtomicString& value) {
         _value = value;
-        _value->ref();
     }
-    void setPrefix(DOMStringImpl* prefix) {
-        if (_prefix) _prefix->deref();
+    void setPrefix(const AtomicString& prefix) {
         _prefix = prefix;
-        if (_prefix) _prefix->ref();
     }
     void allocateImpl(ElementImpl* e);
 
 protected:
     NodeImpl::Id m_id;
-    DOMStringImpl *_prefix;
-    DOMStringImpl *_value;
+    AtomicString _prefix;
+    AtomicString _value;
     AttrImpl* _impl;
 };
 
@@ -164,10 +156,10 @@ public:
     // 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,
-                             const DOMString &localName) const;
+    const AtomicString& getAttribute( NodeImpl::Id id ) const;
+    const AtomicString& getAttribute(const DOMString& localName) const { return getAttributeNS(QString::null, localName); }
+    const AtomicString& getAttributeNS(const DOMString &namespaceURI,
+                                       const DOMString &localName) const;
     void setAttribute( NodeImpl::Id id, DOMStringImpl* value, int &exceptioncode );
     void removeAttribute( NodeImpl::Id id, int &exceptioncode );
 
@@ -238,12 +230,7 @@ protected:
     DOMString openTagStartToString() const;
 
 private:
-    // map of default attributes. derived element classes are responsible
-    // for setting this according to the corresponding element description
-    // in the DTD
-    virtual NamedAttrMapImpl* defaultMap() const;
-
-    void updateId(DOMStringImpl* oldId, DOMStringImpl* newId);
+    void updateId(const AtomicString& oldId, const AtomicString& newId);
 
 protected: // member variables
     mutable NamedAttrMapImpl *namedAttrMap;
diff --git a/WebCore/khtml/xml/dom_nameimpl.h b/WebCore/khtml/xml/dom_nameimpl.h
index e11e5bd..1caee27 100644
--- a/WebCore/khtml/xml/dom_nameimpl.h
+++ b/WebCore/khtml/xml/dom_nameimpl.h
@@ -22,121 +22,18 @@
 #ifndef _DOM_NameImpl_h_
 #define _DOM_NameImpl_h_
 
-#include "dom/dom_string.h"
+#include "dom/dom_atomicstring.h"
 
 namespace DOM {
 
-class AtomicString {
-public:
-    static void init();
-    
-    AtomicString() { }
-    AtomicString(const char *s) : m_string(add(s)) { }
-    AtomicString(const QChar *s, int length) : m_string(add(s, length)) { }
-    AtomicString(const unsigned short* s, int length) : m_string(add((QChar*)s, length)) { }
-    AtomicString(DOMStringImpl* imp) :m_string(add(imp)) { }
-    explicit AtomicString(const DOMString &s) : m_string(add(s.implementation())) { }
-    
-    const DOMString& string() const { return m_string; };
-    QString qstring() const { return m_string.string(); };
-    
-    const DOMStringImpl* implementation() { return m_string.implementation(); }
-    
-    const QChar *unicode() const { return m_string.unicode(); }
-    int length() const { return m_string.length(); }
-    
-    const char *ascii() const { return m_string.string().ascii(); }
-
-    int find(const QChar c, int start = 0) const { return m_string.find(c, start); }
-    
-    bool isNull() const { return m_string.isNull(); }
-    bool isEmpty() const { return m_string.isEmpty(); }
-
-    static const AtomicString &null();
-    
-    friend bool operator==(const AtomicString &, const AtomicString &);
-    friend bool operator!=(const AtomicString &, const AtomicString &);
-    
-    friend bool operator==(const AtomicString &, const char *);
-    
-    static void remove(DOMStringImpl *);
-    
-private:
-    DOMString m_string;
-    
-    static bool equal(DOMStringImpl *, const char *);
-    static bool equal(DOMStringImpl *, const QChar *, uint length);
-    static bool equal(DOMStringImpl *, DOMStringImpl *);
-    
-    static bool equal(const AtomicString &a, const AtomicString &b)
-    { return a.m_string.implementation() == b.m_string.implementation(); }
-    static bool equal(const AtomicString &a, const char *b)
-    { return equal(a.m_string.implementation(), b); }
-    
-    static DOMStringImpl *add(const char *);
-    static DOMStringImpl *add(const QChar *, int length);
-    static DOMStringImpl *add(DOMStringImpl *);
-    
-    static void insert(DOMStringImpl *);
-    
-    static void rehash(int newTableSize);
-    static void expand();
-    static void shrink();
-    
-    static DOMStringImpl **_table;
-    static int _tableSize;
-    static int _tableSizeMask;
-    static int _keyCount;
-};
-
-inline bool operator==(const AtomicString &a, const AtomicString &b)
-{ return AtomicString::equal(a, b); }
-
-inline bool operator!=(const AtomicString &a, const AtomicString &b)
-{ return !AtomicString::equal(a, b); }
-
-inline bool operator==(const AtomicString &a, const char *b)
-{ return AtomicString::equal(a, b); }
-
-// List of property names, passed to a macro so we can do set them up various
-// ways without repeating the list.
-#define KHTML_ATOMICSTRING_EACH_GLOBAL(macro)
-
-    // Define external global variables for all property names above (and one more).
-#if !KHTML_ATOMICSTRING_HIDE_GLOBALS
-#define KHTML_ATOMICSTRING_DECLARE_GLOBAL(name) extern const AtomicString name ## PropertyName;
-    KHTML_ATOMICSTRING_EACH_GLOBAL(KHTML_ATOMICSTRING_DECLARE_GLOBAL)
-    KHTML_ATOMICSTRING_DECLARE_GLOBAL(specialPrototype)
-#undef KHTML_ATOMICSTRING_DECLARE_GLOBAL
-#endif
-        
-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; }
+    const AtomicString& namespaceURI() const { return m_namespaceURI; }
+    const AtomicString& localName() const { return m_localName; }
 
 private:
     AtomicString m_namespaceURI;
@@ -155,10 +52,5 @@ 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 70758e1..b4050c5 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -30,7 +30,7 @@
 #include "dom/dom_node.h"
 #include "misc/helper.h"
 #include "misc/shared.h"
-#include "dom_nameimpl.h"
+#include "dom_atomicstring.h"
 
 class QPainter;
 template <class type> class QPtrList;
diff --git a/WebCore/khtml/xml/dom_stringimpl.cpp b/WebCore/khtml/xml/dom_stringimpl.cpp
index 9e6edad..66c54d2 100644
--- a/WebCore/khtml/xml/dom_stringimpl.cpp
+++ b/WebCore/khtml/xml/dom_stringimpl.cpp
@@ -28,7 +28,7 @@
 #include <kdebug.h>
 
 #include <string.h>
-#include "dom_nameimpl.h"
+#include "dom_atomicstring.h"
 
 using namespace khtml;
 
diff --git a/WebCore/kwq/KWQFont.mm b/WebCore/kwq/KWQFont.mm
index 525ae91..17e5cf8 100644
--- a/WebCore/kwq/KWQFont.mm
+++ b/WebCore/kwq/KWQFont.mm
@@ -65,7 +65,7 @@ QFont &QFont::operator=(const QFont &other)
 
 QString QFont::family() const
 {
-    return _family.family();
+    return _family.family().string();
 }
 
 void QFont::setFamily(const QString &qfamilyName)
diff --git a/WebCore/kwq/KWQFontFamily.h b/WebCore/kwq/KWQFontFamily.h
index cf1a382..2a78bea 100644
--- a/WebCore/kwq/KWQFontFamily.h
+++ b/WebCore/kwq/KWQFontFamily.h
@@ -24,6 +24,7 @@
  */
 
 #include "KWQString.h"
+#include "dom_atomicstring.h"
 
 #ifdef __OBJC__
 @class NSString;
@@ -39,8 +40,8 @@ public:
     KWQFontFamily(const KWQFontFamily &);    
     KWQFontFamily &operator=(const KWQFontFamily &);
         
-    void setFamily(const QString &);
-    QString family() const { return _family; }
+    void setFamily(const DOM::AtomicString &);
+    const DOM::AtomicString& family() const { return _family; }
     bool familyIsEmpty() const { return _family.isEmpty(); }
     
     NSString *getNSFamily() const;
@@ -64,7 +65,7 @@ public:
     void deref() { _refCnt--; if (_refCnt == 0) delete this; }
     
 private:
-    QString _family;
+    DOM::AtomicString _family;
     KWQFontFamily *_next;
     int _refCnt;
     mutable NSString *_NSFamily;
diff --git a/WebCore/kwq/KWQFontFamily.mm b/WebCore/kwq/KWQFontFamily.mm
index 47e4b94..3a28666 100644
--- a/WebCore/kwq/KWQFontFamily.mm
+++ b/WebCore/kwq/KWQFontFamily.mm
@@ -24,6 +24,10 @@
  */
 
 #include "KWQFontFamily.h"
+#include "xml/dom_stringimpl.h"
+
+using DOM::AtomicString;
+using DOM::DOMStringImpl;
 
 KWQFontFamily::KWQFontFamily()
     : _next(0)
@@ -54,29 +58,38 @@ KWQFontFamily& KWQFontFamily::operator=(const KWQFontFamily& other)
     return *this;
 }
 
+const void *retainDOMStringImpl(CFAllocatorRef allocator, const void *value)
+{
+    ((DOMStringImpl*)value)->ref();
+    return value;
+}
+
+void releaseDOMStringImpl(CFAllocatorRef allocator, const void *value)
+{
+    ((DOMStringImpl*)value)->deref();
+}
+
+const CFDictionaryKeyCallBacks CFDictionaryFamilyKeyCallBacks = { 0, retainDOMStringImpl, releaseDOMStringImpl, 0, 0, 0 };
+
 NSString *KWQFontFamily::getNSFamily() const
 {
     if (!_NSFamily) {
         // Use an immutable copy of the name, but keep a set of
         // all family names so we don't end up with too many objects.
         static CFMutableDictionaryRef families;
-        if (families == NULL) {
-            families = CFDictionaryCreateMutable(NULL, 0, &CFDictionaryQStringKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
-        }
-        _NSFamily = (NSString *)CFDictionaryGetValue(families, &_family);
+        if (families == NULL)
+            families = CFDictionaryCreateMutable(NULL, 0, &CFDictionaryFamilyKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+        _NSFamily = (NSString *)CFDictionaryGetValue(families, _family.implementation());
         if (!_NSFamily) {
-            _NSFamily = _family.getNSString();
-            CFDictionarySetValue(families, &_family, _NSFamily);
+            _NSFamily = [NSString stringWithCharacters:(const unichar *)_family.unicode() length:_family.length()];
+            CFDictionarySetValue(families, _family.implementation(), _NSFamily);
         }
     }
     return _NSFamily;
 }
 
-void KWQFontFamily::setFamily(const QString &family)
+void KWQFontFamily::setFamily(const AtomicString &family)
 {
-    if (family == _family) {
-        return;
-    }
     _family = family;
     _NSFamily = nil;
 }
@@ -88,5 +101,5 @@ bool KWQFontFamily::operator==(const KWQFontFamily &compareFontFamily) const
         ((_next && compareFontFamily._next) && (*_next != *(compareFontFamily._next))))
         return false;
     
-    return getNSFamily() == compareFontFamily.getNSFamily();
+    return _family == compareFontFamily._family;
 }
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 984dae8..3238ed3 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -2155,7 +2155,7 @@ NSFileWrapper *KWQKHTMLPart::fileWrapperForElement(ElementImpl *e)
     
     NSFileWrapper *wrapper = nil;
 
-    DOMString attr = e->getAttribute(ATTR_SRC);
+    AtomicString attr = e->getAttribute(ATTR_SRC);
     if (!attr.isEmpty()) {
         NSURL *URL = completeURL(attr.string()).getNSURL();
         wrapper = [_bridge fileWrapperForURL:URL];
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 9aa89f5..11b3000 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -795,7 +795,7 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
     // For <area> tags in image maps, walk the tree for the <area>, not the <img> using it.
     for (NodeImpl *titleNode = nodeInfo.innerNode(); titleNode; titleNode = titleNode->parentNode()) {
         if (titleNode->isElementNode()) {
-            const DOMString title = static_cast<ElementImpl *>(titleNode)->getAttribute(ATTR_TITLE);
+            const AtomicString& title = static_cast<ElementImpl *>(titleNode)->getAttribute(ATTR_TITLE);
             if (!title.isNull()) {
                 // We found a node with a title.
                 QString titleText = title.string();
@@ -810,14 +810,14 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
     if (URLNode) {
         ElementImpl *e = static_cast<ElementImpl *>(URLNode);
         
-        DOMString title = e->getAttribute(ATTR_TITLE);
+        const AtomicString& title = e->getAttribute(ATTR_TITLE);
         if (!title.isEmpty()) {
             QString titleText = title.string();
             titleText.replace('\\', _part->backslashAsCurrencySymbol());
             [element setObject:titleText.getNSString() forKey:WebCoreElementLinkTitleKey];
         }
         
-        DOMString link = e->getAttribute(ATTR_HREF);
+        const AtomicString& link = e->getAttribute(ATTR_HREF);
         if (!link.isNull()) {
             if (e->firstChild()) {
                 Range r(_part->document());

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list