Commit ccbf3d76 authored by eseidel's avatar eseidel

Bug #: 6228

Submitted by: eseidel
Reviewed by: mjs
        DOMString/DOMStringImpl/AtomicString need enhancements before replacing QString
        http://bugzilla.opendarwin.org/show_bug.cgi?id=6228
        Added find(), contains(), startsWith() and endsWith() to DOMString
        Uses the above functions throughout the code.
        Small performance boost.

        * khtml/css/css_base.cpp:
        (CSSSelector::print):
        * khtml/css/css_ruleimpl.cpp:
        (DOM::CSSImportRuleImpl::init):
        * khtml/css/css_valueimpl.cpp:
        (DOM::CSSStyleDeclarationImpl::setProperty):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        (CSSParser::parseDeclaration):
        (CSSParser::parseContent):
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::CSSStyleSelector):
        (khtml::CSSStyleSelector::setEncodedURL):
        (khtml::parseUASheet):
        (khtml::cleanpath):
        (khtml::CSSStyleSelector::checkSelector):
        (khtml::CSSStyleSelector::checkOneSelector):
        (khtml::CSSRuleSet::addRulesFromSheet):
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/dom/dom_string.cpp:
        * khtml/dom/dom_string.h:
        (DOM::DOMString::contains):
        (DOM::DOMString::find):
        (DOM::DOMString::startsWith):
        (DOM::DOMString::endsWith):
        * khtml/html/html_formimpl.cpp:
        (DOM::HTMLFormElementImpl::parseEnctype):
        * khtml/khtml_part.cpp:
        (KHTMLPart::requestFrame):
        (KHTMLPart::submitForm):
        * khtml/misc/decoder.cpp:
        (Decoder::decode):
        * khtml/xml/dom_atomicstring.h:
        (DOM::AtomicString::length):
        (DOM::AtomicString::operator []):
        (DOM::AtomicString::contains):
        (DOM::AtomicString::find):
        (DOM::AtomicString::startsWith):
        (DOM::AtomicString::endsWith):
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::processHttpEquiv):
        * khtml/xml/dom_stringimpl.cpp:
        (DOM::equal):
        (DOM::equalCaseInsensitive):
        (DOM::DOMStringImpl::find):
        (DOM::DOMStringImpl::endsWith):
        * khtml/xml/dom_stringimpl.h:
        (DOM::DOMStringImpl::startsWith):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b401952a
