From kde-commits Mon Aug 25 00:49:33 2008 From: Harri Porten Date: Mon, 25 Aug 2008 00:49:33 +0000 To: kde-commits Subject: branches/KDE/4.1/kdelibs/khtml Message-Id: <1219625373.182535.13179.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121962538727666 SVN commit 851949 by porten: Merged revision 851948: Save some cpu cycles (1-2% in the first skeleton video) by avoiding some QString constructions. M +4 -4 ecma/kjs_css.cpp M +2 -1 ecma/kjs_window.cpp M +2 -1 ecma/xmlhttprequest.cpp M +5 -3 html/html_objectimpl.cpp M +4 -4 java/kjavaappletviewer.cpp M +1 -1 xml/dom_docimpl.cpp --- branches/KDE/4.1/kdelibs/khtml/ecma/kjs_css.cpp #851948:851949 @@ -84,12 +84,12 @@ prop = prop.toLower(); hadPixelPrefix = false; - if (prop.startsWith("css-")) { + if (prop.startsWith(QLatin1String("css-"))) { prop = prop.mid(4); - } else if (prop.startsWith("pixel-")) { + } else if (prop.startsWith(QLatin1String("pixel-"))) { prop = prop.mid(6); hadPixelPrefix = true; - } else if (prop.startsWith("pos-")) { + } else if (prop.startsWith(QLatin1String("pos-"))) { prop = prop.mid(4); hadPixelPrefix = true; } @@ -229,7 +229,7 @@ QString propvalue = value->toString(exec).qstring(); if (pxSuffix) - propvalue += "px"; + propvalue += QLatin1String("px"); #ifdef KJS_VERBOSE kDebug(6070) << "DOMCSSStyleDeclaration: prop=" << prop << " propvalue=" << propvalue; #endif --- branches/KDE/4.1/kdelibs/khtml/ecma/kjs_window.cpp #851948:851949 @@ -1595,7 +1595,8 @@ if (v && v->type() != UndefinedType && v->toString(exec).size() > 0) { features = v->toString(exec).qstring(); // Buggy scripts have ' at beginning and end, cut those - if (features.startsWith("\'") && features.endsWith("\'")) + if (features.startsWith(QLatin1Char('\'')) && + features.endsWith(QLatin1Char('\''))) features = features.mid(1, features.length()-2); } --- branches/KDE/4.1/kdelibs/khtml/ecma/xmlhttprequest.cpp #851948:851949 @@ -406,7 +406,8 @@ // Abondon the request when the protocol is other than "http", // instead of blindly changing it to a "get" request. - if (!protocol.startsWith("http") && !protocol.startsWith("webdav")) + if (!protocol.startsWith(QLatin1String("http")) && + !protocol.startsWith(QLatin1String("webdav"))) { abort(); return; --- branches/KDE/4.1/kdelibs/khtml/html/html_objectimpl.cpp #851948:851949 @@ -412,7 +412,8 @@ effectiveURL = embed->url; if (!embed->serviceType.isEmpty()) effectiveServiceType = embed->serviceType; - } else if (effectiveURL.isEmpty() && classId.startsWith("java:")) { + } else if (effectiveURL.isEmpty() && + classId.startsWith(QLatin1String("java:"))) { effectiveServiceType = "application/x-java-applet"; effectiveURL = classId.mid(5); } @@ -440,7 +441,8 @@ } } - if (effectiveServiceType.isEmpty() && effectiveURL.startsWith("data:")) { + if (effectiveServiceType.isEmpty() && + effectiveURL.startsWith(QLatin1String("data:"))) { // Extract the MIME type from the data URL. int index = effectiveURL.indexOf(';'); if (index == -1) @@ -458,7 +460,7 @@ // but may need to do a detach/attach QStringList supportedImageTypes = khtmlImLoad::ImageManager::loaderDatabase()->supportedMimeTypes(); - bool newImageLike = effectiveServiceType.startsWith("image/") && supportedImageTypes.contains(effectiveServiceType); + bool newImageLike = effectiveServiceType.startsWith(QLatin1String("image/")) && supportedImageTypes.contains(effectiveServiceType); if (newImageLike != m_imageLike) { m_imageLike = newImageLike; --- branches/KDE/4.1/kdelibs/khtml/java/kjavaappletviewer.cpp #851948:851949 @@ -275,7 +275,7 @@ src_param = value; else if (name_lower == QLatin1String("archive") || name_lower == QLatin1String("java_archive") || - name_lower.startsWith ("cache_archive")) + name_lower.startsWith(QLatin1String("cache_archive"))) applet->setArchives (value); else if (name_lower == QLatin1String("name")) appletname = value; @@ -283,7 +283,7 @@ width = value.toInt(); else if (name_lower == QLatin1String("height")) height = value.toInt(); - if (!name.startsWith ("__KHTML__")) { + if (!name.startsWith(QLatin1String("__KHTML__"))) { applet->setParameter (name, value); } } @@ -292,10 +292,10 @@ if (!classid.isEmpty ()) { applet->setParameter ("CLSID", classid); kDebug(6100) << "classid=" << classid << classid.startsWith("clsid:"); - if (classid.startsWith ("clsid:")) + if (classid.startsWith(QLatin1String("clsid:"))) // codeBase contains the URL to the plugin page khtml_codebase = baseurl; - else if (classname.isEmpty () && classid.startsWith ("java:")) + else if (classname.isEmpty () && classid.startsWith(QLatin1String("java:"))) classname = classid.mid(5); } if (classname.isEmpty ()) --- branches/KDE/4.1/kdelibs/khtml/xml/dom_docimpl.cpp #851948:851949 @@ -1833,7 +1833,7 @@ { QString str = content.string().toLower().trimmed(); KUrl url = v->part()->url(); - if ((str == "no-cache") && url.protocol().startsWith("http")) + if ((str == "no-cache") && url.protocol().startsWith(QLatin1String("http"))) { KIO::http_update_cache(url, true, 0); }