Commit 7baeccde authored by darin's avatar darin

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11847 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2734996c
2005-12-30 Darin Adler <darin@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@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@apple.com>
2005-12-30 Geoffrey Garen <ggaren@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@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@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@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@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@nypop.com>
......
......@@ -1234,7 +1234,7 @@ bool CSSStyleSelector::checkOneSelector(CSSSelector *sel, ElementImpl *e)
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:
......
......@@ -252,20 +252,6 @@ const char *DOMString::ascii() const
//-----------------------------------------------------------------------------
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 @@ bool operator==( const DOMString &a, const QString &b )
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;
}
}
......@@ -46,8 +46,6 @@ class DOMStringImpl;
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 @@ protected:
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
......@@ -415,9 +415,9 @@ void KJS::HTMLDocument::putValueProperty(ExecState *exec, int token, JSValue *va
{
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;
......
......@@ -167,13 +167,13 @@ bool StyleChange::checkForLegacyHTMLStyleChange(const CSSProperty *property)
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 @@ bool StyleChange::currentlyHasStyle(const Position &pos, const CSSProperty *prop
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 @@ static bool hasTextDecorationProperty(NodeImpl *node)
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 *ApplyStyleCommand::extractTextDecorationStyle(No
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 *ApplyStyleCommand::extractAndNegateTextDecoratio
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());
......
......@@ -112,7 +112,7 @@ void HTMLBodyElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
} 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 @@ void HTMLFrameElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
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) {
......
......@@ -80,11 +80,11 @@ void HTMLDivElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
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 @@ bool HTMLHRElementImpl::mapToEntry(const QualifiedName& attrName, MappedAttribut
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 @@ void HTMLParagraphElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
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 @@ void HTMLMarqueeElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
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());
......
......@@ -142,7 +142,7 @@ void HTMLElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
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 @@ void HTMLElementImpl::addHTMLAlignment(MappedAttributeImpl* attr)
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 @@ void HTMLElementImpl::setContentEditable(MappedAttributeImpl* attr)
{
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);
......
......@@ -553,9 +553,9 @@ void HTMLFormElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
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 @@ void HTMLFormElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
} 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 @@ DOMString HTMLButtonElementImpl::type() const
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 @@ void HTMLInputElementImpl::setInputType(const DOMString& t)
{
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;