2005-12-29 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
DOMString/DOMStringImpl/AtomicString need enhancements before replacing QString
http://bugzilla.opendarwin.org/show_bug.cgi?id=6228
Added find(), contains(), startsWith() and endsWith() to DOMString
Uses the above functions throughout the code.
Small performance boost.
* khtml/css/css_base.cpp:
(CSSSelector::print):
* khtml/css/css_ruleimpl.cpp:
(DOM::CSSImportRuleImpl::init):
* khtml/css/css_valueimpl.cpp:
(DOM::CSSStyleDeclarationImpl::setProperty):
* khtml/css/cssparser.cpp:
(CSSParser::parseValue):
(CSSParser::parseDeclaration):
(CSSParser::parseContent):
* khtml/css/cssstyleselector.cpp:
(khtml::CSSStyleSelector::CSSStyleSelector):
(khtml::CSSStyleSelector::setEncodedURL):
(khtml::parseUASheet):
(khtml::cleanpath):
(khtml::CSSStyleSelector::checkSelector):
(khtml::CSSStyleSelector::checkOneSelector):
(khtml::CSSRuleSet::addRulesFromSheet):
(khtml::CSSStyleSelector::applyProperty):
* khtml/dom/dom_string.cpp:
* khtml/dom/dom_string.h:
(DOM::DOMString::contains):
(DOM::DOMString::find):
(DOM::DOMString::startsWith):
(DOM::DOMString::endsWith):
* khtml/html/html_formimpl.cpp:
(DOM::HTMLFormElementImpl::parseEnctype):
* khtml/khtml_part.cpp:
(KHTMLPart::requestFrame):
(KHTMLPart::submitForm):
* khtml/misc/decoder.cpp:
(Decoder::decode):
* khtml/xml/dom_atomicstring.h:
(DOM::AtomicString::length):
(DOM::AtomicString::operator []):
(DOM::AtomicString::contains):
(DOM::AtomicString::find):
(DOM::AtomicString::startsWith):
(DOM::AtomicString::endsWith):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::processHttpEquiv):
* khtml/xml/dom_stringimpl.cpp:
(DOM::equal):
(DOM::equalCaseInsensitive):
(DOM::DOMStringImpl::find):
(DOM::DOMStringImpl::endsWith):
* khtml/xml/dom_stringimpl.h:
(DOM::DOMStringImpl::startsWith):
2005-12-29 Rob Buis <rwlbuis@xs4all.nl>
Reviewed by eseidel.
......
......@@ -95,12 +95,8 @@ StyleListImpl::~StyleListImpl()
void CSSSelector::print(void)
{
kdDebug( 6080 ) << "[Selector: tag = " << tag.localName().qstring() << ", attr = \"" << attr.localName().qstring() << "\", match = \"" << match
<< "\" value = \"" << value.qstring().latin1() << "\" relation = " << (int)relation
<< "]" << endl;
if ( tagHistory )
if (tagHistory)
tagHistory->print();
kdDebug( 6080 ) << " specificity = " << specificity() << endl;
}
unsigned int CSSSelector::specificity()
......
......@@ -146,13 +146,6 @@ void CSSImportRuleImpl::init()
// use parent styleheet's URL as the base URL
absHref = KURL(parentSheet->href().qstring(),m_strHref.qstring()).url();
}
/*
else {
// use documents's URL as the base URL
DocumentImpl *doc = static_cast<CSSStyleSheetImpl*>(root)->doc();
absHref = KURL(doc->URL(),m_strHref.qstring()).url();
}
*/
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
......
......@@ -155,7 +155,7 @@ void CSSStyleDeclarationImpl::setProperty(const DOMString &propertyName, const D
int propID = propertyID(propertyName);
if (!propID) // set exception?
return;
bool important = priority.qstring().find("important", 0, false) != -1;
bool important = priority.find("important", 0, false) != -1;
setProperty(propID, value, important, exception);
}
......
......@@ -204,11 +204,6 @@ CSSRuleImpl *CSSParser::parseRule(CSSStyleSheetImpl *sheet, const DOMString &str
bool CSSParser::parseValue( CSSMutableStyleDeclarationImpl *declaration, int _id, const DOMString &string,
bool _important)
{
#ifdef CSS_DEBUG
kdDebug( 6080 ) << "CSSParser::parseValue: id=" << _id << " important=" << _important
<< " value='" << string.qstring() << "'" << endl;
#endif
styleElement = declaration->stylesheet();
setupParser ("@-khtml-value{", string, "} ");
......@@ -281,10 +276,6 @@ bool CSSParser::parseColor( CSSMutableStyleDeclarationImpl *declaration, const D
bool CSSParser::parseDeclaration( CSSMutableStyleDeclarationImpl *declaration, const DOMString &string )
{
#ifdef CSS_DEBUG
kdDebug( 6080 ) << "CSSParser::parseDeclaration:value='" << string.qstring() << "'" << endl;
#endif
styleElement = declaration->stylesheet();
setupParser ( "@-khtml-decls{", string, "} ");
......@@ -1507,9 +1498,6 @@ bool CSSParser::parseContent( int propId, bool important )
DOMString value = parseURL(domString(val->string));
parsedValue = new CSSImageValueImpl(
DOMString(KURL( styleElement->baseURL().qstring(), value.qstring()).url() ), styleElement );
#ifdef CSS_DEBUG
kdDebug( 6080 ) << "content, url=" << value.qstring() << " base=" << styleElement->baseURL().qstring() << endl;
#endif
} else if ( val->unit == Value::Function ) {
// attr( X )
ValueList *args = val->function->args;
......
......@@ -248,9 +248,6 @@ CSSStyleSelector::CSSStyleSelector( DocumentImpl* doc, QString userStyleSheet, S
m_ruleList = 0;
m_collectRulesOnly = false;
//kdDebug( 6080 ) << "number of style sheets in document " << authorStyleSheets.count() << endl;
//kdDebug( 6080 ) << "CSSStyleSelector: author style has " << authorStyle->count() << " elements"<< endl;
}
CSSStyleSelector::CSSStyleSelector( CSSStyleSheetImpl *sheet )
......@@ -288,8 +285,6 @@ void CSSStyleSelector::setEncodedURL(const KURL& url)
}
u.setPath( QString::null );
encodedurl.host = u.url();
//kdDebug() << "CSSStyleSelector::CSSStyleSelector encoded url " << encodedurl.path << endl;
}
CSSStyleSelector::~CSSStyleSelector()
......@@ -310,11 +305,8 @@ static CSSStyleSheetImpl* parseUASheet(const char* sheetName)
if (readbytes >= 0)
file[readbytes] = '\0';
QString style = QString::fromLatin1(file.data());
DOMString str(style);
CSSStyleSheetImpl* sheet = new CSSStyleSheetImpl((CSSStyleSheetImpl*)0);
sheet->parseString(str);
sheet->parseString(DOMString(file.data()));
return sheet;
}
......@@ -559,7 +551,7 @@ static void cleanpath(QString &path)
int refPos = -2;
while ( (pos = path.find( "//", pos )) != -1) {
if (refPos == -2)
refPos = path.find("#", 0);
refPos = path.find("#");
if (refPos > 0 && pos >= refPos)
break;
......@@ -570,7 +562,6 @@ static void cleanpath(QString &path)
}
while ( (pos = path.find( "/./" )) != -1)
path.remove( pos, 2 );
//kdDebug() << "checkPseudoState " << path << endl;
}
static void checkPseudoState( ElementImpl *e, bool checkVisited = true )
......@@ -1111,13 +1102,14 @@ bool CSSStyleSelector::checkSelector(CSSSelector* sel, ElementImpl *e)
bool havePseudo = pseudoStyle != RenderStyle::NOPSEUDO;
// first selector has to match
if (!checkOneSelector(sel, e)) return false;
if (!checkOneSelector(sel, e))
return false;
// check the subselectors
CSSSelector::Relation relation = sel->relation;
while((sel = sel->tagHistory))
{
if (!n->isElementNode()) return false;
while((sel = sel->tagHistory)) {
if (!n->isElementNode())
return false;
if (relation != CSSSelector::SubSelector) {
subject = false;
if (havePseudo && dynamicPseudo != pseudoStyle)
......@@ -1127,26 +1119,23 @@ bool CSSStyleSelector::checkSelector(CSSSelector* sel, ElementImpl *e)
switch(relation)
{
case CSSSelector::Descendant:
{
// FIXME: This match needs to know how to backtrack and be non-deterministic.
bool found = false;
while(!found)
{
do {
n = n->parentNode();
if(!n || !n->isElementNode()) return false;
ElementImpl *elem = static_cast<ElementImpl *>(n);
if (checkOneSelector(sel, elem)) found = true;
}
if (!n || !n->isElementNode())
return false;
} while (!checkOneSelector(sel, static_cast<ElementImpl *>(n)));
break;
}
case CSSSelector::Child:
{
n = n->parentNode();
if (!strictParsing)
while (n && n->implicitNode()) n = n->parentNode();
if(!n || !n->isElementNode()) return false;
ElementImpl *elem = static_cast<ElementImpl *>(n);
if (!checkOneSelector(sel, elem)) return false;
while (n && n->implicitNode())
n = n->parentNode();
if (!n || !n->isElementNode())
return false;
if (!checkOneSelector(sel, static_cast<ElementImpl *>(n)))
return false;
break;
}
case CSSSelector::DirectAdjacent:
......@@ -1154,26 +1143,22 @@ bool CSSStyleSelector::checkSelector(CSSSelector* sel, ElementImpl *e)
n = n->previousSibling();
while (n && !n->isElementNode())
n = n->previousSibling();
if (!n) return false;
ElementImpl *elem = static_cast<ElementImpl*>(n);
if (!checkOneSelector(sel, elem))
if (!n)
return false;
if (!checkOneSelector(sel, static_cast<ElementImpl*>(n)))
return false;
break;
}
case CSSSelector::IndirectAdjacent:
{
// FIXME: This match needs to know how to backtrack and be non-deterministic.
ElementImpl *elem = 0;
do {
n = n->previousSibling();
while (n && !n->isElementNode())
n = n->previousSibling();
if (!n)
return false;
elem = static_cast<ElementImpl*>(n);
} while (!checkOneSelector(sel, elem));
} while (!checkOneSelector(sel, static_cast<ElementImpl*>(n)));
break;
}
case CSSSelector::SubSelector:
{
if (onlyHoverActive)
......@@ -1181,13 +1166,12 @@ bool CSSStyleSelector::checkSelector(CSSSelector* sel, ElementImpl *e)
(sel->pseudoType() == CSSSelector::PseudoHover ||
sel->pseudoType() == CSSSelector::PseudoActive));
//kdDebug() << "CSSOrderedRule::checkSelector" << endl;
ElementImpl *elem = static_cast<ElementImpl *>(n);
// a selector is invalid if something follows :first-xxx
if (elem == element && dynamicPseudo != RenderStyle::NOPSEUDO)
return false;
if (!checkOneSelector(sel, elem)) return false;
//kdDebug() << "CSSOrderedRule::checkSelector: passed" << endl;
if (!checkOneSelector(sel, elem))
return false;
break;
}
}
......@@ -1245,94 +1229,57 @@ bool CSSStyleSelector::checkOneSelector(CSSSelector *sel, ElementImpl *e)
style->setAffectedByAttributeSelectors(); // Special-case the "type" attribute so input form controls can share style.
const AtomicString& value = e->getAttribute(sel->attr);
if (value.isNull()) return false; // attribute is not set
if (value.isNull())
return false; // attribute is not set
switch(sel->match) {
case CSSSelector::Exact:
if ((isXMLDoc && sel->value != value) ||
(!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
if ((isXMLDoc && sel->value != value) || (!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
return false;
break;
case CSSSelector::List:
{
int spacePos = value.find(' ', 0);
if (spacePos == -1) {
// There is no list, just a single item. We can avoid
// allocing QStrings and just treat this as an exact
// match check.
if ((isXMLDoc && sel->value != value) ||
(!isXMLDoc && !equalsIgnoreCase(sel->value, value)))
return false;
break;
}
// The selector's value can't contain a space, or it's totally bogus.
spacePos = sel->value.find(' ');
if (spacePos != -1)
if (sel->value.contains(' '))
return false;
QString str = value.qstring();
QString selStr = sel->value.qstring();
int startSearchAt = 0;
while (true) {
int foundPos = str.find(selStr, startSearchAt, isXMLDoc);
if (foundPos == -1) return false;
if (foundPos == 0 || str[foundPos-1] == ' ') {
uint endStr = foundPos + selStr.length();
if (endStr == str.length() || str[endStr] == ' ')
int foundPos = value.find(sel->value, startSearchAt, isXMLDoc);
if (foundPos == -1)
return false;
if (foundPos == 0 || value[foundPos-1] == ' ') {
uint endStr = foundPos + sel->value.length();
if (endStr == value.length() || value[endStr] == ' ')
break; // We found a match.
}
// No match. Keep looking.
startSearchAt = foundPos + 1;
}
break;
}
case CSSSelector::Contain:
{
//kdDebug( 6080 ) << "checking for contains match" << endl;
QString str = value.qstring();
QString selStr = sel->value.qstring();
int pos = str.find(selStr, 0, isXMLDoc);
if(pos == -1) return false;
if (!value.contains(sel->value, isXMLDoc))
return false;
break;
}
case CSSSelector::Begin:
{
//kdDebug( 6080 ) << "checking for beginswith match" << endl;
QString str = value.qstring();
QString selStr = sel->value.qstring();
int pos = str.find(selStr, 0, isXMLDoc);
if(pos != 0) return false;
if (!value.startsWith(sel->value, isXMLDoc))
return false;
break;
}
case CSSSelector::End:
{
//kdDebug( 6080 ) << "checking for endswith match" << endl;
QString str = value.qstring();
QString selStr = sel->value.qstring();
if (isXMLDoc && !str.endsWith(selStr)) return false;
if (!isXMLDoc) {
int pos = str.length() - selStr.length();
if (pos < 0 || pos != str.find(selStr, pos, false) )
return false;
}
if (!value.endsWith(sel->value, isXMLDoc))
return false;
break;
}
case CSSSelector::Hyphen:
{
//kdDebug( 6080 ) << "checking for hyphen match" << endl;
QString str = value.qstring();
QString selStr = sel->value.qstring();
if(str.length() < selStr.length()) return false;
// Check if str begins with selStr:
if(str.find(selStr, 0, isXMLDoc) != 0) return false;
// It does. Check for exact match or following '-':
if(str.length() != selStr.length()
&& str[selStr.length()] != '-') return false;
if (value.length() < sel->value.length())
return false;
if (!value.startsWith(sel->value, isXMLDoc))
return false;
// It they start the same, check for exact match or following '-':
if (value.length() != sel->value.length() && value[sel->value.length()] != '-')
return false;
break;
}
case CSSSelector::PseudoClass:
case CSSSelector::PseudoElement:
default:
......@@ -1343,7 +1290,6 @@ bool CSSStyleSelector::checkOneSelector(CSSSelector *sel, ElementImpl *e)
{
// Pseudo elements. We need to check first child here. No dynamic pseudo
// elements for the moment
// kdDebug() << "CSSOrderedRule::pseudo " << value << endl;
switch (sel->pseudoType()) {
// Pseudo classes:
case CSSSelector::PseudoEmpty:
......@@ -1636,7 +1582,8 @@ void CSSRuleSet::addRule(CSSStyleRuleImpl* rule, CSSSelector* sel)
void CSSRuleSet::addRulesFromSheet(CSSStyleSheetImpl *sheet, const DOMString &medium)
{
if (!sheet || !sheet->isCSSStyleSheet()) return;
if (!sheet || !sheet->isCSSStyleSheet())
return;
// No media implies "all", but if a media list exists it must
// contain our current medium
......@@ -1654,10 +1601,6 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheetImpl *sheet, const DOMString &me
}
else if(item->isImportRule()) {
CSSImportRuleImpl *import = static_cast<CSSImportRuleImpl *>(item);
//kdDebug( 6080 ) << "@import: Media: "
// << import->media()->mediaText().qstring() << endl;
if (!import->media() || import->media()->contains(medium))
addRulesFromSheet(import->styleSheet(), medium);
}
......@@ -1665,15 +1608,9 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheetImpl *sheet, const DOMString &me
CSSMediaRuleImpl *r = static_cast<CSSMediaRuleImpl*>(item);
CSSRuleListImpl *rules = r->cssRules();
//DOMString mediaText = media->mediaText();
//kdDebug( 6080 ) << "@media: Media: "
// << r->media()->mediaText().qstring() << endl;
if ((!r->media() || r->media()->contains(medium)) && rules) {
// Traverse child elements of the @media rule.
for (unsigned j = 0; j < rules->length(); j++) {
//kdDebug( 6080 ) << "*** Rule #" << j << endl;
CSSRuleImpl *childItem = rules->item(j);
if (childItem->isStyleRule()) {
// It is a StyleRule, so append it to our list
......@@ -1682,20 +1619,9 @@ void CSSRuleSet::addRulesFromSheet(CSSStyleSheetImpl *sheet, const DOMString &me
addRule(rule, s);
}
else
{
//kdDebug( 6080 ) << "Ignoring child rule of "
// "ImportRule: rule is not a StyleRule!" << endl;
}
} // for rules
} // if rules
else
{
//kdDebug( 6080 ) << "CSSMediaRule not rendered: "
// << "rule empty or wrong medium!" << endl;
}
}
// ### include other rules
}
}
......@@ -1835,8 +1761,6 @@ void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant,
void CSSStyleSelector::applyProperty( int id, CSSValueImpl *value )
{
//kdDebug( 6080 ) << "applying property " << prop->m_id << endl;
CSSPrimitiveValueImpl *primitiveValue = 0;
if(value->isPrimitiveValue()) primitiveValue = static_cast<CSSPrimitiveValueImpl *>(value);
......
......@@ -105,19 +105,6 @@ const QChar &DOMString::operator [](unsigned int i) const
return *(m_impl->s+i);
}
int DOMString::find(const QChar c, int start) const
{
unsigned int l = start;
if (!m_impl || l >= m_impl->l )
return -1;
while(l < m_impl->l) {
if (*(m_impl->s+l) == c)
return l;
l++;
}
return -1;
}
uint DOMString::length() const
{
if (!m_impl)
......
......@@ -71,8 +71,23 @@ public:
* character returned will be 0.
*/
const QChar &operator [](unsigned int i) const;
// NOTE: contains returns bool, eventually we'll add count() which returns an int.
bool contains(QChar c) const { return (find(c) != -1); }
bool contains(const char *str, bool caseSensitive = true) const { return (find(str, 0, caseSensitive) != -1); }
int find(const QChar c, int start = 0) const
{ if (m_impl) return m_impl->find(c, start); return -1; }
int find(const char *str, int start = 0, bool caseSensitive = true) const
{ if (m_impl) return m_impl->find(str, start, caseSensitive); return -1; }
int find(const DOMString& str, int start = 0, bool caseSensitive = true) const
{ if (m_impl) return m_impl->find(str.impl(), start, caseSensitive); return -1; }
bool startsWith(const DOMString &s, bool caseSensitive = true) const
{ if (m_impl) return m_impl->startsWith(s.impl(), caseSensitive); return false; }
bool endsWith(const DOMString &s, bool caseSensitive = true) const
{ if (m_impl) return m_impl->endsWith(s.impl(), caseSensitive); return false; }
int find(const QChar c, int start = 0) const;
DOMString &replace(QChar a, QChar b) { if (m_impl) m_impl = m_impl->replace(a, b); return *this; }
uint length() const;
......@@ -87,12 +102,9 @@ public:
DOMString split(unsigned int pos);
/**
* Returns a lowercase version of the string
* Returns a lowercase/uppercase version of the string
*/
DOMString lower() const;
/**
* Returns an uppercase version of the string
*/
DOMString upper() const;
QChar *unicode() const;
......@@ -108,10 +120,6 @@ public:
bool isNull() const { return (m_impl == 0); }
bool isEmpty() const;
/**
* @internal get a handle to the imlementation of the DOMString
* Use at own risk!!!
*/
DOMStringImpl *impl() const { return m_impl.get(); }
#ifdef __OBJC__
......
......@@ -407,20 +407,16 @@ bool HTMLFormElementImpl::formData(FormData &form_data) const
return true;
}
void HTMLFormElementImpl::parseEnctype( const DOMString& type )
void HTMLFormElementImpl::parseEnctype(const DOMString& type)
{
if(type.qstring().find("multipart", 0, false) != -1 || type.qstring().find("form-data", 0, false) != -1)
{
if(type.contains("multipart", false) || type.contains("form-data", false)) {
m_enctype = "multipart/form-data";
m_multipart = true;
m_post = true;
} else if (type.qstring().find("text", 0, false) != -1 || type.qstring().find("plain", 0, false) != -1)
{
} else if (type.contains("text", false) || type.contains("plain", false)) {
m_enctype = "text/plain";
m_multipart = false;
}
else
{
} else {
m_enctype = "application/x-www-form-urlencoded";
m_multipart = false;
}
......
......@@ -1711,12 +1711,9 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
const QStringList &paramNames, const QStringList &paramValues, bool isIFrame )
{
// kdDebug( 6050 ) << "childRequest( ..., " << url << ", " << frameName << " )" << endl;
FrameIt it = d->m_frames.find( frameName );
if ( it == d->m_frames.end() )
{
if (it == d->m_frames.end()) {
khtml::ChildFrame child;
// kdDebug( 6050 ) << "inserting new frame into frame map " << frameName << endl;
child.m_name = frameName;
it = d->m_frames.append( child );
}
......@@ -1727,8 +1724,7 @@ bool KHTMLPart::requestFrame( khtml::RenderPart *frame, const QString &url, cons
(*it).m_paramNames = paramValues;
// Support for <frame src="javascript:string">
if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 )
{
if (url.startsWith("javascript:", false)) {
if (!processObjectRequest(&(*it), "about:blank", "text/html" ))
return false;
......@@ -1923,16 +1919,12 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const FormDa
kdDebug(6000) << this << ": KHTMLPart::submitForm target=" << _target << " url=" << url << endl;
KURL u = completeURL( url );
if ( !u.isValid() )
{
if (!u.isValid())
// ### ERROR HANDLING!
return;
}
QString urlstring = u.url();
if ( urlstring.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 ) {
if (urlstring.startsWith("javascript:", false)) {
urlstring = KURL::decode_string(urlstring);
d->m_executingJavaScriptFormAction = true;
executeScript( urlstring.right( urlstring.length() - 11) );
......@@ -1940,7 +1932,6 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const FormDa
return;
}
KParts::URLArgs args;
if (!d->m_referrer.isEmpty())
......
......@@ -511,16 +511,12 @@ QString Decoder::decode(const char *data, int len)