[webkit-changes] cvs commit: WebCore/khtml/xml dom_atomicstring.cpp dom_atomicstring.h dom_docimpl.cpp dom_stringimpl.cpp dom_stringimpl.h

Darin darin at opensource.apple.com
Fri Dec 30 16:14:31 PST 2005


darin       05/12/30 16:14:31

  Modified:    .        ChangeLog
               khtml    khtml_part.cpp
               khtml/css cssstyleselector.cpp
               khtml/dom dom_string.cpp dom_string.h
               khtml/ecma kjs_html.cpp
               khtml/editing apply_style_command.cpp
               khtml/html html_baseimpl.cpp html_blockimpl.cpp
                        html_elementimpl.cpp html_formimpl.cpp
                        html_imageimpl.cpp html_inlineimpl.cpp
                        html_listimpl.cpp html_tableimpl.cpp htmlparser.cpp
               khtml/rendering render_br.cpp render_form.cpp
               khtml/xml dom_atomicstring.cpp dom_atomicstring.h
                        dom_docimpl.cpp dom_stringimpl.cpp dom_stringimpl.h
  Log:
          Reviewed by Maciej.
  
          - http://bugzilla.opendarwin.org/show_bug.cgi?id=4557
            rename unusual strcmp and strcasecmp for DOMString family
  
          Added new functions named equal and equalIgnoringCase.
  
          * khtml/xml/dom_stringimpl.h: Changed the type of the length parameter to computeHash to unsigned
          to match the rest of the interface. Added equal and equalIgnoringCase functions. Added a
          version of the hash function that works on char* to CaseInsensitiveHash as preparation for an
          atomic string change.
          * khtml/xml/dom_stringimpl.cpp: Moved the QT_ALLOC_QCHAR_VEC and QT_DELETE_QCHAR_VEC macros
          here, and changed them into inline functions.
          (DOM::equal): Implemented.
          (DOM::equalIgnoringCase): Implemented.
          (DOM::DOMStringImpl::computeHash): Changed parameter type to unsigned to match other similar
          functions.
  
          * khtml/dom/dom_string.h: Removed unnecessary friend declarations. Changed operator
          overloads for == and != to call through inline to DOMStringImpl. Replaced strcasecmp
          with equalIgnoringCase, overloaded for one more combination of parameters. Removed strcmp.
          * khtml/dom/dom_string.cpp: Removed functions that are now implemented in DOMStringImpl*.
  
          * khtml/xml/dom_atomicstring.h: Removed a redundant const. Removed unnecessary
          friend declarations. Removed AtomicString::equal. Filled out a larger set of == and
          != operator implementations, mostly with inlines calling through to DOMStringImpl.
          Renamed equalsIgnoreCase to equalIgnoringCase and filled out a larger set as above.
          * khtml/xml/dom_atomicstring.cpp: Renamed AtomicString::equal to just ==.
          Removed some implementation of == and equalsIgnoreCase that are replaced by inlines.
  
          * khtml/html/html_listimpl.cpp:
          (DOM::HTMLOListElementImpl::parseMappedAttribute):
          (DOM::HTMLLIElementImpl::parseMappedAttribute):
          Use the "==" operator instead of strcmp.
  
          * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector):
          Use equalIgnoringCase instead of equalsIgnoreCase.
  
          * khtml/rendering/render_form.cpp:
          (RenderSlider::updateFromElement): Fixed bug where a temporary DOMString was put into
          a const DOMString&. Changed some DOMString to AtomicString as appropriate, and also
          used equalIgnoringCase instead of strcasecmp.
          (RenderSlider::slotSliderValueChanged): More of the same.
  
          * khtml/xml/dom_docimpl.cpp: (DocumentImpl::processHttpEquiv): Replaced use of strcasecmp
          with equalIgnoringCase. Added parentheses to fix incorrect operator precedence in one case
          (&& binds tighter than ||) which fixes a crash when using a http-equiv pragma when there
          is no part (not sure how to reproduce that).
  
          * khtml/khtml_part.cpp:
          (updateState):
          (KHTMLPart::selectionStartHasStyle):
          * khtml/ecma/kjs_html.cpp: (KJS::KJS::HTMLDocument::putValueProperty):
          * khtml/editing/apply_style_command.cpp:
          (khtml::StyleChange::checkForLegacyHTMLStyleChange):
          (khtml::StyleChange::currentlyHasStyle):
          (khtml::hasTextDecorationProperty):
          (khtml::ApplyStyleCommand::extractTextDecorationStyle):
          (khtml::ApplyStyleCommand::extractAndNegateTextDecorationStyle):
          * khtml/html/html_baseimpl.cpp:
          (HTMLBodyElementImpl::parseMappedAttribute):
          (HTMLFrameElementImpl::parseMappedAttribute):
          * khtml/html/html_blockimpl.cpp:
          (HTMLDivElementImpl::parseMappedAttribute):
          (HTMLHRElementImpl::parseMappedAttribute):
          (HTMLParagraphElementImpl::parseMappedAttribute):
          (HTMLMarqueeElementImpl::parseMappedAttribute):
          * khtml/html/html_elementimpl.cpp:
          (HTMLElementImpl::parseMappedAttribute):
          (HTMLElementImpl::addHTMLAlignment):
          (HTMLElementImpl::setContentEditable):
          * khtml/html/html_formimpl.cpp:
          (DOM::HTMLFormElementImpl::parseMappedAttribute):
          (DOM::HTMLButtonElementImpl::parseMappedAttribute):
          (DOM::HTMLInputElementImpl::setInputType):
          (DOM::HTMLInputElementImpl::parseMappedAttribute):
          (DOM::HTMLKeygenElementImpl::appendFormData):
          (DOM::HTMLTextAreaElementImpl::parseMappedAttribute):
          * khtml/html/html_imageimpl.cpp: (DOM::HTMLAreaElementImpl::parseMappedAttribute):
          * khtml/html/html_inlineimpl.cpp: (DOM::HTMLBRElementImpl::parseMappedAttribute):
          * khtml/html/html_tableimpl.cpp: (DOM::HTMLTablePartElementImpl::parseMappedAttribute):
          * khtml/html/htmlparser.cpp: (HTMLParser::handleError):
          Use equalIgnoringCase instead of strcasecmp.
  
  Revision  Changes    Path
  1.71      +113 -27   WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- ChangeLog	30 Dec 2005 22:17:04 -0000	1.70
  +++ ChangeLog	31 Dec 2005 00:14:19 -0000	1.71
  @@ -1,3 +1,89 @@
  +2005-12-30  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by Maciej.
  +
  +        - http://bugzilla.opendarwin.org/show_bug.cgi?id=4557
  +          rename unusual strcmp and strcasecmp for DOMString family
  +
  +        Added new functions named equal and equalIgnoringCase.
  +
  +        * khtml/xml/dom_stringimpl.h: Changed the type of the length parameter to computeHash to unsigned
  +        to match the rest of the interface. Added equal and equalIgnoringCase functions. Added a
  +        version of the hash function that works on char* to CaseInsensitiveHash as preparation for an
  +        atomic string change.
  +        * khtml/xml/dom_stringimpl.cpp: Moved the QT_ALLOC_QCHAR_VEC and QT_DELETE_QCHAR_VEC macros
  +        here, and changed them into inline functions.
  +        (DOM::equal): Implemented.
  +        (DOM::equalIgnoringCase): Implemented.
  +        (DOM::DOMStringImpl::computeHash): Changed parameter type to unsigned to match other similar
  +        functions.
  +
  +        * khtml/dom/dom_string.h: Removed unnecessary friend declarations. Changed operator
  +        overloads for == and != to call through inline to DOMStringImpl. Replaced strcasecmp
  +        with equalIgnoringCase, overloaded for one more combination of parameters. Removed strcmp.
  +        * khtml/dom/dom_string.cpp: Removed functions that are now implemented in DOMStringImpl*.
  +
  +        * khtml/xml/dom_atomicstring.h: Removed a redundant const. Removed unnecessary
  +        friend declarations. Removed AtomicString::equal. Filled out a larger set of == and
  +        != operator implementations, mostly with inlines calling through to DOMStringImpl.
  +        Renamed equalsIgnoreCase to equalIgnoringCase and filled out a larger set as above.
  +        * khtml/xml/dom_atomicstring.cpp: Renamed AtomicString::equal to just ==.
  +        Removed some implementation of == and equalsIgnoreCase that are replaced by inlines.
  +
  +        * khtml/html/html_listimpl.cpp:
  +        (DOM::HTMLOListElementImpl::parseMappedAttribute):
  +        (DOM::HTMLLIElementImpl::parseMappedAttribute):
  +        Use the "==" operator instead of strcmp.
  +
  +        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector):
  +        Use equalIgnoringCase instead of equalsIgnoreCase.
  +
  +        * khtml/rendering/render_form.cpp:
  +        (RenderSlider::updateFromElement): Fixed bug where a temporary DOMString was put into
  +        a const DOMString&. Changed some DOMString to AtomicString as appropriate, and also
  +        used equalIgnoringCase instead of strcasecmp.
  +        (RenderSlider::slotSliderValueChanged): More of the same.
  +
  +        * khtml/xml/dom_docimpl.cpp: (DocumentImpl::processHttpEquiv): Replaced use of strcasecmp
  +        with equalIgnoringCase. Added parentheses to fix incorrect operator precedence in one case
  +        (&& binds tighter than ||) which fixes a crash when using a http-equiv pragma when there
  +        is no part (not sure how to reproduce that).
  +
  +        * khtml/khtml_part.cpp:
  +        (updateState):
  +        (KHTMLPart::selectionStartHasStyle):
  +        * khtml/ecma/kjs_html.cpp: (KJS::KJS::HTMLDocument::putValueProperty):
  +        * khtml/editing/apply_style_command.cpp:
  +        (khtml::StyleChange::checkForLegacyHTMLStyleChange):
  +        (khtml::StyleChange::currentlyHasStyle):
  +        (khtml::hasTextDecorationProperty):
  +        (khtml::ApplyStyleCommand::extractTextDecorationStyle):
  +        (khtml::ApplyStyleCommand::extractAndNegateTextDecorationStyle):
  +        * khtml/html/html_baseimpl.cpp:
  +        (HTMLBodyElementImpl::parseMappedAttribute):
  +        (HTMLFrameElementImpl::parseMappedAttribute):
  +        * khtml/html/html_blockimpl.cpp:
  +        (HTMLDivElementImpl::parseMappedAttribute):
  +        (HTMLHRElementImpl::parseMappedAttribute):
  +        (HTMLParagraphElementImpl::parseMappedAttribute):
  +        (HTMLMarqueeElementImpl::parseMappedAttribute):
  +        * khtml/html/html_elementimpl.cpp:
  +        (HTMLElementImpl::parseMappedAttribute):
  +        (HTMLElementImpl::addHTMLAlignment):
  +        (HTMLElementImpl::setContentEditable):
  +        * khtml/html/html_formimpl.cpp:
  +        (DOM::HTMLFormElementImpl::parseMappedAttribute):
  +        (DOM::HTMLButtonElementImpl::parseMappedAttribute):
  +        (DOM::HTMLInputElementImpl::setInputType):
  +        (DOM::HTMLInputElementImpl::parseMappedAttribute):
  +        (DOM::HTMLKeygenElementImpl::appendFormData):
  +        (DOM::HTMLTextAreaElementImpl::parseMappedAttribute):
  +        * khtml/html/html_imageimpl.cpp: (DOM::HTMLAreaElementImpl::parseMappedAttribute):
  +        * khtml/html/html_inlineimpl.cpp: (DOM::HTMLBRElementImpl::parseMappedAttribute):
  +        * khtml/html/html_tableimpl.cpp: (DOM::HTMLTablePartElementImpl::parseMappedAttribute):
  +        * khtml/html/htmlparser.cpp: (HTMLParser::handleError):
  +        Use equalIgnoringCase instead of strcasecmp.
  +
   2005-12-30  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
           Reviewed by Darin, landed by ap.
  @@ -31,7 +117,7 @@
           (khtml::TextIterator::rangeFromLocationAndLength):
           Only special-case (0, 0) ranges for empty documents.
   
  -2005-12-29  Geoffrey Garen  <ggaren at apple.com>
  +2005-12-30  Geoffrey Garen  <ggaren at apple.com>
   
           Added test case for <rdar://problem/4268278> Submitting a form in onUnload event
           handler causes crash in -[WebDataSource(WebPrivate) _commitIfReady:]
  @@ -42,16 +128,16 @@
   
           Reviewed by Eric.
   
  -		- Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6297
  -		XMLSerializer should use createMarkup.
  -				
  +        - Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6297
  +        XMLSerializer should use createMarkup.
  +
           * khtml/ecma/xmlserializer.cpp:
           (KJS::XMLSerializerProtoFunc::callAsFunction):
  -		Use createMarkup instead of NodeImpl::toString.
  -		
  +        Use createMarkup instead of NodeImpl::toString.
  +
           * khtml/editing/markup.cpp:
           (khtml::startMarkup):
  -		escape attribute values and ignore document fragment nodes.
  +        escape attribute values and ignore document fragment nodes.
   
   2005-12-30  Eric Seidel  <eseidel at apple.com>
   
  @@ -124,7 +210,7 @@
           http://bugzilla.opendarwin.org/show_bug.cgi?id=6293
           
           * kwq/WebCoreBridge.h: Removed childFrames method from WebCoreBridge protocol
  -	since it is not actually used.
  +        since it is not actually used.
   
   2005-12-29  Eric Seidel  <eseidel at apple.com>
   
  @@ -476,11 +562,11 @@
   
           Reviewed and landed by Maciej.
   
  -	- fixed 4405: <button> not listed in form collections.
  -	http://bugzilla.opendarwin.org/show_bug.cgi?id=4405
  +        - fixed 4405: <button> not listed in form collections.
  +        http://bugzilla.opendarwin.org/show_bug.cgi?id=4405
  +
  +        Test: fast/forms/button-in-forms-collection.html
   
  -	Test: fast/forms/button-in-forms-collection.html
  -	
           * khtml/html/html_formimpl.h:
           (DOM::HTMLButtonElementImpl::isEnumeratable): override to return true
   
  @@ -494,7 +580,7 @@
           * kwq/WebCoreBridge.h:
           * kwq/WebCoreBridge.mm:
           (-[WebCoreBridge parent]): New method, relies on the KHTMLPart's
  -	parent pointer.
  +        parent pointer.
   
   2005-12-24  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
  @@ -513,8 +599,8 @@
           Reviewed by Eric.
   
           - replaced QPtrDict for Accessors structs with HashMap (also renamed some
  -	stray getSetInfo methods)
  -	http://bugzilla.opendarwin.org/show_bug.cgi?id=6223
  +        stray getSetInfo methods)
  +        http://bugzilla.opendarwin.org/show_bug.cgi?id=6223
   
           * khtml/ecma/kjs_html.cpp:
           (KJS::HTMLElement::accessors):
  @@ -822,18 +908,18 @@
           Reviewed by Eric.
   
           - made RefPtr<DOMStringImpl> usable as a hashtable key/value
  -	- changed XSLTProcessorImpl to make use of this instead of a QDict.
  -	- partially fixed broken param handling for xslt
  +        - changed XSLTProcessorImpl to make use of this instead of a QDict.
  +        - partially fixed broken param handling for xslt
   
  -	See LayoutTests for updated test case.
  +        See LayoutTests for updated test case.
   
           * khtml/xml/dom_stringimpl.cpp:
           * khtml/xml/dom_stringimpl.h:
           (KXMLCore::): Set things up so you can use RefPtr<DOMStringImpl> as
  -	a hashtable key (should already be usable as a value).
  +        a hashtable key (should already be usable as a value).
           * khtml/xsl/xslt_processorimpl.cpp:
           (DOM::xsltParamArrayFromParameterMap): Updated to use a HashMap of RefPtrs instead
  -	of QDict. Also, fixed bugs that would have kept this from ever working at all.
  +        of QDict. Also, fixed bugs that would have kept this from ever working at all.
           (DOM::XSLTProcessorImpl::transformToString): ditto
           (DOM::XSLTProcessorImpl::setParameter): ditto
           (DOM::XSLTProcessorImpl::getParameter): ditto
  @@ -1302,18 +1388,18 @@
           Reviewed by Darin.
   
           - fixed leak in createAttributeMap
  -	http://bugzilla.opendarwin.org/show_bug.cgi?id=6162
  -	
  +        http://bugzilla.opendarwin.org/show_bug.cgi?id=6162
  +
           * khtml/xml/dom_elementimpl.cpp:
           (StyledElementImpl::createAttributeMap): the new attribute map
  -	is going in a RefPtr, don't also ref it manually.
  +        is going in a RefPtr, don't also ref it manually.
   
   2005-12-20  Maciej Stachowiak  <mjs at apple.com>
   
           Reviewed by Darin.
   
           - change an assignment to a contructor declaration to build with PassRefPtr
  -	leak fix changes
  +        leak fix changes
   
           * ksvg2/svg/SVGTransformableImpl.cpp:
           (SVGTransformableImpl::parseTransformAttribute):
  @@ -1565,14 +1651,14 @@
   
           Reviewed by Beth
   
  -	- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6149
  +        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6149
             REGRESSION (WebCore-417.5): horizontal scrollbar in overflow with top
             border doesn't receive mouse events
   
           * khtml/rendering/render_block.cpp:
           (khtml::RenderBlock::isPointInScrollbar):
  -	Removed borderTop() from horizontal scrollbar rect computation.
  -	* manual-tests/scrollbar-hittest2.html: Added.
  +        Removed borderTop() from horizontal scrollbar rect computation.
  +        * manual-tests/scrollbar-hittest2.html: Added.
   
   2005-12-19  Alexey Proskuryakov  <ap at nypop.com>
   
  
  
  
  1.375     +2 -4      WebCore/khtml/khtml_part.cpp
  
  Index: khtml_part.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
  retrieving revision 1.374
  retrieving revision 1.375
  diff -u -r1.374 -r1.375
  --- khtml_part.cpp	30 Dec 2005 03:27:15 -0000	1.374
  +++ khtml_part.cpp	31 Dec 2005 00:14:20 -0000	1.375
  @@ -3008,7 +3008,7 @@
           int propertyID = (*it).id();
           DOMString desiredProperty = desiredStyle->getPropertyValue(propertyID);
           DOMString computedProperty = computedStyle->getPropertyValue(propertyID);
  -        KHTMLPart::TriState propertyState = strcasecmp(desiredProperty, computedProperty) == 0
  +        KHTMLPart::TriState propertyState = equalIgnoringCase(desiredProperty, computedProperty)
               ? KHTMLPart::trueTriState : KHTMLPart::falseTriState;
           if (atStart) {
               state = propertyState;
  @@ -3075,9 +3075,7 @@
       QValueListConstIterator<CSSProperty> end;
       for (QValueListConstIterator<CSSProperty> it = mutableStyle->valuesIterator(); it != end; ++it) {
           int propertyID = (*it).id();
  -        DOMString desiredProperty = mutableStyle->getPropertyValue(propertyID);
  -        DOMString selectionProperty = selectionStyle->getPropertyValue(propertyID);
  -        if (strcasecmp(selectionProperty, desiredProperty) != 0) {
  +        if (!equalIgnoringCase(mutableStyle->getPropertyValue(propertyID), selectionStyle->getPropertyValue(propertyID))) {
               match = false;
               break;
           }
  
  
  
  1.234     +1 -1      WebCore/khtml/css/cssstyleselector.cpp
  
  Index: cssstyleselector.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
  retrieving revision 1.233
  retrieving revision 1.234
  diff -u -r1.233 -r1.234
  --- cssstyleselector.cpp	30 Dec 2005 03:27:17 -0000	1.233
  +++ cssstyleselector.cpp	31 Dec 2005 00:14:21 -0000	1.234
  @@ -1234,7 +1234,7 @@
   
           switch(sel->match) {
           case CSSSelector::Exact:
  -	    if ((isXMLDoc && sel->value != value) || (!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
  +	    if ((isXMLDoc && sel->value != value) || (!isXMLDoc && !equalIgnoringCase(sel->value, value)))
                   return false;
               break;
           case CSSSelector::List:
  
  
  
  1.26      +0 -33     WebCore/khtml/dom/dom_string.cpp
  
  Index: dom_string.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/dom/dom_string.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- dom_string.cpp	30 Dec 2005 03:27:19 -0000	1.25
  +++ dom_string.cpp	31 Dec 2005 00:14:22 -0000	1.26
  @@ -252,20 +252,6 @@
   
   //-----------------------------------------------------------------------------
   
  -bool operator==( const DOMString &a, const DOMString &b )
  -{
  -    if (a.m_impl == b.m_impl)
  -        return true;
  -    
  -    unsigned int l = a.length();
  -
  -    if ( l != b.length() ) return false;
  -
  -    if (!memcmp(a.unicode(), b.unicode(), l*sizeof(QChar)))
  -        return true;
  -    return false;
  -}
  -
   bool operator==( const DOMString &a, const QString &b )
   {
       unsigned int l = a.length();
  @@ -277,23 +263,4 @@
       return false;
   }
   
  -bool operator==( const DOMString &a, const char *b )
  -{
  -    DOMStringImpl *aimpl = a.m_impl.get();
  -    
  -    if (!b)
  -        return !aimpl;
  -    
  -    if (aimpl) {
  -        int alen = aimpl->l;
  -        const QChar *aptr = aimpl->s;
  -        while (alen--) {
  -            unsigned char c = *b++;
  -            if (!c || (*aptr++).unicode() != c)
  -                return false;
  -        }
  -    }
  -    return *b == 0;
  -}
  -
   }
  
  
  
  1.20      +20 -18    WebCore/khtml/dom/dom_string.h
  
  Index: dom_string.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/dom/dom_string.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- dom_string.h	30 Dec 2005 03:27:19 -0000	1.19
  +++ dom_string.h	31 Dec 2005 00:14:22 -0000	1.20
  @@ -46,8 +46,6 @@
   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
  @@ -136,21 +134,25 @@
       RefPtr<DOMStringImpl> m_impl;
   };
   
  -DOMString 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 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)
  -bool strcasecmp( const DOMString &a, const DOMString &b );
  -bool strcasecmp( const DOMString& a, const char* b );
  +DOMString operator+(const DOMString&, const DOMString&);
  +
  +inline bool operator==(const DOMString& a, const DOMString& b) { return equal(a.impl(), b.impl()); }
  +inline bool operator==(const DOMString& a, const char* b) { return equal(a.impl(), b); }
  +inline bool operator==(const char* a, const DOMString& b) { return equal(a, b.impl()); }
  +
  +inline bool operator!=(const DOMString& a, const DOMString& b) { return !equal(a.impl(), b.impl()); }
  +inline bool operator!=(const DOMString& a, const char* b) { return !equal(a.impl(), b); }
  +inline bool operator!=(const char* a, const DOMString& b) { return !equal(a, b.impl()); }
  +
  +inline bool equalIgnoringCase(const DOMString& a, const DOMString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
  +inline bool equalIgnoringCase(const DOMString& a, const char* b) { return equalIgnoringCase(a.impl(), b); }
  +inline bool equalIgnoringCase(const char* a, const DOMString& b) { return equalIgnoringCase(a, b.impl()); }
  +
  +bool operator==(const DOMString& a, const QString& b);
  +inline bool operator==( const QString& b, const DOMString& a) { return a == b; }
  +inline bool operator!=(const DOMString& a, const QString& b) { return !(a == b); }
  +inline bool operator!=(const QString& b, const DOMString& a ) { return !(a == b); }
  +
  +}
   
  -};
   #endif
  
  
  
  1.163     +2 -2      WebCore/khtml/ecma/kjs_html.cpp
  
  Index: kjs_html.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_html.cpp,v
  retrieving revision 1.162
  retrieving revision 1.163
  diff -u -r1.162 -r1.163
  --- kjs_html.cpp	30 Dec 2005 04:11:48 -0000	1.162
  +++ kjs_html.cpp	31 Dec 2005 00:14:22 -0000	1.163
  @@ -415,9 +415,9 @@
       {
         DOMString modeString = value->toString(exec).domString();
         DocumentImpl::InheritedBool mode;
  -      if (!strcasecmp(modeString, "on"))
  +      if (equalIgnoringCase(modeString, "on"))
           mode = DocumentImpl::on;
  -      else if (!strcasecmp(modeString, "off"))
  +      else if (equalIgnoringCase(modeString, "off"))
           mode = DocumentImpl::off;
         else
           mode = DocumentImpl::inherit;
  
  
  
  1.23      +6 -6      WebCore/khtml/editing/apply_style_command.cpp
  
  Index: apply_style_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/apply_style_command.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- apply_style_command.cpp	22 Dec 2005 04:11:36 -0000	1.22
  +++ apply_style_command.cpp	31 Dec 2005 00:14:23 -0000	1.23
  @@ -167,13 +167,13 @@
       DOMString valueText(property->value()->cssText());
       switch (property->id()) {
           case CSS_PROP_FONT_WEIGHT:
  -            if (strcasecmp(valueText, "bold") == 0) {
  +            if (equalIgnoringCase(valueText, "bold")) {
                   m_applyBold = true;
                   return true;
               }
               break;
           case CSS_PROP_FONT_STYLE:
  -            if (strcasecmp(valueText, "italic") == 0 || strcasecmp(valueText, "oblique") == 0) {
  +            if (equalIgnoringCase(valueText, "italic") || equalIgnoringCase(valueText, "oblique")) {
                   m_applyItalic = true;
                   return true;
               }
  @@ -224,7 +224,7 @@
       RefPtr<CSSValueImpl> value = style->getPropertyCSSValue(property->id(), DoNotUpdateLayout);
       if (!value)
           return false;
  -    return strcasecmp(value->cssText(), property->value()->cssText()) == 0;
  +    return equalIgnoringCase(value->cssText(), property->value()->cssText());
   }
   
   static DOMString &styleSpanClassString()
  @@ -725,7 +725,7 @@
       ElementImpl *element = static_cast<ElementImpl *>(node);
       CSSComputedStyleDeclarationImpl style(element);
       RefPtr<CSSValueImpl> value = style.getPropertyCSSValue(CSS_PROP_TEXT_DECORATION, DoNotUpdateLayout);
  -    return value && strcasecmp(value->cssText(), "none") != 0;
  +    return value && !equalIgnoringCase(value->cssText(), "none");
   }
   
   static NodeImpl* highestAncestorWithTextDecoration(NodeImpl *node)
  @@ -758,7 +758,7 @@
       CSSMutableStyleDeclarationImpl *textDecorationStyle = style->copyPropertiesInSet(properties, 1);
   
       RefPtr<CSSValueImpl> property = style->getPropertyCSSValue(CSS_PROP_TEXT_DECORATION);
  -    if (property && strcasecmp(property->cssText(), "none") != 0)
  +    if (property && !equalIgnoringCase(property->cssText(), "none"))
           removeCSSProperty(style.get(), CSS_PROP_TEXT_DECORATION);
   
       return textDecorationStyle;
  @@ -781,7 +781,7 @@
       CSSMutableStyleDeclarationImpl *textDecorationStyle = computedStyle->copyPropertiesInSet(properties, 1);
   
       RefPtr<CSSValueImpl> property = computedStyle->getPropertyCSSValue(CSS_PROP_TEXT_DECORATION);
  -    if (property && strcasecmp(property->cssText(), "none") != 0) {
  +    if (property && !equalIgnoringCase(property->cssText(), "none")) {
           RefPtr<CSSMutableStyleDeclarationImpl> newStyle = textDecorationStyle->copy();
           newStyle->setProperty(CSS_PROP_TEXT_DECORATION, "none");
           applyTextDecorationStyle(node, newStyle.get());
  
  
  
  1.88      +4 -7      WebCore/khtml/html/html_baseimpl.cpp
  
  Index: html_baseimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_baseimpl.cpp,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- html_baseimpl.cpp	23 Dec 2005 18:44:15 -0000	1.87
  +++ html_baseimpl.cpp	31 Dec 2005 00:14:24 -0000	1.88
  @@ -112,7 +112,7 @@
       } else if (attr->name() == textAttr) {
           addCSSColor(attr, CSS_PROP_COLOR, attr->value());
       } else if (attr->name() == bgpropertiesAttr) {
  -        if (strcasecmp( attr->value(), "fixed" ) == 0)
  +        if (equalIgnoringCase(attr->value(), "fixed"))
               addCSSProperty(attr, CSS_PROP_BACKGROUND_ATTACHMENT, CSS_VAL_FIXED);
       } else if (attr->name() == vlinkAttr ||
                  attr->name() == alinkAttr ||
  @@ -403,13 +403,10 @@
           m_noResize = true;
           // FIXME: If we are already attached, this has no effect.
       } else if (attr->name() == scrollingAttr) {
  -        kdDebug( 6031 ) << "set scroll mode" << endl;
  -	// Auto and yes both simply mean "allow scrolling."  No means
  -	// "don't allow scrolling."
  -        if( strcasecmp( attr->value(), "auto" ) == 0 ||
  -            strcasecmp( attr->value(), "yes" ) == 0 )
  +        // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
  +        if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes"))
               m_scrolling = QScrollView::Auto;
  -        else if( strcasecmp( attr->value(), "no" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "no"))
               m_scrolling = QScrollView::AlwaysOff;
           // FIXME: If we are already attached, this has no effect.
       } else if (attr->name() == onloadAttr) {
  
  
  
  1.29      +10 -12    WebCore/khtml/html/html_blockimpl.cpp
  
  Index: html_blockimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_blockimpl.cpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- html_blockimpl.cpp	8 Nov 2005 08:10:57 -0000	1.28
  +++ html_blockimpl.cpp	31 Dec 2005 00:14:24 -0000	1.29
  @@ -80,11 +80,11 @@
   {
       if (attr->name() == alignAttr) {
           DOMString v = attr->value();
  -	if ( strcasecmp( attr->value(), "middle" ) == 0 || strcasecmp( attr->value(), "center" ) == 0 )
  +	if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))
              addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_CENTER);
  -        else if (strcasecmp(attr->value(), "left") == 0)
  +        else if (equalIgnoringCase(attr->value(), "left"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_LEFT);
  -        else if (strcasecmp(attr->value(), "right") == 0)
  +        else if (equalIgnoringCase(attr->value(), "right"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_RIGHT);
           else
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, v);
  @@ -129,15 +129,13 @@
   void HTMLHRElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
   {
       if (attr->name() == alignAttr) {
  -        if (strcasecmp(attr->value(), "left") == 0) {
  +        if (equalIgnoringCase(attr->value(), "left")) {
               addCSSProperty(attr, CSS_PROP_MARGIN_LEFT, "0");
   	    addCSSProperty(attr, CSS_PROP_MARGIN_RIGHT, CSS_VAL_AUTO);
  -	}
  -        else if (strcasecmp(attr->value(), "right") == 0) {
  +	} else if (equalIgnoringCase(attr->value(), "right")) {
   	    addCSSProperty(attr, CSS_PROP_MARGIN_LEFT, CSS_VAL_AUTO);
   	    addCSSProperty(attr, CSS_PROP_MARGIN_RIGHT, "0");
  -	}
  -	else {
  +	} else {
         	    addCSSProperty(attr, CSS_PROP_MARGIN_LEFT, CSS_VAL_AUTO);
               addCSSProperty(attr, CSS_PROP_MARGIN_RIGHT, CSS_VAL_AUTO);
   	}
  @@ -265,11 +263,11 @@
   {
       if (attr->name() == alignAttr) {
           DOMString v = attr->value();
  -        if ( strcasecmp( attr->value(), "middle" ) == 0 || strcasecmp( attr->value(), "center" ) == 0 )
  +        if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_CENTER);
  -        else if (strcasecmp(attr->value(), "left") == 0)
  +        else if (equalIgnoringCase(attr->value(), "left"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_LEFT);
  -        else if (strcasecmp(attr->value(), "right") == 0)
  +        else if (equalIgnoringCase(attr->value(), "right"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_RIGHT);
           else
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, v);
  @@ -396,7 +394,7 @@
               addCSSLength(attr, CSS_PROP__KHTML_MARQUEE_SPEED, attr->value());
       } else if (attr->name() == loopAttr) {
           if (!attr->value().isEmpty()) {
  -            if (attr->value() == "-1" || strcasecmp(attr->value(), "infinite") == 0)
  +            if (attr->value() == "-1" || equalIgnoringCase(attr->value(), "infinite"))
                   addCSSProperty(attr, CSS_PROP__KHTML_MARQUEE_REPETITION, CSS_VAL_INFINITE);
               else
                   addCSSLength(attr, CSS_PROP__KHTML_MARQUEE_REPETITION, attr->value());
  
  
  
  1.116     +13 -15    WebCore/khtml/html/html_elementimpl.cpp
  
  Index: html_elementimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.cpp,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- html_elementimpl.cpp	23 Dec 2005 18:44:15 -0000	1.115
  +++ html_elementimpl.cpp	31 Dec 2005 00:14:24 -0000	1.116
  @@ -142,7 +142,7 @@
   
       DOMString indexstring;
       if (attr->name() == alignAttr) {
  -        if (strcasecmp(attr->value(), "middle" ) == 0)
  +        if (equalIgnoringCase(attr->value(), "middle"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, "center");
           else
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, attr->value());
  @@ -430,25 +430,25 @@
       int propfloat = -1;
       int propvalign = -1;
       const AtomicString& alignment = attr->value();
  -    if ( strcasecmp( alignment, "absmiddle" ) == 0 ) {
  +    if (equalIgnoringCase(alignment, "absmiddle")) {
           propvalign = CSS_VAL_MIDDLE;
  -    } else if ( strcasecmp( alignment, "absbottom" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "absbottom")) {
           propvalign = CSS_VAL_BOTTOM;
  -    } else if ( strcasecmp( alignment, "left" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "left")) {
   	propfloat = CSS_VAL_LEFT;
   	propvalign = CSS_VAL_TOP;
  -    } else if ( strcasecmp( alignment, "right" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "right")) {
   	propfloat = CSS_VAL_RIGHT;
   	propvalign = CSS_VAL_TOP;
  -    } else if ( strcasecmp( alignment, "top" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "top")) {
   	propvalign = CSS_VAL_TOP;
  -    } else if ( strcasecmp( alignment, "middle" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "middle")) {
   	propvalign = CSS_VAL__KHTML_BASELINE_MIDDLE;
  -    } else if ( strcasecmp( alignment, "center" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "center")) {
   	propvalign = CSS_VAL_MIDDLE;
  -    } else if ( strcasecmp( alignment, "bottom" ) == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "bottom")) {
   	propvalign = CSS_VAL_BASELINE;
  -    } else if ( strcasecmp ( alignment, "texttop") == 0 ) {
  +    } else if (equalIgnoringCase(alignment, "texttop")) {
   	propvalign = CSS_VAL_TEXT_TOP;
       }
       
  @@ -502,17 +502,15 @@
   {
       KHTMLPart *part = getDocument()->part();
       const AtomicString& enabled = attr->value();
  -    if (enabled.isEmpty() || strcasecmp(enabled, "true") == 0) {
  +    if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) {
           addCSSProperty(attr, CSS_PROP__KHTML_USER_MODIFY, CSS_VAL_READ_WRITE);
           if (part)
               part->applyEditingStyleToElement(this);    
  -    }
  -    else if (strcasecmp(enabled, "false") == 0) {
  +    } else if (equalIgnoringCase(enabled, "false")) {
           addCSSProperty(attr, CSS_PROP__KHTML_USER_MODIFY, CSS_VAL_READ_ONLY);
           if (part)
               part->removeEditingStyleFromElement(this);    
  -    }
  -    else if (strcasecmp(enabled, "inherit") == 0) {
  +    } else if (equalIgnoringCase(enabled, "inherit")) {
           addCSSProperty(attr, CSS_PROP__KHTML_USER_MODIFY, CSS_VAL_INHERIT);
           if (part)
               part->removeEditingStyleFromElement(this);    
  
  
  
  1.218     +25 -27    WebCore/khtml/html/html_formimpl.cpp
  
  Index: html_formimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
  retrieving revision 1.217
  retrieving revision 1.218
  diff -u -r1.217 -r1.218
  --- html_formimpl.cpp	30 Dec 2005 03:27:19 -0000	1.217
  +++ html_formimpl.cpp	31 Dec 2005 00:14:24 -0000	1.218
  @@ -553,9 +553,9 @@
       else if (attr->name() == targetAttr) {
           m_target = attr->value();
       } else if (attr->name() == methodAttr) {
  -        if ( strcasecmp( attr->value(), "post" ) == 0 )
  +        if (equalIgnoringCase(attr->value(), "post"))
               m_post = true;
  -        else if ( strcasecmp( attr->value(), "get" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "get"))
               m_post = false;
       } else if (attr->name() == enctypeAttr) {
           parseEnctype(attr->value());
  @@ -566,7 +566,7 @@
       } else if (attr->name() == acceptAttr) {
           // ignore this one for the moment...
       } else if (attr->name() == autocompleteAttr) {
  -        m_autocomplete = strcasecmp( attr->value(), "off" );
  +        m_autocomplete = !equalIgnoringCase(attr->value(), "off");
       } else if (attr->name() == onsubmitAttr) {
           setHTMLEventListener(submitEvent, attr);
       } else if (attr->name() == onresetAttr) {
  @@ -1049,11 +1049,11 @@
   void HTMLButtonElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
   {
       if (attr->name() ==  typeAttr) {
  -        if ( strcasecmp( attr->value(), "submit" ) == 0 )
  +        if (equalIgnoringCase(attr->value(), "submit"))
               m_type = SUBMIT;
  -        else if ( strcasecmp( attr->value(), "reset" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "reset"))
               m_type = RESET;
  -        else if ( strcasecmp( attr->value(), "button" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "button"))
               m_type = BUTTON;
       } else if (attr->name() == valueAttr) {
           m_value = attr->value();
  @@ -1263,29 +1263,29 @@
   {
       typeEnum newType;
       
  -    if ( strcasecmp( t, "password" ) == 0 )
  +    if (equalIgnoringCase(t, "password"))
           newType = PASSWORD;
  -    else if ( strcasecmp( t, "checkbox" ) == 0 )
  +    else if (equalIgnoringCase(t, "checkbox"))
           newType = CHECKBOX;
  -    else if ( strcasecmp( t, "radio" ) == 0 )
  +    else if (equalIgnoringCase(t, "radio"))
           newType = RADIO;
  -    else if ( strcasecmp( t, "submit" ) == 0 )
  +    else if (equalIgnoringCase(t, "submit"))
           newType = SUBMIT;
  -    else if ( strcasecmp( t, "reset" ) == 0 )
  +    else if (equalIgnoringCase(t, "reset"))
           newType = RESET;
  -    else if ( strcasecmp( t, "file" ) == 0 )
  +    else if (equalIgnoringCase(t, "file"))
           newType = FILE;
  -    else if ( strcasecmp( t, "hidden" ) == 0 )
  +    else if (equalIgnoringCase(t, "hidden"))
           newType = HIDDEN;
  -    else if ( strcasecmp( t, "image" ) == 0 )
  +    else if (equalIgnoringCase(t, "image"))
           newType = IMAGE;
  -    else if ( strcasecmp( t, "button" ) == 0 )
  +    else if (equalIgnoringCase(t, "button"))
           newType = BUTTON;
  -    else if ( strcasecmp( t, "khtml_isindex" ) == 0 )
  +    else if (equalIgnoringCase(t, "khtml_isindex"))
           newType = ISINDEX;
  -    else if ( strcasecmp( t, "search" ) == 0 )
  +    else if (equalIgnoringCase(t, "search"))
           newType = SEARCH;
  -    else if ( strcasecmp( t, "range" ) == 0 )
  +    else if (equalIgnoringCase(t, "range"))
           newType = RANGE;
       else
           newType = TEXT;
  @@ -1595,7 +1595,7 @@
           if (m_type == RADIO && checked())
               getDocument()->radioButtonChecked(this, m_form);
       } else if (attr->name() == autocompleteAttr) {
  -        m_autocomplete = strcasecmp( attr->value(), "off" );
  +        m_autocomplete = !equalIgnoringCase(attr->value(), "off");
       } else if (attr->name() ==  typeAttr) {
           setInputType(attr->value());
       } else if (attr->name() == valueAttr) {
  @@ -2986,13 +2986,11 @@
   bool HTMLKeygenElementImpl::appendFormData(FormDataList& encoded_values, bool)
   {
       // Only RSA is supported at this time.
  -    if (!m_keyType.isNull() && strcasecmp(m_keyType, "rsa")) {
  +    if (!m_keyType.isNull() && !equalIgnoringCase(m_keyType, "rsa"))
           return false;
  -    }
       QString value = KSSLKeyGen::signedPublicKeyAndChallengeString(selectedIndex(), m_challenge.qstring(), getDocument()->part()->baseURL());
  -    if (value.isNull()) {
  +    if (value.isNull())
           return false;
  -    }
       encoded_values.appendData(name(), value.utf8());
       return true;
   }
  @@ -3325,13 +3323,13 @@
       } else if (attr->name() == wrapAttr) {
           // virtual / physical is Netscape extension of HTML 3.0, now deprecated
           // soft/ hard / off is recommendation for HTML 4 extension by IE and NS 4
  -        if ( strcasecmp( attr->value(), "virtual" ) == 0  || strcasecmp( attr->value(), "soft") == 0)
  +        if (equalIgnoringCase(attr->value(), "virtual") || equalIgnoringCase(attr->value(), "soft"))
               m_wrap = ta_Virtual;
  -        else if ( strcasecmp ( attr->value(), "physical" ) == 0 || strcasecmp( attr->value(), "hard") == 0)
  +        else if (equalIgnoringCase(attr->value(), "physical") || equalIgnoringCase(attr->value(), "hard"))
               m_wrap = ta_Physical;
  -        else if(strcasecmp( attr->value(), "on" ) == 0)
  +        else if (equalIgnoringCase(attr->value(), "on" ))
               m_wrap = ta_Physical;
  -        else if(strcasecmp( attr->value(), "off") == 0)
  +        else if (equalIgnoringCase(attr->value(), "off"))
               m_wrap = ta_NoWrap;
           if (renderer())
               renderer()->setNeedsLayoutAndMinMaxRecalc();
  
  
  
  1.64      +4 -4      WebCore/khtml/html/html_imageimpl.cpp
  
  Index: html_imageimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_imageimpl.cpp,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- html_imageimpl.cpp	23 Dec 2005 18:44:16 -0000	1.63
  +++ html_imageimpl.cpp	31 Dec 2005 00:14:25 -0000	1.64
  @@ -531,13 +531,13 @@
   void HTMLAreaElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
   {
       if (attr->name() == shapeAttr) {
  -        if ( strcasecmp( attr->value(), "default" ) == 0 )
  +        if (equalIgnoringCase(attr->value(), "default"))
               m_shape = Default;
  -        else if ( strcasecmp( attr->value(), "circle" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "circle"))
               m_shape = Circle;
  -        else if ( strcasecmp( attr->value(), "poly" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "poly"))
               m_shape = Poly;
  -        else if ( strcasecmp( attr->value(), "rect" ) == 0 )
  +        else if (equalIgnoringCase(attr->value(), "rect"))
               m_shape = Rect;
       } else if (attr->name() == coordsAttr) {
           delete [] m_coords;
  
  
  
  1.57      +6 -6      WebCore/khtml/html/html_inlineimpl.cpp
  
  Index: html_inlineimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_inlineimpl.cpp,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- html_inlineimpl.cpp	27 Dec 2005 18:26:14 -0000	1.56
  +++ html_inlineimpl.cpp	31 Dec 2005 00:14:25 -0000	1.57
  @@ -398,14 +398,14 @@
   void HTMLBRElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
   {
       if (attr->name() == clearAttr) {
  -        DOMString str = attr->value();
           // If the string is empty, then don't add the clear property. 
  -        // <br clear> and <br clear=""> are just treated like <br> by Gecko,
  -        // Mac IE, etc. -dwh
  +        // <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh
  +        const AtomicString& str = attr->value();
           if (!str.isEmpty()) {
  -            if (strcasecmp(str,"all") == 0) 
  -                str = "both";
  -            addCSSProperty(attr, CSS_PROP_CLEAR, str);
  +            if (equalIgnoringCase(str, "all"))
  +                addCSSProperty(attr, CSS_PROP_CLEAR, "both");
  +            else
  +                addCSSProperty(attr, CSS_PROP_CLEAR, str);
           }
       } else
           HTMLElementImpl::parseMappedAttribute(attr);
  
  
  
  1.17      +10 -10    WebCore/khtml/html/html_listimpl.cpp
  
  Index: html_listimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_listimpl.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- html_listimpl.cpp	3 Oct 2005 21:12:29 -0000	1.16
  +++ html_listimpl.cpp	31 Dec 2005 00:14:25 -0000	1.17
  @@ -111,15 +111,15 @@
   void HTMLOListElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
   {
       if (attr->name() == typeAttr) {
  -        if ( strcmp( attr->value(), "a" ) == 0 )
  +        if (attr->value() == "a")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ALPHA);
  -        else if ( strcmp( attr->value(), "A" ) == 0 )
  +        else if (attr->value() == "A")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ALPHA);
  -        else if ( strcmp( attr->value(), "i" ) == 0 )
  +        else if (attr->value() == "i")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ROMAN);
  -        else if ( strcmp( attr->value(), "I" ) == 0 )
  +        else if (attr->value() == "I")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ROMAN);
  -        else if ( strcmp( attr->value(), "1" ) == 0 )
  +        else if (attr->value() == "1")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
       } else if (attr->name() == startAttr) {
           _start = !attr->isNull() ? attr->value().toInt() : 1;
  @@ -178,15 +178,15 @@
               list->setValue(requestedValue);
           }
       } else if (attr->name() == typeAttr) {
  -        if ( strcmp( attr->value(), "a" ) == 0 )
  +        if (attr->value() == "a")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ALPHA);
  -        else if ( strcmp( attr->value(), "A" ) == 0 )
  +        else if (attr->value() == "A")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ALPHA);
  -        else if ( strcmp( attr->value(), "i" ) == 0 )
  +        else if (attr->value() == "i")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_LOWER_ROMAN);
  -        else if ( strcmp( attr->value(), "I" ) == 0 )
  +        else if (attr->value() == "I")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_UPPER_ROMAN);
  -        else if ( strcmp( attr->value(), "1" ) == 0 )
  +        else if (attr->value() == "1")
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
           else
               addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, attr->value());
  
  
  
  1.73      +5 -5      WebCore/khtml/html/html_tableimpl.cpp
  
  Index: html_tableimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.cpp,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- html_tableimpl.cpp	23 Dec 2005 18:44:17 -0000	1.72
  +++ html_tableimpl.cpp	31 Dec 2005 00:14:25 -0000	1.73
  @@ -707,14 +707,14 @@
           if (!attr->value().isEmpty())
               addCSSProperty(attr, CSS_PROP_VERTICAL_ALIGN, attr->value());
       } else if (attr->name() == alignAttr) {
  -        DOMString v = attr->value();
  -        if ( strcasecmp( attr->value(), "middle" ) == 0 || strcasecmp( attr->value(), "center" ) == 0 )
  +        const AtomicString& v = attr->value();
  +        if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_CENTER);
  -        else if (strcasecmp(attr->value(), "absmiddle") == 0)
  +        else if (equalIgnoringCase(v, "absmiddle"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL_CENTER);
  -        else if (strcasecmp(attr->value(), "left") == 0)
  +        else if (equalIgnoringCase(v, "left"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_LEFT);
  -        else if (strcasecmp(attr->value(), "right") == 0)
  +        else if (equalIgnoringCase(v, "right"))
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__KHTML_RIGHT);
           else
               addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, v);
  
  
  
  1.129     +1 -2      WebCore/khtml/html/htmlparser.cpp
  
  Index: htmlparser.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmlparser.cpp,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- htmlparser.cpp	28 Dec 2005 18:46:22 -0000	1.128
  +++ htmlparser.cpp	31 Dec 2005 00:14:25 -0000	1.129
  @@ -386,8 +386,7 @@
               else if (!current->isDocumentNode())
                   return false;
           } else if (h->hasLocalName(inputTag)) {
  -            DOMString type = h->getAttribute(typeAttr);
  -            if (strcasecmp(type, "hidden") == 0 && form) {
  +            if (equalIgnoringCase(h->getAttribute(typeAttr), "hidden") && form) {
                   form->addChild(n);
                   if (!n->attached() && HTMLWidget)
                       n->attach();
  
  
  
  1.30      +7 -5      WebCore/khtml/rendering/render_br.cpp
  
  Index: render_br.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_br.cpp,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- render_br.cpp	3 Oct 2005 21:12:38 -0000	1.29
  +++ render_br.cpp	31 Dec 2005 00:14:28 -0000	1.30
  @@ -26,12 +26,12 @@
   #include "render_block.h"
   #include "render_line.h"
   
  -using namespace khtml;
  -using DOM::Position;
  +using namespace DOM;
   
  -RenderBR::RenderBR(DOM::NodeImpl* node)
  -    : RenderText(node, new DOM::DOMStringImpl(QChar('\n'))),
  -      m_lineHeight(-1)
  +namespace khtml {
  +
  +RenderBR::RenderBR(NodeImpl* node)
  +    : RenderText(node, new DOMStringImpl("\n")), m_lineHeight(-1)
   {
   }
   
  @@ -127,3 +127,5 @@
   {
       return firstTextBox();
   }
  +
  +}
  
  
  
  1.138     +9 -9      WebCore/khtml/rendering/render_form.cpp
  
  Index: render_form.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_form.cpp,v
  retrieving revision 1.137
  retrieving revision 1.138
  diff -u -r1.137 -r1.138
  --- render_form.cpp	24 Dec 2005 10:02:22 -0000	1.137
  +++ render_form.cpp	31 Dec 2005 00:14:28 -0000	1.138
  @@ -1172,10 +1172,10 @@
   
   void RenderSlider::updateFromElement()
   {
  -    const DOMString& value = element()->value();
  -    const DOMString& min = element()->getAttribute(minAttr);
  -    const DOMString& max = element()->getAttribute(maxAttr);
  -    const DOMString& precision = element()->getAttribute(precisionAttr);
  +    DOMString value = element()->value();
  +    const AtomicString& min = element()->getAttribute(minAttr);
  +    const AtomicString& max = element()->getAttribute(maxAttr);
  +    const AtomicString& precision = element()->getAttribute(precisionAttr);
       
       double minVal = min.isNull() ? 0.0 : min.qstring().toDouble();
       double maxVal = max.isNull() ? 100.0 : max.qstring().toDouble();
  @@ -1184,8 +1184,8 @@
       double val = value.isNull() ? (maxVal + minVal)/2.0 : value.qstring().toDouble();
       val = kMax(minVal, kMin(val, maxVal)); // Make sure val is within min/max.
       
  -    // Force integer value if not float (strcasecmp returns confusingly backward boolean).
  -    if (strcasecmp(precision, "float"))
  +    // Force integer value if not float.
  +    if (!equalIgnoringCase(precision, "float"))
           val = (int)(val + 0.5);
   
       element()->setValue(QString::number(val));
  @@ -1204,10 +1204,10 @@
       QSlider* slider = (QSlider*)widget();
   
       double val = slider->value();
  -    const DOMString& precision = element()->getAttribute(precisionAttr);
  +    const AtomicString& precision = element()->getAttribute(precisionAttr);
   
  -    // Force integer value if not float (strcasecmp returns confusingly backward boolean).
  -    if (strcasecmp(precision, "float"))
  +    // Force integer value if not float.
  +    if (!equalIgnoringCase(precision, "float"))
           val = (int)(val + 0.5);
   
       element()->setValue(QString::number(val));
  
  
  
  1.16      +2 -21     WebCore/khtml/xml/dom_atomicstring.cpp
  
  Index: dom_atomicstring.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_atomicstring.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- dom_atomicstring.cpp	23 Dec 2005 01:52:40 -0000	1.15
  +++ dom_atomicstring.cpp	31 Dec 2005 00:14:29 -0000	1.16
  @@ -64,9 +64,9 @@
       }
   };
   
  -bool AtomicString::equal(const AtomicString &a, const char *b)
  +bool operator==(const AtomicString &a, const char *b)
   { 
  -    DOMStringImpl *impl = a.m_string.impl();
  +    DOMStringImpl *impl = a.impl();
       if ((!impl || !impl->s) && !b)
           return true;
       if ((!impl || !impl->s) || !b)
  @@ -187,23 +187,4 @@
       }
   }
   
  -bool operator==(const AtomicString &a, const DOMString &b)
  -{
  -    return a.domString() == b;    
  -}
  -   
  -bool equalsIgnoreCase(const AtomicString &as, const DOMString &bs)
  -{
  -    // returns true when equal, false otherwise (ignoring case)
  -    return !strcasecmp(as.domString(), bs);
  -}
  -
  -bool equalsIgnoreCase(const AtomicString &as, const AtomicString &bs)
  -{
  -    // returns true when equal, false otherwise (ignoring case)
  -    if (as == bs)
  -        return true;
  -    return !strcasecmp(as.domString(), bs.domString());
  -}
  -
   }
  
  
  
  1.11      +23 -37    WebCore/khtml/xml/dom_atomicstring.h
  
  Index: dom_atomicstring.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_atomicstring.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- dom_atomicstring.h	30 Dec 2005 03:27:20 -0000	1.10
  +++ dom_atomicstring.h	31 Dec 2005 00:14:29 -0000	1.11
  @@ -19,8 +19,9 @@
    * Boston, MA 02111-1307, USA.
    *
    */
  -#ifndef _DOM_AtomicString_h_
  -#define _DOM_AtomicString_h_
  +
  +#ifndef DOM_AtomicString_h
  +#define DOM_AtomicString_h
   
   #include "dom/dom_string.h"
   
  @@ -49,10 +50,10 @@
       
       const QChar &operator [](unsigned int i) const { return m_string[i]; }
       
  -    bool contains(const QChar c) const { return m_string.contains(c); }
  +    bool contains(QChar c) const { return m_string.contains(c); }
       bool contains(const AtomicString &s, bool caseSentitive = true) const { return (find(s, 0, caseSentitive) != -1); }
   
  -    int find(const QChar c, int start = 0) const { return m_string.find(c, start); }
  +    int find(QChar c, int start = 0) const { return m_string.find(c, start); }
       int find(const AtomicString &s, int start = 0, bool caseSentitive = true) const
           { return m_string.find(s.domString(), start, caseSentitive); }
       
  @@ -68,12 +69,6 @@
       bool isNull() const { return m_string.isNull(); }
       bool isEmpty() const { return m_string.isEmpty(); }
   
  -    friend bool operator==(const AtomicString &, const AtomicString &);
  -    friend bool operator!=(const AtomicString &, const AtomicString &);
  -    
  -    friend bool operator==(const AtomicString &, const char *);
  -    friend bool operator!=(const AtomicString &, const char *);
  -    
       static void remove(DOMStringImpl *);
       
   #ifdef __OBJC__
  @@ -84,14 +79,6 @@
   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.impl() == b.m_string.impl(); }
  -    static bool equal(const AtomicString &a, const char *b);
  -    
       static DOMStringImpl *add(const char *);
       static DOMStringImpl *add(const QChar *, int length);
       static DOMStringImpl *add(DOMStringImpl *);
  @@ -108,20 +95,23 @@
       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); }
  -
  -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.
  +inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); }
  +bool operator==(const AtomicString& a, const char* b);
  +inline bool operator==(const AtomicString& a, const DOMString& b) { return equal(a.impl(), b.impl()); }
  +inline bool operator==(const char* a, const AtomicString& b) { return b == a; }
  +inline bool operator==(const DOMString& a, const AtomicString& b) { return equal(a.impl(), b.impl()); }
  +
  +inline bool operator!=(const AtomicString& a, const AtomicString& b) { return a.impl() != b.impl(); }
  +inline bool operator!=(const AtomicString& a, const char *b) { return !(a == b); }
  +inline bool operator!=(const AtomicString& a, const DOMString& b) { return !equal(a.impl(), b.impl()); }
  +inline bool operator!=(const char* a, const AtomicString& b) { return !(b == a); }
  +inline bool operator!=(const DOMString& a, const AtomicString& b) { return !equal(a.impl(), b.impl()); }
  +
  +inline bool equalIgnoringCase(const AtomicString& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
  +inline bool equalIgnoringCase(const AtomicString& a, const char* b) { return equalIgnoringCase(a.impl(), b); }
  +inline bool equalIgnoringCase(const AtomicString& a, const DOMString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
  +inline bool equalIgnoringCase(const char* a, const AtomicString& b) { return equalIgnoringCase(a, b.impl()); }
  +inline bool equalIgnoringCase(const DOMString& a, const AtomicString& b) { return equalIgnoringCase(a.impl(), b.impl()); }
   
   // Define external global variables for the commonly used atomic strings.
   #if !KHTML_ATOMICSTRING_HIDE_GLOBALS
  @@ -131,11 +121,7 @@
       extern const AtomicString commentAtom;
       extern const AtomicString starAtom;
   #endif
  -        
  -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
  
  
  
  1.295     +7 -7      WebCore/khtml/xml/dom_docimpl.cpp
  
  Index: dom_docimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
  retrieving revision 1.294
  retrieving revision 1.295
  diff -u -r1.294 -r1.295
  --- dom_docimpl.cpp	30 Dec 2005 03:27:20 -0000	1.294
  +++ dom_docimpl.cpp	31 Dec 2005 00:14:29 -0000	1.295
  @@ -1828,7 +1828,7 @@
   
       KHTMLPart *part = this->part();
   
  -    if (strcasecmp(equiv, "default-style") == 0) {
  +    if (equalIgnoringCase(equiv, "default-style")) {
           // The preferred style set has been overridden as per section 
           // 14.3.2 of the HTML4.0 specification.  We need to update the
           // sheet used variable and then update our style selector. 
  @@ -1839,7 +1839,7 @@
           m_preferredStylesheetSet = content;
           updateStyleSelector();
       }
  -    else if(strcasecmp(equiv, "refresh") == 0 && part->metaRefreshEnabled())
  +    else if (equalIgnoringCase(equiv, "refresh") && part->metaRefreshEnabled())
       {
           // get delay and url
           QString str = content.qstring().stripWhiteSpace();
  @@ -1873,25 +1873,25 @@
                   part->scheduleRedirection(delay, completeURL( str ), delay <= 1);
           }
       }
  -    else if(strcasecmp(equiv, "expires") == 0)
  +    else if (equalIgnoringCase(equiv, "expires"))
       {
           QString str = content.qstring().stripWhiteSpace();
           time_t expire_date = str.toInt();
           if (m_docLoader)
               m_docLoader->setExpireDate(expire_date);
       }
  -    else if(strcasecmp(equiv, "pragma") == 0 || strcasecmp(equiv, "cache-control") == 0 && part)
  +    else if ((equalIgnoringCase(equiv, "pragma") || equalIgnoringCase(equiv, "cache-control")) && part)
       {
           QString str = content.qstring().lower().stripWhiteSpace();
           KURL url = part->url();
           if ((str == "no-cache") && url.protocol().startsWith("http"))
              KIO::http_update_cache(url, true, 0);
       }
  -    else if( (strcasecmp(equiv, "set-cookie") == 0))
  +    else if (equalIgnoringCase(equiv, "set-cookie"))
       {
           // ### make setCookie work on XML documents too; e.g. in case of <html:meta .....>
  -        HTMLDocumentImpl *d = static_cast<HTMLDocumentImpl *>(this);
  -        d->setCookie(content);
  +        if (isHTMLDocument())
  +            static_cast<HTMLDocumentImpl *>(this)->setCookie(content);
       }
   }
   
  
  
  
  1.37      +128 -37   WebCore/khtml/xml/dom_stringimpl.cpp
  
  Index: dom_stringimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_stringimpl.cpp,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- dom_stringimpl.cpp	30 Dec 2005 03:27:21 -0000	1.36
  +++ dom_stringimpl.cpp	31 Dec 2005 00:14:29 -0000	1.37
  @@ -4,7 +4,7 @@
    * Copyright (C) 1999 Lars Knoll (knoll at kde.org)
    *           (C) 1999 Antti Koivisto (koivisto at kde.org)
    *           (C) 2001 Dirk Mueller ( mueller at kde.org )
  - * Copyright (C) 2003 Apple Computer, Inc.
  + * Copyright (C) 2003, 2005 Apple Computer, Inc.
    *
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU Library General Public
  @@ -26,18 +26,29 @@
   #include "config.h"
   #include "dom_stringimpl.h"
   
  -#include <kdebug.h>
  -
  -#include <string.h>
   #include "dom_atomicstring.h"
  +#include "khtmllayout.h"
  +#include <kdebug.h>
   #include <kxmlcore/Assertions.h>
  +#include <string.h>
   
   using namespace khtml;
  +using namespace KXMLCore;
   
   namespace DOM {
   
   using khtml::Fixed;
   
  +static inline QChar* newQCharVector(unsigned n)
  +{
  +    return static_cast<QChar*>(fastMalloc(sizeof(QChar) * n));
  +}
  +
  +static inline void deleteQCharVector(QChar* p)
  +{
  +    fastFree(p);
  +}
  +
   DOMStringImpl* DOMStringImpl::empty()
   {
       static WithOneRef w;
  @@ -50,7 +61,7 @@
       _hash = 0;
       _inTable = false;
       bool havestr = str && len;
  -    s = QT_ALLOC_QCHAR_VEC(havestr ? len : 1);
  +    s = newQCharVector(havestr ? len : 1);
       if (havestr) {
           memcpy( s, str, len * sizeof(QChar) );
           l = len;
  @@ -68,7 +79,7 @@
       _hash = 0;
       _inTable = false;
       bool havestr = str && len;
  -    s = QT_ALLOC_QCHAR_VEC(havestr ? len : 1);
  +    s = newQCharVector(havestr ? len : 1);
       if (havestr) {
           memcpy( s, str, len * sizeof(QChar) );
           l = len;
  @@ -86,7 +97,7 @@
       if(str && *str)
       {
           l = strlen(str);
  -        s = QT_ALLOC_QCHAR_VEC( l );
  +        s = newQCharVector( l );
           int i = l;
           QChar* ptr = s;
           while( i-- )
  @@ -94,7 +105,7 @@
       }
       else
       {
  -        s = QT_ALLOC_QCHAR_VEC( 1 );  // crash protection
  +        s = newQCharVector( 1 );  // crash protection
           s[0] = 0x0; // == QChar::null;
           l = 0;
       }
  @@ -108,60 +119,50 @@
       if (!l || !str)
           return;
       
  -    s = QT_ALLOC_QCHAR_VEC(l);
  +    s = newQCharVector(l);
       int i = l;
       QChar* ptr = s;
       while( i-- )
           *ptr++ = *str++;
   }
   
  -DOMStringImpl::DOMStringImpl(const QChar &ch) {
  -    _hash = 0;
  -    _inTable = false;
  -    s = QT_ALLOC_QCHAR_VEC( 1 );
  -    s[0] = ch;
  -    l = 1;
  -}
  -
   DOMStringImpl::~DOMStringImpl()
   {
       if (_inTable)
           AtomicString::remove(this);
  -    if (s)
  -        QT_DELETE_QCHAR_VEC(s);
  +    deleteQCharVector(s);
   }
   
  -void DOMStringImpl::append(DOMStringImpl *str)
  +void DOMStringImpl::append(const DOMStringImpl *str)
   {
       assert(!_inTable);
       if(str && str->l != 0)
       {
           int newlen = l+str->l;
  -        QChar *c = QT_ALLOC_QCHAR_VEC(newlen);
  +        QChar *c = newQCharVector(newlen);
           memcpy(c, s, l*sizeof(QChar));
           memcpy(c+l, str->s, str->l*sizeof(QChar));
  -        if(s) QT_DELETE_QCHAR_VEC(s);
  +        deleteQCharVector(s);
           s = c;
           l = newlen;
       }
   }
   
  -void DOMStringImpl::insert(DOMStringImpl *str, uint pos)
  +void DOMStringImpl::insert(const DOMStringImpl *str, uint pos)
   {
       assert(!_inTable);
  -    if(pos > l)
  -    {
  +    if (pos >= l) {
           append(str);
           return;
       }
       if(str && str->l != 0)
       {
           int newlen = l+str->l;
  -        QChar *c = QT_ALLOC_QCHAR_VEC(newlen);
  +        QChar *c = newQCharVector(newlen);
           memcpy(c, s, pos*sizeof(QChar));
           memcpy(c+pos, str->s, str->l*sizeof(QChar));
           memcpy(c+pos+str->l, s+pos, (l-pos)*sizeof(QChar));
  -        if(s) QT_DELETE_QCHAR_VEC(s);
  +        deleteQCharVector(s);
           s = c;
           l = newlen;
       }
  @@ -173,9 +174,9 @@
       if(len > (int)l) return;
   
       int nl = len < 1 ? 1 : len;
  -    QChar *c = QT_ALLOC_QCHAR_VEC(nl);
  +    QChar *c = newQCharVector(nl);
       memcpy(c, s, nl*sizeof(QChar));
  -    if(s) QT_DELETE_QCHAR_VEC(s);
  +    deleteQCharVector(s);
       s = c;
       l = len;
   }
  @@ -189,10 +190,10 @@
       len = l - pos;
   
       uint newLen = l-len;
  -    QChar *c = QT_ALLOC_QCHAR_VEC(newLen);
  +    QChar *c = newQCharVector(newLen);
       memcpy(c, s, pos*sizeof(QChar));
       memcpy(c+pos, s+pos+len, (l-len-pos)*sizeof(QChar));
  -    if(s) QT_DELETE_QCHAR_VEC(s);
  +    deleteQCharVector(s);
       s = c;
       l = newLen;
   }
  @@ -203,7 +204,7 @@
       if( pos >=l ) return new DOMStringImpl();
   
       uint newLen = l-pos;
  -    QChar *c = QT_ALLOC_QCHAR_VEC(newLen);
  +    QChar *c = newQCharVector(newLen);
       memcpy(c, s+pos, newLen*sizeof(QChar));
   
       DOMStringImpl *str = new DOMStringImpl(s + pos, newLen);
  @@ -369,7 +370,7 @@
       if (!l)
           return c;
   
  -    c->s = QT_ALLOC_QCHAR_VEC(l);
  +    c->s = newQCharVector(l);
       c->l = l;
   
       for (unsigned int i = 0; i < l; i++)
  @@ -383,7 +384,7 @@
       DOMStringImpl *c = new DOMStringImpl;
       if(!l) return c;
   
  -    c->s = QT_ALLOC_QCHAR_VEC(l);
  +    c->s = newQCharVector(l);
       c->l = l;
   
       for (unsigned int i = 0; i < l; i++)
  @@ -398,7 +399,7 @@
       bool haveCapped = false;
       if(!l) return c;
   
  -    c->s = QT_ALLOC_QCHAR_VEC(l);
  +    c->s = newQCharVector(l);
       c->l = l;
   
       if ( l ) c->s[0] = s[0].upper();
  @@ -619,7 +620,7 @@
   
       DOMStringImpl *c = new DOMStringImpl;
   
  -    c->s = QT_ALLOC_QCHAR_VEC(l);
  +    c->s = newQCharVector(l);
       c->l = l;
   
       for (i = 0; i != l; ++i) {
  @@ -632,13 +633,103 @@
       return c;
   }
   
  +bool equal(const DOMStringImpl* a, const DOMStringImpl* b)
  +{
  +    return DefaultHash<DOM::DOMStringImpl*>::equal(a, b);
  +}
  +
  +bool equal(const DOMStringImpl* a, const char* b)
  +{
  +    if (!a)
  +        return !b;
  +    if (!b)
  +        return !a;
  +
  +    uint length = a->l;
  +    const QChar* as = a->s;
  +    for (uint i = 0; i != length; ++i) {
  +        char c = b[i];
  +        if (!c)
  +            return false;
  +        if (as[i] != c)
  +            return false;
  +    }
  +
  +    return !b[length];
  +}
  +
  +bool equal(const char* a, const DOMStringImpl* b)
  +{
  +    if (!a)
  +        return !b;
  +    if (!b)
  +        return !a;
  +
  +    uint length = b->l;
  +    const QChar* bs = b->s;
  +    for (uint i = 0; i != length; ++i) {
  +        char c = a[i];
  +        if (!c)
  +            return false;
  +        if (c != bs[i])
  +            return false;
  +    }
  +
  +    return !a[length];
  +}
  +
  +bool equalIgnoringCase(const DOMStringImpl* a, const DOMStringImpl* b)
  +{
  +    return CaseInsensitiveHash::equal(a, b);
  +}
  +
  +bool equalIgnoringCase(const DOMStringImpl* a, const char* b)
  +{
  +    if (!a)
  +        return !b;
  +    if (!b)
  +        return !a;
  +
  +    uint length = a->l;
  +    const QChar* as = a->s;
  +    for (uint i = 0; i != length; ++i) {
  +        char c = b[i];
  +        if (!c)
  +            return false;
  +        if (as[i].lower() != QChar(c).lower())
  +            return false;
  +    }
  +
  +    return !b[length];
  +}
  +
  +bool equalIgnoringCase(const char* a, const DOMStringImpl* b)
  +{
  +    if (!a)
  +        return !b;
  +    if (!b)
  +        return !a;
  +
  +    uint length = b->l;
  +    const QChar* bs = b->s;
  +    for (uint i = 0; i != length; ++i) {
  +        char c = a[i];
  +        if (!c)
  +            return false;
  +        if (QChar(c).lower() != bs[i].lower())
  +            return false;
  +    }
  +
  +    return !a[length];
  +}
  +
   // Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
   // or anything like that.
   const unsigned PHI = 0x9e3779b9U;
   
   // Paul Hsieh's SuperFastHash
   // http://www.azillionmonkeys.com/qed/hash.html
  -unsigned DOMStringImpl::computeHash(const QChar *s, int len)
  +unsigned DOMStringImpl::computeHash(const QChar *s, unsigned len)
   {
       unsigned l = len;
       uint32_t hash = PHI;
  
  
  
  1.21      +99 -47    WebCore/khtml/xml/dom_stringimpl.h
  
  Index: dom_stringimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_stringimpl.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- dom_stringimpl.h	30 Dec 2005 03:27:21 -0000	1.20
  +++ dom_stringimpl.h	31 Dec 2005 00:14:29 -0000	1.21
  @@ -2,6 +2,7 @@
    * This file is part of the DOM implementation for KDE.
    *
    * Copyright (C) 1999 Lars Knoll (knoll at kde.org)
  + * Copyright (C) 2005 Apple Computer, Inc.
    *
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU Library General Public
  @@ -19,17 +20,17 @@
    * Boston, MA 02111-1307, USA.
    *
    */
  -#ifndef _DOM_DOMStringImpl_h_
  -#define _DOM_DOMStringImpl_h_
   
  -#include <qstring.h>
  +#ifndef DOM_DOMStringImpl_h
  +#define DOM_DOMStringImpl_h
   
  -#include "misc/khtmllayout.h"
   #include "misc/shared.h"
   #include <kxmlcore/RefPtr.h>
  +#include <qstring.h>
   
  -#define QT_ALLOC_QCHAR_VEC(N) static_cast<QChar*>(fastMalloc(sizeof(QChar)*(N)))
  -#define QT_DELETE_QCHAR_VEC(P) fastFree(P)
  +namespace khtml {
  +    struct Length;
  +}
   
   namespace DOM {
   
  @@ -37,57 +38,55 @@
   {
   private:
       struct WithOneRef { };
  -    DOMStringImpl(WithOneRef) { s = 0; l = 0; _hash = 0; _inTable = false; ref(); }
  +    DOMStringImpl(WithOneRef) : l(0), s(0), _hash(0), _inTable(false) { ref(); }
   
   protected:
  -    DOMStringImpl() { s = 0, l = 0; _hash = 0; _inTable = false; }
  +    DOMStringImpl() : l(0), s(0), _hash(0), _inTable(false) { }
   public:
  -    DOMStringImpl(const QChar *str, unsigned int len);
  -    DOMStringImpl(const char *str);
  -    DOMStringImpl(const char *str, unsigned int len);
  -    DOMStringImpl(const QChar &ch);
  -    DOMStringImpl(const QString &str);
  +    DOMStringImpl(const QChar*, unsigned len);
  +    DOMStringImpl(const char*);
  +    DOMStringImpl(const char*, unsigned len);
  +    DOMStringImpl(const QString&);
       ~DOMStringImpl();
  +
  +    unsigned length() const { return l; }
       
       unsigned hash() const { if (_hash == 0) _hash = computeHash(s, l); return _hash; }
  -    static unsigned computeHash(const QChar *, int length);
  -    static unsigned computeHash(const char *);
  +    static unsigned computeHash(const QChar*, unsigned len);
  +    static unsigned computeHash(const char*);
       
  -    void append(DOMStringImpl *str);
  -    void insert(DOMStringImpl *str, unsigned int pos);
  +    void append(const DOMStringImpl*);
  +    void insert(const DOMStringImpl*, unsigned pos);
       void truncate(int len);
  -    void remove(unsigned int pos, int len=1);
  -    DOMStringImpl *split(unsigned int pos);
  -    DOMStringImpl *copy() const {
  -        return new DOMStringImpl(s,l);
  -    };
  +    void remove(unsigned pos, int len = 1);
  +    DOMStringImpl* split(unsigned pos);
  +    DOMStringImpl* copy() const { return new DOMStringImpl(s, l); }
   
  -    DOMStringImpl *substring(unsigned int pos, unsigned int len);
  +    DOMStringImpl *substring(unsigned pos, unsigned len);
   
  -    const QChar &operator [] (int pos)
  -	{ return *(s+pos); }
  +    const QChar& operator[] (int pos) const { return s[pos]; }
   
       khtml::Length toLength() const;
       
       bool containsOnlyWhitespace() const;
  -    bool containsOnlyWhitespace(unsigned int from, unsigned int len) const;
  +    bool containsOnlyWhitespace(unsigned from, unsigned len) const;
       
       // ignores trailing garbage, unlike QString
  -    int toInt(bool* ok=0) const;
  +    int toInt(bool* ok = 0) const;
   
       khtml::Length* toCoordsArray(int& len) const;
       khtml::Length* toLengthArray(int& len) const;
       bool isLower() const;
  -    DOMStringImpl *lower() const;
  -    DOMStringImpl *upper() const;
  -    DOMStringImpl *capitalize() const;
  -
  -    int find(const char *chs, int index = 0, bool caseSensitive = true) const;
  -    int find(QChar c, int index = 0) const;
  -    int find(const DOMStringImpl *str, int index, bool caseSensitive = true) const;
  +    DOMStringImpl* lower() const;
  +    DOMStringImpl* upper() const;
  +    DOMStringImpl* capitalize() const;
  +
  +    int find(const char *, int index = 0, bool caseSensitive = true) const;
  +    int find(QChar, int index = 0) const;
  +    int find(const DOMStringImpl*, int index, bool caseSensitive = true) const;
   
  -    bool startsWith(const DOMStringImpl *s, bool caseSensitive = true) const { return (find(s, 0, caseSensitive) == 0); }
  -    bool endsWith(const DOMStringImpl *s, bool caseSensitive = true) const;
  +    bool startsWith(const DOMStringImpl* s, bool caseSensitive = true) const { return find(s, 0, caseSensitive) == 0; }
  +    bool endsWith(const DOMStringImpl*, bool caseSensitive = true) const;
   
       // This modifies the string in place if there is only one ref, makes a new string otherwise.
       DOMStringImpl *replace(QChar, QChar);
  @@ -95,14 +94,22 @@
       static DOMStringImpl* empty();
   
       // For debugging only, leaks memory.
  -    const char *ascii() const;
  +    const char* ascii() const;
   
  -    unsigned int l;
  -    QChar *s;
  +    unsigned l;
  +    QChar* s;
       mutable unsigned _hash;
       bool _inTable;
   };
   
  +bool equal(const DOMStringImpl*, const DOMStringImpl*);
  +bool equal(const DOMStringImpl*, const char*);
  +bool equal(const char*, const DOMStringImpl*);
  +
  +bool equalIgnoringCase(const DOMStringImpl*, const DOMStringImpl*);
  +bool equalIgnoringCase(const DOMStringImpl*, const char*);
  +bool equalIgnoringCase(const char*, const DOMStringImpl*);
  +
   }
   
   namespace KXMLCore {
  @@ -116,16 +123,16 @@
               if (a == b) return true;
               if (!a || !b) return false;
               
  -            uint aLength = a->l;
  -            uint bLength = b->l;
  +            unsigned aLength = a->l;
  +            unsigned bLength = b->l;
               if (aLength != bLength)
                   return false;
               
               const uint32_t *aChars = reinterpret_cast<const uint32_t *>(a->s);
               const uint32_t *bChars = reinterpret_cast<const uint32_t *>(b->s);
               
  -            uint halfLength = aLength >> 1;
  -            for (uint i = 0; i != halfLength; ++i) {
  +            unsigned halfLength = aLength >> 1;
  +            for (unsigned i = 0; i != halfLength; ++i) {
                   if (*aChars++ != *bChars++)
                       return false;
               }
  @@ -186,16 +193,62 @@
               return hash;
           }
           
  +        static unsigned hash(const char* str, unsigned length)
  +        {
  +            // This hash is designed to work on 16-bit chunks at a time. But since the normal case
  +            // (above) is to hash UTF-16 characters, we just treat the 8-bit chars as if they
  +            // were 16-bit chunks, which will give matching results.
  +
  +            unsigned l = length;
  +            const char* s = str;
  +            uint32_t hash = PHI;
  +            uint32_t tmp;
  +            
  +            int rem = l & 1;
  +            l >>= 1;
  +            
  +            // Main loop
  +            for (; l > 0; l--) {
  +                hash += QChar(s[0]).lower().unicode();
  +                tmp = (QChar(s[1]).lower().unicode() << 11) ^ hash;
  +                hash = (hash << 16) ^ tmp;
  +                s += 2;
  +                hash += hash >> 11;
  +            }
  +            
  +            // Handle end case
  +            if (rem) {
  +                hash += QChar(s[0]).lower().unicode();
  +                hash ^= hash << 11;
  +                hash += hash >> 17;
  +            }
  +            
  +            // Force "avalanching" of final 127 bits
  +            hash ^= hash << 3;
  +            hash += hash >> 5;
  +            hash ^= hash << 2;
  +            hash += hash >> 15;
  +            hash ^= hash << 10;
  +            
  +            // this avoids ever returning a hash code of 0, since that is used to
  +            // signal "hash not computed yet", using a value that is likely to be
  +            // effectively the same as 0 when the low bits are masked
  +            if (hash == 0)
  +                hash = 0x80000000;
  +            
  +            return hash;
  +        }
  +        
           static bool equal(const DOM::DOMStringImpl *a, const DOM::DOMStringImpl *b)
           {
               if (a == b) return true;
               if (!a || !b) return false;
  -            uint length = a->l;
  +            unsigned length = a->l;
               if (length != b->l)
                   return false;
               const QChar *as = a->s;
               const QChar *bs = b->s;
  -            for (uint i = 0; i != length; ++i)
  +            for (unsigned i = 0; i != length; ++i)
                   if (as[i].lower() != bs[i].lower())
                       return false;
               return true;
  @@ -216,8 +269,7 @@
       
       template <typename T> class HashTraits;
   
  -    template<>
  -    struct HashTraits<RefPtr<DOM::DOMStringImpl> > {
  +    template<> struct HashTraits<RefPtr<DOM::DOMStringImpl> > {
           typedef RefPtr<DOM::DOMStringImpl> TraitType;
   
           static const bool emptyValueIsZero = true;
  
  
  



More information about the webkit-changes mailing list