Changeset 30243 in webkit


Ignore:
Timestamp:
Feb 14, 2008, 9:03:55 PM (17 years ago)
Author:
Darin Adler
Message:

WebCore:

Reviewed by Eric Seidel.

Based on work by Marvin Decker <marv.decker@gmail.com>

  • changed completeURL and various DOM getters to return KURL, to avoid conversion back and forth from KURL to String
  • changed the conversion of KURL to NSURL or NSString to be automatic, to ease the use of KURL in Objective C DOM bindings, and eliminated the getNSURL function
  • because I had to visit the DOM bindings anyway, eliminated almost all the use of the KJS namespace for things in WebCore
  • fixed HTMLOptionElement constructor to check for undefined rather than size of the arguments array
  • eliminated some other unnecessary uses of DeprecatedString
  • changed String::split to take a Vector parameter instead of returning a Vector, for better performance
  • added a couple of missing calls to do layout in SVG image handling; I was able to reproduce these only because I had broken URLs for a while -- not sure how to reproduce them now but the changes are clearly needed

Performance testing shows this to be at least a 1% speedup.

Added a new function protocolIs to efficiently compare protocols
without case errors and a blankURL function so we don't have to
code "about:blank" in multiple places in the code and don't have to
construct a frash KURL each time. Moved decode_string and encode_string
out of KURL and gave them clearer names.

Made KURL constructors explicit to highlight potentially-expensive
operations and the poor semantics of KURL's constructor that takes
a String.

  • WebCore.base.exp: Updated.
  • bindings/js/JSAttrCustom.cpp: (WebCore::JSAttr::setValue): Use protocolIs.
  • bindings/js/JSAudioConstructor.h: KJS namespace change.
  • bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJS): Ditto.
  • bindings/js/JSCSSValueCustom.cpp: (WebCore::toJS): Ditto.
  • bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::location): Ditto. (WebCore::JSDocument::setLocation): Updated for KURL change. (WebCore::toJS): KJS namespace change.
  • bindings/js/JSElementCustom.cpp: (WebCore::allowSettingSrcToJavascriptURL): Use protocolIs. (WebCore::JSElement::setAttribute): KJS namespace change. (WebCore::JSElement::setAttributeNode): Ditto. (WebCore::JSElement::setAttributeNS): Ditto. (WebCore::JSElement::setAttributeNodeNS): Ditto.
  • bindings/js/JSHTMLFrameElementCustom.cpp: (WebCore::allowSettingJavascriptURL): Use protocolIs. (WebCore::JSHTMLFrameElement::setSrc): KJS namespace change. (WebCore::JSHTMLFrameElement::setLocation): Ditto.
  • bindings/js/JSHTMLIFrameElementCustom.cpp: (WebCore::JSHTMLIFrameElement::setSrc): Use protocolIs.
  • bindings/js/JSHTMLOptionElementConstructor.cpp: (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor): (WebCore::JSHTMLOptionElementConstructor::construct): Cleaned up the structure a bit and changed checking to check for undefined rather than number of arguments.
  • bindings/js/JSHTMLOptionElementConstructor.h: KJS namespace change.
  • bindings/js/JSLocation.cpp: (WebCore::JSLocation::put): Eliminated some DeprecatedString use, and use protocolIs. (WebCore::jsLocationProtoFuncReplace): Ditto. (WebCore::jsLocationProtoFuncReload): Ditto. (WebCore::jsLocationProtoFuncAssign): Ditto.
  • bindings/js/JSLocation.h: KJS namespace change.
  • bindings/js/JSNamedNodeMapCustom.cpp: (WebCore::JSNamedNodeMap::canGetItemsForName): Ditto. (WebCore::JSNamedNodeMap::nameGetter): Ditto.
  • bindings/js/JSNamedNodesCollection.cpp: (WebCore::JSNamedNodesCollection::JSNamedNodesCollection): Ditto.
  • bindings/js/JSNamedNodesCollection.h: Ditto.
  • bindings/js/JSXMLHttpRequest.cpp: (WebCore::jsXMLHttpRequestPrototypeFunctionOpen): Removed DeprecatedString use. (WebCore::jsXMLHttpRequestPrototypeFunctionSend): Ditto.
  • bindings/js/JSXMLHttpRequest.h: Moved this class into the WebCore namespace.
  • bindings/js/JSXSLTProcessor.cpp: Namespace change.
  • bindings/js/JSXSLTProcessor.h: Ditto.
  • bindings/js/kjs_binding.cpp: Updated for namespace change. (WebCore::jsStringOrNull): Added an overload for KURL to allow DOM classes to return KURL even if the DOM expects a string. (WebCore::jsStringOrUndefined): Ditto. (WebCore::jsStringOrFalse): Ditto.
  • bindings/js/kjs_binding.h: Moved everything into the WebCore namespace.
  • bindings/js/kjs_css.h: Namespace change.
  • bindings/js/kjs_events.cpp: Removed an include.
  • bindings/js/kjs_events.h: Namespace change.
  • bindings/js/kjs_html.h: Namespace change.
  • bindings/js/kjs_navigator.cpp: Moved everything into the WebCore namespace.
  • bindings/js/kjs_navigator.h: Ditto.
  • bindings/js/kjs_window.cpp: (KJS::parseModalDialogFeatures): Updated for String::split change. (KJS::createWindow): Use protocolIs and removed some DeprecatedString. (KJS::Window::put): Ditto. (KJS::Window::allowsAccessFrom): Ditto. (KJS::windowProtoFuncOpen): Ditto.
  • bindings/objc/DOM.mm: (-[DOMElement _getURLAttribute:]): Removed getNSURL call.
  • bindings/objc/DOMHTML.mm: (-[DOMHTMLDocument _createDocumentFragmentWithMarkupString:baseURLString:]): Ditto.
  • bindings/scripts/CodeGeneratorCOM.pm: Updated includes so conversions from KURL will work.
  • bindings/scripts/CodeGeneratorJS.pm: Updated for namespace changes, and also updated includes so conversions from KURL will work.
  • bindings/scripts/CodeGeneratorObjC.pm: Updated includes so conversions from KURL will work.
  • bridge/mac/WebCoreAXObject.mm: (-[WebCoreAXObject accessibilityAttributeValue:]): Removed getNSURL call. Also streamlined the logic. (AXAttributedStringAppendText): Ditto.
  • bridge/mac/WebCoreScriptDebugger.mm: (toNSString): Tweaked. (toNSURL): Removed getNSURL call.
  • css/CSSImageValue.cpp: (WebCore::CSSImageValue::image): Removed DeprecatedString use.
  • css/CSSImportRule.cpp: (WebCore::CSSImportRule::insertedIntoParent): Ditto.
  • css/CSSParser.cpp: (WebCore::CSSParser::parseValue): Ditto. (WebCore::CSSParser::parseContent): Ditto. (WebCore::CSSParser::parseBackgroundImage): Ditto. (WebCore::CSSParser::parseFontFaceSrc): Ditto. (WebCore::CSSParser::parseBorderImage): Ditto.
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::setEncodedURL): Ditto. (WebCore::checkPseudoState): Ditto.
  • css/CSSStyleSelector.h: Ditto.
  • css/MediaList.cpp: (WebCore::MediaList::setMediaText): Updated for String::split change.
  • css/StyleBase.cpp: (WebCore::StyleBase::baseURL): Return KURL.
  • css/StyleBase.h: DItto.
  • dom/Document.cpp: (WebCore::Document::~Document): Updated for namespace change. (WebCore::Document::documentURI): Return KURL. (WebCore::Document::setDocumentURI): Removed DeprecatedString use. (WebCore::Document::baseURI): Return KURL. (WebCore::Document::open): Updated to use blankURL. (WebCore::Document::setURL): Take KURL. (WebCore::Document::shouldBeAllowedToLoadLocalResources): Updated for change to use KURL (WebCore::Document::setBaseURL): Take KURL. (WebCore::Document::elementSheet): Updated for KURL change. (WebCore::Document::mappedElementSheet): Ditto. (WebCore::Document::processHttpEquiv): Ditto. (WebCore::Document::recalcStyleSelector): Removed use of DeprecatedString -- also noticed some dead code here! (WebCore::Document::setCookie): Ditto. (WebCore::Document::completeURL): Return KURL.
  • dom/Document.h: Use KURL instead of String in a few places.
  • dom/DocumentType.cpp: (WebCore::DocumentType::baseURI): Return KURL.
  • dom/DocumentType.h: Ditto.
  • dom/Element.cpp: (WebCore::Element::baseURI): Return KURL.
  • dom/Element.h: Ditto.
  • dom/Node.cpp: (WebCore::Node::setDocument): Namespace change. (WebCore::Node::baseURI): Return KURL.
  • dom/Node.h: Ditto.
  • dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::checkStyleSheet): Updated for KURL change.
  • dom/StyleElement.cpp: (WebCore::StyleElement::process): Changed to use Vector<UChar> instead of String for better performance. (WebCore::StyleElement::createSheet): Removed use of DeprecateString.
  • dom/XMLTokenizer.cpp: (WebCore::XMLTokenizer::endElementNs): Updated for KURL change. (WebCore::XMLTokenizer::end): Ditto. (WebCore::xmlDocPtrForString): Removed use of DeprecateString.
  • dom/XMLTokenizer.h: Ditto.
  • editing/markup.cpp: Moved appendString to PlatformString.h. (WebCore::appendQuotedURLAttributeValue): Use protocolIs. (WebCore::completeURLs): Removed DeprecatedString use. (WebCore::createFragmentFromMarkup): Use blankURL. (WebCore::fillContainerFromString): Removed DeprecatedString use. (WebCore::createFragmentFromText): Ditto.
  • history/HistoryItem.cpp: (WebCore::HistoryItem::url): Removed DeprecatedString use. (WebCore::HistoryItem::originalURL): Ditto.
  • history/HistoryItem.h: Removed include.
  • html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::defaultEventHandler): Removed use of DeprecatedString. (WebCore::HTMLAnchorElement::href): Return KURL. (WebCore::HTMLAnchorElement::hash): Removed DeprecatedString use. (WebCore::HTMLAnchorElement::host): Ditto. (WebCore::HTMLAnchorElement::hostname): Ditto. (WebCore::HTMLAnchorElement::pathname): Ditto. (WebCore::HTMLAnchorElement::port): Ditto. (WebCore::HTMLAnchorElement::protocol): Ditto. (WebCore::HTMLAnchorElement::search): Ditto. (WebCore::HTMLAnchorElement::toString): Ditto.
  • html/HTMLAnchorElement.h: Ditto.
  • html/HTMLAppletElement.cpp: (WebCore::HTMLAppletElement::createRenderer): Updated for KURL change.
  • html/HTMLAreaElement.cpp: (WebCore::HTMLAreaElement::href): Return KURL.
  • html/HTMLAreaElement.h: Ditto.
  • html/HTMLBaseElement.cpp: (WebCore::HTMLBaseElement::removedFromDocument): Updated for KURL change. (WebCore::HTMLBaseElement::process): Removed DeprecatedString use.
  • html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::parseMappedAttribute): Updated for KURL change.
  • html/HTMLEmbedElement.cpp: (WebCore::HTMLEmbedElement::parseMappedAttribute): Removed use of DeprecatedString.
  • html/HTMLEmbedElement.h: Removed DeprecatedString use.
  • html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::formWouldHaveSecureSubmission): Use protocolIs. (WebCore::encodeCString): Updated for change to String::split. (WebCore::HTMLFormElement::dataEncoding): Ditto. (WebCore::HTMLFormElement::formData): Removed DeprecatedString use. (WebCore::HTMLFormElement::isMailtoForm): Use protocolIs. (WebCore::HTMLFormElement::submit): Updated for KURL change. (WebCore::HTMLFormElement::reset): Ditto.
  • html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed): Updated for KURL change and use equalIgnoringRef instead of doing a setRef to get the same effect. (WebCore::HTMLFrameElementBase::openURL): Use blankURL. (WebCore::HTMLFrameElementBase::location): Return KURL. (WebCore::HTMLFrameElementBase::src): Return KURL.
  • html/HTMLFrameElementBase.h: Ditto.
  • html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::parseMappedAttribute): Updated for KURL change. (WebCore::HTMLImageElement::longDesc): Return KURL. (WebCore::HTMLImageElement::lowsrc): Return KURL. (WebCore::HTMLImageElement::src): Return KURL.
  • html/HTMLImageElement.h: Ditto. Also removed imageMap() function.
  • html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::src): Return KURL.
  • html/HTMLInputElement.h: Ditto.
  • html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::parseMappedAttribute): Updated for KURL change. (WebCore::HTMLLinkElement::tokenizeRelAttribute): Updated for String::split change. (WebCore::HTMLLinkElement::href): Return KURL.
  • html/HTMLLinkElement.h: Ditto.
  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::src): Return KURL. (WebCore::HTMLMediaElement::pickMedia): Updated for KURL change.
  • html/HTMLMediaElement.h: Ditto.
  • html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::isImageType): Use protocolIs. (WebCore::HTMLObjectElement::data): Return KURL.
  • html/HTMLObjectElement.h: Ditto.
  • html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::groupLabelText): Removed DeprecatedString use.
  • html/HTMLParser.cpp: (WebCore::HTMLParser::reportErrorToConsole): Updated for KURL change.
  • html/HTMLScriptElement.cpp: (WebCore::HTMLScriptElement::insertedIntoDocument): Ditto. (WebCore::HTMLScriptElement::text): Changed to use Vector<UChar> instead of String for better performance. (WebCore::HTMLScriptElement::src): Return KURL.
  • html/HTMLScriptElement.h: Ditto.
  • html/HTMLSourceElement.cpp: (WebCore::HTMLSourceElement::src): Return KURL.
  • html/HTMLSourceElement.h: Ditto.
  • html/HTMLTableElement.cpp: (WebCore::HTMLTableElement::parseMappedAttribute): Updated for KURL change.
  • html/HTMLTablePartElement.cpp: (WebCore::HTMLTablePartElement::parseMappedAttribute): Updated for KURL change.
  • html/HTMLTextAreaElement.cpp: (WebCore::HTMLTextAreaElement::setValue): Removed DeprecatedString use.
  • html/HTMLTokenizer.cpp: (WebCore::HTMLTokenizer::scriptExecution): Ditto. (WebCore::HTMLTokenizer::notifyFinished): Use protocolIs.
  • html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::poster): Return KURL.
  • html/HTMLVideoElement.h: Ditto.
  • html/HTMLViewSourceDocument.cpp: (WebCore::HTMLViewSourceDocument::addText): Updated for String::split change.
  • loader/DocLoader.cpp: (WebCore::DocLoader::checkForReload): Add an explicit check for an empty URL here to avoid problems using its string as a hash table key later. (WebCore::DocLoader::requestResource): Removed DeprecatedString use.
  • loader/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryTokenizer::createTDForFilename): Updated for KURL change. (WebCore::FTPDirectoryTokenizer::parseAndAppendOneLine): Removed use of DeprecatedString.
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::requestFrame): Use protocolIs. (WebCore::FrameLoader::loadSubframe): Use blankURL. (WebCore::FrameLoader::submitForm): Use protocolIs and removed use of DeprecatedString. (WebCore::FrameLoader::iconURL): Return KURL. Use protcolIs. (WebCore::FrameLoader::didOpenURL): Use protocolIs. (WebCore::FrameLoader::didExplicitOpen): Use blankURL. (WebCore::FrameLoader::executeIfJavaScriptURL): Use protocolIs. Update for name change to decodeURLEscapeSequences. (WebCore::FrameLoader::receivedFirstData): Updated for KURL changes. (WebCore::FrameLoader::begin): Removed DeprecatedString use. Renamed baseurl to baseURL. Updated to use KURL more. (WebCore::FrameLoader::gotoAnchor): Removed use of encodedHtmlRef function, which is no different from ref. (WebCore::FrameLoader::completeURL): Updated for KURL change. (WebCore::FrameLoader::scheduleLocationChange): Ditto. (WebCore::FrameLoader::canCachePage): Use protocolIs. (WebCore::FrameLoader::updatePolicyBaseURL): Update for KURL change. (WebCore::FrameLoader::setPolicyBaseURL): Take KURL. (WebCore::FrameLoader::startRedirectionTimer): Removed use of DeprecatedString. (WebCore::FrameLoader::load): Use protocolIs. (WebCore::FrameLoader::shouldHideReferrer): Use protocolIs. (WebCore::FrameLoader::shouldAllowNavigation): Updated for KURL change. (WebCore::FrameLoader::commitProvisionalLoad): Use blankURL. (WebCore::FrameLoader::open): Use protcolIs. (WebCore::FrameLoader::createHistoryItem): Use blankURL. (WebCore::FrameLoader::createJavaAppletWidget): Updated for KURL change. (WebCore::FrameLoader::switchOutLowBandwidthDisplayIfReady): Removed DeprecatedString use.
  • loader/FrameLoader.h: Ditto.
  • loader/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure): Updated for KURL change.
  • loader/PluginDocument.cpp: (WebCore::PluginTokenizer::createDocumentStructure): Ditto.
  • loader/icon/IconDatabase.cpp: (WebCore::IconDatabase::iconForPageURL): Added a check for an empty URL before trying to use it as a hash table key.
  • loader/icon/IconLoader.h: Tweaked includes.
  • loader/loader.cpp: (WebCore::Loader::servePendingRequests): Use protcolIs. Also removed some code to set up a local variable that is never used (and a DeprecatedString on to boot!).
  • loader/mac/LoaderNSURLExtras.m: (suggestedFilenameWithMIMEType): Removed unnecessary typecast.
  • page/ContextMenuController.cpp: Removed include.
  • page/mac/EventHandlerMac.mm: (WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks): Use protocolIs.
  • page/mac/WebCoreFrameBridge.mm: (-[WebCoreFrameBridge URLWithAttributeString:]): Removed getNSURL call. (-[WebCoreFrameBridge baseURL]): Ditto.
  • platform/KURL.cpp: (WebCore::isSchemeFirstChar): Fixed bug in handling of values >= 0x80. (WebCore::isSchemeChar): Ditto. (WebCore::isPathSegmentEndChar): Ditto. (WebCore::hexDigitValue): Changed parameter type to UChar. (WebCore::copyASCII): Added. (WebCore::findFirstOf): Added. (WebCore::KURL::protocolIs): Added. (WebCore::KURL::KURL): Tightened logic up quite a bit. Changed parameter types from DeprecatedString to String. (WebCore::KURL::init): Changed parameter type to String. Preserved the passed-in string even if the base is invalid. Cleaned up logic to determine if the originalString should be pased in to the parse function. Simplified by calling the new parse overload that takes String in many cases. (WebCore::KURL::lastPathComponent): Return String. (WebCore::KURL::protocol): Ditto. (WebCore::KURL::host): Ditto. (WebCore::KURL::port): Changed logic to use early return for clarity. (WebCore::KURL::pass): Return String. (WebCore::KURL::user): Ditto. (WebCore::KURL::ref): Ditto. (WebCore::assertProtocolIsGood): Added. (WebCore::KURL::protocolIs): Added. (WebCore::KURL::query): Return String. (WebCore::KURL::path): Ditto. (WebCore::KURL::setProtocol): Take String. (WebCore::KURL::setHost): Ditto. (WebCore::KURL::setPort): Use String. (WebCore::KURL::setHostAndPort): Take String. (WebCore::KURL::setUser): Ditto. (WebCore::KURL::setPass): Ditto. (WebCore::KURL::setRef): Ditto. (WebCore::KURL::setQuery): Ditto. (WebCore::KURL::setPath): Ditto. (WebCore::KURL::prettyURL): Return String. Use Vector<UChar> to build it. (WebCore::decodeURLEscapeSequences): Renamed from KURL::decode_string. Return String. Use Vector<UChar> to build it. (WebCore::KURL::isLocalFile): Use protocolIs. (WebCore::KURL::parse): Added an overload that takes a String to replace the use of DeprecatedString::ascii at various call sites. Updated for name change (urlString -> m_string). (WebCore::equalIgnoringRef): Wrote a new implementation that doesn't do any allocation. (WebCore::encodeWithURLEscapeSequences): Renamed from KURL::encode_string. Return String. (WebCore::appendEncodedHostname): Added. Replaces encodeHostname and avoids the need to allocate a string. (WebCore::findHostnamesInMailToURL): Update to use findFirstOf instead of regular expressions. (WebCore::findHostnameInHierarchicalURL): Ditto. (WebCore::encodeHostnames): Use protocolIs and the other helpers above. (WebCore::encodeRelativeString): Changed to put result into a CharBuffer. (WebCore::substituteBackslashes): Updated to use String. (WebCore::KURL::copyToBuffer): Added. (WebCore::protocolIs): Added. (WebCore::blankURL): Added. (WebCore::KURL::print): Updated.
  • platform/KURL.h: Added a number of comments. Reorganized the header a bit. Made the string constructors explicit. Changed to use String instead of DeprecatedString. Removed encodedHTMLRef. Renamed and added a few functions.
  • platform/cf/KURLCFNet.cpp: (WebCore::KURL::KURL): Streamlined the logic a bit. (WebCore::KURL::createCFURL): Changed to use copyToBuffer.
  • platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivate::createQTMovie): Removed getNSURL call. Use protocolIs.
  • platform/mac/ClipboardMac.mm: (WebCore::ClipboardMac::declareAndWriteDragImage): Removed getNSURL call.
  • platform/mac/CookieJar.mm: (WebCore::cookies): Removed getNSURL call. (WebCore::setCookies): Removed getNSURL call.
  • platform/mac/KURLMac.mm: (WebCore::KURL::KURL): Streamlined the logic a bit.
  • platform/mac/PasteboardMac.mm: (WebCore::Pasteboard::writeURL): Removed getNSURL call. (WebCore::Pasteboard::writeImage): Ditto.
  • platform/mac/SSLKeyGeneratorMac.mm: (WebCore::signedPublicKeyAndChallengeString): Ditto.
  • platform/network/HTTPParsers.cpp: (WebCore::filenameFromHTTPContentDisposition): Updated for String::split.
  • platform/network/ResourceHandle.cpp: (WebCore::ResourceHandle::portAllowed): Use protocolIs.
  • platform/network/cf/ResourceErrorCF.cpp: (WebCore::ResourceError::operator CFErrorRef): Removed deprecatedString call.
  • platform/network/curl/ResourceHandleManager.cpp: (WebCore::headerCallback): Ditto. (WebCore::parseDataUrl): Use String instead of DeprecatedString. (WebCore::ResourceHandleManager::startJob): Updated for KURL changes.
  • platform/network/mac/ResourceErrorMac.mm: (WebCore::ResourceError::operator NSError*): Removed getNSURL call.
  • platform/network/mac/ResourceRequest.h: (WebCore::ResourceRequest::ResourceRequest): Removed DeprecatedString use.
  • platform/network/mac/ResourceRequestMac.mm: (WebCore::ResourceRequest::doUpdatePlatformRequest): Removed getNSURL call.
  • platform/network/mac/ResourceResponseMac.mm: (WebCore::ResourceResponse::nsURLResponse): Removed getNSURL call.
  • platform/qt/ClipboardQt.cpp: (WebCore::ClipboardQt::writeURL): Removed deprecatedString call.
  • platform/text/CString.h: (WebCore::CStringBuffer::length): Fixed size_t/unsigned mismatch to make it possible to compile this on Windows with higher warning level
  • platform/text/PlatformString.h: Updated split to modify a result parameter rather than returning a Vector. Added charactersAreAllASCII and an append function that appends a String to a Vector<UChar>.
  • platform/text/String.cpp: (WebCore::String::split): Updated.
  • platform/win/BString.cpp: (WebCore::BString::BString): Added conversion from KURL.
  • platform/win/BString.h: Ditto.
  • platform/win/ClipboardUtilitiesWin.cpp: (WebCore::markupToCF_HTML): Removed use of deprecatedString.
  • platform/win/ClipboardWin.cpp: (WebCore::filesystemPathFromUrlOrTitle): Ditto. (WebCore::createGlobalHDropContent): Ditto. (WebCore::ClipboardWin::setData): Ditto. (WebCore::ClipboardWin::writeRange): Ditto.
  • platform/win/PasteboardWin.cpp: (WebCore::Pasteboard::writeSelection): Ditto.
  • plugins/PluginStream.cpp: (WebCore::PluginStream::startStream): Ditto. (WebCore::PluginStream::destroyStream): Ditto.
  • plugins/win/PluginViewWin.cpp: (WebCore::scriptStringIfJavaScriptURL): Ditto. (WebCore::PluginView::performRequest): Ditto. (WebCore::PluginView::PluginView): Ditto.
  • rendering/HitTestResult.cpp: (WebCore::HitTestResult::absoluteImageURL): Removed DeprecatedString use. (WebCore::HitTestResult::absoluteLinkURL): Ditto.
  • rendering/RenderFrameSet.cpp: (WebCore::RenderFrameSet::layOutAxis): Fixed comment wording.
  • rendering/RenderImage.cpp: (WebCore::RenderImage::paintReplaced): Removed use of DeperecatedString, (WebCore::RenderImage::imageMap): Changed to call useMap instead of imageMap; both do the same thing, and the first is standard DOM.
  • rendering/RenderObject.cpp: (WebCore::RenderObject::addPDFURLRect): Rewrote and streamlined to remove DeprecatedString use.
  • rendering/RenderObject.h: Changed addPDFURLRect to take const IntRect&.
  • rendering/RenderPartObject.cpp: (WebCore::isURLAllowed): Updated for KURL change and use equalIgnoringRef instead of doing a setRef to get the same effect. (WebCore::RenderPartObject::updateWidget): Updated for KURL change.
  • rendering/RenderText.cpp: (WebCore::charactersAreAllASCII): Moved the guts to PlatformString.h.
  • rendering/SVGRenderSupport.cpp: (WebCore::renderSubtreeToImage): Added missing call to do layout. I ran into this while doing some layout tests while URL processing was broken.
  • rendering/SVGRenderTreeAsText.h: Removed include.
  • svg/SVGImageLoader.cpp: (WebCore::SVGImageLoader::updateFromElement): Removed DeprecatedString use.
  • svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw): Added missing call to do layout. I ran into this while doing some layout tests while URL processing was broken. (WebCore::SVGImage::dataChanged): Use a null URL rather than an arbitrary string for the document.
  • xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::getResponseXML): Removed DeprecatedString use. (WebCore::XMLHttpRequest::urlMatchesDocumentDomain): Ditto. (WebCore::XMLHttpRequest::open): Ditto. (WebCore::XMLHttpRequest::send): Namespace change. (WebCore::XMLHttpRequest::dropProtection): Ditto.
  • xml/XMLHttpRequest.h: Removed DeprecatedString use.
  • xml/XSLImportRule.cpp: (WebCore::XSLImportRule::loadSheet): Removed DeprecatedString use.
  • xml/XSLStyleSheet.cpp: (WebCore::XSLStyleSheet::loadChildSheets): Ditto. (WebCore::XSLStyleSheet::loadChildSheet): Ditto.
  • xml/XSLStyleSheet.h: Ditto.
  • xml/XSLTProcessor.cpp: (WebCore::docLoaderFunc): Ditto. (WebCore::xsltStylesheetPointer): Ditto. (WebCore::xmlDocPtrFromNode): Ditto.

WebKit/gtk:

  • webkit/webkitwebframe.cpp: Removed DeprecatedString use to try to keep it building.
  • webkit/webkitwebview.cpp: Ditto.

WebKit/mac:

Reviewed by Eric Seidel.

  • updated for WebCore KURL changes
  • History/WebHistoryItem.mm: (-[WebHistoryItem URL]): Removed getNSURL call.
  • Misc/WebElementDictionary.mm: (-[WebElementDictionary _absoluteImageURL]): Ditto. (-[WebElementDictionary _absoluteLinkURL]): Ditto.
  • Misc/WebNSAttributedStringExtras.mm: (fileWrapperForElement): Ditto. (+[NSAttributedString _web_attributedStringFromRange:]): Ditto.
  • Misc/WebNSURLExtras.mm: (-[NSString _webkit_stringByReplacingValidPercentEscapes]): Updated for function name change.
  • WebCoreSupport/WebContextMenuClient.mm: (WebContextMenuClient::downloadURL): Removed getNSURL call.
  • WebCoreSupport/WebDragClient.mm: (WebDragClient::createDragImageForLink): Ditto.
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::dispatchWillPerformClientRedirect): Ditto. (WebFrameLoaderClient::startDownload): Ditto. (WebFrameLoaderClient::updateGlobalHistoryForStandardLoad): Ditto. (WebFrameLoaderClient::updateGlobalHistoryForReload): Ditto. (WebFrameLoaderClient::cancelledError): Ditto. (WebFrameLoaderClient::blockedError): Ditto. (WebFrameLoaderClient::cannotShowURLError): Ditto. (WebFrameLoaderClient::interruptForPolicyChangeError): Ditto. (WebFrameLoaderClient::cannotShowMIMETypeError): Ditto. (WebFrameLoaderClient::fileDoesNotExistError): Ditto. (WebFrameLoaderClient::willUseArchive): Ditto. (WebFrameLoaderClient::setTitle): Ditto. (WebFrameLoaderClient::actionDictionary): Ditto. (WebFrameLoaderClient::createFrame): Ditto. (WebFrameLoaderClient::objectContentType): Ditto. (WebFrameLoaderClient::createPlugin): Ditto. (WebFrameLoaderClient::createJavaAppletWidget): Ditto.
  • WebView/WebDataSource.mm: (-[WebDataSource _URL]): Ditto. (-[WebDataSource _initWithDocumentLoader:]): Ditto. (-[WebDataSource unreachableURL]): Ditto.
  • WebView/WebHTMLView.mm: (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): Ditto.

WebKit/win:

  • updated for WebCore KURL changes
  • MarshallingHelpers.cpp: (MarshallingHelpers::BSTRToKURL): Removed deprecatedString call. (MarshallingHelpers::KURLToBSTR): Tweaked for efficiency.
  • WebContextMenuClient.cpp: (WebContextMenuClient::searchWithGoogle): Updated for KURL changes.
  • WebDataSource.cpp: (WebDataSource::unreachableURL): Ditto.
  • WebDownload.cpp: (WebDownload::init): Ditto. (WebDownload::initWithRequest): Ditto.
  • WebFrame.cpp: (WebFrame::loadData): Ditto. (WebFrame::loadURLIntoChild): Ditto. (WebFrame::objectContentType): Ditto.
  • WebResource.cpp: (WebResource::initWithData): Ditto.
  • WebURLResponse.cpp: (WebURLResponse::createInstance): Ditto. (WebURLResponse::initWithURL): Ditto.
  • WebView.cpp: (WebView::userAgentForURL): Ditto. (WebView::copyURL): Ditto. (WebView::notifyPreferencesChanged): Ditto.

WebKit/wx:

  • WebView.cpp: Removed use of DeprecatedString to keep this compiling.
Location:
trunk
Files:
177 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30240 r30243  
     12008-02-14  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Based on work by Marvin Decker <marv.decker@gmail.com>
     6
     7        - fix http://bugs.webkit.org/show_bug.cgi?id=16538
     8          KURL should use String instead of DeprecatedString
     9
     10        - fix http://bugs.webkit.org/show_bug.cgi?id=16485
     11          DocLoader::checkForReload will crash if the URL isNull
     12          and a similar problem in IconDatabase
     13
     14        - fix http://bugs.webkit.org/show_bug.cgi?id=16487
     15          KURL doesn't preserve isNull when constructed with a DeprecatedString
     16
     17        - changed completeURL and various DOM getters to return KURL, to avoid
     18          conversion back and forth from KURL to String
     19
     20        - changed the conversion of KURL to NSURL or NSString to be automatic,
     21          to ease the use of KURL in Objective C DOM bindings, and eliminated
     22          the getNSURL function
     23
     24        - because I had to visit the DOM bindings anyway, eliminated almost all
     25          the use of the KJS namespace for things in WebCore
     26
     27        - fixed HTMLOptionElement constructor to check for undefined rather
     28          than size of the arguments array
     29
     30        - eliminated some other unnecessary uses of DeprecatedString
     31
     32        - changed String::split to take a Vector parameter instead of returning
     33          a Vector, for better performance
     34
     35        - added a couple of missing calls to do layout in SVG image handling;
     36          I was able to reproduce these only because I had broken URLs for a
     37          while -- not sure how to reproduce them now but the changes are
     38          clearly needed
     39
     40        Performance testing shows this to be at least a 1% speedup.
     41
     42        Added a new function protocolIs to efficiently compare protocols
     43        without case errors and a blankURL function so we don't have to
     44        code "about:blank" in multiple places in the code and don't have to
     45        construct a frash KURL each time. Moved decode_string and encode_string
     46        out of KURL and gave them clearer names.
     47
     48        Made KURL constructors explicit to highlight potentially-expensive
     49        operations and the poor semantics of KURL's constructor that takes
     50        a String.
     51
     52        * WebCore.base.exp: Updated.
     53
     54        * bindings/js/JSAttrCustom.cpp:
     55        (WebCore::JSAttr::setValue): Use protocolIs.
     56        * bindings/js/JSAudioConstructor.h: KJS namespace change.
     57        * bindings/js/JSCSSRuleCustom.cpp:
     58        (WebCore::toJS): Ditto.
     59        * bindings/js/JSCSSValueCustom.cpp:
     60        (WebCore::toJS): Ditto.
     61        * bindings/js/JSDocumentCustom.cpp:
     62        (WebCore::JSDocument::location): Ditto.
     63        (WebCore::JSDocument::setLocation): Updated for KURL change.
     64        (WebCore::toJS): KJS namespace change.
     65        * bindings/js/JSElementCustom.cpp:
     66        (WebCore::allowSettingSrcToJavascriptURL): Use protocolIs.
     67        (WebCore::JSElement::setAttribute): KJS namespace change.
     68        (WebCore::JSElement::setAttributeNode): Ditto.
     69        (WebCore::JSElement::setAttributeNS): Ditto.
     70        (WebCore::JSElement::setAttributeNodeNS): Ditto.
     71        * bindings/js/JSHTMLFrameElementCustom.cpp:
     72        (WebCore::allowSettingJavascriptURL): Use protocolIs.
     73        (WebCore::JSHTMLFrameElement::setSrc): KJS namespace change.
     74        (WebCore::JSHTMLFrameElement::setLocation): Ditto.
     75        * bindings/js/JSHTMLIFrameElementCustom.cpp:
     76        (WebCore::JSHTMLIFrameElement::setSrc): Use protocolIs.
     77        * bindings/js/JSHTMLOptionElementConstructor.cpp:
     78        (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor):
     79        (WebCore::JSHTMLOptionElementConstructor::construct): Cleaned up the
     80        structure a bit and changed checking to check for undefined rather than
     81        number of arguments.
     82        * bindings/js/JSHTMLOptionElementConstructor.h: KJS namespace change.
     83        * bindings/js/JSLocation.cpp:
     84        (WebCore::JSLocation::put): Eliminated some DeprecatedString use,
     85        and use protocolIs.
     86        (WebCore::jsLocationProtoFuncReplace): Ditto.
     87        (WebCore::jsLocationProtoFuncReload): Ditto.
     88        (WebCore::jsLocationProtoFuncAssign): Ditto.
     89        * bindings/js/JSLocation.h: KJS namespace change.
     90        * bindings/js/JSNamedNodeMapCustom.cpp:
     91        (WebCore::JSNamedNodeMap::canGetItemsForName): Ditto.
     92        (WebCore::JSNamedNodeMap::nameGetter): Ditto.
     93        * bindings/js/JSNamedNodesCollection.cpp:
     94        (WebCore::JSNamedNodesCollection::JSNamedNodesCollection): Ditto.
     95        * bindings/js/JSNamedNodesCollection.h: Ditto.
     96        * bindings/js/JSXMLHttpRequest.cpp:
     97        (WebCore::jsXMLHttpRequestPrototypeFunctionOpen): Removed
     98        DeprecatedString use.
     99        (WebCore::jsXMLHttpRequestPrototypeFunctionSend): Ditto.
     100        * bindings/js/JSXMLHttpRequest.h: Moved this class into the WebCore
     101        namespace.
     102        * bindings/js/JSXSLTProcessor.cpp: Namespace change.
     103        * bindings/js/JSXSLTProcessor.h: Ditto.
     104
     105        * bindings/js/kjs_binding.cpp: Updated for namespace change.
     106        (WebCore::jsStringOrNull): Added an overload for KURL to allow DOM
     107        classes to return KURL even if the DOM expects a string.
     108        (WebCore::jsStringOrUndefined): Ditto.
     109        (WebCore::jsStringOrFalse): Ditto.
     110        * bindings/js/kjs_binding.h: Moved everything into the WebCore
     111        namespace.
     112
     113        * bindings/js/kjs_css.h: Namespace change.
     114        * bindings/js/kjs_events.cpp: Removed an include.
     115        * bindings/js/kjs_events.h: Namespace change.
     116        * bindings/js/kjs_html.h: Namespace change.
     117
     118        * bindings/js/kjs_navigator.cpp: Moved everything into the
     119        WebCore namespace.
     120        * bindings/js/kjs_navigator.h: Ditto.
     121
     122        * bindings/js/kjs_window.cpp:
     123        (KJS::parseModalDialogFeatures): Updated for String::split change.
     124        (KJS::createWindow): Use protocolIs and removed some DeprecatedString.
     125        (KJS::Window::put): Ditto.
     126        (KJS::Window::allowsAccessFrom): Ditto.
     127        (KJS::windowProtoFuncOpen): Ditto.
     128
     129        * bindings/objc/DOM.mm:
     130        (-[DOMElement _getURLAttribute:]): Removed getNSURL call.
     131        * bindings/objc/DOMHTML.mm:
     132        (-[DOMHTMLDocument _createDocumentFragmentWithMarkupString:baseURLString:]): Ditto.
     133
     134        * bindings/scripts/CodeGeneratorCOM.pm: Updated includes so conversions from
     135        KURL will work.
     136        * bindings/scripts/CodeGeneratorJS.pm: Updated for namespace changes, and also
     137        updated includes so conversions from KURL will work.
     138        * bindings/scripts/CodeGeneratorObjC.pm: Updated includes so conversions from
     139        KURL will work.
     140
     141        * bridge/mac/WebCoreAXObject.mm:
     142        (-[WebCoreAXObject accessibilityAttributeValue:]): Removed getNSURL call.
     143        Also streamlined the logic.
     144        (AXAttributedStringAppendText): Ditto.
     145
     146        * bridge/mac/WebCoreScriptDebugger.mm:
     147        (toNSString): Tweaked.
     148        (toNSURL): Removed getNSURL call.
     149
     150        * css/CSSImageValue.cpp:
     151        (WebCore::CSSImageValue::image): Removed DeprecatedString use.
     152        * css/CSSImportRule.cpp:
     153        (WebCore::CSSImportRule::insertedIntoParent): Ditto.
     154        * css/CSSParser.cpp:
     155        (WebCore::CSSParser::parseValue): Ditto.
     156        (WebCore::CSSParser::parseContent): Ditto.
     157        (WebCore::CSSParser::parseBackgroundImage): Ditto.
     158        (WebCore::CSSParser::parseFontFaceSrc): Ditto.
     159        (WebCore::CSSParser::parseBorderImage): Ditto.
     160        * css/CSSStyleSelector.cpp:
     161        (WebCore::CSSStyleSelector::setEncodedURL): Ditto.
     162        (WebCore::checkPseudoState): Ditto.
     163        * css/CSSStyleSelector.h: Ditto.
     164
     165        * css/MediaList.cpp:
     166        (WebCore::MediaList::setMediaText): Updated for String::split change.
     167
     168        * css/StyleBase.cpp:
     169        (WebCore::StyleBase::baseURL): Return KURL.
     170        * css/StyleBase.h: DItto.
     171
     172        * dom/Document.cpp:
     173        (WebCore::Document::~Document): Updated for namespace change.
     174        (WebCore::Document::documentURI): Return KURL.
     175        (WebCore::Document::setDocumentURI): Removed DeprecatedString use.
     176        (WebCore::Document::baseURI): Return KURL.
     177        (WebCore::Document::open): Updated to use blankURL.
     178        (WebCore::Document::setURL): Take KURL.
     179        (WebCore::Document::shouldBeAllowedToLoadLocalResources): Updated for
     180        change to use KURL
     181        (WebCore::Document::setBaseURL): Take KURL.
     182        (WebCore::Document::elementSheet): Updated for KURL change.
     183        (WebCore::Document::mappedElementSheet): Ditto.
     184        (WebCore::Document::processHttpEquiv): Ditto.
     185        (WebCore::Document::recalcStyleSelector): Removed use of
     186        DeprecatedString -- also noticed some dead code here!
     187        (WebCore::Document::setCookie): Ditto.
     188        (WebCore::Document::completeURL): Return KURL.
     189        * dom/Document.h: Use KURL instead of String in a few places.
     190
     191        * dom/DocumentType.cpp:
     192        (WebCore::DocumentType::baseURI): Return KURL.
     193        * dom/DocumentType.h: Ditto.
     194
     195        * dom/Element.cpp:
     196        (WebCore::Element::baseURI): Return KURL.
     197        * dom/Element.h: Ditto.
     198
     199        * dom/Node.cpp:
     200        (WebCore::Node::setDocument): Namespace change.
     201        (WebCore::Node::baseURI): Return KURL.
     202        * dom/Node.h: Ditto.
     203
     204        * dom/ProcessingInstruction.cpp:
     205        (WebCore::ProcessingInstruction::checkStyleSheet): Updated for KURL change.
     206        * dom/StyleElement.cpp:
     207        (WebCore::StyleElement::process): Changed to use Vector<UChar> instead of
     208        String for better performance.
     209        (WebCore::StyleElement::createSheet): Removed use of DeprecateString.
     210        * dom/XMLTokenizer.cpp:
     211        (WebCore::XMLTokenizer::endElementNs): Updated for KURL change.
     212        (WebCore::XMLTokenizer::end): Ditto.
     213        (WebCore::xmlDocPtrForString): Removed use of DeprecateString.
     214        * dom/XMLTokenizer.h: Ditto.
     215
     216        * editing/markup.cpp: Moved appendString to PlatformString.h.
     217        (WebCore::appendQuotedURLAttributeValue): Use protocolIs.
     218        (WebCore::completeURLs): Removed DeprecatedString use.
     219        (WebCore::createFragmentFromMarkup): Use blankURL.
     220        (WebCore::fillContainerFromString): Removed DeprecatedString use.
     221        (WebCore::createFragmentFromText): Ditto.
     222
     223        * history/HistoryItem.cpp:
     224        (WebCore::HistoryItem::url): Removed DeprecatedString use.
     225        (WebCore::HistoryItem::originalURL): Ditto.
     226        * history/HistoryItem.h: Removed include.
     227
     228        * html/HTMLAnchorElement.cpp:
     229        (WebCore::HTMLAnchorElement::defaultEventHandler): Removed use of
     230        DeprecatedString.
     231        (WebCore::HTMLAnchorElement::href): Return KURL.
     232        (WebCore::HTMLAnchorElement::hash): Removed DeprecatedString use.
     233        (WebCore::HTMLAnchorElement::host): Ditto.
     234        (WebCore::HTMLAnchorElement::hostname): Ditto.
     235        (WebCore::HTMLAnchorElement::pathname): Ditto.
     236        (WebCore::HTMLAnchorElement::port): Ditto.
     237        (WebCore::HTMLAnchorElement::protocol): Ditto.
     238        (WebCore::HTMLAnchorElement::search): Ditto.
     239        (WebCore::HTMLAnchorElement::toString): Ditto.
     240        * html/HTMLAnchorElement.h: Ditto.
     241        * html/HTMLAppletElement.cpp:
     242        (WebCore::HTMLAppletElement::createRenderer): Updated for KURL change.
     243        * html/HTMLAreaElement.cpp:
     244        (WebCore::HTMLAreaElement::href): Return KURL.
     245        * html/HTMLAreaElement.h: Ditto.
     246        * html/HTMLBaseElement.cpp:
     247        (WebCore::HTMLBaseElement::removedFromDocument): Updated for KURL change.
     248        (WebCore::HTMLBaseElement::process): Removed DeprecatedString use.
     249        * html/HTMLBodyElement.cpp:
     250        (WebCore::HTMLBodyElement::parseMappedAttribute): Updated for KURL change.
     251        * html/HTMLEmbedElement.cpp:
     252        (WebCore::HTMLEmbedElement::parseMappedAttribute): Removed use of
     253        DeprecatedString.
     254        * html/HTMLEmbedElement.h: Removed DeprecatedString use.
     255        * html/HTMLFormElement.cpp:
     256        (WebCore::HTMLFormElement::formWouldHaveSecureSubmission): Use protocolIs.
     257        (WebCore::encodeCString): Updated for change to String::split.
     258        (WebCore::HTMLFormElement::dataEncoding): Ditto.
     259        (WebCore::HTMLFormElement::formData): Removed DeprecatedString use.
     260        (WebCore::HTMLFormElement::isMailtoForm): Use protocolIs.
     261        (WebCore::HTMLFormElement::submit): Updated for KURL change.
     262        (WebCore::HTMLFormElement::reset): Ditto.
     263        * html/HTMLFrameElementBase.cpp:
     264        (WebCore::HTMLFrameElementBase::isURLAllowed): Updated for KURL change
     265        and use equalIgnoringRef instead of doing a setRef to get the same effect.
     266        (WebCore::HTMLFrameElementBase::openURL): Use blankURL.
     267        (WebCore::HTMLFrameElementBase::location): Return KURL.
     268        (WebCore::HTMLFrameElementBase::src): Return KURL.
     269        * html/HTMLFrameElementBase.h: Ditto.
     270        * html/HTMLImageElement.cpp:
     271        (WebCore::HTMLImageElement::parseMappedAttribute): Updated for KURL change.
     272        (WebCore::HTMLImageElement::longDesc): Return KURL.
     273        (WebCore::HTMLImageElement::lowsrc): Return KURL.
     274        (WebCore::HTMLImageElement::src): Return KURL.
     275        * html/HTMLImageElement.h: Ditto. Also removed imageMap() function.
     276        * html/HTMLInputElement.cpp:
     277        (WebCore::HTMLInputElement::src): Return KURL.
     278        * html/HTMLInputElement.h: Ditto.
     279        * html/HTMLLinkElement.cpp:
     280        (WebCore::HTMLLinkElement::parseMappedAttribute): Updated for KURL change.
     281        (WebCore::HTMLLinkElement::tokenizeRelAttribute): Updated for String::split change.
     282        (WebCore::HTMLLinkElement::href): Return KURL.
     283        * html/HTMLLinkElement.h: Ditto.
     284        * html/HTMLMediaElement.cpp:
     285        (WebCore::HTMLMediaElement::src): Return KURL.
     286        (WebCore::HTMLMediaElement::pickMedia): Updated for KURL change.
     287        * html/HTMLMediaElement.h: Ditto.
     288        * html/HTMLObjectElement.cpp:
     289        (WebCore::HTMLObjectElement::isImageType): Use protocolIs.
     290        (WebCore::HTMLObjectElement::data): Return KURL.
     291        * html/HTMLObjectElement.h: Ditto.
     292        * html/HTMLOptGroupElement.cpp:
     293        (WebCore::HTMLOptGroupElement::groupLabelText): Removed DeprecatedString use.
     294        * html/HTMLParser.cpp:
     295        (WebCore::HTMLParser::reportErrorToConsole): Updated for KURL change.
     296        * html/HTMLScriptElement.cpp:
     297        (WebCore::HTMLScriptElement::insertedIntoDocument): Ditto.
     298        (WebCore::HTMLScriptElement::text): Changed to use Vector<UChar> instead of
     299        String for better performance.
     300        (WebCore::HTMLScriptElement::src): Return KURL.
     301        * html/HTMLScriptElement.h: Ditto.
     302        * html/HTMLSourceElement.cpp:
     303        (WebCore::HTMLSourceElement::src): Return KURL.
     304        * html/HTMLSourceElement.h: Ditto.
     305        * html/HTMLTableElement.cpp:
     306        (WebCore::HTMLTableElement::parseMappedAttribute): Updated for KURL change.
     307        * html/HTMLTablePartElement.cpp:
     308        (WebCore::HTMLTablePartElement::parseMappedAttribute): Updated for KURL change.
     309        * html/HTMLTextAreaElement.cpp:
     310        (WebCore::HTMLTextAreaElement::setValue): Removed DeprecatedString use.
     311        * html/HTMLTokenizer.cpp:
     312        (WebCore::HTMLTokenizer::scriptExecution): Ditto.
     313        (WebCore::HTMLTokenizer::notifyFinished): Use protocolIs.
     314        * html/HTMLVideoElement.cpp:
     315        (WebCore::HTMLVideoElement::poster): Return KURL.
     316        * html/HTMLVideoElement.h: Ditto.
     317        * html/HTMLViewSourceDocument.cpp:
     318        (WebCore::HTMLViewSourceDocument::addText): Updated for String::split change.
     319
     320        * loader/DocLoader.cpp:
     321        (WebCore::DocLoader::checkForReload): Add an explicit check for an empty URL
     322        here to avoid problems using its string as a hash table key later.
     323        (WebCore::DocLoader::requestResource): Removed DeprecatedString use.
     324
     325        * loader/FTPDirectoryDocument.cpp:
     326        (WebCore::FTPDirectoryTokenizer::createTDForFilename): Updated for KURL change.
     327        (WebCore::FTPDirectoryTokenizer::parseAndAppendOneLine): Removed use of
     328        DeprecatedString.
     329
     330        * loader/FrameLoader.cpp:
     331        (WebCore::FrameLoader::requestFrame): Use protocolIs.
     332        (WebCore::FrameLoader::loadSubframe): Use blankURL.
     333        (WebCore::FrameLoader::submitForm): Use protocolIs and removed use of
     334        DeprecatedString.
     335        (WebCore::FrameLoader::iconURL): Return KURL. Use protcolIs.
     336        (WebCore::FrameLoader::didOpenURL): Use protocolIs.
     337        (WebCore::FrameLoader::didExplicitOpen): Use blankURL.
     338        (WebCore::FrameLoader::executeIfJavaScriptURL): Use protocolIs.
     339        Update for name change to decodeURLEscapeSequences.
     340        (WebCore::FrameLoader::receivedFirstData): Updated for KURL changes.
     341        (WebCore::FrameLoader::begin): Removed DeprecatedString use.
     342        Renamed baseurl to baseURL. Updated to use KURL more.
     343        (WebCore::FrameLoader::gotoAnchor): Removed use of encodedHtmlRef
     344        function, which is no different from ref.
     345        (WebCore::FrameLoader::completeURL): Updated for KURL change.
     346        (WebCore::FrameLoader::scheduleLocationChange): Ditto.
     347        (WebCore::FrameLoader::canCachePage): Use protocolIs.
     348        (WebCore::FrameLoader::updatePolicyBaseURL): Update for KURL change.
     349        (WebCore::FrameLoader::setPolicyBaseURL): Take KURL.
     350        (WebCore::FrameLoader::startRedirectionTimer): Removed use of
     351        DeprecatedString.
     352        (WebCore::FrameLoader::load): Use protocolIs.
     353        (WebCore::FrameLoader::shouldHideReferrer): Use protocolIs.
     354        (WebCore::FrameLoader::shouldAllowNavigation): Updated for KURL change.
     355        (WebCore::FrameLoader::commitProvisionalLoad): Use blankURL.
     356        (WebCore::FrameLoader::open): Use protcolIs.
     357        (WebCore::FrameLoader::createHistoryItem): Use blankURL.
     358        (WebCore::FrameLoader::createJavaAppletWidget): Updated for KURL change.
     359        (WebCore::FrameLoader::switchOutLowBandwidthDisplayIfReady): Removed
     360        DeprecatedString use.
     361        * loader/FrameLoader.h: Ditto.
     362
     363        * loader/ImageDocument.cpp:
     364        (WebCore::ImageDocument::createDocumentStructure): Updated for KURL change.
     365        * loader/PluginDocument.cpp:
     366        (WebCore::PluginTokenizer::createDocumentStructure): Ditto.
     367
     368        * loader/icon/IconDatabase.cpp:
     369        (WebCore::IconDatabase::iconForPageURL): Added a check for an empty URL
     370        before trying to use it as a hash table key.
     371
     372        * loader/icon/IconLoader.h: Tweaked includes.
     373
     374        * loader/loader.cpp:
     375        (WebCore::Loader::servePendingRequests): Use protcolIs. Also removed some
     376        code to set up a local variable that is never used (and a DeprecatedString
     377        on to boot!).
     378
     379        * loader/mac/LoaderNSURLExtras.m:
     380        (suggestedFilenameWithMIMEType): Removed unnecessary typecast.
     381
     382        * page/ContextMenuController.cpp: Removed include.
     383
     384        * page/mac/EventHandlerMac.mm:
     385        (WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks):
     386        Use protocolIs.
     387
     388        * page/mac/WebCoreFrameBridge.mm:
     389        (-[WebCoreFrameBridge URLWithAttributeString:]): Removed getNSURL call.
     390        (-[WebCoreFrameBridge baseURL]): Ditto.
     391
     392        * platform/KURL.cpp:
     393        (WebCore::isSchemeFirstChar): Fixed bug in handling of values >= 0x80.
     394        (WebCore::isSchemeChar): Ditto.
     395        (WebCore::isPathSegmentEndChar): Ditto.
     396        (WebCore::hexDigitValue): Changed parameter type to UChar.
     397        (WebCore::copyASCII): Added.
     398        (WebCore::findFirstOf): Added.
     399        (WebCore::KURL::protocolIs): Added.
     400        (WebCore::KURL::KURL): Tightened logic up quite a bit. Changed parameter
     401        types from DeprecatedString to String.
     402        (WebCore::KURL::init): Changed parameter type to String. Preserved the
     403        passed-in string even if the base is invalid. Cleaned up logic to determine
     404        if the originalString should be pased in to the parse function. Simplified
     405        by calling the new parse overload that takes String in many cases.
     406        (WebCore::KURL::lastPathComponent): Return String.
     407        (WebCore::KURL::protocol): Ditto.
     408        (WebCore::KURL::host): Ditto.
     409        (WebCore::KURL::port): Changed logic to use early return for clarity.
     410        (WebCore::KURL::pass): Return String.
     411        (WebCore::KURL::user): Ditto.
     412        (WebCore::KURL::ref): Ditto.
     413        (WebCore::assertProtocolIsGood): Added.
     414        (WebCore::KURL::protocolIs): Added.
     415        (WebCore::KURL::query): Return String.
     416        (WebCore::KURL::path): Ditto.
     417        (WebCore::KURL::setProtocol): Take String.
     418        (WebCore::KURL::setHost): Ditto.
     419        (WebCore::KURL::setPort): Use String.
     420        (WebCore::KURL::setHostAndPort): Take String.
     421        (WebCore::KURL::setUser): Ditto.
     422        (WebCore::KURL::setPass): Ditto.
     423        (WebCore::KURL::setRef): Ditto.
     424        (WebCore::KURL::setQuery): Ditto.
     425        (WebCore::KURL::setPath): Ditto.
     426        (WebCore::KURL::prettyURL): Return String. Use Vector<UChar> to build it.
     427        (WebCore::decodeURLEscapeSequences): Renamed from KURL::decode_string.
     428        Return String. Use Vector<UChar> to build it.
     429        (WebCore::KURL::isLocalFile): Use protocolIs.
     430        (WebCore::KURL::parse): Added an overload that takes a String to replace
     431        the use of DeprecatedString::ascii at various call sites. Updated for
     432        name change (urlString -> m_string).
     433        (WebCore::equalIgnoringRef): Wrote a new implementation that doesn't
     434        do any allocation.
     435        (WebCore::encodeWithURLEscapeSequences): Renamed from KURL::encode_string.
     436        Return String.
     437        (WebCore::appendEncodedHostname): Added. Replaces encodeHostname and
     438        avoids the need to allocate a string.
     439        (WebCore::findHostnamesInMailToURL): Update to use findFirstOf instead of
     440        regular expressions.
     441        (WebCore::findHostnameInHierarchicalURL): Ditto.
     442        (WebCore::encodeHostnames): Use protocolIs and the other helpers above.
     443        (WebCore::encodeRelativeString): Changed to put result into a CharBuffer.
     444        (WebCore::substituteBackslashes): Updated to use String.
     445        (WebCore::KURL::copyToBuffer): Added.
     446        (WebCore::protocolIs): Added.
     447        (WebCore::blankURL): Added.
     448        (WebCore::KURL::print): Updated.
     449        * platform/KURL.h: Added a number of comments. Reorganized the header a bit.
     450        Made the string constructors explicit. Changed to use String instead of
     451        DeprecatedString. Removed encodedHTMLRef. Renamed and added a few functions.
     452
     453        * platform/cf/KURLCFNet.cpp:
     454        (WebCore::KURL::KURL): Streamlined the logic a bit.
     455        (WebCore::KURL::createCFURL): Changed to use copyToBuffer.
     456
     457        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
     458        (WebCore::MediaPlayerPrivate::createQTMovie): Removed getNSURL call.
     459        Use protocolIs.
     460        * platform/mac/ClipboardMac.mm:
     461        (WebCore::ClipboardMac::declareAndWriteDragImage): Removed getNSURL call.
     462        * platform/mac/CookieJar.mm:
     463        (WebCore::cookies): Removed getNSURL call.
     464        (WebCore::setCookies): Removed getNSURL call.
     465        * platform/mac/KURLMac.mm:
     466        (WebCore::KURL::KURL): Streamlined the logic a bit.
     467        * platform/mac/PasteboardMac.mm:
     468        (WebCore::Pasteboard::writeURL): Removed getNSURL call.
     469        (WebCore::Pasteboard::writeImage): Ditto.
     470        * platform/mac/SSLKeyGeneratorMac.mm:
     471        (WebCore::signedPublicKeyAndChallengeString): Ditto.
     472
     473        * platform/network/HTTPParsers.cpp:
     474        (WebCore::filenameFromHTTPContentDisposition): Updated for String::split.
     475        * platform/network/ResourceHandle.cpp:
     476        (WebCore::ResourceHandle::portAllowed): Use protocolIs.
     477
     478        * platform/network/cf/ResourceErrorCF.cpp:
     479        (WebCore::ResourceError::operator CFErrorRef): Removed deprecatedString call.
     480        * platform/network/curl/ResourceHandleManager.cpp:
     481        (WebCore::headerCallback): Ditto.
     482        (WebCore::parseDataUrl): Use String instead of DeprecatedString.
     483        (WebCore::ResourceHandleManager::startJob): Updated for KURL changes.
     484        * platform/network/mac/ResourceErrorMac.mm:
     485        (WebCore::ResourceError::operator NSError*): Removed getNSURL call.
     486        * platform/network/mac/ResourceRequest.h:
     487        (WebCore::ResourceRequest::ResourceRequest): Removed DeprecatedString use.
     488        * platform/network/mac/ResourceRequestMac.mm:
     489        (WebCore::ResourceRequest::doUpdatePlatformRequest): Removed getNSURL call.
     490        * platform/network/mac/ResourceResponseMac.mm:
     491        (WebCore::ResourceResponse::nsURLResponse): Removed getNSURL call.
     492
     493        * platform/qt/ClipboardQt.cpp:
     494        (WebCore::ClipboardQt::writeURL): Removed deprecatedString call.
     495
     496        * platform/text/CString.h:
     497        (WebCore::CStringBuffer::length): Fixed size_t/unsigned mismatch to make it
     498        possible to compile this on Windows with higher warning level
     499
     500        * platform/text/PlatformString.h: Updated split to modify a result parameter
     501        rather than returning a Vector. Added charactersAreAllASCII and an append
     502        function that appends a String to a Vector<UChar>.
     503        * platform/text/String.cpp:
     504        (WebCore::String::split): Updated.
     505
     506        * platform/win/BString.cpp:
     507        (WebCore::BString::BString): Added conversion from KURL.
     508        * platform/win/BString.h: Ditto.
     509
     510        * platform/win/ClipboardUtilitiesWin.cpp:
     511        (WebCore::markupToCF_HTML): Removed use of deprecatedString.
     512        * platform/win/ClipboardWin.cpp:
     513        (WebCore::filesystemPathFromUrlOrTitle): Ditto.
     514        (WebCore::createGlobalHDropContent): Ditto.
     515        (WebCore::ClipboardWin::setData): Ditto.
     516        (WebCore::ClipboardWin::writeRange): Ditto.
     517        * platform/win/PasteboardWin.cpp:
     518        (WebCore::Pasteboard::writeSelection): Ditto.
     519        * plugins/PluginStream.cpp:
     520        (WebCore::PluginStream::startStream): Ditto.
     521        (WebCore::PluginStream::destroyStream): Ditto.
     522        * plugins/win/PluginViewWin.cpp:
     523        (WebCore::scriptStringIfJavaScriptURL): Ditto.
     524        (WebCore::PluginView::performRequest): Ditto.
     525        (WebCore::PluginView::PluginView): Ditto.
     526
     527        * rendering/HitTestResult.cpp:
     528        (WebCore::HitTestResult::absoluteImageURL): Removed DeprecatedString use.
     529        (WebCore::HitTestResult::absoluteLinkURL): Ditto.
     530
     531        * rendering/RenderFrameSet.cpp:
     532        (WebCore::RenderFrameSet::layOutAxis): Fixed comment wording.
     533        * rendering/RenderImage.cpp:
     534        (WebCore::RenderImage::paintReplaced): Removed use of DeperecatedString,
     535        (WebCore::RenderImage::imageMap): Changed to call useMap instead of imageMap;
     536        both do the same thing, and the first is standard DOM.
     537
     538        * rendering/RenderObject.cpp:
     539        (WebCore::RenderObject::addPDFURLRect): Rewrote and streamlined to remove
     540        DeprecatedString use.
     541        * rendering/RenderObject.h: Changed addPDFURLRect to take const IntRect&.
     542
     543        * rendering/RenderPartObject.cpp:
     544        (WebCore::isURLAllowed): Updated for KURL change and use equalIgnoringRef
     545        instead of doing a setRef to get the same effect.
     546        (WebCore::RenderPartObject::updateWidget): Updated for KURL change.
     547
     548        * rendering/RenderText.cpp:
     549        (WebCore::charactersAreAllASCII): Moved the guts to PlatformString.h.
     550
     551        * rendering/SVGRenderSupport.cpp:
     552        (WebCore::renderSubtreeToImage): Added missing call to do layout. I ran
     553        into this while doing some layout tests while URL processing was broken.
     554
     555        * rendering/SVGRenderTreeAsText.h: Removed include.
     556
     557        * svg/SVGImageLoader.cpp:
     558        (WebCore::SVGImageLoader::updateFromElement): Removed DeprecatedString use.
     559
     560        * svg/graphics/SVGImage.cpp:
     561        (WebCore::SVGImage::draw): Added missing call to do layout. I ran
     562        into this while doing some layout tests while URL processing was broken.
     563        (WebCore::SVGImage::dataChanged): Use a null URL rather than an arbitrary
     564        string for the document.
     565
     566        * xml/XMLHttpRequest.cpp:
     567        (WebCore::XMLHttpRequest::getResponseXML): Removed DeprecatedString use.
     568        (WebCore::XMLHttpRequest::urlMatchesDocumentDomain): Ditto.
     569        (WebCore::XMLHttpRequest::open): Ditto.
     570        (WebCore::XMLHttpRequest::send):  Namespace change.
     571        (WebCore::XMLHttpRequest::dropProtection): Ditto.
     572        * xml/XMLHttpRequest.h: Removed DeprecatedString use.
     573
     574        * xml/XSLImportRule.cpp:
     575        (WebCore::XSLImportRule::loadSheet): Removed DeprecatedString use.
     576        * xml/XSLStyleSheet.cpp:
     577        (WebCore::XSLStyleSheet::loadChildSheets): Ditto.
     578        (WebCore::XSLStyleSheet::loadChildSheet): Ditto.
     579        * xml/XSLStyleSheet.h: Ditto.
     580        * xml/XSLTProcessor.cpp:
     581        (WebCore::docLoaderFunc): Ditto.
     582        (WebCore::xsltStylesheetPointer): Ditto.
     583        (WebCore::xmlDocPtrFromNode): Ditto.
     584
    15852008-02-14  Ada Chan  <adachan@apple.com>
    2586
  • trunk/WebCore/WebCore.base.exp

    r30196 r30243  
    360360__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
    361361__ZN7WebCore21reportThreadViolationEPKc
     362__ZN7WebCore24decodeURLEscapeSequencesERKNS_6StringE
    362363__ZN7WebCore24notifyHistoryItemChangedE
    363364__ZN7WebCore26CSSMutableStyleDeclarationC1Ev
     
    372373__ZN7WebCore4FontD1Ev
    373374__ZN7WebCore4FontaSERKS0_
    374 __ZN7WebCore4KURL13decode_stringERKNS_16DeprecatedStringE
    375375__ZN7WebCore4KURLC1EP5NSURL
    376 __ZN7WebCore4KURLC1ERKNS_16DeprecatedStringE
     376__ZN7WebCore4KURLC1ERKNS_6StringE
    377377__ZN7WebCore4KURLC1Ev
    378378__ZN7WebCore4Node17stopIgnoringLeaksEv
     
    459459__ZN7WebCore7IntSizeC1ERK7_NSSize
    460460__ZN7WebCore7nsColorERKNS_5ColorE
    461 __ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
     461__ZN7WebCore8Document11completeURLERKNS_6StringE
    462462__ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
    463463__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
     
    539539__ZN7WebCore9pageCacheEv
    540540__ZN7WebCoreeqERKNS_19ResourceRequestBaseES2_
    541 __ZN7WebCoreeqERKNS_4KURLES2_
    542541__ZNK7WebCore11CachedImage5imageEv
    543542__ZNK7WebCore11ContextMenu19platformDescriptionEv
     
    637636__ZNK7WebCore4KURL4hostEv
    638637__ZNK7WebCore4KURL4pathEv
    639 __ZNK7WebCore4KURL8getNSURLEv
     638__ZNK7WebCore4KURLcvP5NSURLEv
    640639__ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
    641640__ZNK7WebCore5Frame10isFrameSetEv
  • trunk/WebCore/bindings/js/JSAttrCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "JSAttr.h"
    3131
    32 #include "Attr.h"
    33 #include "Document.h"
    34 #include "ExceptionCode.h"
    3532#include "HTMLFrameElementBase.h"
    3633#include "HTMLNames.h"
    37 #include "PlatformString.h"
    38 #include "kjs_binding.h"
    39 #include "kjs_dom.h"
     34
     35using namespace KJS;
    4036
    4137namespace WebCore {
     
    4339using namespace HTMLNames;
    4440
    45 void JSAttr::setValue(KJS::ExecState* exec, KJS::JSValue* value)
     41void JSAttr::setValue(ExecState* exec, JSValue* value)
    4642{
    4743    Attr* imp = static_cast<Attr*>(impl());
     
    4945
    5046    Element* ownerElement = imp->ownerElement();
    51     if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag)) && equalIgnoringCase(imp->name(), "src") && attrValue.startsWith("javascript:", false)) {
    52         HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(ownerElement);
    53         if (!checkNodeSecurity(exec, frame->contentDocument()))
    54             return;
     47    if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag))) {
     48        if (equalIgnoringCase(imp->name(), "src") && protocolIs(attrValue, "javascript")) {
     49            if (!checkNodeSecurity(exec, static_cast<HTMLFrameElementBase*>(ownerElement)->contentDocument()))
     50                return;
     51        }
    5552    }
    5653
    5754    ExceptionCode ec = 0;
    5855    imp->setValue(attrValue, ec);
    59     KJS::setDOMException(exec, ec);
     56    setDOMException(exec, ec);
    6057}
    6158
  • trunk/WebCore/bindings/js/JSAudioConstructor.h

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3434namespace WebCore {
    3535
    36     class JSAudioConstructor : public KJS::DOMObject {
     36    class JSAudioConstructor : public DOMObject {
    3737    public:
    3838        JSAudioConstructor(KJS::ExecState*, Document*);
  • trunk/WebCore/bindings/js/JSCSSRuleCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232#include "CSSMediaRule.h"
    3333#include "CSSPageRule.h"
    34 #include "CSSRule.h"
    3534#include "CSSStyleRule.h"
    3635#include "JSCSSCharsetRule.h"
     
    4039#include "JSCSSPageRule.h"
    4140#include "JSCSSStyleRule.h"
    42 #include "kjs_binding.h"
     41
     42using namespace KJS;
    4343
    4444namespace WebCore {
    4545
    46 KJS::JSValue* toJS(KJS::ExecState* exec, CSSRule* rule)
     46JSValue* toJS(ExecState* exec, CSSRule* rule)
    4747{
    4848    if (!rule)
    49         return KJS::jsNull();
     49        return jsNull();
    5050
    51     KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(rule);
     51    DOMObject* ret = ScriptInterpreter::getDOMObject(rule);
    5252
    5353    if (ret)
     
    7878    }
    7979
    80     KJS::ScriptInterpreter::putDOMObject(rule, ret);
     80    ScriptInterpreter::putDOMObject(rule, ret);
    8181    return ret;
    8282}
  • trunk/WebCore/bindings/js/JSCSSValueCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#include "CSSPrimitiveValue.h"
    30 #include "CSSValue.h"
    3130#include "CSSValueList.h"
    3231#include "JSCSSPrimitiveValue.h"
    3332#include "JSCSSValueList.h"
    34 #include "kjs_binding.h"
    3533
    3634#if ENABLE(SVG)
     
    4139#endif
    4240
     41using namespace KJS;
     42
    4343namespace WebCore {
    4444
    45 KJS::JSValue* toJS(KJS::ExecState* exec, CSSValue* value)
     45JSValue* toJS(ExecState* exec, CSSValue* value)
    4646{
    4747    if (!value)
    48         return KJS::jsNull();
     48        return jsNull();
    4949
    50     KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(value);
     50    DOMObject* ret = ScriptInterpreter::getDOMObject(value);
    5151
    5252    if (ret)
     
    6666        ret = new JSCSSValue(JSCSSValuePrototype::self(exec), value);
    6767
    68     KJS::ScriptInterpreter::putDOMObject(value, ret);
     68    ScriptInterpreter::putDOMObject(value, ret);
    6969    return ret;
    7070}
  • trunk/WebCore/bindings/js/JSDocumentCustom.cpp

    r29663 r30243  
    2222
    2323#include "DOMWindow.h"
    24 #include "Document.h"
    2524#include "Frame.h"
    2625#include "FrameLoader.h"
     
    2928#include "JSHTMLDocument.h"
    3029#include "JSLocation.h"
    31 #include "kjs_binding.h"
    3230#include "kjs_proxy.h"
    3331
     
    3735#endif
    3836
     37using namespace KJS;
     38
    3939namespace WebCore {
    40 
    41 using namespace KJS;
    4240
    4341void JSDocument::mark()
     
    5351        return jsNull();
    5452
    55     KJS::Window* win = KJS::Window::retrieveWindow(frame);
     53    Window* win = Window::retrieveWindow(frame);
    5654    ASSERT(win);
    5755    return win->location();
     
    7068    Frame* activeFrame = static_cast<JSDOMWindow*>(exec->dynamicGlobalObject())->impl()->frame();
    7169    if (activeFrame)
    72         str = activeFrame->document()->completeURL(str);
     70        str = activeFrame->document()->completeURL(str).string();
    7371
    7472    bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
     
    9795    // back/forward cache.
    9896    if (doc->frame())
    99         KJS::Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
     97        Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
    10098    else {
    10199        size_t nodeCount = 0;
  • trunk/WebCore/bindings/js/JSElementCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#include "JSElement.h"
    3232
    33 #include "Attr.h"
    34 #include "Document.h"
    35 #include "Element.h"
    3633#include "ExceptionCode.h"
    3734#include "HTMLFrameElementBase.h"
    3835#include "HTMLNames.h"
    39 #include "PlatformString.h"
    40 #include "kjs_binding.h"
    41 #include "kjs_dom.h"
     36
     37using namespace KJS;
    4238
    4339namespace WebCore {
     
    4541using namespace HTMLNames;
    4642
    47 static inline bool allowSettingSrcToJavascriptURL(KJS::ExecState* exec, Element* element, String name, String value)
     43static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value)
    4844{
    49     if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && value.startsWith("javascript:", false)) {
     45    if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIs(value, "javascript")) {
    5046        HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(element);
    5147        if (!checkNodeSecurity(exec, frame->contentDocument()))
     
    5551}
    5652
    57 KJS::JSValue* JSElement::setAttribute(KJS::ExecState* exec, const KJS::List& args)
     53JSValue* JSElement::setAttribute(ExecState* exec, const List& args)
    5854{
    5955    ExceptionCode ec = 0;
     
    6359    Element* imp = impl();
    6460    if (!allowSettingSrcToJavascriptURL(exec, imp, name, value))
    65         return KJS::jsUndefined();
     61        return jsUndefined();
    6662
    6763    imp->setAttribute(name, value, ec);
    68     KJS::setDOMException(exec, ec);
    69     return KJS::jsUndefined();
     64    setDOMException(exec, ec);
     65    return jsUndefined();
    7066}
    7167
    72 KJS::JSValue* JSElement::setAttributeNode(KJS::ExecState* exec, const KJS::List& args)
     68JSValue* JSElement::setAttributeNode(ExecState* exec, const List& args)
    7369{
    7470    ExceptionCode ec = 0;
     
    7773    if (!newAttrOk) {
    7874        setDOMException(exec, TYPE_MISMATCH_ERR);
    79         return KJS::jsUndefined();
     75        return jsUndefined();
    8076    }
    8177
    8278    Element* imp = impl();
    8379    if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
    84         return KJS::jsUndefined();
     80        return jsUndefined();
    8581
    86     KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
    87     KJS::setDOMException(exec, ec);
     82    JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
     83    setDOMException(exec, ec);
    8884    return result;
    8985}
    9086
    91 KJS::JSValue* JSElement::setAttributeNS(KJS::ExecState* exec, const KJS::List& args)
     87JSValue* JSElement::setAttributeNS(ExecState* exec, const List& args)
    9288{
    9389    ExceptionCode ec = 0;
     
    9894    Element* imp = impl();
    9995    if (!allowSettingSrcToJavascriptURL(exec, imp, qualifiedName, value))
    100         return KJS::jsUndefined();
     96        return jsUndefined();
    10197
    10298    imp->setAttributeNS(namespaceURI, qualifiedName, value, ec);
    103     KJS::setDOMException(exec, ec);
    104     return KJS::jsUndefined();
     99    setDOMException(exec, ec);
     100    return jsUndefined();
    105101}
    106102
    107 KJS::JSValue* JSElement::setAttributeNodeNS(KJS::ExecState* exec, const KJS::List& args)
     103JSValue* JSElement::setAttributeNodeNS(ExecState* exec, const List& args)
    108104{
    109105    ExceptionCode ec = 0;
     
    111107    Attr* newAttr = toAttr(args[0], newAttrOk);
    112108    if (!newAttrOk) {
    113         KJS::setDOMException(exec, TYPE_MISMATCH_ERR);
    114         return KJS::jsUndefined();
     109        setDOMException(exec, TYPE_MISMATCH_ERR);
     110        return jsUndefined();
    115111    }
    116112
    117113    Element* imp = impl();
    118114    if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
    119         return KJS::jsUndefined();
     115        return jsUndefined();
    120116
    121     KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
    122     KJS::setDOMException(exec, ec);
     117    JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
     118    setDOMException(exec, ec);
    123119    return result;
    124120}
  • trunk/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "JSHTMLFrameElement.h"
    3131
    32 #include "Document.h"
    3332#include "HTMLFrameElement.h"
    34 #include "PlatformString.h"
    35 #include "kjs_binding.h"
    36 #include "kjs_dom.h"
     33
     34using namespace KJS;
    3735
    3836namespace WebCore {
    3937
    40 static inline bool allowSettingJavascriptURL(KJS::ExecState* exec, HTMLFrameElement* imp, String value)
     38static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* imp, const String& value)
    4139{
    42     if (value.startsWith("javascript:", false)) {
     40    if (protocolIs(value, "javascript")) {
    4341        if (!checkNodeSecurity(exec, imp->contentDocument()))
    4442            return false;
     
    4745}
    4846
    49 void JSHTMLFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
     47void JSHTMLFrameElement::setSrc(ExecState* exec, JSValue* value)
    5048{
    5149    HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl());
    52     String srcValue = KJS::valueToStringWithNullCheck(exec, value);
     50    String srcValue = valueToStringWithNullCheck(exec, value);
    5351
    5452    if (!allowSettingJavascriptURL(exec, imp, srcValue))
     
    5957}
    6058
    61 void JSHTMLFrameElement::setLocation(KJS::ExecState* exec, KJS::JSValue* value)
     59void JSHTMLFrameElement::setLocation(ExecState* exec, JSValue* value)
    6260{
    6361    HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl());
    64     String locationValue = KJS::valueToStringWithNullCheck(exec, value);
     62    String locationValue = valueToStringWithNullCheck(exec, value);
    6563
    6664    if (!allowSettingJavascriptURL(exec, imp, locationValue))
  • trunk/WebCore/bindings/js/JSHTMLIFrameElementCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030#include "JSHTMLIFrameElement.h"
    3131
    32 #include "Document.h"
    3332#include "HTMLIFrameElement.h"
    34 #include "PlatformString.h"
    35 #include "kjs_binding.h"
    36 #include "kjs_dom.h"
     33
     34using namespace KJS;
    3735
    3836namespace WebCore {
    3937
    40 void JSHTMLIFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
     38void JSHTMLIFrameElement::setSrc(ExecState* exec, JSValue* value)
    4139{
    4240    HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
    43     String srcValue = KJS::valueToStringWithNullCheck(exec, value);
    44     if (srcValue.startsWith("javascript:", false)) {
     41
     42    String srcValue = valueToStringWithNullCheck(exec, value);
     43
     44    if (protocolIs(srcValue, "javascript")) {
    4545        if (!checkNodeSecurity(exec, imp->contentDocument()))
    4646            return;
     
    4848
    4949    imp->setSrc(srcValue);
    50     return;
    5150}
    5251
  • trunk/WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp

    r30040 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    2626#include "Text.h"
    2727
     28using namespace KJS;
     29
    2830namespace WebCore {
    2931
    30 using namespace KJS;
    31 
    32 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* d)
    33     : KJS::DOMObject(exec->lexicalGlobalObject()->objectPrototype())
    34     , m_doc(d)
     32JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document)
     33    : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
     34    , m_document(document)
    3535{
    3636    putDirect(exec->propertyNames().length, jsNumber(4), ReadOnly|DontDelete|DontEnum);
     
    4444JSObject* JSHTMLOptionElementConstructor::construct(ExecState* exec, const List& args)
    4545{
    46     int exception = 0;
    47     RefPtr<Element> el(m_doc->createElement("option", exception));
    48     HTMLOptionElement* opt = 0;
    49     if (el) {
    50         opt = static_cast<HTMLOptionElement*>(el.get());
    51         int sz = args.size();
    52         RefPtr<Text> text = m_doc->createTextNode("");
    53         opt->appendChild(text, exception);
    54         if (exception == 0 && sz > 0)
    55             text->setData(args[0]->toString(exec), exception);
    56         if (exception == 0 && sz > 1)
    57             opt->setValue(args[1]->toString(exec));
    58         if (exception == 0 && sz > 2)
    59             opt->setDefaultSelected(args[2]->toBoolean(exec));
    60         if (exception == 0 && sz > 3)
    61             opt->setSelected(args[3]->toBoolean(exec));
     46    ExceptionCode ec = 0;
     47
     48    RefPtr<HTMLOptionElement> element = static_pointer_cast<HTMLOptionElement>(m_document->createElement("option", ec));
     49    if (element) {
     50        RefPtr<Text> text = m_document->createTextNode("");
     51        if (!args[0]->isUndefined())
     52            text->setData(args[0]->toString(exec), ec);
     53        if (ec == 0)
     54            element->appendChild(text.release(), ec);
     55        if (ec == 0 && !args[1]->isUndefined())
     56            element->setValue(args[1]->toString(exec));
     57        if (ec == 0)
     58            element->setDefaultSelected(args[2]->toBoolean(exec));
     59        if (ec == 0)
     60            element->setSelected(args[3]->toBoolean(exec));
    6261    }
    6362
    64     setDOMException(exec, exception);
    65     return static_cast<JSObject*>(toJS(exec, opt));
     63    setDOMException(exec, ec);
     64    if (ec || !element)
     65        return 0;
     66
     67    return static_cast<JSObject*>(toJS(exec, element.release()));
    6668}
    6769
  • trunk/WebCore/bindings/js/JSHTMLOptionElementConstructor.h

    r29663 r30243  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc.
     2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    2626namespace WebCore {
    2727
    28     class JSHTMLOptionElementConstructor : public KJS::DOMObject {
     28    class JSHTMLOptionElementConstructor : public DOMObject {
    2929    public:
    3030        JSHTMLOptionElementConstructor(KJS::ExecState*, Document*);
    3131        virtual bool implementsConstruct() const;
    32         virtual KJS::JSObject *construct(KJS::ExecState*, const KJS::List& args);
     32        virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List& args);
    3333    private:
    34         RefPtr<Document> m_doc;
     34        RefPtr<Document> m_document;
    3535    };
    3636
  • trunk/WebCore/bindings/js/JSLocation.cpp

    r30157 r30243  
    2727#include "Frame.h"
    2828#include "FrameLoader.h"
    29 #include "PlatformString.h"
    3029#include "kjs_proxy.h"
    3130#include "kjs_window.h"
     
    138137    return;
    139138
    140   DeprecatedString str = value->toString(exec);
     139  String str = value->toString(exec);
    141140  KURL url = m_frame->loader()->url();
    142141  bool sameDomainAccess = allowsAccessFromFrame(exec, m_frame);
     
    153152      switch (entry->value.intValue) {
    154153      case Href: {
     154          // FIXME: Why isn't this security check needed for the other properties, like Host, below?
    155155          Frame* frame = Window::retrieveActive(exec)->impl()->frame();
    156156          if (!frame)
     
    161161          break;
    162162      }
    163       case Hash: {
     163      case Hash:
    164164          if (str.startsWith("#"))
    165               str = str.mid(1);
     165              str = str.substring(1);
    166166          if (url.ref() == str)
    167167              return;
    168168          url.setRef(str);
    169169          break;
    170       }
    171       case Host: {
     170      case Host:
    172171          url.setHostAndPort(str);
    173172          break;
    174       }
    175173      case Hostname:
    176174          url.setHost(str);
     
    179177          url.setPath(str);
    180178          break;
    181       case Port:
    182           url.setPort(str.toUInt());
    183           break;
     179      case Port: {
     180          // FIXME: Could make this a little less ugly if String provided a toUnsignedShort function.
     181          int port = str.toInt();
     182          if (port < 0 || port > 0xFFFF)
     183              port = 0;
     184          url.setPort(port);
     185          break;
     186      }
    184187      case Protocol:
    185188          url.setProtocol(str);
     
    200203
    201204  Frame* activeFrame = Window::retrieveActive(exec)->impl()->frame();
    202   if (!url.deprecatedString().startsWith("javascript:", false) || sameDomainAccess) {
     205  if (!url.protocolIs("javascript") || sameDomainAccess) {
    203206    bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
    204207    m_frame->loader()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), false, userGesture);
     
    235238        if (!activeFrame->loader()->shouldAllowNavigation(frame))
    236239            return jsUndefined();
    237         DeprecatedString str = args[0]->toString(exec);
     240        String str = args[0]->toString(exec);
    238241        const Window* window = Window::retrieveWindow(frame);
    239         if (!str.startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {
     242        if (!protocolIs(str, "javascript") || (window && window->allowsAccessFrom(exec))) {
    240243            bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
    241244            frame->loader()->scheduleLocationChange(activeFrame->loader()->completeURL(str).string(), activeFrame->loader()->outgoingReferrer(), true, userGesture);
     
    259262        return jsUndefined();
    260263
    261     if (!frame->loader()->url().deprecatedString().startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {
     264    if (!frame->loader()->url().protocolIs("javascript") || (window && window->allowsAccessFrom(exec))) {
    262265        bool userGesture = Window::retrieveActive(exec)->impl()->frame()->scriptProxy()->processingUserGesture();
    263266        frame->loader()->scheduleRefresh(userGesture);
     
    281284        const Window* window = Window::retrieveWindow(frame);
    282285        String dstUrl = activeFrame->loader()->completeURL(args[0]->toString(exec)).string();
    283         if (!dstUrl.startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {
     286        if (!protocolIs(dstUrl, "javascript") || (window && window->allowsAccessFrom(exec))) {
    284287            bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
    285288            // We want a new history item if this JS was called via a user gesture
  • trunk/WebCore/bindings/js/JSLocation.h

    r30157 r30243  
    3131    class Frame;
    3232
    33     class JSLocation : public KJS::DOMObject {
    34         typedef KJS::DOMObject Base;
     33    class JSLocation : public DOMObject {
     34        typedef DOMObject Base;
    3535
    3636        friend class KJS::Window;
  • trunk/WebCore/bindings/js/JSNamedNodeMapCustom.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#include "NamedNodeMap.h"
    30 #include "PlatformString.h"
    3130#include "kjs_binding.h"
    3231#include "kjs_dom.h"
    3332
     33using namespace KJS;
     34
    3435namespace WebCore {
    3536
    36 bool JSNamedNodeMap::canGetItemsForName(KJS::ExecState*, NamedNodeMap* impl, const KJS::Identifier& propertyName)
     37bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, const Identifier& propertyName)
    3738{
    3839    return impl->getNamedItem(propertyName);
    3940}
    4041
    41 KJS::JSValue* JSNamedNodeMap::nameGetter(KJS::ExecState* exec, KJS::JSObject* originalObject, const KJS::Identifier& propertyName, const KJS::PropertySlot& slot)
     42JSValue* JSNamedNodeMap::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
    4243{
    4344    JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(slot.slotBase());
    44     return KJS::toJS(exec, thisObj->impl()->getNamedItem(propertyName));
     45    return toJS(exec, thisObj->impl()->getNamedItem(propertyName));
    4546}
    4647
  • trunk/WebCore/bindings/js/JSNamedNodesCollection.cpp

    r29663 r30243  
    4242// so it shouldn't be a problem that it's storing all the nodes (with the same name). (David)
    4343JSNamedNodesCollection::JSNamedNodesCollection(KJS::JSObject* prototype, const Vector<RefPtr<Node> >& nodes)
    44     : KJS::DOMObject(prototype)
     44    : DOMObject(prototype)
    4545    , m_nodes(nodes)
    4646{
  • trunk/WebCore/bindings/js/JSNamedNodesCollection.h

    r29663 r30243  
    3636    // Internal class, used for the collection return by e.g. document.forms.myinput
    3737    // when multiple nodes have the same name.
    38     class JSNamedNodesCollection : public KJS::DOMObject {
     38    class JSNamedNodesCollection : public DOMObject {
    3939    public:
    4040        JSNamedNodesCollection(KJS::JSObject* prototype, const Vector<RefPtr<Node> >&);
  • trunk/WebCore/bindings/js/JSXMLHttpRequest.cpp

    r29508 r30243  
    3232#include "kjs_window.h"
    3333
     34using namespace KJS;
     35using namespace WebCore;
     36
    3437#include "JSXMLHttpRequest.lut.h"
    3538
    36 namespace KJS {
    37 
    38 using namespace WebCore;
    39 
    40 ////////////////////// JSXMLHttpRequest Object ////////////////////////
     39namespace WebCore {
    4140
    4241/* Source for JSXMLHttpRequestPrototypeTable.
     
    251250}
    252251
    253 
    254252JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState* exec, JSObject* thisObj, const List& args)
    255253{
     
    267265    if (!frame)
    268266        return jsUndefined();
    269     KURL url = frame->loader()->completeURL(DeprecatedString(args[1]->toString(exec)));
     267    KURL url = frame->loader()->completeURL(args[1]->toString(exec));
    270268
    271269    bool async = true;
     
    299297
    300298    if (args.size() >= 1) {
    301         if (args[0]->toObject(exec)->inherits(&JSDocument::info)) {
    302             Document* doc = static_cast<Document*>(static_cast<JSDocument*>(args[0]->toObject(exec))->impl());
    303             body = doc->toString().deprecatedString();
    304         } else {
     299        if (args[0]->toObject(exec)->inherits(&JSDocument::info))
     300            body = static_cast<Document*>(static_cast<JSDocument*>(args[0]->toObject(exec))->impl())->toString();
     301        else {
    305302            // converting certain values (like null) to object can set an exception
    306303            if (exec->hadException())
  • trunk/WebCore/bindings/js/JSXMLHttpRequest.h

    r29508 r30243  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    3  *  This file is part of the KDE libraries
    4  *  Copyright (C) 2003 Apple Computer, Inc.
     2 *  Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
    53 *  Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
    64 *
     
    3028class Document;
    3129
    32 }
    33 
    34 namespace KJS {
    35 
    3630class JSXMLHttpRequestConstructorImp : public DOMObject {
    3731public:
    38     JSXMLHttpRequestConstructorImp(ExecState*, WebCore::Document*);
     32    JSXMLHttpRequestConstructorImp(KJS::ExecState*, Document*);
    3933
    4034    virtual bool implementsConstruct() const;
    41     virtual JSObject* construct(ExecState*, const List&);
     35    virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
    4236
    4337private:
    44     RefPtr<WebCore::Document> doc;
     38    RefPtr<Document> doc;
    4539};
    4640
    4741class JSXMLHttpRequest : public DOMObject {
    4842public:
    49     JSXMLHttpRequest(JSObject* prototype, WebCore::Document*);
     43    JSXMLHttpRequest(KJS::JSObject* prototype, Document*);
    5044    ~JSXMLHttpRequest();
    5145
    52     virtual const ClassInfo* classInfo() const { return &info; }
    53     static const ClassInfo info;
     46    virtual const KJS::ClassInfo* classInfo() const { return &info; }
     47    static const KJS::ClassInfo info;
    5448    enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status,
    5549        StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader, OverrideMIMEType,
    5650        AddEventListener, RemoveEventListener, DispatchEvent };
    5751
    58     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
    59     JSValue* getValueProperty(ExecState*, int token) const;
    60     virtual void put(ExecState*, const Identifier& propertyName, JSValue* value, int attr = None);
    61     void putValueProperty(ExecState*, int token, JSValue* value, int /*attr*/);
    62     virtual bool toBoolean(ExecState*) const { return true; }
     52    virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
     53    KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;
     54    virtual void put(KJS::ExecState*, const KJS::Identifier& propertyName, KJS::JSValue*, int attr);
     55    void putValueProperty(KJS::ExecState*, int token, KJS::JSValue*, int attr);
     56    virtual bool toBoolean(KJS::ExecState*) const { return true; }
    6357    virtual void mark();
    6458
    65     WebCore::XMLHttpRequest* impl() const { return m_impl.get(); }
     59    XMLHttpRequest* impl() const { return m_impl.get(); }
    6660
    6761private:
    68     RefPtr<WebCore::XMLHttpRequest> m_impl;
     62    RefPtr<XMLHttpRequest> m_impl;
    6963};
    7064
    71 JSValue* jsXMLHttpRequestPrototypeFunctionAbort(ExecState*, JSObject*, const List&);
    72 JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(ExecState*, JSObject*, const List&);
    73 JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(ExecState*, JSObject*, const List&);
    74 JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState*, JSObject*, const List&);
    75 JSValue* jsXMLHttpRequestPrototypeFunctionSend(ExecState*, JSObject*, const List&);
    76 JSValue* jsXMLHttpRequestPrototypeFunctionSetRequestHeader(ExecState*, JSObject*, const List&);
    77 JSValue* jsXMLHttpRequestPrototypeFunctionOverrideMIMEType(ExecState*, JSObject*, const List&);
    78 JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(ExecState*, JSObject*, const List&);
    79 JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(ExecState*, JSObject*, const List&);
    80 JSValue* jsXMLHttpRequestPrototypeFunctionDispatchEvent(ExecState*, JSObject*, const List&);
     65KJS::JSValue* jsXMLHttpRequestPrototypeFunctionAbort(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     66KJS::JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     67KJS::JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     68KJS::JSValue* jsXMLHttpRequestPrototypeFunctionOpen(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     69KJS::JSValue* jsXMLHttpRequestPrototypeFunctionSend(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     70KJS::JSValue* jsXMLHttpRequestPrototypeFunctionSetRequestHeader(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     71KJS::JSValue* jsXMLHttpRequestPrototypeFunctionOverrideMIMEType(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     72KJS::JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     73KJS::JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     74KJS::JSValue* jsXMLHttpRequestPrototypeFunctionDispatchEvent(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
    8175
    82 } // namespace KJS
     76} // namespace WebCore
    8377
    8478#endif // JSXMLHttpRequest_h
  • trunk/WebCore/bindings/js/JSXSLTProcessor.cpp

    r29508 r30243  
    11/*
    2  * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131
    3232#include "XSLTProcessor.h"
    33 #include "JSXSLTProcessor.lut.h"
    3433#include "kjs_dom.h"
    3534#include "JSDocument.h"
     
    3736#include "DocumentFragment.h"
    3837
     38using namespace KJS;
    3939using namespace WebCore;
    4040
    41 namespace KJS {
     41#include "JSXSLTProcessor.lut.h"
     42
     43namespace WebCore {
    4244
    4345const ClassInfo JSXSLTProcessor::info = { "XSLTProcessor", 0, 0 };
     
    7274JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState* exec, JSObject* thisObj, const List& args)
    7375{
    74     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     76    if (!thisObj->inherits(&JSXSLTProcessor::info))
    7577        return throwError(exec, TypeError);
    7678    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    8890JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState* exec, JSObject* thisObj, const List& args)
    8991{
    90     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     92    if (!thisObj->inherits(&JSXSLTProcessor::info))
    9193        return throwError(exec, TypeError);
    9294    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    105107JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState* exec, JSObject* thisObj, const List& args)
    106108{
    107     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     109    if (!thisObj->inherits(&JSXSLTProcessor::info))
    108110        return throwError(exec, TypeError);
    109111    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    123125JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(ExecState* exec, JSObject* thisObj, const List& args)
    124126{
    125     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     127    if (!thisObj->inherits(&JSXSLTProcessor::info))
    126128        return throwError(exec, TypeError);
    127129    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    138140JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(ExecState* exec, JSObject* thisObj, const List& args)
    139141{
    140     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     142    if (!thisObj->inherits(&JSXSLTProcessor::info))
    141143        return throwError(exec, TypeError);
    142144    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    154156JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState* exec, JSObject* thisObj, const List& args)
    155157{
    156     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     158    if (!thisObj->inherits(&JSXSLTProcessor::info))
    157159        return throwError(exec, TypeError);
    158160    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    168170JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(ExecState* exec, JSObject* thisObj, const List& args)
    169171{
    170     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     172    if (!thisObj->inherits(&JSXSLTProcessor::info))
    171173        return throwError(exec, TypeError);
    172174    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    178180JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState* exec, JSObject* thisObj, const List& args)
    179181{
    180     if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
     182    if (!thisObj->inherits(&JSXSLTProcessor::info))
    181183        return throwError(exec, TypeError);
    182184    XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
     
    186188}
    187189
    188 XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState *exec)
     190XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState* exec)
    189191    : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
    190192{
  • trunk/WebCore/bindings/js/JSXSLTProcessor.h

    r29508 r30243  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232
    3333namespace WebCore {
    34     class XSLTProcessor;
    35 }
     34
     35class XSLTProcessor;
    3636
    3737// Eventually we should implement XSLTException:
     
    3939// http://bugs.webkit.org/show_bug.cgi?id=5446
    4040
    41 namespace KJS {
    42 
    4341class JSXSLTProcessor : public DOMObject {
    4442public:
    45     JSXSLTProcessor(JSObject* prototype);
     43    JSXSLTProcessor(KJS::JSObject* prototype);
    4644    ~JSXSLTProcessor();
    4745   
    48     virtual const ClassInfo *classInfo() const { return &info; }
    49     static const ClassInfo info;
     46    virtual const KJS::ClassInfo* classInfo() const { return &info; }
     47    static const KJS::ClassInfo info;
    5048
    51     WebCore::XSLTProcessor *impl() const { return m_impl.get(); }
     49    XSLTProcessor* impl() const { return m_impl.get(); }
     50
    5251private:
    53     RefPtr<WebCore::XSLTProcessor> m_impl;
     52    RefPtr<XSLTProcessor> m_impl;
    5453};
    5554
    5655class XSLTProcessorConstructorImp : public DOMObject {
    5756public:
    58     XSLTProcessorConstructorImp(ExecState*);
     57    XSLTProcessorConstructorImp(KJS::ExecState*);
    5958
    6059    virtual bool implementsConstruct() const;
    61     virtual JSObject* construct(ExecState*, const List&);
     60    virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
    6261};
    6362
    64 JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState*, JSObject*, const List&);
    65 JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState*, JSObject*, const List&);
    66 JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState*, JSObject*, const List&);
    67 JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(ExecState*, JSObject*, const List&);
    68 JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(ExecState*, JSObject*, const List&);
    69 JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState*, JSObject*, const List&);
    70 JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(ExecState*, JSObject*, const List&);
    71 JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState*, JSObject*, const List&);
     63KJS::JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     64KJS::JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     65KJS::JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     66KJS::JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     67KJS::JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     68KJS::JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     69KJS::JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
     70KJS::JSValue* jsXSLTProcessorPrototypeFunctionReset(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
    7271
    73 } // namespace KJS
     72} // namespace WebCore
    7473
    7574#endif // ENABLE(XSLT)
  • trunk/WebCore/bindings/js/kjs_binding.cpp

    r30157 r30243  
    3737#include "JSRangeException.h"
    3838#include "JSXMLHttpRequestException.h"
     39#include "KURL.h"
    3940#include "RangeException.h"
    4041#include "XMLHttpRequestException.h"
     
    5253
    5354using namespace KJS;
    54 using namespace WebCore;
     55
     56namespace WebCore {
     57
    5558using namespace HTMLNames;
    56 
    57 // FIXME: Move all this stuff into the WebCore namespace.
    58 
    59 namespace KJS {
    6059
    6160typedef HashMap<void*, DOMObject*> DOMObjectMap;
     
    263262}
    264263
     264JSValue* jsStringOrNull(const KURL& url)
     265{
     266    if (url.isNull())
     267        return jsNull();
     268    return jsString(url.string());
     269}
     270
     271JSValue* jsStringOrUndefined(const KURL& url)
     272{
     273    if (url.isNull())
     274        return jsUndefined();
     275    return jsString(url.string());
     276}
     277
     278JSValue* jsStringOrFalse(const KURL& url)
     279{
     280    if (url.isNull())
     281        return jsBoolean(false);
     282    return jsString(url.string());
     283}
     284
    265285String valueToStringWithNullCheck(ExecState* exec, JSValue* val)
    266286{
     
    321341}
    322342
    323 } // namespace KJS
    324 
    325 namespace WebCore {
    326 
    327343bool allowsAccessFromFrame(ExecState* exec, Frame* frame)
    328344{
  • trunk/WebCore/bindings/js/kjs_binding.h

    r30157 r30243  
    3232
    3333namespace WebCore {
     34
    3435    class AtomicString;
    3536    class Document;
    3637    class Event;
    3738    class Frame;
     39    class KURL;
    3840    class Node;
    3941    class String;
     
    4547    class SVGElement;
    4648#endif
    47 }
    4849
    49 namespace KJS {
    50 
    51     /**
    52      * Base class for all objects in this binding EXCEPT Window
    53      */
    54     class DOMObject : public JSObject {
     50    // Base class for all objects in this binding except Window.
     51    class DOMObject : public KJS::JSObject {
    5552    protected:
    56         explicit DOMObject(JSValue* prototype) // FIXME: this should take a JSObject once JSLocation has a real prototype
     53        explicit DOMObject(KJS::JSValue* prototype) // FIXME: this should take a JSObject once JSLocation has a real prototype
    5754            : JSObject(prototype)
    5855        {
    5956            // DOMObject destruction is not thread-safe because DOMObjects wrap
    6057            // unsafe WebCore DOM data structures.
    61             Collector::collectOnMainThreadOnly(this);
     58            KJS::Collector::collectOnMainThreadOnly(this);
    6259        }
    6360
     
    7067    };
    7168
    72     class ScriptInterpreter : public Interpreter {
     69    class ScriptInterpreter : public KJS::Interpreter {
    7370    public:
    7471        static DOMObject* getDOMObject(void* objectHandle);
     
    7673        static void forgetDOMObject(void* objectHandle);
    7774
    78         static WebCore::JSNode* getDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
    79         static void putDOMNodeForDocument(WebCore::Document*, WebCore::Node*, WebCore::JSNode* nodeWrapper);
    80         static void forgetDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
    81         static void forgetAllDOMNodesForDocument(WebCore::Document*);
    82         static void updateDOMNodeDocument(WebCore::Node*, WebCore::Document* oldDoc, WebCore::Document* newDoc);
    83         static void markDOMNodesForDocument(WebCore::Document*);
     75        static JSNode* getDOMNodeForDocument(Document*, Node*);
     76        static void putDOMNodeForDocument(Document*, Node*, JSNode* nodeWrapper);
     77        static void forgetDOMNodeForDocument(Document*, Node*);
     78        static void forgetAllDOMNodesForDocument(Document*);
     79        static void updateDOMNodeDocument(Node*, Document* oldDoc, Document* newDoc);
     80        static void markDOMNodesForDocument(Document*);
    8481    };
    8582
    86     /**
    87      * Retrieve from cache, or create, a JS object around a DOM object
    88      */
    89     template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline JSValue* cacheDOMObject(ExecState* exec, DOMObj* domObj)
     83    // Retrieve from cache, or create, a JS wrapper for a DOM object.
     84    template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline KJS::JSValue* cacheDOMObject(KJS::ExecState* exec, DOMObj* domObj)
    9085    {
    9186        if (!domObj)
    92             return jsNull();
     87            return KJS::jsNull();
    9388        if (DOMObject* ret = ScriptInterpreter::getDOMObject(domObj))
    9489            return ret;
     
    9994
    10095#if ENABLE(SVG)
    101     /**
    102      * Retrieve from cache, or create, a JS object around a SVG DOM object
    103      */
    104     template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline JSValue* cacheSVGDOMObject(ExecState* exec, DOMObj* domObj, WebCore::SVGElement* context)
     96    // Retrieve from cache, or create, a JS wrapper for an SVG DOM object.
     97    template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline KJS::JSValue* cacheSVGDOMObject(KJS::ExecState* exec, DOMObj* domObj, SVGElement* context)
    10598    {
    10699        if (!domObj)
    107             return jsNull();
     100            return KJS::jsNull();
    108101        if (DOMObject* ret = ScriptInterpreter::getDOMObject(domObj))
    109102            return ret;
     
    115108
    116109    // Convert a DOM implementation exception code into a JavaScript exception in the execution state.
    117     void setDOMException(ExecState*, WebCore::ExceptionCode);
     110    void setDOMException(KJS::ExecState*, ExceptionCode);
    118111
    119112    // Helper class to call setDOMException on exit without adding lots of separate calls to that function.
    120113    class DOMExceptionTranslator : Noncopyable {
    121114    public:
    122         explicit DOMExceptionTranslator(ExecState* exec) : m_exec(exec), m_code(0) { }
     115        explicit DOMExceptionTranslator(KJS::ExecState* exec) : m_exec(exec), m_code(0) { }
    123116        ~DOMExceptionTranslator() { setDOMException(m_exec, m_code); }
    124         operator WebCore::ExceptionCode&() { return m_code; }
     117        operator ExceptionCode&() { return m_code; }
    125118    private:
    126         ExecState* m_exec;
    127         WebCore::ExceptionCode m_code;
     119        KJS::ExecState* m_exec;
     120        ExceptionCode m_code;
    128121    };
    129122
    130     JSValue* jsStringOrNull(const WebCore::String&); // null if the string is null
    131     JSValue* jsStringOrUndefined(const WebCore::String&); // undefined if the string is null
    132     JSValue* jsStringOrFalse(const WebCore::String&); // boolean false if the string is null
     123    KJS::JSValue* jsStringOrNull(const String&); // null if the string is null
     124    KJS::JSValue* jsStringOrNull(const KURL&); // null if the URL is null
    133125
    134     // see JavaScriptCore for explanation should be used for UString that is already owned
    135     // by another object, so that collecting the JSString wrapper is unlikely to save memory.
    136     JSValue* jsOwnedStringOrNull(const KJS::UString&);
     126    KJS::JSValue* jsStringOrUndefined(const String&); // undefined if the string is null
     127    KJS::JSValue* jsStringOrUndefined(const KURL&); // undefined if the URL is null
    137128
    138     WebCore::String valueToStringWithNullCheck(ExecState*, JSValue*); // null String if the value is null
    139     WebCore::String valueToStringWithUndefinedOrNullCheck(ExecState*, JSValue*); // null String if the value is null or undefined
     129    KJS::JSValue* jsStringOrFalse(const String&); // boolean false if the string is null
     130    KJS::JSValue* jsStringOrFalse(const KURL&); // boolean false if the URL is null
    140131
    141     template <typename T> inline JSValue* toJS(ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
     132    // See JavaScriptCore for explanation: Should be used for any UString that is already owned by another
     133    // object, to let the engine know that collecting the JSString wrapper is unlikely to save memory.
     134    KJS::JSValue* jsOwnedStringOrNull(const KJS::UString&);
    142135
    143 } // namespace KJS
     136    String valueToStringWithNullCheck(KJS::ExecState*, KJS::JSValue*); // null String if the value is null
     137    String valueToStringWithUndefinedOrNullCheck(KJS::ExecState*, KJS::JSValue*); // null String if the value is null or undefined
    144138
    145 namespace WebCore {
     139    template <typename T> inline KJS::JSValue* toJS(KJS::ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
    146140
    147141    // Helpers for Window, History, and Location classes to implement cross-domain policy.
     
    151145    bool allowsAccessFromFrame(KJS::ExecState*, Frame*, String& message);
    152146    void printErrorMessageForFrame(Frame*, const String& message);
    153 
    154147    KJS::JSValue* nonCachingStaticFunctionGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier& propertyName, const KJS::PropertySlot&);
    155148    KJS::JSValue* objectToStringFunctionGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier& propertyName, const KJS::PropertySlot&);
  • trunk/WebCore/bindings/js/kjs_css.h

    r29134 r30243  
    2929namespace WebCore {
    3030
    31     class JSRGBColor : public KJS::DOMObject {
     31    class JSRGBColor : public DOMObject {
    3232    public:
    3333        JSRGBColor(KJS::JSObject* prototype, unsigned color);
  • trunk/WebCore/bindings/js/kjs_events.cpp

    r29508 r30243  
    3535#include "JSEvent.h"
    3636#include "JSEventTargetNode.h"
    37 #include "KURL.h"
    3837#include "Page.h"
    3938#include "kjs_proxy.h"
  • trunk/WebCore/bindings/js/kjs_events.h

    r29508 r30243  
    9898    KJS::JSValue* getNodeEventListener(Node*, const AtomicString& eventType);
    9999
    100     class JSClipboard : public KJS::DOMObject {
     100    class JSClipboard : public DOMObject {
    101101    public:
    102102        JSClipboard(KJS::JSObject* prototype, Clipboard*);
  • trunk/WebCore/bindings/js/kjs_html.h

    r25754 r30243  
    3232    class JSHTMLElement;
    3333
    34     class ImageConstructorImp : public KJS::DOMObject {
     34    class ImageConstructorImp : public DOMObject {
    3535    public:
    3636        ImageConstructorImp(KJS::ExecState*, Document*);
  • trunk/WebCore/bindings/js/kjs_navigator.cpp

    r30015 r30243  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    32 *  Copyright (C) 2000 Harri Porten (porten@kde.org)
    43 *  Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
    54 *  Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
    6  *  Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All Rights Reserved.
     5 *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All Rights Reserved.
    76 *
    87 *  This library is free software; you can redistribute it and/or
     
    6564#endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
    6665
     66using namespace KJS;
    6767using namespace WebCore;
    6868
    69 namespace KJS {
     69namespace WebCore {
    7070
    7171    class PluginBase : public DOMObject {
    7272    public:
    73         PluginBase(ExecState *exec);
     73        PluginBase(ExecState*);
    7474        virtual ~PluginBase();
    7575       
     
    7878    protected:
    7979        static void cachePluginDataIfNecessary();
    80         static Vector<PluginInfo*> *plugins;
    81         static Vector<MimeClassInfo*> *mimes;
     80        static Vector<PluginInfo*>* plugins;
     81        static Vector<MimeClassInfo*>* mimes;
    8282
    8383    private:
     
    8888    class Plugins : public PluginBase {
    8989    public:
    90         Plugins(ExecState *exec) : PluginBase(exec) {};
    91         virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    92         JSValue *getValueProperty(ExecState *, int token) const;
     90        Plugins(ExecState* exec) : PluginBase(exec) { }
     91        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     92        JSValue* getValueProperty(ExecState*, int token) const;
    9393        virtual const ClassInfo* classInfo() const { return &info; }
    9494        static const ClassInfo info;
    9595        enum { Length };
    9696    private:
    97         static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
    98         static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
     97        static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     98        static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
    9999    };
    100100
     
    103103    class MimeTypes : public PluginBase {
    104104    public:
    105         MimeTypes(ExecState *exec) : PluginBase(exec) { };
    106         virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    107         JSValue *getValueProperty(ExecState *, int token) const;
     105        MimeTypes(ExecState* exec) : PluginBase(exec) { };
     106        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     107        JSValue* getValueProperty(ExecState*, int token) const;
    108108        virtual const ClassInfo* classInfo() const { return &info; }
    109109        static const ClassInfo info;
    110110        enum { Length };
    111111    private:
    112         static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
    113         static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
     112        static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     113        static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
    114114    };
    115115
    116116    class Plugin : public PluginBase {
    117117    public:
    118         Plugin(ExecState *exec, PluginInfo *info) : PluginBase(exec), m_info(info) { }
    119         virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    120         JSValue *getValueProperty(ExecState *, int token) const;
     118        Plugin(ExecState* exec, PluginInfo* info) : PluginBase(exec), m_info(info) { }
     119        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     120        JSValue* getValueProperty(ExecState*, int token) const;
    121121        virtual const ClassInfo* classInfo() const { return &info; }
    122122        static const ClassInfo info;
    123123        enum { Name, Filename, Description, Length };
    124124    private:
    125         static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
    126         static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
    127 
    128         PluginInfo *m_info;
     125        static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     126        static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     127
     128        PluginInfo* m_info;
    129129    };
    130130
    131131    class MimeType : public PluginBase {
    132132    public:
    133         MimeType( ExecState *exec, MimeClassInfo *info ) : PluginBase(exec), m_info(info) { }
    134         virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    135         JSValue *getValueProperty(ExecState *, int token) const;
     133        MimeType(ExecState* exec, MimeClassInfo* info) : PluginBase(exec), m_info(info) { }
     134        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     135        JSValue* getValueProperty(ExecState*, int token) const;
    136136        virtual const ClassInfo* classInfo() const { return &info; }
    137137        static const ClassInfo info;
    138138        enum { Type, Suffixes, Description, EnabledPlugin };
    139139    private:
    140         MimeClassInfo *m_info;
     140        MimeClassInfo* m_info;
    141141    };
    142142
    143 } // namespace
     143}
    144144
    145145#include "kjs_navigator.lut.h"
    146146
    147 namespace KJS {
     147namespace WebCore {
    148148
    149149const ClassInfo Plugins::info = { "PluginArray", 0, &PluginsTable };
     
    152152const ClassInfo MimeType::info = { "MimeType", 0, &MimeTypeTable };
    153153
    154 Vector<PluginInfo*> *KJS::PluginBase::plugins = 0;
    155 Vector<MimeClassInfo*> *KJS::PluginBase::mimes = 0;
    156 int KJS::PluginBase::m_plugInCacheRefCount = 0;
     154Vector<PluginInfo*>* PluginBase::plugins = 0;
     155Vector<MimeClassInfo*>* PluginBase::mimes = 0;
     156int PluginBase::m_plugInCacheRefCount = 0;
    157157
    158158const ClassInfo Navigator::info = { "Navigator", 0, &NavigatorTable };
     
    182182}
    183183
    184 bool Navigator::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     184bool Navigator::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    185185{
    186186  return getStaticPropertySlot<Navigator, JSObject>(exec, &NavigatorTable, this, propertyName, slot);
     
    301301*/
    302302
    303 JSValue *Plugins::getValueProperty(ExecState *exec, int token) const
     303JSValue* Plugins::getValueProperty(ExecState* exec, int token) const
    304304{
    305305  ASSERT(token == Length);
     
    307307}
    308308
    309 JSValue *Plugins::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
     309JSValue* Plugins::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
    310310{
    311311    return new Plugin(exec, plugins->at(slot.index()));
    312312}
    313313
    314 JSValue *Plugins::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
     314JSValue* Plugins::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
    315315{
    316316    AtomicString atomicPropertyName = propertyName;
    317317    Vector<PluginInfo*>::iterator end = plugins->end();
    318318    for (Vector<PluginInfo*>::iterator itr = plugins->begin(); itr != end; itr++) {
    319         PluginInfo *pl = *itr;
     319        PluginInfo* pl = *itr;
    320320        if (pl->name == atomicPropertyName)
    321321            return new Plugin(exec, pl);
     
    324324}
    325325
    326 bool Plugins::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     326bool Plugins::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    327327{
    328328    const HashEntry* entry = Lookup::findEntry(&PluginsTable, propertyName);
     
    364364*/
    365365
    366 JSValue *MimeTypes::getValueProperty(ExecState *exec, int token) const
     366JSValue* MimeTypes::getValueProperty(ExecState* exec, int token) const
    367367{
    368368  ASSERT(token == Length);
     
    370370}
    371371
    372 JSValue *MimeTypes::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
     372JSValue* MimeTypes::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
    373373{
    374374    return new MimeType(exec, mimes->at(slot.index()));
    375375}
    376376
    377 JSValue *MimeTypes::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
     377JSValue* MimeTypes::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
    378378{
    379379    AtomicString atomicPropertyName = propertyName;
    380380    Vector<MimeClassInfo*>::iterator end = mimes->end();
    381381    for (Vector<MimeClassInfo*>::iterator itr = mimes->begin(); itr != end; itr++) {
    382         MimeClassInfo *m = (*itr);
     382        MimeClassInfo* m = (*itr);
    383383        if (m->type == atomicPropertyName)
    384384            return new MimeType(exec, m);
     
    387387}
    388388
    389 bool MimeTypes::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     389bool MimeTypes::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    390390{
    391391    const HashEntry* entry = Lookup::findEntry(&MimeTypesTable, propertyName);
     
    428428*/
    429429
    430 JSValue *Plugin::getValueProperty(ExecState *exec, int token) const
     430JSValue* Plugin::getValueProperty(ExecState* exec, int token) const
    431431{
    432432    switch (token) {
     
    445445}
    446446
    447 JSValue *Plugin::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
    448 {
    449     Plugin *thisObj = static_cast<Plugin *>(slot.slotBase());
     447JSValue* Plugin::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
     448{
     449    Plugin* thisObj = static_cast<Plugin*>(slot.slotBase());
    450450    return new MimeType(exec, thisObj->m_info->mimes.at(slot.index()));
    451451}
    452452
    453 JSValue *Plugin::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
    454 {
    455     Plugin *thisObj = static_cast<Plugin *>(slot.slotBase());
     453JSValue* Plugin::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
     454{
     455    Plugin* thisObj = static_cast<Plugin*>(slot.slotBase());
    456456    AtomicString atomicPropertyName = propertyName;
    457457    Vector<MimeClassInfo*>::iterator end = thisObj->m_info->mimes.end();
    458458    for (Vector<MimeClassInfo*>::iterator itr = thisObj->m_info->mimes.begin(); itr != end; itr++) {
    459         MimeClassInfo *m = (*itr);
     459        MimeClassInfo* m = (*itr);
    460460        if (m->type == atomicPropertyName)
    461461            return new MimeType(exec, m);
     
    465465
    466466
    467 bool Plugin::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     467bool Plugin::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    468468{
    469469    const HashEntry* entry = Lookup::findEntry(&PluginTable, propertyName);
     
    505505*/
    506506
    507 JSValue *MimeType::getValueProperty(ExecState *exec, int token) const
     507JSValue* MimeType::getValueProperty(ExecState* exec, int token) const
    508508{
    509509    switch (token) {
     
    528528}
    529529
    530 bool MimeType::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
     530bool MimeType::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    531531{
    532532    return getStaticValueSlot<MimeType, PluginBase>(exec, &MimeTypeTable, this, propertyName, slot);
     
    541541JSValue* navigatorProtoFuncJavaEnabled(ExecState* exec, JSObject* thisObj, const List&)
    542542{
    543   if (!thisObj->inherits(&KJS::Navigator::info))
    544     return throwError(exec, TypeError);
    545   Navigator *nav = static_cast<Navigator *>(thisObj);
    546   // javaEnabled()
    547   Settings* settings = nav->frame() ? nav->frame()->settings() : 0;
    548   return jsBoolean(settings && settings->isJavaEnabled());
     543    if (!thisObj->inherits(&Navigator::info))
     544        return throwError(exec, TypeError);
     545    Navigator* nav = static_cast<Navigator*>(thisObj);
     546    Settings* settings = nav->frame() ? nav->frame()->settings() : 0;
     547    return jsBoolean(settings && settings->isJavaEnabled());
    549548}
    550549
  • trunk/WebCore/bindings/js/kjs_navigator.h

    r29508 r30243  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    3  *  This file is part of the KDE libraries
    42 *  Copyright (C) 2000 Harri Porten (porten@kde.org)
     3 *  Copyright (C) 2008 Apple Inc. All rights reserved.
    54 *
    65 *  This library is free software; you can redistribute it and/or
     
    2524
    2625namespace WebCore {
     26
    2727    class Frame;
    28 }
    2928
    30 namespace KJS {
     29    class Navigator : public DOMObject {
     30    public:
     31        Navigator(KJS::JSObject* prototype, Frame*);
    3132
    32   class Navigator : public DOMObject {
    33   public:
    34     Navigator(JSObject* prototype, WebCore::Frame*);
     33        virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
     34        KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;
     35        virtual const KJS::ClassInfo* classInfo() const { return &info; }
     36        static const KJS::ClassInfo info;
    3537
    36     virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
    37     JSValue *getValueProperty(ExecState *exec, int token) const;
    38     virtual const ClassInfo* classInfo() const { return &info; }
    39     static const ClassInfo info;
    40     enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
    41            _Plugins, _MimeTypes, Product, ProductSub, Vendor, VendorSub, CookieEnabled };
    42     WebCore::Frame *frame() const { return m_frame; }
    43   private:
    44     WebCore::Frame *m_frame;
    45   };
     38        enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
     39               _Plugins, _MimeTypes, Product, ProductSub, Vendor, VendorSub, CookieEnabled };
    4640
    47   // Functions
    48   JSValue* navigatorProtoFuncJavaEnabled(ExecState*, JSObject*, const List&);
     41        Frame* frame() const { return m_frame; }
     42
     43    private:
     44        Frame* m_frame;
     45    };
     46
     47    KJS::JSValue* navigatorProtoFuncJavaEnabled(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
    4948
    5049} // namespace
  • trunk/WebCore/bindings/js/kjs_window.cpp

    r30157 r30243  
    292292    HashMap<String, String> map;
    293293
    294     Vector<String> features = featuresArg.split(';');
     294    Vector<String> features;
     295    featuresArg.split(';', features);
    295296    Vector<String>::const_iterator end = features.end();
    296297    for (Vector<String>::const_iterator it = features.begin(); it != end; ++it) {
     
    360361        newWindow->putDirect("dialogArguments", dialogArgs);
    361362
    362     if (!url.startsWith("javascript:", false) || newWindow->allowsAccessFrom(exec)) {
    363         String completedURL = url.isEmpty() ? url : activeFrame->document()->completeURL(url);
     363    if (!protocolIs(url, "javascript") || newWindow->allowsAccessFrom(exec)) {
     364        KURL completedURL = url.isEmpty() ? KURL("") : activeFrame->document()->completeURL(url);
    364365        bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
    365366
    366367        if (created) {
    367             newFrame->loader()->changeLocation(KURL(completedURL.deprecatedString()), activeFrame->loader()->outgoingReferrer(), false, userGesture);
     368            newFrame->loader()->changeLocation(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
    368369            if (Document* oldDoc = openerFrame->document())
    369370                newFrame->document()->setBaseURL(oldDoc->baseURL());
    370371        } else if (!url.isEmpty())
    371             newFrame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
     372            newFrame->loader()->scheduleLocationChange(completedURL.string(), activeFrame->loader()->outgoingReferrer(), false, userGesture);
    372373    }
    373374
     
    705706          return;
    706707        String dstUrl = p->loader()->completeURL(value->toString(exec)).string();
    707         if (!dstUrl.startsWith("javascript:", false) || allowsAccessFrom(exec)) {
     708        if (!protocolIs(dstUrl, "javascript") || allowsAccessFrom(exec)) {
    708709          bool userGesture = p->scriptProxy()->processingUserGesture();
    709710          // We want a new history item if this JS was called via a user gesture
     
    889890    // FIXME: this error message should contain more specifics of why the same origin check has failed.
    890891    message = String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains, protocols and ports must match.\n",
    891                              targetDocument->url().utf8().data(), originDocument->url().utf8().data());
     892        targetDocument->url().string().utf8().data(), originDocument->url().string().utf8().data());
    892893    return false;
    893894}
     
    11381139        String completedURL;
    11391140        if (!urlString.isEmpty())
    1140             completedURL = activeFrame->document()->completeURL(urlString);
     1141            completedURL = activeFrame->document()->completeURL(urlString).string();
    11411142
    11421143        const Window* targetedWindow = Window::retrieveWindow(frame);
    1143         if (!completedURL.isEmpty() && (!completedURL.startsWith("javascript:", false) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
     1144        if (!completedURL.isEmpty() && (!protocolIs(completedURL, "javascript") || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
    11441145            bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
    11451146            frame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
  • trunk/WebCore/bindings/objc/DOM.mm

    r30089 r30243  
    580580    WebCore::Element* element = [self _element];
    581581    ASSERT(element);
    582     return WebCore::KURL(element->document()->completeURL(parseURL(element->getAttribute(name)).deprecatedString())).getNSURL();
     582    return element->document()->completeURL(parseURL(element->getAttribute(name)));
    583583}
    584584
  • trunk/WebCore/bindings/objc/DOMHTML.mm

    r24771 r30243  
    3737#import "HTMLInputElement.h"
    3838#import "HTMLObjectElement.h"
    39 #import "KURL.h"
    4039#import "Range.h"
    4140#import "RenderTextControl.h"
     
    6463- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString
    6564{
    66     NSURL *baseURL = WebCore::KURL([self _document]->completeURL(WebCore::parseURL(baseURLString)).deprecatedString()).getNSURL();
     65    NSURL *baseURL = [self _document]->completeURL(WebCore::parseURL(baseURLString));
    6766    return [self createDocumentFragmentWithMarkupString:markupString baseURL:baseURL];
    6867}
  • trunk/WebCore/bindings/scripts/CodeGeneratorCOM.pm

    r30182 r30243  
    310310
    311311    if ($codeGenerator->IsStringType($type)) {
    312         $CPPImplementationWebCoreIncludes{"PlatformString.h"} = 1;
     312        $CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1;
    313313        $CPPImplementationWebCoreIncludes{"BString.h"} = 1;
    314         $CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1;
     314        $CPPImplementationWebCoreIncludes{"KURL.h"} = 1;
    315315        return;
    316316    }
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r30102 r30243  
    117117
    118118    return $dataNode->extendedAttributes->{"LegacyParent"} if $dataNode->extendedAttributes->{"LegacyParent"};
    119     return "KJS::DOMObject" if @{$dataNode->parents} eq 0;
     119    return "DOMObject" if @{$dataNode->parents} eq 0;
    120120    return "JS" . $codeGenerator->StripModule($dataNode->parents(0));
    121121}
     
    11911191        push(@implContent, "    ${className}* thisObj = static_cast<$className*>(slot.slotBase());\n");
    11921192        if (IndexGetterReturnsStrings($implClassName)) {
    1193             $implIncludes{"PlatformString.h"} = 1;
     1193            $implIncludes{"KURL.h"} = 1;
    11941194            push(@implContent, "    return jsStringOrNull(thisObj->impl()->item(slot.index()));\n");
    11951195        } else {
     
    12141214        push(@implContent, "{\n");
    12151215        if ($podType) {
    1216             push(@implContent, "    return KJS::cacheSVGDOMObject<JSSVGPODTypeWrapper<$podType>, $className, ${className}Prototype>(exec, obj, context);\n");
     1216            push(@implContent, "    return cacheSVGDOMObject<JSSVGPODTypeWrapper<$podType>, $className, ${className}Prototype>(exec, obj, context);\n");
    12171217        } elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
    1218             push(@implContent, "    return KJS::cacheSVGDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj, context);\n");
     1218            push(@implContent, "    return cacheSVGDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj, context);\n");
    12191219        } else {
    1220             push(@implContent, "    return KJS::cacheDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj);\n");
     1220            push(@implContent, "    return cacheDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj);\n");
    12211221        }
    12221222        push(@implContent, "}\n");
     
    14451445
    14461446    if ($codeGenerator->IsStringType($type)) {
    1447         $implIncludes{"PlatformString.h"} = 1;
     1447        $implIncludes{"KURL.h"} = 1;
    14481448        my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"};
    14491449        if (defined $conv) {
  • trunk/WebCore/bindings/scripts/CodeGeneratorObjC.pm

    r29073 r30243  
    44# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
    55# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
    6 # Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     6# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    77#
    88# This library is free software; you can redistribute it and/or
     
    537537
    538538    if ($codeGenerator->IsStringType($type)) {
    539         $implIncludes{"PlatformString.h"} = 1;
     539        $implIncludes{"KURL.h"} = 1;
    540540        return;
    541541    }
  • trunk/WebCore/bridge/mac/WebCoreAXObject.mm

    r29250 r30243  
    11/*
    2  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    11001100    if ([attributeName isEqualToString: NSAccessibilityURLAttribute]) {
    11011101        if ([self isAnchor]) {
    1102             HTMLAnchorElement* anchor = [self anchorElement];
    1103             if (anchor) {
    1104                 DeprecatedString s = anchor->getAttribute(hrefAttr).deprecatedString();
    1105                 if (!s.isNull()) {
    1106                     s = anchor->document()->completeURL(s);
    1107                     return KURL(s).getNSURL();
    1108                 }
     1102            if (HTMLAnchorElement* anchor = [self anchorElement]) {
     1103                NSURL *href = anchor->href();
     1104                return href;
    11091105            }
    1110         }
    1111         else if (m_renderer->isImage() && m_renderer->element() && m_renderer->element()->hasTagName(imgTag)) {
    1112             DeprecatedString src = static_cast<HTMLImageElement*>(m_renderer->element())->src().deprecatedString();
    1113             if (!src.isNull())
    1114                 return KURL(src).getNSURL();
     1106        } else if (m_renderer->isImage() && m_renderer->element() && m_renderer->element()->hasTagName(imgTag)) {
     1107            NSURL *src = static_cast<HTMLImageElement*>(m_renderer->element())->src();
     1108            return src;
    11151109        }
    11161110        return nil;
     
    16731667    // NOTE: color attributes are handled specially because -[NSMutableAttributedString addAttribute: value: range:] does not merge
    16741668    // identical colors.  Workaround is to not replace an existing color attribute if it matches what we are adding.  This also means
    1675     // we can not just pre-remove all inherited attributes on the appended string, so we have to remove the irrelevant ones individually.
     1669    // we cannot just pre-remove all inherited attributes on the appended string, so we have to remove the irrelevant ones individually.
    16761670
    16771671    // remove inherited attachment from prior AXAttributedStringAppendReplaced
  • trunk/WebCore/bridge/mac/WebCoreScriptDebugger.mm

    r28608 r30243  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6060
    6161// convert UString to NSString
    62 static NSString *toNSString(const UString &s)
    63 {
    64     if (s.isEmpty()) return nil;
    65     return [NSString stringWithCharacters:(const unichar *)s.data() length:s.size()];
     62static NSString *toNSString(const UString& s)
     63{
     64    if (s.isEmpty())
     65        return nil;
     66    return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s.data()) length:s.size()];
    6667}
    6768
    6869// convert UString to NSURL
    69 static NSURL *toNSURL(const UString &s)
    70 {
    71     if (s.isEmpty()) return nil;
    72     return KURL(DeprecatedString(s)).getNSURL();
     70static NSURL *toNSURL(const UString& s)
     71{
     72    if (s.isEmpty())
     73        return nil;
     74    return KURL(s);
    7375}
    7476
     
    138140};
    139141
    140 
    141 
    142142// WebCoreScriptDebugger
    143143//
     
    160160{
    161161    if ((self = [super init])) {
    162         _delegate   = delegate;
     162        _delegate  = delegate;
    163163        _globalObj = [_delegate globalObject];
    164164        _debugger  = new WebCoreScriptDebuggerImp(self, [_globalObj _rootObject]->globalObject());
     
    187187@end
    188188
    189 
    190 
    191189@implementation WebCoreScriptDebugger (WebCoreScriptDebuggerInternal)
    192190
     
    206204
    207205@end
    208 
    209 
    210206
    211207// WebCoreScriptCallFrame
     
    256252@end
    257253
    258 
    259 
    260254@implementation WebCoreScriptCallFrame
    261255
     
    276270    return _caller;
    277271}
    278 
    279272
    280273// Returns an array of scope objects (most local first).
     
    302295}
    303296
    304 
    305297// Returns the name of the function for this frame, if available.
    306298// Returns nil for anonymous functions and for the global frame.
     
    309301{
    310302    if (_state->scopeNode()) {
    311         FunctionImp *func = _state->function();
     303        FunctionImp* func = _state->function();
    312304        if (func) {
    313305            Identifier fn = func->functionName();
     
    318310}
    319311
    320 
    321312// Returns the pending exception for this frame (nil if none).
    322313
     
    326317    return [self _convertValueToObjcValue:_state->exception()];
    327318}
    328 
    329319
    330320// Evaluate some JavaScript code in the context of this frame.
  • trunk/WebCore/css/CSSImageValue.cpp

    r30208 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
    5  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    64 *
    75 * This library is free software; you can redistribute it and/or
     
    6361        if (loader)
    6462            m_image = loader->requestImage(url);
    65         else
     63        else {
    6664            // FIXME: Should find a way to make these images sit in their own memory partition, since they are user agent images.
    67             m_image = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(url.deprecatedString()), 0, 0));
     65            m_image = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(url), 0, 0));
     66        }
    6867
    6968        if (m_image)
  • trunk/WebCore/css/CSSImportRule.cpp

    r30147 r30243  
    2929#include "DocLoader.h"
    3030#include "Document.h"
    31 #include "KURL.h"
    3231#include "MediaList.h"
    3332
     
    9291    if (!parentSheet->href().isNull())
    9392        // use parent styleheet's URL as the base URL
    94         absHref = KURL(parentSheet->href().deprecatedString(), m_strHref.deprecatedString()).string();
     93        absHref = KURL(KURL(parentSheet->href()), m_strHref).string();
    9594
    9695    // Check for a cycle in our import chain.  If we encounter a stylesheet
  • trunk/WebCore/css/CSSParser.cpp

    r30208 r30243  
    5555#include "FontFamilyValue.h"
    5656#include "FontValue.h"
    57 #include "KURL.h"
    5857#include "MediaList.h"
    5958#include "MediaQueryExp.h"
     
    817816            if (strict || coords.size() == 0) {
    818817                if (!uri.isEmpty()) {
    819                     list->append(new CSSCursorImageValue(
    820                                  KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
    821                                  hotspot, styleElement));
     818                    list->append(new CSSCursorImageValue(KURL(styleElement->baseURL(), uri).string(),
     819                        hotspot, styleElement));
    822820                }
    823821            }
     
    877875            String uri = parseURL(domString(value->string));
    878876            if (!uri.isEmpty()) {
    879                 parsedValue = new CSSImageValue(
    880                     KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
    881                     styleElement);
     877                parsedValue = new CSSImageValue(KURL(styleElement->baseURL(), uri).string(), styleElement);
    882878                valueList->next();
    883879            }
     
    10841080                if (val->unit == CSSPrimitiveValue::CSS_URI) {
    10851081                    String value = parseURL(domString(val->string));
    1086                     parsedValue = new CSSPrimitiveValue(
    1087                                     KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).string(),
    1088                                     CSSPrimitiveValue::CSS_URI);
     1082                    parsedValue = new CSSPrimitiveValue(KURL(styleElement->baseURL(), value).string(),
     1083                        CSSPrimitiveValue::CSS_URI);
    10891084                }
    10901085                if (!parsedValue)
     
    18351830            // url
    18361831            String value = parseURL(domString(val->string));
    1837             parsedValue = new CSSImageValue(
    1838                 KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).string(), styleElement);
     1832            parsedValue = new CSSImageValue(KURL(styleElement->baseURL(), value).string(), styleElement);
    18391833        } else if (val->unit == Value::Function) {
    18401834            // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z])
     
    19021896        String uri = parseURL(domString(valueList->current()->string));
    19031897        if (!uri.isEmpty())
    1904             value = new CSSImageValue(KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
    1905                                          styleElement);
     1898            value = new CSSImageValue(KURL(styleElement->baseURL(), uri).string(), styleElement);
    19061899        return true;
    19071900    }
     
    27322725        if (val->unit == CSSPrimitiveValue::CSS_URI && !expectComma) {
    27332726            String value = parseURL(domString(val->string));
    2734             parsedValue = new CSSFontFaceSrcValue(KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).string(), false);
     2727            parsedValue = new CSSFontFaceSrcValue(KURL(styleElement->baseURL(), value).string(), false);
    27352728            uriValue = parsedValue;
    27362729            allowFormat = true;
     
    32873280        return false;
    32883281   
    3289     context.commitImage(new CSSImageValue(KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
    3290                                                              styleElement));
     3282    context.commitImage(new CSSImageValue(KURL(styleElement->baseURL(), uri).string(), styleElement));
    32913283    while ((val = valueList->next())) {
    32923284        if (context.allowNumber() && validUnit(val, FInteger|FNonNeg|FPercent, true)) {
     
    39263918typedef int yy_state_type;
    39273919typedef unsigned YY_CHAR;
    3928 // this line makes sure we treat all Unicode chars correctly.
     3920// The following line makes sure we treat non-Latin-1 Unicode characters correctly.
    39293921#define YY_SC_TO_UI(c) (c > 0xff ? 0xff : c)
    39303922#define YY_DO_BEFORE_ACTION \
     
    39413933#define yyterminate() yyTok = END_TOKEN; return yyTok
    39423934#define YY_FATAL_ERROR(a)
    3943 // The line below is needed to build the tokenizer with conditon stack.
     3935// The following line is needed to build the tokenizer with a condition stack.
    39443936// The macro is used in the tokenizer grammar with lines containing
    39453937// BEGIN(mediaqueries) and BEGIN(initial). yy_start acts as index to
    39463938// tokenizer transition table, and 'mediaqueries' and 'initial' are
    39473939// offset multipliers that specify which transitions are active
    3948 // in the tokenizer during in each condition (tokenizer state)
     3940// in the tokenizer during in each condition (tokenizer state).
    39493941#define BEGIN yy_start = 1 + 2 *
    39503942
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r30208 r30243  
    232232#endif
    233233
    234 static CSSStyleSelector::Encodedurl *currentEncodedURL = 0;
     234static CSSStyleSelector::EncodedURL* currentEncodedURL = 0;
    235235static PseudoState pseudoState;
    236236
     
    320320    KURL u = url;
    321321
    322     u.setQuery(DeprecatedString::null);
    323     u.setRef(DeprecatedString::null);
    324     m_encodedURL.file = u.deprecatedString();
    325     int pos = m_encodedURL.file.findRev('/');
     322    u.setQuery(String());
     323    u.setRef(String());
     324    m_encodedURL.file = u.string();
     325    int pos = m_encodedURL.file.reverseFind('/');
    326326    m_encodedURL.path = m_encodedURL.file;
    327327    if (pos > 0) {
    328328        m_encodedURL.path.truncate(pos);
    329         m_encodedURL.path += '/';
    330     }
    331     u.setPath(DeprecatedString::null);
    332     m_encodedURL.host = u.deprecatedString();
     329        m_encodedURL.path.append('/');
     330    }
     331    u.setPath(String());
     332    m_encodedURL.prefix = u.string();
    333333}
    334334
     
    704704    DeprecatedString u = cu.string();
    705705    if (length && characters[0] == '/')
    706         u.prepend(currentEncodedURL->host);
     706        u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->prefix.characters()), currentEncodedURL->prefix.length());
    707707    else if (length && characters[0] == '#')
    708         u.prepend(currentEncodedURL->file);
     708        u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->file.characters()), currentEncodedURL->file.length());
    709709    else
    710         u.prepend(currentEncodedURL->path);
     710        u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->path.characters()), currentEncodedURL->path.length());
    711711    cleanpath(u);
    712712    pseudoState = historyContains(reinterpret_cast<const UChar*>(u.unicode()), u.length())
  • trunk/WebCore/css/CSSStyleSelector.h

    r29647 r30243  
    11/*
    2  * This file is part of the CSS implementation for KDE.
    3  *
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    5  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
     3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    64 *
    75 * This library is free software; you can redistribute it and/or
     
    10199        bool strictParsing;
    102100
    103         struct Encodedurl {
    104             DeprecatedString host; //also contains protocol
    105             DeprecatedString path;
    106             DeprecatedString file;
     101        struct EncodedURL {
     102            String prefix; // protocol, host, etc.
     103            String path;
     104            String file;
    107105        } m_encodedURL;
    108106
  • trunk/WebCore/css/MediaList.cpp

    r25754 r30243  
    188188    CSSParser p(true);
    189189
    190     Vector<String> list = value.split(',');
     190    Vector<String> list;
     191    value.split(',', list);
    191192    Vector<String>::const_iterator end = list.end();
    192193    for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) {
  • trunk/WebCore/css/StyleBase.cpp

    r25754 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
    53 *               1999 Waldo Bastian (bastian@kde.org)
    64 *               2001 Andreas Schlapbach (schlpbch@iam.unibe.ch)
    75 *               2001-2003 Dirk Mueller (mueller@kde.org)
    8  * Copyright (C) 2002, 2006 Apple Computer, Inc.
     6 * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
    97 *
    108 * This library is free software; you can redistribute it and/or
     
    4644}
    4745
    48 String StyleBase::baseURL()
     46KURL StyleBase::baseURL() const
    4947{
    50     // try to find the style sheet. If found look for its url.
    51     // If it has none, look for the parentsheet, or the parentNode and
    52     // try to find out about their url
     48    // Try to find the style sheet. If found look for its URL.
     49    // If it has none, get the URL from the parent sheet or the parent node.
    5350
    54     StyleSheet* sheet = stylesheet();
    55 
     51    StyleSheet* sheet = const_cast<StyleBase*>(this)->stylesheet();
    5652    if (!sheet)
    57         return String();
    58 
     53        return KURL();
    5954    if (!sheet->href().isNull())
    60         return sheet->href();
    61 
    62     // find parent
     55        return KURL(sheet->href());
    6356    if (sheet->parent())
    6457        return sheet->parent()->baseURL();
    65 
    6658    if (!sheet->ownerNode())
    67         return String();
    68 
     59        return KURL();
    6960    return sheet->ownerNode()->document()->baseURL();
    7061}
  • trunk/WebCore/css/StyleBase.h

    r30122 r30243  
    11/*
    2  * This file is part of the CSS implementation for KDE.
    3  *
    42 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
    53 * Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
    64 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
    7  * Copyright (C) 2004, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    3230    class String;
    3331    class StyleSheet;
     32    class KURL;
    3433
    3534    // a style class which has a parent (almost all have)
     
    4847
    4948        // returns the url of the style sheet this object belongs to
    50         String baseURL();
     49        KURL baseURL() const;
    5150
    5251        virtual bool isStyleSheet() const { return false; }
  • trunk/WebCore/dom/Document.cpp

    r30195 r30243  
    408408    {
    409409        KJS::JSLock lock;
    410         KJS::ScriptInterpreter::forgetAllDOMNodesForDocument(this);
     410        ScriptInterpreter::forgetAllDOMNodesForDocument(this);
    411411    }
    412412
     
    829829}
    830830
    831 String Document::documentURI() const
     831KURL Document::documentURI() const
    832832{
    833833    return m_baseURL;
    834834}
    835835
    836 void Document::setDocumentURI(const String &uri)
    837 {
    838     m_baseURL = uri.deprecatedString();
    839 }
    840 
    841 String Document::baseURI() const
    842 {
    843     return documentURI();
     836void Document::setDocumentURI(const String& uri)
     837{
     838    m_baseURL = KURL(uri);
     839}
     840
     841KURL Document::baseURI() const
     842{
     843    return m_baseURL;
    844844}
    845845
     
    13241324    // This is work that we should probably do in clear(), but we can't have it
    13251325    // happen when implicitOpen() is called unless we reorganize Frame code.
    1326     if (Document *parent = parentDocument()) {
    1327         if (m_url.isEmpty() || m_url == "about:blank")
     1326    if (Document* parent = parentDocument()) {
     1327        if (m_url.isEmpty() || m_url == blankURL())
    13281328            setURL(parent->baseURL());
    1329         if (m_baseURL.isEmpty() || m_baseURL == "about:blank")
     1329        if (m_baseURL.isEmpty() || m_baseURL == blankURL())
    13301330            setBaseURL(parent->baseURL());
    13311331    }
     
    16171617}
    16181618
    1619 void Document::setURL(const DeprecatedString& url)
     1619void Document::setURL(const KURL& url)
    16201620{
    16211621    if (url == m_url)
     
    16241624    m_url = url;
    16251625    if (m_styleSelector)
    1626         m_styleSelector->setEncodedURL(m_url);
     1626        m_styleSelector->setEncodedURL(url);
    16271627
    16281628    m_isAllowedToLoadLocalResources = shouldBeAllowedToLoadLocalResources();
     
    16311631bool Document::shouldBeAllowedToLoadLocalResources() const
    16321632{
    1633     if (FrameLoader::shouldTreatURLAsLocal(m_url))
     1633    if (FrameLoader::shouldTreatURLAsLocal(m_url.string()))
    16341634        return true;
    16351635
     
    16421642        return false;
    16431643
    1644     if (m_url == "about:blank" && frame->loader()->opener() && frame->loader()->opener()->document()->isAllowedToLoadLocalResources())
     1644    if (m_url == blankURL() && frame->loader()->opener() && frame->loader()->opener()->document()->isAllowedToLoadLocalResources())
    16451645        return true;
    16461646   
     
    16481648}
    16491649
    1650 void Document::setBaseURL(const DeprecatedString& baseURL)
     1650void Document::setBaseURL(const KURL& baseURL)
    16511651{
    1652     m_baseURL = baseURL; 
     1652    m_baseURL = baseURL;
    16531653    if (m_elemSheet)
    1654         m_elemSheet->setHref(m_baseURL);
     1654        m_elemSheet->setHref(baseURL.string());
    16551655}
    16561656
     
    16881688{
    16891689    if (!m_elemSheet)
    1690         m_elemSheet = new CSSStyleSheet(this, baseURL());
     1690        m_elemSheet = new CSSStyleSheet(this, baseURL().string());
    16911691    return m_elemSheet.get();
    16921692}
     
    16951695{
    16961696    if (!m_mappedElementSheet)
    1697         m_mappedElementSheet = new CSSStyleSheet(this, baseURL());
     1697        m_mappedElementSheet = new CSSStyleSheet(this, baseURL().string());
    16981698    return m_mappedElementSheet.get();
    16991699}
     
    18481848                url = frame->loader()->url().string();
    18491849            else
    1850                 url = completeURL(url);
     1850                url = completeURL(url).string();
    18511851            frame->loader()->scheduleHTTPRedirection(delay, url);
    18521852        }
     
    21812181                if (title != m_preferredStylesheetSet)
    21822182                    sheet = 0;
    2183 
    2184 #if ENABLE(SVG)
    2185                 if (!n->isHTMLElement())
    2186                     title = title.deprecatedString().replace('&', "&&");
    2187 #endif
    21882183            }
    21892184        }
     
    26082603void Document::setCookie(const String& value)
    26092604{
    2610     setCookies(this, url(), policyBaseURL().deprecatedString(), value);
     2605    setCookies(this, url(), policyBaseURL(), value);
    26112606}
    26122607
     
    27862781}
    27872782
    2788 DeprecatedString Document::completeURL(const DeprecatedString& url)
    2789 {
    2790     // FIXME: This treats null URLs the same as empty URLs, unlike the String function below.
    2791 
    2792     // If both the URL and base URL are empty, like they are for documents
    2793     // created using DOMImplementation::createDocument, just return the passed in URL.
    2794     // (We do this because url() returns "about:blank" for empty URLs.
    2795     if (m_url.isEmpty() && m_baseURL.isEmpty())
    2796         return url;
     2783KURL Document::completeURL(const String& url)
     2784{
     2785    // Always return a null URL when passed a null string.
     2786    // FIXME: Should we change the KURL constructor to have this behavior?
     2787    if (url.isNull())
     2788        return KURL();
     2789    KURL base = m_baseURL;
     2790    if (base.isEmpty())
     2791        base = m_url;
    27972792    if (!m_decoder)
    2798         return KURL(baseURL(), url).deprecatedString();
    2799     return KURL(baseURL(), url, m_decoder->encoding()).deprecatedString();
    2800 }
    2801 
    2802 String Document::completeURL(const String& url)
    2803 {
    2804     // FIXME: This always returns null when passed a null URL, unlike the DeprecatedString function above.
    2805     // Code relies on this behavior, namely the href property of <a> and the data property of <object>.
    2806     if (url.isNull())
    2807         return url;
    2808     return completeURL(url.deprecatedString());
     2793        return KURL(base, url);
     2794    return KURL(base, url, m_decoder->encoding());
    28092795}
    28102796
  • trunk/WebCore/dom/Document.h

    r30195 r30243  
    3333#include "HTMLCollection.h"
    3434#include "HTMLFormElement.h"
     35#include "KURL.h"
    3536#include "StringHash.h"
    3637#include "Timer.h"
     
    219220    void setXMLStandalone(bool, ExceptionCode&);
    220221
    221     String documentURI() const;
     222    KURL documentURI() const;
    222223    void setDocumentURI(const String&);
    223224
    224     virtual String baseURI() const;
     225    virtual KURL baseURI() const;
    225226
    226227    PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
     
    372373    bool wellFormed() const { return m_wellFormed; }
    373374
    374     DeprecatedString url() const { return m_url.isEmpty() ? "about:blank" : m_url; }
    375     void setURL(const DeprecatedString& url);
    376 
    377     DeprecatedString baseURL() const { return m_baseURL.isEmpty() ? url() : m_baseURL; }
    378     void setBaseURL(const DeprecatedString& baseURL);
    379 
    380     String baseTarget() const { return m_baseTarget; }
     375    const KURL& url() const { return m_url.isEmpty() ? blankURL() : m_url; }
     376    void setURL(const KURL&);
     377
     378    const KURL& baseURL() const { return m_baseURL.isEmpty() ? url() : m_baseURL; }
     379    void setBaseURL(const KURL&);
     380
     381    const String& baseTarget() const { return m_baseTarget; }
    381382    void setBaseTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
    382383
    383     DeprecatedString completeURL(const DeprecatedString &);
    384     String completeURL(const String&);
     384    KURL completeURL(const String&);
    385385
    386386    // from cachedObjectClient
     
    571571    String lastModified() const;
    572572
    573     String policyBaseURL() const { return m_policyBaseURL; }
    574     void setPolicyBaseURL(const String& s) { m_policyBaseURL = s; }
     573    const KURL& policyBaseURL() const { return m_policyBaseURL; }
     574    void setPolicyBaseURL(const KURL& url) { m_policyBaseURL = url; }
    575575   
    576576    // The following implements the rule from HTML 4 for what valid names are.
     
    701701    Tokenizer* m_tokenizer;
    702702    bool m_wellFormed;
    703     DeprecatedString m_url;
    704     DeprecatedString m_baseURL;
     703    KURL m_url;
     704    KURL m_baseURL;
    705705    String m_baseTarget;
    706706
     
    814814    ImageMapsByName m_imageMapsByName;
    815815
    816     String m_policyBaseURL;
     816    KURL m_policyBaseURL;
    817817
    818818    HashSet<Node*> m_disconnectedNodesWithEventListeners;
  • trunk/WebCore/dom/DocumentType.cpp

    r25754 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    7  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    3230namespace WebCore {
    3331
    34 DocumentType::DocumentType(DOMImplementation *i, Document *doc, const String &n, const String &p, const String &s)
    35     : Node(doc), m_implementation(i), m_name(n), m_publicId(p), m_systemId(s)
     32DocumentType::DocumentType(DOMImplementation* i, Document* document, const String& n, const String& p, const String& s)
     33    : Node(document)
     34    , m_implementation(i)
     35    , m_name(n)
     36    , m_publicId(p)
     37    , m_systemId(s)
    3638{
    3739}
    3840
    39 DocumentType::DocumentType(Document *doc, const String &n, const String &p, const String &s)
    40     : Node(doc), m_name(n), m_publicId(p), m_systemId(s)
     41DocumentType::DocumentType(Document* document, const String& n, const String& p, const String& s)
     42    : Node(document)
     43    , m_name(n)
     44    , m_publicId(p)
     45    , m_systemId(s)
    4146{
    4247}
    4348
    44 DocumentType::DocumentType(Document *doc, const DocumentType &t)
    45     : Node(doc), m_implementation(t.m_implementation)
    46     , m_name(t.m_name), m_publicId(t.m_publicId), m_systemId(t.m_systemId), m_subset(t.m_subset)
     49DocumentType::DocumentType(Document* document, const DocumentType &t)
     50    : Node(document)
     51    , m_implementation(t.m_implementation)
     52    , m_name(t.m_name)
     53    , m_publicId(t.m_publicId)
     54    , m_systemId(t.m_systemId)
     55    , m_subset(t.m_subset)
    4756{
    4857}
     
    7584}
    7685
    77 String DocumentType::baseURI() const
     86KURL DocumentType::baseURI() const
    7887{
    79     return String();
     88    return KURL();
    8089}
    8190
     
    92101PassRefPtr<Node> DocumentType::cloneNode(bool /*deep*/)
    93102{
    94     // The DOM Level 2 specification says cloning DocumentType nodes is "implementation dependent" so for now we do not support it.
     103    // The DOM Level 2 specification says cloning DocumentType nodes is "implementation dependent".
     104    // For now, we do not support it.
    95105    return 0;
    96106}
  • trunk/WebCore/dom/DocumentType.h

    r25754 r30243  
    4949    String internalSubset() const { return m_subset; }
    5050
    51     virtual String baseURI() const;
     51    virtual KURL baseURI() const;
    5252
    5353    // Other methods (not part of DOM)
  • trunk/WebCore/dom/Element.cpp

    r30117 r30243  
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    66 *           (C) 2007 David Smith (catfish.man@gmail.com)
    7  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     7 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    88 *           (C) 2007 Eric Seidel (eric@webkit.org)
    99 *
     
    3838#include "HTMLElement.h"
    3939#include "HTMLNames.h"
    40 #include "KURL.h"
    4140#include "NamedAttrMap.h"
    4241#include "NodeList.h"
     
    563562}
    564563
    565 String Element::baseURI() const
    566 {
    567     KURL xmlbase(getAttribute(baseAttr).deprecatedString());
    568 
    569     if (!xmlbase.protocol().isEmpty())
    570         return xmlbase.string();
     564KURL Element::baseURI() const
     565{
     566    KURL base(getAttribute(baseAttr));
     567    if (!base.protocol().isEmpty())
     568        return base;
    571569
    572570    Node* parent = parentNode();
    573     if (parent)
    574         return KURL(parent->baseURI().deprecatedString(), xmlbase.deprecatedString()).string();
    575 
    576     return xmlbase.string();
     571    if (!parent)
     572        return base;
     573
     574    KURL parentBase = parent->baseURI();
     575    if (parentBase.isNull())
     576        return base;
     577
     578    return KURL(parentBase, base.string());
    577579}
    578580
  • trunk/WebCore/dom/Element.h

    r30112 r30243  
    110110    virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
    111111
    112     virtual String baseURI() const;
     112    virtual KURL baseURI() const;
    113113
    114114    // DOM methods overridden from  parent classes
  • trunk/WebCore/dom/Node.cpp

    r30237 r30243  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    5  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    66 * Copyright (C) 2007 Trolltech ASA
    77 *
     
    4343#include "HTMLNames.h"
    4444#include "HTMLNames.h"
    45 #include "KURL.h"
    4645#include "Logging.h"
    4746#include "NameNodeList.h"
     
    153152    {
    154153        KJS::JSLock lock;
    155         KJS::ScriptInterpreter::updateDOMNodeDocument(this, m_document.get(), doc);
     154        ScriptInterpreter::updateDOMNodeDocument(this, m_document.get(), doc);
    156155    }   
    157156    m_document = doc;
     
    12831282}
    12841283
    1285 NamedAttrMap *Node::attributes() const
    1286 {
    1287     return 0;
    1288 }
    1289 
    1290 String Node::baseURI() const
    1291 {
    1292     Node* parent = parentNode();
    1293     if (parent)
    1294         return parent->baseURI();
    1295 
    1296     return String();
     1284NamedAttrMap* Node::attributes() const
     1285{
     1286    return 0;
     1287}
     1288
     1289KURL Node::baseURI() const
     1290{
     1291    return parentNode() ? parentNode()->baseURI() : KURL();
    12971292}
    12981293
  • trunk/WebCore/dom/Node.h

    r30112 r30243  
    4545class IntRect;
    4646class KeyboardEvent;
     47class KURL;
    4748class NamedAttrMap;
    4849class NodeList;
     
    107108    virtual NamedAttrMap* attributes() const;
    108109
    109     virtual String baseURI() const;
     110    virtual KURL baseURI() const;
    110111
    111112    // These should all actually return a node, but this is only important for language bindings,
  • trunk/WebCore/dom/ProcessingInstruction.cpp

    r30147 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
    5  * Copyright (C) 2006 Apple Computer, Inc.
     3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    64 *
    75 * This library is free software; you can redistribute it and/or
     
    2018 * Boston, MA 02110-1301, USA.
    2119 */
     20
    2221#include "config.h"
    2322#include "ProcessingInstruction.h"
     
    157156#if ENABLE(XSLT)
    158157                    if (m_isXSL)
    159                         m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href));
     158                        m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href).string());
    160159                    else
    161160#endif
     
    165164                            charset = document()->frame()->loader()->encoding();
    166165
    167                         m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href), charset);
     166                        m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href).string(), charset);
    168167                    }
    169168                    if (m_cachedSheet)
  • trunk/WebCore/dom/StyleElement.cpp

    r29663 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 2006, 2007 Rob Buis
     3 * Copyright (C) 2008 Apple, Inc. All rights reserved.
    54 *
    65 * This library is free software; you can redistribute it and/or
     
    1918 * Boston, MA 02110-1301, USA.
    2019 */
     20
    2121#include "config.h"
    2222#include "StyleElement.h"
     
    5757        return;
    5858
    59     String text = "";
     59    Vector<UChar> text;
    6060
    6161    for (Node* c = e->firstChild(); c; c = c->nextSibling())
    6262        if (c->nodeType() == Node::TEXT_NODE || c->nodeType() == Node::CDATA_SECTION_NODE || c->nodeType() == Node::COMMENT_NODE)
    63             text += c->nodeValue();
     63            append(text, c->nodeValue());
    6464
    65     createSheet(e, text);
     65    createSheet(e, String::adopt(text));
    6666}
    6767
     
    7575    }
    7676
    77     String typeValue = e->isHTMLElement() ? type().deprecatedString().lower() : type();
    78     if (typeValue.isEmpty() || typeValue == "text/css") { // Type must be empty or CSS
     77    // If type is empty or CSS, this is a CSS style sheet.
     78    const AtomicString& type = this->type();
     79    if (type.isEmpty() || (e->isHTMLElement() ? equalIgnoringCase(type, "text/css") : (type == "text/css"))) {
    7980        RefPtr<MediaList> mediaList = new MediaList((CSSStyleSheet*)0, media(), e->isHTMLElement());
    8081        MediaQueryEvaluator screenEval("screen", true);
  • trunk/WebCore/dom/XMLTokenizer.cpp

    r30236 r30243  
    864864                    scriptCode += static_cast<CharacterData*>(child)->data();
    865865            }
    866             m_view->frame()->loader()->executeScript(m_doc->url(), m_scriptStartLine - 1, scriptCode);
     866            m_view->frame()->loader()->executeScript(m_doc->url().string(), m_scriptStartLine - 1, scriptCode);
    867867        }
    868868       
     
    12931293#if ENABLE(XSLT)
    12941294    if (m_sawXSLTransform) {
    1295         m_doc->setTransformSource(xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url()));
     1295        m_doc->setTransformSource(xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url().string()));
    12961296       
    12971297        m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets.
     
    14421442
    14431443#if ENABLE(XSLT)
    1444 void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const DeprecatedString& url)
     1444void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const String& url)
    14451445{
    14461446    if (source.isEmpty())
     
    14611461    xmlDocPtr sourceDoc = xmlReadMemory(reinterpret_cast<const char*>(source.characters()),
    14621462                                        source.length() * sizeof(UChar),
    1463                                         url.ascii(),
     1463                                        url.latin1().data(),
    14641464                                        BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
    14651465                                        XSLT_PARSE_OPTIONS);
  • trunk/WebCore/dom/XMLTokenizer.h

    r28639 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
    5  * Copyright (C) 2005, 2006 Apple Computer, Inc.
     3 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
    64 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
    75 * Copyright (C) 2007 Trolltech ASA
     
    171169
    172170#if ENABLE(XSLT)
    173 void* xmlDocPtrForString(DocLoader*, const String& source, const DeprecatedString& url);
     171void* xmlDocPtrForString(DocLoader*, const String& source, const String& url);
    174172void setLoaderForLibXMLCallbacks(DocLoader*);
    175173#endif
  • trunk/WebCore/editing/markup.cpp

    r29452 r30243  
    11/*
    2  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4646#include "HTMLNames.h"
    4747#include "InlineTextBox.h"
    48 #include "KURL.h"
    4948#include "Logging.h"
    5049#include "ProcessingInstruction.h"
     
    8786};
    8887
    89 static inline void appendString(Vector<UChar>& result, const String& str)
    90 {
    91     result.append(str.characters(), str.length());
    92 }
    93    
    9488static void appendAttributeValue(Vector<UChar>& result, const String& attr)
    9589{
     
    107101            case '&':
    108102                result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
    109                 appendString(result, ampEntity);
     103                append(result, ampEntity);
    110104                lastCopiedFrom = i + 1;
    111105                break;
    112106            case '<':
    113107                result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
    114                 appendString(result, ltEntity);
     108                append(result, ltEntity);
    115109                lastCopiedFrom = i + 1;
    116110                break;
    117111            case '"':
    118112                result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
    119                 appendString(result, quotEntity);
     113                append(result, quotEntity);
    120114                lastCopiedFrom = i + 1;
    121115        }
     
    167161            result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
    168162            if (c == '&')
    169                 appendString(result, ampEntity);
     163                append(result, ampEntity);
    170164            else
    171                 appendString(result, ltEntity);
     165                append(result, ltEntity);
    172166            lastCopiedFrom = i + 1;
    173167        }
     
    182176}   
    183177   
    184 static void appendQuotedURLAttributeValue(Vector<UChar>& result, String urlString)
     178static void appendQuotedURLAttributeValue(Vector<UChar>& result, const String& urlString)
    185179{
    186180    UChar quoteChar = '\"';
    187     if (urlString.stripWhiteSpace().startsWith("javascript:", false)) {
     181    String strippedURLString = urlString.stripWhiteSpace();
     182    if (protocolIs(strippedURLString, "javascript")) {
    188183        // minimal escaping for javascript urls
    189         if (urlString.contains('\"')) {
    190             if (urlString.contains('\''))
    191                 urlString.replace('\"', "&quot;");
     184        if (strippedURLString.contains('"')) {
     185            if (strippedURLString.contains('\''))
     186                strippedURLString.replace('\"', "&quot;");
    192187            else
    193188                quoteChar = '\'';
    194189        }
    195190        result.append(quoteChar);
    196         appendString(result, urlString);
     191        append(result, strippedURLString);
    197192        result.append(quoteChar);
    198193        return;
    199194    }
    200195
    201     // FIXME this does not fully match other browsers. Firefox escapes spaces and other special characters.
     196    // FIXME: This does not fully match other browsers. Firefox escapes spaces and other special characters.
    202197    result.append(quoteChar);
    203198    appendAttributeValue(result, urlString);
     
    332327        static const String xmlns("xmlns");
    333328        result.append(' ');
    334         appendString(result, xmlns);
     329        append(result, xmlns);
    335330        if (!prefix.isEmpty()) {
    336331            result.append(':');
    337             appendString(result, prefix);
     332            append(result, prefix);
    338333        }
    339334
     
    373368        }
    374369        case Node::COMMENT_NODE:
    375             appendString(result, static_cast<const Comment*>(node)->toString());
     370            append(result, static_cast<const Comment*>(node)->toString());
    376371            break;
    377372        case Node::DOCUMENT_NODE: {
     
    380375            const DocumentType* docType = static_cast<const Document*>(node)->doctype();
    381376            if (docType)
    382                 appendString(result, docType->toString());
     377                append(result, docType->toString());
    383378            break;
    384379        }
     
    386381            break;
    387382        case Node::DOCUMENT_TYPE_NODE:
    388             appendString(result, static_cast<const DocumentType*>(node)->toString());
     383            append(result, static_cast<const DocumentType*>(node)->toString());
    389384            break;
    390385        case Node::PROCESSING_INSTRUCTION_NODE:
    391             appendString(result, static_cast<const ProcessingInstruction*>(node)->toString());
     386            append(result, static_cast<const ProcessingInstruction*>(node)->toString());
    392387            break;
    393388        case Node::ELEMENT_NODE: {
     
    395390            const Element* el = static_cast<const Element*>(node);
    396391            bool convert = convertBlocksToInlines & isBlock(const_cast<Node*>(node));
    397             appendString(result, el->nodeNamePreservingCase());
     392            append(result, el->nodeNamePreservingCase());
    398393            NamedAttrMap *attrs = el->attributes();
    399394            unsigned length = attrs->length();
     
    409404
    410405                if (documentIsHTML)
    411                     appendString(result, attr->name().localName());
     406                    append(result, attr->name().localName());
    412407                else
    413                     appendString(result, attr->name().toString());
     408                    append(result, attr->name().toString());
    414409
    415410                result.append('=');
     
    438433                if (style->length() > 0) {
    439434                    static const String stylePrefix(" style=\"");
    440                     appendString(result, stylePrefix);
     435                    append(result, stylePrefix);
    441436                    appendAttributeValue(result, style->cssText());
    442437                    result.append('\"');
     
    453448        }
    454449        case Node::CDATA_SECTION_NODE:
    455             appendString(result, static_cast<const CDATASection*>(node)->toString());
     450            append(result, static_cast<const CDATASection*>(node)->toString());
    456451            break;
    457452        case Node::ATTRIBUTE_NODE:
     
    504499    result.append('<');
    505500    result.append('/');
    506     appendString(result, static_cast<const Element*>(node)->nodeNamePreservingCase());
     501    append(result, static_cast<const Element*>(node)->nodeNamePreservingCase());
    507502    result.append('>');
    508503}
     
    541536    Vector<AttributeChange> changes;
    542537
    543     KURL baseURLAsKURL(baseURL.deprecatedString());
     538    KURL parsedBaseURL(baseURL);
    544539
    545540    Node* end = node->traverseNextSibling();
     
    551546            for (unsigned i = 0; i < length; i++) {
    552547                Attribute* attr = attrs->attributeItem(i);
    553                 if (e->isURLAttribute(attr)) {
    554                     String completedURL = KURL(baseURLAsKURL, attr->value().deprecatedString()).string();
    555                     changes.append(AttributeChange(e, attr->name(), completedURL));
    556                 }
     548                if (e->isURLAttribute(attr))
     549                    changes.append(AttributeChange(e, attr->name(), KURL(parsedBaseURL, attr->value()).string()));
    557550            }
    558551        }
     
    623616
    624617    for (size_t i = preCount; i > 0; --i)
    625         appendString(result, preMarkups[i - 1]);
     618        append(result, preMarkups[i - 1]);
    626619
    627620    for (size_t i = 0; i < postCount; ++i)
    628         appendString(result, postMarkups[i]);
     621        append(result, postMarkups[i]);
    629622
    630623    return String::adopt(result);
     
    807800                    Vector<UChar> openTag;
    808801                    static const String divStyle("<div style=\"");
    809                     appendString(openTag, divStyle);
     802                    append(openTag, divStyle);
    810803                    appendAttributeValue(openTag, style->cssText());
    811804                    openTag.append('\"');
     
    849842            Vector<UChar> openTag;
    850843            const String spanClassStyle = String("<span class=\"" AppleStyleSpanClass "\" style=\"");
    851             appendString(openTag, spanClassStyle);
     844            append(openTag, spanClassStyle);
    852845            appendAttributeValue(openTag, style->cssText());
    853846            openTag.append('\"');
     
    891884    RefPtr<DocumentFragment> fragment = element->createContextualFragment(markup);
    892885
    893     if (fragment && !baseURL.isEmpty() && baseURL != "about:blank" && baseURL != document->baseURL())
     886    if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL())
    894887        completeURLs(fragment.get(), baseURL);
    895888
     
    923916}
    924917
    925 static void fillContainerFromString(ContainerNode* paragraph, const DeprecatedString& string)
     918static void fillContainerFromString(ContainerNode* paragraph, const String& string)
    926919{
    927920    Document* document = paragraph->document();
     
    936929    ASSERT(string.find('\n') == -1);
    937930
    938     DeprecatedStringList tabList = DeprecatedStringList::split('\t', string, true);
    939     DeprecatedString tabText = "";
     931    Vector<String> tabList;
     932    string.split('\t', true, tabList);
     933    String tabText = "";
    940934    bool first = true;
    941     while (!tabList.isEmpty()) {
    942         DeprecatedString s = tabList.first();
    943         tabList.pop_front();
     935    size_t numEntries = tabList.size();
     936    for (size_t i = 0; i < numEntries; ++i) {
     937        const String& s = tabList[i];
    944938
    945939        // append the non-tab textual part
     
    950944                tabText = "";
    951945            }
    952             RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, tabList.isEmpty()));
     946            RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
    953947            paragraph->appendChild(textNode.release(), ec);
    954948            ASSERT(ec == 0);
     
    957951        // there is a tab after every entry, except the last entry
    958952        // (if the last character is a tab, the list gets an extra empty entry)
    959         if (!tabList.isEmpty())
    960             tabText += '\t';
     953        if (i + 1 != numEntries)
     954            tabText.append('\t');
    961955        else if (!tabText.isEmpty()) {
    962956            paragraph->appendChild(createTabSpanElement(document, tabText), ec);
     
    986980        return fragment.release();
    987981
    988     DeprecatedString string = text.deprecatedString();
     982    String string = text;
    989983    string.replace("\r\n", "\n");
    990984    string.replace('\r', '\n');
     
    10161010    bool useClonesOfEnclosingBlock = !block->hasTagName(bodyTag);
    10171011   
    1018     DeprecatedStringList list = DeprecatedStringList::split('\n', string, true); // true gets us empty strings in the list
    1019     while (!list.isEmpty()) {
    1020         DeprecatedString s = list.first();
    1021         list.pop_front();
     1012    Vector<String> list;
     1013    string.split('\n', true, list); // true gets us empty strings in the list
     1014    size_t numLines = list.size();
     1015    for (size_t i = 0; i < numLines; ++i) {
     1016        const String& s = list[i];
    10221017
    10231018        RefPtr<Element> element;
    1024         if (s.isEmpty() && list.isEmpty()) {
     1019        if (s.isEmpty() && i + 1 == numLines) {
    10251020            // For last line, use the "magic BR" rather than a P.
    10261021            element = document->createElementNS(xhtmlNamespaceURI, "br", ec);
  • trunk/WebCore/history/HistoryItem.cpp

    r30122 r30243  
    177177KURL HistoryItem::url() const
    178178{
    179     return KURL(m_urlString.deprecatedString());
     179    return KURL(m_urlString);
    180180}
    181181
    182182KURL HistoryItem::originalURL() const
    183183{
    184     return KURL(m_originalURLString.deprecatedString());
     184    return KURL(m_originalURLString);
    185185}
    186186
  • trunk/WebCore/history/HistoryItem.h

    r30001 r30243  
    3030#include "FormData.h"
    3131#include "IntPoint.h"
    32 #include "KURL.h"
    3332#include "PlatformString.h"
    3433#include <wtf/RefCounted.h>
  • trunk/WebCore/html/HTMLAnchorElement.cpp

    r30044 r30243  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2000 Simon Hausmann <hausmann@kde.org>
    5  * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
     5 * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
    66 *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
    77 *
     
    198198                    int y = e->pageY() - absy;
    199199                    url += "?";
    200                     url += DeprecatedString::number(x);
     200                    url += String::number(x);
    201201                    url += ",";
    202                     url += DeprecatedString::number(y);
     202                    url += String::number(y);
    203203                } else {
    204204                    evt->setDefaultHandled();
     
    329329}
    330330
    331 String HTMLAnchorElement::href() const
     331KURL HTMLAnchorElement::href() const
    332332{
    333333    return document()->completeURL(getAttribute(hrefAttr));
     
    416416String HTMLAnchorElement::hash() const
    417417{
    418     return '#' + KURL(href().deprecatedString()).ref();
     418    return "#" + href().ref();
    419419}
    420420
    421421String HTMLAnchorElement::host() const
    422422{
    423     return KURL(href().deprecatedString()).host();
     423    return href().host();
    424424}
    425425
    426426String HTMLAnchorElement::hostname() const
    427427{
    428     KURL url(href().deprecatedString());
    429     if (url.port()==0)
     428    KURL url(href());
     429    if (url.port() == 0)
    430430        return url.host();
    431     else
    432         return url.host() + ":" + String::number(url.port());
     431    return url.host() + ":" + String::number(url.port());
    433432}
    434433
    435434String HTMLAnchorElement::pathname() const
    436435{
    437     return KURL(href().deprecatedString()).path();
     436    return href().path();
    438437}
    439438
    440439String HTMLAnchorElement::port() const
    441440{
    442     return DeprecatedString::number(KURL(href().deprecatedString()).port());
     441    return String::number(href().port());
    443442}
    444443
    445444String HTMLAnchorElement::protocol() const
    446445{
    447     return KURL(href().deprecatedString()).protocol() + ":";
     446    return href().protocol() + ":";
    448447}
    449448
    450449String HTMLAnchorElement::search() const
    451450{
    452     return KURL(href().deprecatedString()).query();
     451    return href().query();
    453452}
    454453
     
    460459String HTMLAnchorElement::toString() const
    461460{
    462     return href();
     461    return href().string();
    463462}
    464463
  • trunk/WebCore/html/HTMLAnchorElement.h

    r25754 r30243  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2000 Simon Hausmann <hausmann@kde.org>
    5  * Copyright (C) 2007 Apple Inc. All rights reserved.
     5 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    66 *
    77 * This library is free software; you can redistribute it and/or
     
    2828
    2929namespace WebCore {
    30 
    31 class String;
    3230
    3331class HTMLAnchorElement : public HTMLElement {
     
    6159    void setCoords(const String&);
    6260
    63     String href() const;
     61    KURL href() const;
    6462    void setHref(const String&);
    6563
  • trunk/WebCore/html/HTMLAppletElement.cpp

    r30112 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
    7  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. ALl rights reserved.
    86 * Copyright (C) 2007 Trolltech ASA
    97 *
     
    2321 * Boston, MA 02110-1301, USA.
    2422 */
     23
    2524#include "config.h"
    2625#include "HTMLAppletElement.h"
     
    3736using namespace HTMLNames;
    3837
    39 HTMLAppletElement::HTMLAppletElement(Document *doc)
    40 : HTMLPlugInElement(appletTag, doc)
     38HTMLAppletElement::HTMLAppletElement(Document* doc)
     39    : HTMLPlugInElement(appletTag, doc)
    4140{
    4241}
     
    5049}
    5150
    52 void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)
     51void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr)
    5352{
    5453    if (attr->name() == altAttr ||
     
    6261        String newNameAttr = attr->value();
    6362        if (inDocument() && document()->isHTMLDocument()) {
    64             HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     63            HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    6564            doc->removeNamedItem(oldNameAttr);
    6665            doc->addNamedItem(newNameAttr);
     
    7069        String newIdAttr = attr->value();
    7170        if (inDocument() && document()->isHTMLDocument()) {
    72             HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     71            HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    7372            doc->removeDocExtraNamedItem(oldIdAttr);
    7473            doc->addDocExtraNamedItem(newIdAttr);
     
    8483{
    8584    if (document()->isHTMLDocument()) {
    86         HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     85        HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    8786        doc->addNamedItem(oldNameAttr);
    8887        doc->addDocExtraNamedItem(oldIdAttr);
     
    9594{
    9695    if (document()->isHTMLDocument()) {
    97         HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     96        HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    9897        doc->removeNamedItem(oldNameAttr);
    9998        doc->removeDocExtraNamedItem(oldIdAttr);
     
    103102}
    104103
    105 bool HTMLAppletElement::rendererIsNeeded(RenderStyle *style)
     104bool HTMLAppletElement::rendererIsNeeded(RenderStyle* style)
    106105{
    107106    return !getAttribute(codeAttr).isNull();
    108107}
    109108
    110 RenderObject *HTMLAppletElement::createRenderer(RenderArena *arena, RenderStyle *style)
     109RenderObject* HTMLAppletElement::createRenderer(RenderArena* arena, RenderStyle* style)
    111110{
    112111    Settings* settings = document()->settings();
     
    126125            args.set("archive", archive);
    127126
    128         args.set("baseURL", document()->baseURL());
     127        args.set("baseURL", document()->baseURL().string());
    129128
    130129        const AtomicString& mayScript = getAttribute(mayscriptAttr);
     
    141140
    142141#if USE(JAVASCRIPTCORE_BINDINGS)
    143 KJS::Bindings::Instance *HTMLAppletElement::getInstance() const
     142KJS::Bindings::Instance* HTMLAppletElement::getInstance() const
    144143{
    145144    Settings* settings = document()->settings();
  • trunk/WebCore/html/HTMLAreaElement.cpp

    r25754 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
     
    2119 * Boston, MA 02110-1301, USA.
    2220 */
     21
    2322#include "config.h"
    2423#include "HTMLAreaElement.h"
    2524
    2625#include "Document.h"
     26#include "FloatRect.h"
    2727#include "HTMLNames.h"
    28 #include "FloatRect.h"
    2928#include "HitTestResult.h"
    3029#include "RenderObject.h"
     
    180179}
    181180
    182 String HTMLAreaElement::href() const
     181KURL HTMLAreaElement::href() const
    183182{
    184183    return document()->completeURL(getAttribute(hrefAttr));
  • trunk/WebCore/html/HTMLAreaElement.h

    r25754 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    6  * Copyright (C) 2004 Apple Computer, Inc.
     4 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
    75 *
    86 * This library is free software; you can redistribute it and/or
     
    3634class HTMLAreaElement : public HTMLAnchorElement {
    3735public:
    38     enum Shape { Default, Poly, Rect, Circle, Unknown };
    39 
    4036    HTMLAreaElement(Document*);
    4137    ~HTMLAreaElement();
     
    6157    void setCoords(const String&);
    6258
    63     String href() const;
     59    KURL href() const;
    6460    void setHref(const String&);
    6561
     
    7571    void setTarget(const String&);
    7672
    77 protected:
     73private:
     74    enum Shape { Default, Poly, Rect, Circle, Unknown };
    7875    Path getRegion(const IntSize&) const;
    7976    Path region;
  • trunk/WebCore/html/HTMLBaseElement.cpp

    r28639 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    7  * Copyright (C) 2003 Apple Computer, Inc.
     5 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    3735using namespace HTMLNames;
    3836
    39 HTMLBaseElement::HTMLBaseElement(Document *doc)
     37HTMLBaseElement::HTMLBaseElement(Document* doc)
    4038    : HTMLElement(baseTag, doc)
    4139{
     
    4644}
    4745
    48 void HTMLBaseElement::parseMappedAttribute(MappedAttribute *attr)
     46void HTMLBaseElement::parseMappedAttribute(MappedAttribute* attr)
    4947{
    5048    if (attr->name() == hrefAttr) {
     
    7068    // Since the document doesn't have a base element...
    7169    // (This will break in the case of multiple base elements, but that's not valid anyway (?))
    72     document()->setBaseURL(DeprecatedString::null);
    73     document()->setBaseTarget(DeprecatedString::null);
     70    document()->setBaseURL(KURL());
     71    document()->setBaseTarget(String());
    7472}
    7573
     
    8078
    8179    if (!m_href.isEmpty() && document()->frame())
    82         document()->setBaseURL(KURL(document()->frame()->loader()->url(), m_href.deprecatedString()).deprecatedString());
     80        document()->setBaseURL(KURL(document()->frame()->loader()->url(), m_href));
    8381
    8482    if (!m_target.isEmpty())
  • trunk/WebCore/html/HTMLBodyElement.cpp

    r25754 r30243  
    1 /**
     1/*
    22 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2000 Simon Hausmann (hausmann@kde.org)
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    6  * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
     6 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
    77 *
    88 * This library is free software; you can redistribute it and/or
     
    8989        String url = parseURL(attr->value());
    9090        if (!url.isEmpty())
    91             addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
     91            addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string());
    9292    } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) {
    9393        addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
     
    181181}
    182182
    183 void HTMLBodyElement::setALink(const String &value)
     183void HTMLBodyElement::setALink(const String& value)
    184184{
    185185    setAttribute(alinkAttr, value);
     
    191191}
    192192
    193 void HTMLBodyElement::setBackground(const String &value)
     193void HTMLBodyElement::setBackground(const String& value)
    194194{
    195195    setAttribute(backgroundAttr, value);
     
    201201}
    202202
    203 void HTMLBodyElement::setBgColor(const String &value)
     203void HTMLBodyElement::setBgColor(const String& value)
    204204{
    205205    setAttribute(bgcolorAttr, value);
     
    211211}
    212212
    213 void HTMLBodyElement::setLink(const String &value)
     213void HTMLBodyElement::setLink(const String& value)
    214214{
    215215    setAttribute(linkAttr, value);
     
    221221}
    222222
    223 void HTMLBodyElement::setText(const String &value)
     223void HTMLBodyElement::setText(const String& value)
    224224{
    225225    setAttribute(textAttr, value);
     
    231231}
    232232
    233 void HTMLBodyElement::setVLink(const String &value)
     233void HTMLBodyElement::setVLink(const String& value)
    234234{
    235235    setAttribute(vlinkAttr, value);
     
    242242    doc->updateLayoutIgnorePendingStylesheets();
    243243    FrameView* view = doc->view();
    244    
    245244    return view ? view->contentsX() : 0;
    246245}
     
    262261    doc->updateLayoutIgnorePendingStylesheets();
    263262    FrameView* view = doc->view();
    264    
    265263    return view ? view->contentsY() : 0;
    266264}
     
    282280    doc->updateLayoutIgnorePendingStylesheets();
    283281    FrameView* view = doc->view();
    284    
    285282    return view ? view->contentsHeight() : 0;   
    286283}
     
    292289    doc->updateLayoutIgnorePendingStylesheets();
    293290    FrameView* view = doc->view();
    294    
    295291    return view ? view->contentsWidth() : 0;   
    296292}
  • trunk/WebCore/html/HTMLEmbedElement.cpp

    r29913 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
    7  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    86 * Copyright (C) 2007 Trolltech ASA
    97 *
     
    2321 * Boston, MA 02110-1301, USA.
    2422 */
     23
    2524#include "config.h"
    2625#include "HTMLEmbedElement.h"
     
    6564}
    6665   
    67 KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
     66KJS::Bindings::Instance* HTMLEmbedElement::getInstance() const
    6867{
    6968    Frame* frame = document()->frame();
     
    107106            m_serviceType = m_serviceType.left(pos);
    108107    } else if (attr->name() == codeAttr || attr->name() == srcAttr)
    109          url = parseURL(val).deprecatedString();
     108        m_url = parseURL(val);
    110109    else if (attr->name() == pluginpageAttr || attr->name() == pluginspageAttr)
    111110        m_pluginPage = val;
     
    128127}
    129128
    130 bool HTMLEmbedElement::rendererIsNeeded(RenderStyle *style)
    131 {
    132     Frame *frame = document()->frame();
     129bool HTMLEmbedElement::rendererIsNeeded(RenderStyle* style)
     130{
     131    Frame* frame = document()->frame();
    133132    if (!frame)
    134133        return false;
    135134
    136     Node *p = parentNode();
     135    Node* p = parentNode();
    137136    if (p && p->hasTagName(objectTag)) {
    138137        ASSERT(p->renderer());
     
    143142}
    144143
    145 RenderObject *HTMLEmbedElement::createRenderer(RenderArena *arena, RenderStyle *style)
     144RenderObject* HTMLEmbedElement::createRenderer(RenderArena* arena, RenderStyle* style)
    146145{
    147146    return new (arena) RenderPartObject(this);
     
    172171{
    173172    if (document()->isHTMLDocument()) {
    174         HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     173        HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    175174        doc->addNamedItem(oldNameAttr);
    176175    }
     
    196195{
    197196    if (document()->isHTMLDocument()) {
    198         HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     197        HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    199198        doc->removeNamedItem(oldNameAttr);
    200199    }
     
    216215}
    217216
    218 bool HTMLEmbedElement::isURLAttribute(Attribute *attr) const
     217bool HTMLEmbedElement::isURLAttribute(Attribute* attr) const
    219218{
    220219    return attr->name() == srcAttr;
  • trunk/WebCore/html/HTMLEmbedElement.h

    r29913 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    6  * Copyright (C) 2004, 2006 Apple Computer, Inc.
     4 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
    75 *
    86 * This library is free software; you can redistribute it and/or
     
    6866    void setType(const String&);
    6967
    70     DeprecatedString url;
     68    const String& url() const { return m_url; }
     69    const String& serviceType() const { return m_serviceType; }
     70
     71private:
     72    String m_url;
    7173    String m_pluginPage;
    7274    String m_serviceType;
  • trunk/WebCore/html/HTMLFormElement.cpp

    r29989 r30243  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    5  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    66 *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    77 *
     
    8787}
    8888
    89 bool HTMLFormElement::formWouldHaveSecureSubmission(const String &url)
    90 {
    91     if (url.isNull()) {
    92         return false;
    93     }
    94     return document()->completeURL(url.deprecatedString()).startsWith("https:", false);
     89bool HTMLFormElement::formWouldHaveSecureSubmission(const String& url)
     90{
     91    return document()->completeURL(url).protocolIs("https");
    9592}
    9693
     
    103100{
    104101    if (document()->isHTMLDocument()) {
    105         HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     102        HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    106103        doc->addNamedItem(oldNameAttr);
    107104    }
     
    113110{
    114111    if (document()->isHTMLDocument()) {
    115         HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     112        HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    116113        doc->removeNamedItem(oldNameAttr);
    117114    }
     
    150147    for (unsigned i = 0; i < formElements.size(); ++i) {
    151148        if (formElements[i]->hasLocalName(inputTag)) {
    152             HTMLInputElement *element = static_cast<HTMLInputElement *>(formElements[i]);
     149            HTMLInputElement* element = static_cast<HTMLInputElement*>(formElements[i]);
    153150            if (element->isSuccessfulSubmitButton() && element->renderer()) {
    154151                submitFound = true;
     
    168165    // http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
    169166    // same safe characters as Netscape for compatibility
    170     static const char *safe = "-._*";
     167    static const char* safe = "-._*";
    171168    int elen = e.length();
    172169    DeprecatedCString encoded((elen + e.contains('\n')) * 3 + 1);
     
    247244    String str = m_acceptcharset;
    248245    str.replace(',', ' ');
    249     Vector<String> charsets = str.split(' ');
     246    Vector<String> charsets;
     247    str.split(' ', charsets);
    250248    Vector<String>::const_iterator end = charsets.end();
    251249    for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it)
     
    313311
    314312                        if (!static_cast<HTMLInputElement*>(current)->value().isEmpty()) {
    315                             DeprecatedString mimeType = MIMETypeRegistry::getMIMETypeForPath(path).deprecatedString();
     313                            String mimeType = MIMETypeRegistry::getMIMETypeForPath(path);
    316314                            if (!mimeType.isEmpty()) {
    317315                                hstr += "\r\nContent-Type: ";
    318                                 hstr += mimeType.ascii();
     316                                hstr += mimeType.latin1().deprecatedCString();
    319317                            }
    320318                        }
     
    365363bool HTMLFormElement::isMailtoForm() const
    366364{
    367     return m_url.startsWith("mailto:", false);
     365    return protocolIs(m_url, "mailto");
    368366}
    369367
     
    445443void HTMLFormElement::submit(Event* event, bool activateSubmitButton)
    446444{
    447     FrameView *view = document()->view();
    448     Frame *frame = document()->frame();
     445    FrameView* view = document()->view();
     446    Frame* frame = document()->frame();
    449447    if (!view || !frame)
    450448        return;
     
    483481   
    484482    if (!m_url)
    485         m_url = document()->url();
     483        m_url = document()->url().string();
    486484
    487485    if (m_post) {
     
    497495                if (equalIgnoringCase(enctype(), "text/plain")) {
    498496                    // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20.
    499                     body = KURL::decode_string(body.replace('&', "\r\n").replace('+', ' ').deprecatedString() + "\r\n");
     497                    body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', ' ') + "\r\n");
    500498                }
    501499                data = new FormData((String("body=") + encodeCString(body.utf8())).replace('+', "%20").latin1());
     
    520518void HTMLFormElement::reset()
    521519{
    522     Frame *frame = document()->frame();
     520    Frame* frame = document()->frame();
    523521    if (m_inreset || !frame)
    524522        return;
     
    539537}
    540538
    541 void HTMLFormElement::parseMappedAttribute(MappedAttribute *attr)
     539void HTMLFormElement::parseMappedAttribute(MappedAttribute* attr)
    542540{
    543541    if (attr->name() == actionAttr)
     
    567565        String newNameAttr = attr->value();
    568566        if (inDocument() && document()->isHTMLDocument()) {
    569             HTMLDocument *doc = static_cast<HTMLDocument *>(document());
     567            HTMLDocument* doc = static_cast<HTMLDocument*>(document());
    570568            doc->removeNamedItem(oldNameAttr);
    571569            doc->addNamedItem(newNameAttr);
     
    586584}
    587585
    588 unsigned HTMLFormElement::formElementIndex(HTMLGenericFormElement *e)
     586unsigned HTMLFormElement::formElementIndex(HTMLGenericFormElement* e)
    589587{
    590588    // Check for the special case where this element is the very last thing in
     
    594592    if (e->traverseNextNode(this)) {
    595593        unsigned i = 0;
    596         for (Node *node = this; node; node = node->traverseNextNode(this)) {
     594        for (Node* node = this; node; node = node->traverseNextNode(this)) {
    597595            if (node == e)
    598596                return i;
    599597            if (node->isHTMLElement()
    600                     && static_cast<HTMLElement *>(node)->isGenericFormElement()
    601                     && static_cast<HTMLGenericFormElement *>(node)->form() == this)
     598                    && static_cast<HTMLElement*>(node)->isGenericFormElement()
     599                    && static_cast<HTMLGenericFormElement*>(node)->form() == this)
    602600                ++i;
    603601        }
     
    619617}
    620618
    621 bool HTMLFormElement::isURLAttribute(Attribute *attr) const
     619bool HTMLFormElement::isURLAttribute(Attribute* attr) const
    622620{
    623621    return attr->name() == actionAttr;
    624622}
    625623
    626 void HTMLFormElement::registerImgElement(HTMLImageElement *e)
     624void HTMLFormElement::registerImgElement(HTMLImageElement* e)
    627625{
    628626    imgElements.append(e);
    629627}
    630628
    631 void HTMLFormElement::removeImgElement(HTMLImageElement *e)
     629void HTMLFormElement::removeImgElement(HTMLImageElement* e)
    632630{
    633631    removeFromVector(imgElements, e);
  • trunk/WebCore/html/HTMLFrameElementBase.cpp

    r27125 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2000 Simon Hausmann (hausmann@kde.org)
    75 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    8  * Copyright (C) 2004, 2006 Apple Computer, Inc.
     6 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
    97 *
    108 * This library is free software; you can redistribute it and/or
     
    2321 * Boston, MA 02110-1301, USA.
    2422 */
     23
    2524#include "config.h"
    2625#include "HTMLFrameElementBase.h"
     
    6261        return true;
    6362
    64     KURL completeURL(document()->completeURL(URLString.deprecatedString()));
    65     completeURL.setRef(DeprecatedString::null);
     63    KURL completeURL(document()->completeURL(URLString));
    6664
    6765    // Don't allow more than 200 total frames in a set. This seems
     
    6967    // frameset pages can quickly bring the program to its knees with
    7068    // exponential growth in the number of frames.
    71 
    72     // FIXME: This limit could be higher, but WebKit has some
     69    // FIXME: This limit could be higher, but because WebKit has some
    7370    // algorithms that happen while loading which appear to be N^2 or
    74     // worse in the number of frames
    75     if (Frame* parentFrame = document()->frame())
     71    // worse in the number of frames, we'll keep it at 200 for now.
     72    if (Frame* parentFrame = document()->frame()) {
    7673        if (parentFrame->page()->frameCount() > 200)
    7774            return false;
     75    }
    7876
    7977    // We allow one level of self-reference because some sites depend on that.
     
    8179    bool foundSelfReference = false;
    8280    for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) {
    83         KURL frameURL = frame->loader()->url();
    84         frameURL.setRef(DeprecatedString::null);
    85         if (frameURL == completeURL) {
     81        if (equalIgnoringRef(frame->loader()->url(), completeURL)) {
    8682            if (foundSelfReference)
    8783                return false;
     
    10197
    10298    if (m_URL.isEmpty())
    103         m_URL = "about:blank";
     99        m_URL = blankURL().string();
    104100
    105101    Frame* parentFrame = document()->frame();
     
    204200}
    205201
    206 String HTMLFrameElementBase::location() const
     202KURL HTMLFrameElementBase::location() const
    207203{
    208204    return src();
     
    303299}
    304300
    305 String HTMLFrameElementBase::src() const
     301KURL HTMLFrameElementBase::src() const
    306302{
    307303    return document()->completeURL(getAttribute(srcAttr));
  • trunk/WebCore/html/HTMLFrameElementBase.h

    r29722 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2000 Simon Hausmann <hausmann@kde.org>
    7  * Copyright (C) 2004, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    4139    virtual void attach();
    4240
    43     String location() const;
     41    KURL location() const;
    4442    void setLocation(const String&);
    4543
     
    7573    void setScrolling(const String&);
    7674
    77     String src() const;
     75    KURL src() const;
    7876    void setSrc(const String&);
    7977
  • trunk/WebCore/html/HTMLImageElement.cpp

    r29185 r30243  
    117117            usemap = attr->value();
    118118        else
    119             usemap = document()->completeURL(parseURL(attr->value()));
     119            usemap = document()->completeURL(parseURL(attr->value())).string();
    120120        m_isLink = !attr->isNull();
    121121    } else if (attrName == ismapAttr)
     
    343343}
    344344
    345 String HTMLImageElement::longDesc() const
     345KURL HTMLImageElement::longDesc() const
    346346{
    347347    return document()->completeURL(getAttribute(longdescAttr));
     
    353353}
    354354
    355 String HTMLImageElement::lowsrc() const
     355KURL HTMLImageElement::lowsrc() const
    356356{
    357357    return document()->completeURL(getAttribute(lowsrcAttr));
     
    363363}
    364364
    365 String HTMLImageElement::src() const
     365KURL HTMLImageElement::src() const
    366366{
    367367    return document()->completeURL(getAttribute(srcAttr));
  • trunk/WebCore/html/HTMLImageElement.h

    r26992 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    6  * Copyright (C) 2004 Apple Computer, Inc.
     4 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
    75 *
    86 * This library is free software; you can redistribute it and/or
     
    2624#define HTMLImageElement_h
    2725
     26#include "GraphicsTypes.h"
    2827#include "HTMLElement.h"
    29 #include "GraphicsTypes.h"
    3028#include "HTMLImageLoader.h"
    3129
    3230namespace WebCore {
    33     class HTMLFormElement;
     31
     32class HTMLFormElement;
    3433
    3534class HTMLImageElement : public HTMLElement {
     
    6362    String altText() const;
    6463
    65     String imageMap() const { return usemap; }
    66    
    6764    virtual bool isURLAttribute(Attribute*) const;
    6865
     
    9491    void setIsMap(bool);
    9592
    96     String longDesc() const;
     93    KURL longDesc() const;
    9794    void setLongDesc(const String&);
    9895
    99     String lowsrc() const;
     96    KURL lowsrc() const;
    10097    void setLowsrc(const String&);
    10198
    102     String src() const;
     99    KURL src() const;
    103100    void setSrc(const String&);
    104101
     
    117114
    118115    bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); }
    119 protected:
     116
     117private:
    120118    HTMLImageLoader m_imageLoader;
    121119    String usemap;
  • trunk/WebCore/html/HTMLInputElement.cpp

    r29098 r30243  
    14501450}
    14511451
    1452 String HTMLInputElement::src() const
     1452KURL HTMLInputElement::src() const
    14531453{
    14541454    return document()->completeURL(getAttribute(srcAttr));
  • trunk/WebCore/html/HTMLInputElement.h

    r29204 r30243  
    3131
    3232class HTMLImageLoader;
     33class KURL;
    3334class Selection;
    3435
     
    167168    void setSize(unsigned);
    168169
    169     String src() const;
     170    KURL src() const;
    170171    void setSrc(const String&);
    171172
  • trunk/WebCore/html/HTMLLinkElement.cpp

    r30147 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    7  * Copyright (C) 2003 Apple Computer, Inc.
     5 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    2220 * Boston, MA 02110-1301, USA.
    2321 */
     22
    2423#include "config.h"
    2524#include "HTMLLinkElement.h"
     
    109108        process();
    110109    } else if (attr->name() == hrefAttr) {
    111         m_url = document()->completeURL(parseURL(attr->value()));
     110        m_url = document()->completeURL(parseURL(attr->value())).string();
    112111        process();
    113112    } else if (attr->name() == typeAttr) {
     
    139138        // Tokenize the rel attribute and set bits based on specific keywords that we find.
    140139        rel.replace('\n', ' ');
    141         Vector<String> list = rel.split(' ');
     140        Vector<String> list;
     141        rel.split(' ', list);
    142142        Vector<String>::const_iterator end = list.end();
    143143        for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) {
     
    275275}
    276276
    277 String HTMLLinkElement::href() const
     277KURL HTMLLinkElement::href() const
    278278{
    279279    return document()->completeURL(getAttribute(hrefAttr));
  • trunk/WebCore/html/HTMLLinkElement.h

    r30147 r30243  
    11/*
    2  * This file is part of the DOM implementation for KDE.
    3  *
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    6  * Copyright (C) 2003 Apple Computer, Inc.
     4 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
    75 *
    86 * This library is free software; you can redistribute it and/or
     
    2220 *
    2321 */
     22
    2423#ifndef HTMLLinkElement_h
    2524#define HTMLLinkElement_h
    2625
     26#include "CSSStyleSheet.h"
     27#include "CachedResourceClient.h"
    2728#include "HTMLElement.h"
    28 #include "CachedResourceClient.h"
    29 #include "CSSStyleSheet.h"
    3029
    3130namespace WebCore {
    3231
    3332class CachedCSSStyleSheet;
     33class KURL;
    3434
    35 class HTMLLinkElement : public HTMLElement, public CachedResourceClient
    36 {
     35class HTMLLinkElement : public HTMLElement, public CachedResourceClient {
    3736public:
    3837    HTMLLinkElement(Document*);
     
    4847    void setCharset(const String&);
    4948
    50     String href() const;
     49    KURL href() const;
    5150    void setHref(const String&);
    5251
  • trunk/WebCore/html/HTMLMediaElement.cpp

    r30151 r30243  
    11/*
    2  * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    227227}
    228228
    229 String HTMLMediaElement::src() const
     229KURL HTMLMediaElement::src() const
    230230{
    231231    return document()->completeURL(getAttribute(srcAttr));
     
    820820                        continue;
    821821                }
    822                 mediaSrc = source->src();
     822                mediaSrc = source->src().string();
    823823                break;
    824824            }
     
    826826    }
    827827    if (!mediaSrc.isEmpty())
    828         mediaSrc = document()->completeURL(mediaSrc);
     828        mediaSrc = document()->completeURL(mediaSrc).string();
    829829    return mediaSrc;
    830830}
  • trunk/WebCore/html/HTMLMediaElement.h

    r30043 r30243  
    3838class MediaError;
    3939class TimeRanges;
     40class KURL;
    4041   
    4142class HTMLMediaElement : public HTMLElement, public MediaPlayerClient {
     
    7273
    7374// network state
    74     String src() const;
     75    KURL src() const;
    7576    void setSrc(const String&);
    7677    String currentSrc() const;
  • trunk/WebCore/html/HTMLObjectElement.cpp

    r30112 r30243  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
    5  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    66 * Copyright (C) 2007 Trolltech ASA
    77 *
     
    261261bool HTMLObjectElement::isImageType()
    262262{
    263     if (m_serviceType.isEmpty() && m_url.startsWith("data:")) {
     263    if (m_serviceType.isEmpty() && protocolIs(m_url, "data")) {
    264264        // Extract the MIME type from the data URL.
    265265        int index = m_url.find(';');
     
    379379}
    380380
    381 String HTMLObjectElement::data() const
     381KURL HTMLObjectElement::data() const
    382382{
    383383    return document()->completeURL(getAttribute(dataAttr));
  • trunk/WebCore/html/HTMLObjectElement.h

    r30112 r30243  
    22 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    4  * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
     4 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    3030
    3131class HTMLImageLoader;
     32class KURL;
    3233
    3334class HTMLObjectElement : public HTMLPlugInElement {
     
    8081    void setCodeType(const String&);
    8182   
    82     String data() const;
     83    KURL data() const;
    8384    void setData(const String&);
    8485
  • trunk/WebCore/html/HTMLOptGroupElement.cpp

    r30112 r30243  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    5  * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    66 *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    77 *
     
    161161String HTMLOptGroupElement::groupLabelText() const
    162162{
    163     DeprecatedString itemText = getAttribute(labelAttr).deprecatedString();
     163    String itemText = getAttribute(labelAttr);
    164164   
    165165    itemText.replace('\\', document()->backslashAsCurrencySymbol());
  • trunk/WebCore/html/HTMLParser.cpp

    r30127 r30243  
    14781478    message.replace("%tag2", tag2);
    14791479
    1480     page->chrome()->addMessageToConsole(HTMLMessageSource, isWarning(errorCode) ? WarningMessageLevel: ErrorMessageLevel, message, lineNumber, document->url());
    1481 }
    1482 
    1483 }
     1480    page->chrome()->addMessageToConsole(HTMLMessageSource,
     1481        isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel,
     1482        message, lineNumber, document->url().string());
     1483}
     1484
     1485}
  • trunk/WebCore/html/HTMLScriptElement.cpp

    r30112 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    64 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    7  * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc.
     5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    2220 * Boston, MA 02110-1301, USA.
    2321 */
     22
    2423#include "config.h"
    2524#include "HTMLScriptElement.h"
     
    4140using namespace EventNames;
    4241
    43 HTMLScriptElement::HTMLScriptElement(Document *doc)
     42HTMLScriptElement::HTMLScriptElement(Document* doc)
    4443    : HTMLElement(scriptTag, doc)
    4544    , m_cachedScript(0)
     
    5554}
    5655
    57 bool HTMLScriptElement::isURLAttribute(Attribute *attr) const
     56bool HTMLScriptElement::isURLAttribute(Attribute* attr) const
    5857{
    5958    return attr->name() == srcAttr;
     
    6665    // we evaluate the script.
    6766    if (!m_createdByParser && inDocument() && firstChild())
    68         evaluateScript(document()->url(), text());
     67        evaluateScript(document()->url().string(), text());
    6968    HTMLElement::childrenChanged(changedByParser);
    7069}
    7170
    72 void HTMLScriptElement::parseMappedAttribute(MappedAttribute *attr)
     71void HTMLScriptElement::parseMappedAttribute(MappedAttribute* attr)
    7372{
    7473    const QualifiedName& attrName = attr->name();
     
    140139    String scriptString = text();   
    141140    if (!scriptString.isEmpty())
    142         evaluateScript(document()->url(), scriptString);
     141        evaluateScript(document()->url().string(), scriptString);
    143142}
    144143
     
    155154void HTMLScriptElement::notifyFinished(CachedResource* o)
    156155{
    157     CachedScript *cs = static_cast<CachedScript *>(o);
     156    CachedScript* cs = static_cast<CachedScript*>(o);
    158157
    159158    ASSERT(cs == m_cachedScript);
     
    246245String HTMLScriptElement::text() const
    247246{
    248     String val = "";
    249    
    250     for (Node *n = firstChild(); n; n = n->nextSibling()) {
     247    Vector<UChar> val;
     248   
     249    for (Node* n = firstChild(); n; n = n->nextSibling()) {
    251250        if (n->isTextNode())
    252             val += static_cast<Text *>(n)->data();
    253     }
    254    
    255     return val;
     251            append(val, static_cast<Text*>(n)->data());
     252    }
     253   
     254    return String::adopt(val);
    256255}
    257256
     
    266265    }
    267266   
    268     if (numChildren > 0) {
     267    if (numChildren > 0)
    269268        removeChildren();
    270     }
    271269   
    272270    appendChild(document()->createTextNode(value.impl()), ec);
     
    279277}
    280278
    281 void HTMLScriptElement::setHtmlFor(const String &/*value*/)
     279void HTMLScriptElement::setHtmlFor(const String& /*value*/)
    282280{
    283281    // DOM Level 1 says: reserved for future use.
     
    290288}
    291289
    292 void HTMLScriptElement::setEvent(const String &/*value*/)
     290void HTMLScriptElement::setEvent(const String& /*value*/)
    293291{
    294292    // DOM Level 1 says: reserved for future use.
     
    315313}
    316314
    317 String HTMLScriptElement::src() const
     315KURL HTMLScriptElement::src() const
    318316{
    319317    return document()->completeURL(getAttribute(srcAttr));
  • trunk/WebCore/html/HTMLScriptElement.h

    r30112 r30243  
    22 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    4  * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    7070    void setDefer(bool);
    7171
    72     String src() const;
     72    KURL src() const;
    7373    void setSrc(const String&);
    7474
  • trunk/WebCore/html/HTMLSourceElement.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#include "HTMLDocument.h"
    3232#include "HTMLMediaElement.h"
     33#include "HTMLNames.h"
    3334
    3435using namespace std;
     
    5758}
    5859
    59 String HTMLSourceElement::src() const
     60KURL HTMLSourceElement::src() const
    6061{
    6162    return document()->completeURL(getAttribute(srcAttr));
  • trunk/WebCore/html/HTMLSourceElement.h

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3030
    3131#include "HTMLElement.h"
    32 #include "HTMLNames.h"
    3332#include <limits>
    3433
    3534namespace WebCore {
    3635
    37 using namespace HTMLNames;
    38    
    39 class MediaError;
    40    
     36class KURL;
     37
    4138class HTMLSourceElement : public HTMLElement {
    4239public:
     
    4946    virtual void insertedIntoDocument();
    5047   
    51     String src() const;
     48    KURL src() const;
    5249    String media() const;
    5350    String type() const;
  • trunk/WebCore/html/HTMLTableElement.cpp

    r29647 r30243  
    352352        String url = parseURL(attr->value());
    353353        if (!url.isEmpty())
    354             addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
     354            addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string());
    355355    } else if (attr->name() == frameAttr) {
    356356        // Cache the value of "frame" so that the table can examine it later.
  • trunk/WebCore/html/HTMLTablePartElement.cpp

    r25754 r30243  
    6767        String url = parseURL(attr->value());
    6868        if (!url.isEmpty())
    69             addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
     69            addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string());
    7070    } else if (attr->name() == bordercolorAttr) {
    7171        if (!attr->value().isEmpty()) {
  • trunk/WebCore/html/HTMLTextAreaElement.cpp

    r30112 r30243  
    257257    // Code elsewhere normalizes line endings added by the user via the keyboard or pasting.
    258258    // We must normalize line endings coming from JS.
    259     DeprecatedString valueWithNormalizedLineEndings = value.deprecatedString();
     259    String valueWithNormalizedLineEndings = value;
    260260    valueWithNormalizedLineEndings.replace("\r\n", "\n");
    261261    valueWithNormalizedLineEndings.replace("\r", "\n");
  • trunk/WebCore/html/HTMLTokenizer.cpp

    r30127 r30243  
    511511        return state;
    512512    m_executingScript++;
    513     DeprecatedString url = scriptURL.isNull() ? m_doc->frame()->document()->url() : scriptURL.deprecatedString();
     513    String url = scriptURL.isNull() ? m_doc->frame()->document()->url().string() : scriptURL;
    514514
    515515    SegmentedString *savedPrependingSrc = currentPrependingSrc;
     
    12211221                    if (settings && settings->isJavaScriptEnabled()) {
    12221222                        if ((a = currToken.attrs->getAttributeItem(srcAttr)))
    1223                             scriptSrc = m_doc->completeURL(parseURL(a->value()));
     1223                            scriptSrc = m_doc->completeURL(parseURL(a->value())).string();
    12241224                        if ((a = currToken.attrs->getAttributeItem(charsetAttr)))
    12251225                            scriptSrcCharset = a->value().domString().stripWhiteSpace();
     
    16161616    if (dest > buffer) {
    16171617#ifdef TOKEN_DEBUG
    1618         if(currToken.tagName.length()) {
    1619             qDebug( "unexpected token: %s, str: *%s*", currToken.tagName.deprecatedString().latin1(),DeprecatedConstString( buffer,dest-buffer ).deprecatedString().latin1() );
     1618        if (currToken.tagName.length()) {
     1619            qDebug( "unexpected token: %s, str: *%s*", currToken.tagName.latin1().data(), DeprecatedConstString(buffer, dest-buffer).deprecatedString().latin1());
    16201620            ASSERT(0);
    16211621        }
     
    16371637    DeprecatedString name = currToken.tagName.deprecatedString();
    16381638    DeprecatedString text;
    1639     if(currToken.text)
     1639    if (currToken.text)
    16401640        text = DeprecatedConstString(currToken.text->unicode(), currToken.text->length()).deprecatedString();
    16411641
     
    17181718    // FIXME: this should really be done for all script loads or the same effect should be achieved by other
    17191719    // means, like javascript suspend/resume
    1720     m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded() && pendingScripts.head()->url().startsWith("file:", false);
     1720    m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded() && protocolIs(pendingScripts.head()->url(), "file");
    17211721    if (m_hasScriptsWaitingForStylesheets)
    17221722        return;
  • trunk/WebCore/html/HTMLVideoElement.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8484}
    8585
    86 void HTMLVideoElement::parseMappedAttribute(MappedAttribute *attr)
     86void HTMLVideoElement::parseMappedAttribute(MappedAttribute* attr)
    8787{
    8888    const QualifiedName& attrName = attr->name();
     
    141141}
    142142
    143 String HTMLVideoElement::poster() const
     143KURL HTMLVideoElement::poster() const
    144144{
    145145    return document()->completeURL(getAttribute(posterAttr));
     
    151151}
    152152
    153 bool HTMLVideoElement::isURLAttribute(Attribute *attr) const
     153bool HTMLVideoElement::isURLAttribute(Attribute* attr) const
    154154{
    155155    return attr->name() == posterAttr;
  • trunk/WebCore/html/HTMLVideoElement.h

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5959    int videoHeight() const;
    6060   
    61     String poster() const;
     61    KURL poster() const;
    6262    void setPoster(const String&);
    6363
  • trunk/WebCore/html/HTMLViewSourceDocument.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424
    2525#include "config.h"
     26#include "HTMLViewSourceDocument.h"
     27
    2628#include "DOMImplementation.h"
    27 #include "HTMLViewSourceDocument.h"
    2829#include "HTMLTokenizer.h"
    2930#include "HTMLHtmlElement.h"
     
    3940#include "HTMLNames.h"
    4041
    41 namespace WebCore
    42 {
     42namespace WebCore {
    4343
    4444using namespace HTMLNames;
     
    249249
    250250    // Add in the content, splitting on newlines.
    251     Vector<String> lines = text.split('\n', true);
     251    Vector<String> lines;
     252    text.split('\n', true, lines);
    252253    unsigned size = lines.size();
    253254    for (unsigned i = 0; i < size; i++) {
  • trunk/WebCore/loader/DocLoader.cpp

    r29322 r30243  
    11/*
    2     This file is part of the KDE libraries
    3 
    42    Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
    53    Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
    64    Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
    7     Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     5    Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    86
    97    This library is free software; you can redistribute it and/or
     
    6664{
    6765    if (m_allowStaleResources)
    68         return; //Don't reload resources while pasting
     66        return; // Don't reload resources while pasting
     67
     68    if (fullURL.isEmpty())
     69        return;
     70
    6971    if (m_cachePolicy == CachePolicyVerify) {
    7072       if (!m_reloadedURLs.contains(fullURL.string())) {
     
    142144CachedResource* DocLoader::requestResource(CachedResource::Type type, const String& url, const String* charset, bool skipCanLoadCheck, bool sendResourceLoadCallbacks)
    143145{
    144     KURL fullURL = m_doc->completeURL(url.deprecatedString());
     146    KURL fullURL = m_doc->completeURL(url);
    145147   
    146148    if (cache()->disabled()) {
  • trunk/WebCore/loader/FTPDirectoryDocument.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "CharacterNames.h"
    3030#include "CString.h"
    31 #include "Element.h"
    3231#include "HTMLNames.h"
    3332#include "HTMLTableElement.h"
    34 #include "HTMLTableSectionElement.h"
    3533#include "HTMLTokenizer.h"
    36 #include "KURL.h"
    3734#include "LocalizedStrings.h"
    3835#include "Logging.h"
     
    4239#include "SharedBuffer.h"
    4340#include "Text.h"
    44 #include "XMLTokenizer.h"
    45 
    46 // On Win, the threadsafe *_r functions need to be gotten from pthreads.
    47 #if COMPILER(MSVC) && USE(PTHREADS)
    48 #include <pthread.h>
    49 #endif
    5041
    5142#if PLATFORM(QT)
     
    6152class FTPDirectoryTokenizer : public HTMLTokenizer {
    6253public:
    63     FTPDirectoryTokenizer(HTMLDocument* doc);
     54    FTPDirectoryTokenizer(HTMLDocument*);
    6455
    6556    virtual bool write(const SegmentedString&, bool appendData);
     
    150141    ExceptionCode ec;
    151142   
    152     String fullURL = m_doc->baseURL();
     143    String fullURL = m_doc->baseURL().string();
    153144    if (fullURL[fullURL.length() - 1] == '/')
    154145        fullURL.append(filename);
     
    308299    ListResult result;
    309300
    310     DeprecatedString depString = inputLine.deprecatedString();
    311     const char* line = depString.ascii();
    312    
    313     FTPEntryType typeResult = parseOneFTPLine(line, m_listState, result);
     301    FTPEntryType typeResult = parseOneFTPLine(inputLine.latin1().data(), m_listState, result);
    314302   
    315303    // FTPMiscEntry is a comment or usage statistic which we don't care about, and junk is invalid data - bail in these 2 cases
  • trunk/WebCore/loader/FrameLoader.cpp

    r30222 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Trolltech ASA
    44 *
     
    413413    KURL scriptURL;
    414414    KURL url;
    415     if (urlString.startsWith("javascript:", false)) {
    416         scriptURL = urlString.deprecatedString();
    417         url = "about:blank";
     415    if (protocolIs(urlString, "javascript")) {
     416        scriptURL = KURL(urlString);
     417        url = blankURL();
    418418    } else
    419419        url = completeURL(urlString);
     
    473473    // it's being added to the child list. It would be a good idea to
    474474    // create the child first, then invoke the loader separately.
    475     if (url.isEmpty() || url == "about:blank") {
     475    if (url.isEmpty() || url == blankURL()) {
    476476        frame->loader()->completed();
    477477        frame->loader()->checkCompleted();
     
    502502        return;
    503503
    504     DeprecatedString urlString = u.deprecatedString();
    505     if (urlString.startsWith("javascript:", false)) {
     504    if (u.protocolIs("javascript")) {
    506505        m_isExecutingJavaScriptFormAction = true;
    507506        executeIfJavaScriptURL(u, false, false);
     
    533532        if (!query.isEmpty())
    534533            query.append('&');
    535         u.setQuery((query + body).deprecatedString());
     534        u.setQuery(query + body);
    536535    }
    537536
    538537    if (strcmp(action, "GET") == 0) {
    539         u.setQuery(formData->flattenToString().deprecatedString());
     538        u.setQuery(formData->flattenToString());
    540539    } else {
    541540        if (!isMailtoForm)
     
    650649    // If this isn't a top level frame, return nothing
    651650    if (m_frame->tree() && m_frame->tree()->parent())
    652         return "";
    653        
     651        return KURL();
     652
    654653    // If we have an iconURL from a Link element, return that
    655654    if (m_frame->document() && !m_frame->document()->iconURL().isEmpty())
    656         return m_frame->document()->iconURL().deprecatedString();
    657        
     655        return KURL(m_frame->document()->iconURL());
     656
    658657    // Don't return a favicon iconURL unless we're http or https
    659     if (m_URL.protocol() != "http" && m_URL.protocol() != "https")
    660         return "";
    661        
     658    if (!m_URL.protocolIs("http") && !m_URL.protocolIs("https"))
     659        return KURL();
     660
    662661    KURL url;
    663662    url.setProtocol(m_URL.protocol());
     
    688687
    689688    m_URL = url;
    690     if (m_URL.protocol().startsWith("http") && !m_URL.host().isEmpty() && m_URL.path().isEmpty())
     689    if ((m_URL.protocolIs("http") || m_URL.protocolIs("https")) && !m_URL.host().isEmpty() && m_URL.path().isEmpty())
    691690        m_URL.setPath("/");
    692691    m_workingURL = m_URL;
     
    710709    // implicitly precedes document.write.
    711710    cancelRedirection();
    712     if (m_frame->document()->url() != "about:blank")
     711    if (m_frame->document()->url() != blankURL())
    713712        m_URL = m_frame->document()->url();
    714713}
     
    716715bool FrameLoader::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument)
    717716{
    718     if (!url.deprecatedString().startsWith("javascript:", false))
     717    if (!url.protocolIs("javascript"))
    719718        return false;
    720719
    721     String script = KURL::decode_string(url.deprecatedString().mid(strlen("javascript:")));
     720    String script = decodeURLEscapeSequences(url.string().substring(strlen("javascript:")));
    722721    JSValue* result = executeScript(script, userGesture);
    723722
     
    860859        url = m_URL.string();
    861860    else
    862         url = m_frame->document()->completeURL(url);
     861        url = m_frame->document()->completeURL(url).string();
    863862
    864863    scheduleHTTPRedirection(delay, url);
     
    898897
    899898    KURL ref(url);
    900     ref.setUser(DeprecatedString());
    901     ref.setPass(DeprecatedString());
    902     ref.setRef(DeprecatedString());
     899    ref.setUser(String());
     900    ref.setPass(String());
     901    ref.setRef(String());
    903902    m_outgoingReferrer = ref.string();
    904903    m_URL = url;
    905     KURL baseurl;
    906 
     904    KURL baseURL;
    907905    if (!m_URL.isEmpty())
    908         baseurl = m_URL;
     906        baseURL = m_URL;
    909907
    910908    RefPtr<Document> document = DOMImplementation::instance()->createDocument(m_responseMIMEType, m_frame, m_frame->inViewSourceMode());
    911909    m_frame->setDocument(document);
    912910
    913     document->setURL(m_URL.deprecatedString());
     911    document->setURL(m_URL);
    914912    // We prefer m_baseURL over m_URL because m_URL changes when we are
    915913    // about to load a new page.
    916     document->setBaseURL(baseurl.deprecatedString());
     914    document->setBaseURL(baseURL);
    917915    if (m_decoder)
    918916        document->setDecoder(m_decoder.get());
     
    11861184{
    11871185    // If our URL has no ref, then we have no place we need to jump to.
    1188     // OTOH if css target was set previously, we want to set it to 0, recalc
     1186    // OTOH If CSS target was set previously, we want to set it to 0, recalc
    11891187    // and possibly repaint because :target pseudo class may have been
    1190     // set(See bug 11321)
    1191     if (!m_URL.hasRef() &&
    1192         !(m_frame->document() && m_frame->document()->getCSSTarget()))
    1193         return;
    1194 
    1195     DeprecatedString ref = m_URL.encodedHtmlRef();
    1196     if (!gotoAnchor(ref)) {
    1197         // Can't use htmlRef() here because it doesn't know which encoding to use to decode.
    1198         // Decoding here has to match encoding in completeURL, which means it has to use the
    1199         // page's encoding rather than UTF-8.
    1200         if (m_decoder)
    1201             gotoAnchor(KURL::decode_string(ref, m_decoder->encoding()));
    1202     }
     1188    // set (see bug 11321).
     1189    if (!m_URL.hasRef() && !(m_frame->document() && m_frame->document()->getCSSTarget()))
     1190        return;
     1191
     1192    String ref = m_URL.ref();
     1193    if (gotoAnchor(ref))
     1194        return;
     1195
     1196    // Try again after decoding the ref, based on the document's encoding.
     1197    if (m_decoder)
     1198        gotoAnchor(decodeURLEscapeSequences(ref, m_decoder->encoding()));
    12031199}
    12041200
     
    13271323{
    13281324    ASSERT(m_frame->document());
    1329     return m_frame->document()->completeURL(url).deprecatedString();
     1325    return m_frame->document()->completeURL(url);
    13301326}
    13311327
     
    13441340    // If the URL we're going to navigate to is the same as the current one, except for the
    13451341    // fragment part, we don't need to schedule the location change.
    1346     KURL u(url.deprecatedString());
    1347     if (u.hasRef() && equalIgnoringRef(m_URL, u)) {
     1342    KURL parsedURL(url);
     1343    if (parsedURL.hasRef() && equalIgnoringRef(m_URL, parsedURL)) {
    13481344        changeLocation(url, referrer, lockHistory, wasUserGesture);
    13491345        return;
     
    17711767        // the right NPObjects. See <rdar://problem/5197041> for more information.
    17721768        && !m_containsPlugIns
    1773         && !m_URL.protocol().startsWith("https")
     1769        && !m_URL.protocolIs("https")
    17741770        && m_frame->document()
    17751771        && !m_frame->document()->applets()->length()
     
    17961792        setPolicyBaseURL(m_frame->tree()->parent()->document()->policyBaseURL());
    17971793    else
    1798         setPolicyBaseURL(m_URL.string());
    1799 }
    1800 
    1801 void FrameLoader::setPolicyBaseURL(const String& s)
     1794        setPolicyBaseURL(m_URL);
     1795}
     1796
     1797void FrameLoader::setPolicyBaseURL(const KURL& url)
    18021798{
    18031799    if (m_frame->document())
    1804         m_frame->document()->setPolicyBaseURL(s);
     1800        m_frame->document()->setPolicyBaseURL(url);
    18051801    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
    1806         child->loader()->setPolicyBaseURL(s);
     1802        child->loader()->setPolicyBaseURL(url);
    18071803}
    18081804
     
    18481844        case ScheduledRedirection::locationChange:
    18491845        case ScheduledRedirection::locationChangeDuringLoad:
    1850             clientRedirected(m_scheduledRedirection->url.deprecatedString(),
     1846            clientRedirected(KURL(m_scheduledRedirection->url),
    18511847                m_scheduledRedirection->delay,
    18521848                currentTime() + m_redirectionTimer.nextFireInterval(),
     
    19471943 
    19481944    ASSERT(frame()->document());
    1949     if (url.deprecatedString().startsWith("file:", false)) {
     1945    if (url.protocolIs("file")) {
    19501946        if (!canLoad(url, frame()->document()) && !canLoad(url, referrer)) {
    19511947            FrameLoader::reportLocalLoadFailed(m_frame->page(), url.string());
     
    21732169bool FrameLoader::shouldHideReferrer(const KURL& url, const String& referrer)
    21742170{
    2175     bool referrerIsSecureURL = referrer.startsWith("https:", false);
    2176     bool referrerIsWebURL = referrerIsSecureURL || referrer.startsWith("http:", false);
     2171    bool referrerIsSecureURL = protocolIs(referrer, "https");
     2172    bool referrerIsWebURL = referrerIsSecureURL || protocolIs(referrer, "http");
    21772173
    21782174    if (!referrerIsWebURL)
     
    21822178        return false;
    21832179
    2184     bool URLIsSecureURL = url.deprecatedString().startsWith("https:", false);
     2180    bool URLIsSecureURL = url.protocolIs("https");
    21852181
    21862182    return !URLIsSecureURL;
     
    23592355        // FIXME: this error message should contain more specifics of why the navigation change is not allowed.
    23602356        String message = String::format("Unsafe JavaScript attempt to initiate a navigation change for frame with URL %s from frame with URL %s.\n",
    2361                                         targetDocument->url().utf8().data(), activeDocument->url().utf8().data());
     2357            targetDocument->url().string().utf8().data(), activeDocument->url().string().utf8().data());
    23622358
    23632359        if (KJS::Interpreter::shouldPrintExceptions())
     
    25592555            url = pdl->responseURL();
    25602556        if (url.isEmpty())
    2561             url = "about:blank";
     2557            url = blankURL();
    25622558
    25632559        didOpenURL(url);
     
    27492745    KURL url = cachedPage.url();
    27502746
    2751     if (url.protocol().startsWith("http") && !url.host().isEmpty() && url.path().isEmpty())
     2747    if ((url.protocolIs("http") || url.protocolIs("https")) && !url.host().isEmpty() && url.path().isEmpty())
    27522748        url.setPath("/");
    27532749   
     
    38273823    // See bug 3368236 and related bugs for more information.
    38283824    if (url.isEmpty())
    3829         url = KURL("about:blank");
     3825        url = blankURL();
    38303826    if (originalURL.isEmpty())
    3831         originalURL = KURL("about:blank");
     3827        originalURL = blankURL();
    38323828   
    38333829    RefPtr<HistoryItem> item = new HistoryItem(url, m_frame->tree()->name(), m_frame->tree()->parent() ? m_frame->tree()->parent()->tree()->name() : "", docLoader ? docLoader->title() : "");
     
    45764572   
    45774573    if (baseURLString.isEmpty())
    4578         baseURLString = m_frame->document()->baseURL();
     4574        baseURLString = m_frame->document()->baseURL().string();
    45794575    KURL baseURL = completeURL(baseURLString);
    45804576
     
    47934789                createDocument(m_responseMIMEType, m_frame, m_frame->inViewSourceMode());
    47944790            m_frame->setDocument(newDoc);
    4795             newDoc->setURL(m_URL.deprecatedString());
    4796             newDoc->setBaseURL(m_URL.deprecatedString());
     4791            newDoc->setURL(m_URL);
     4792            newDoc->setBaseURL(m_URL);
    47974793            if (m_decoder)
    47984794                newDoc->setDecoder(m_decoder.get());
  • trunk/WebCore/loader/FrameLoader.h

    r30001 r30243  
    479479
    480480        void updatePolicyBaseURL();
    481         void setPolicyBaseURL(const String&);
     481        void setPolicyBaseURL(const KURL&);
    482482
    483483        // Also not cool.
  • trunk/WebCore/loader/ImageDocument.cpp

    r30170 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    168168    imageElement->setAttribute(styleAttr, "-webkit-user-select: none");       
    169169    imageElement->setLoadManually(true);
    170     imageElement->setSrc(url());
     170    imageElement->setSrc(url().string());
    171171   
    172172    body->appendChild(imageElement, ec);
  • trunk/WebCore/loader/PluginDocument.cpp

    r29663 r30243  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    8989   
    9090    m_embedElement->setAttribute(nameAttr, "plugin");
    91     m_embedElement->setSrc(m_doc->url());
     91    m_embedElement->setSrc(m_doc->url().string());
    9292    m_embedElement->setType(m_doc->frame()->loader()->responseMIMEType());
    9393   
  • trunk/WebCore/loader/icon/IconDatabase.cpp

    r29922 r30243  
    219219{   
    220220    ASSERT_NOT_SYNC_THREAD();
    221    
    222     ASSERT(!pageURLOriginal.isNull());
    223 
    224     // pageURLOriginal can not be stored without being deep copied first. 
     221
     222    // pageURLOriginal cannot be stored without being deep copied first. 
    225223    // We should go our of our way to only copy it if we have to store it
    226224   
    227     if (!isOpen())
     225    if (!isOpen() || pageURLOriginal.isEmpty())
    228226        return defaultIcon(size);
    229227
  • trunk/WebCore/loader/icon/IconLoader.h

    r29663 r30243  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#define IconLoader_h
    2828
    29 #include "KURL.h"
    3029#include "SubresourceLoaderClient.h"
    3130#include <memory>
     31#include <wtf/Forward.h>
    3232#include <wtf/Noncopyable.h>
    33 #include <wtf/PassRefPtr.h>
     33#include <wtf/RefPtr.h>
    3434
    3535namespace WebCore {
    3636
    3737class Frame;
     38class KURL;
    3839class SharedBuffer;
    3940
  • trunk/WebCore/loader/loader.cpp

    r28639 r30243  
    44    Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
    55    Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
    6     Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     6    Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    77
    88    This library is free software; you can redistribute it and/or
     
    7575
    7676        KURL r = dl->doc()->url();
    77         if (r.protocol().startsWith("http") && r.path().isEmpty())
     77        if ((r.protocolIs("http") || r.protocolIs("https")) && r.path().isEmpty())
    7878            r.setPath("/");
    7979        request.setHTTPReferrer(r.string());
    80         DeprecatedString domain = r.host();
    81         if (dl->doc()->isHTMLDocument())
    82             domain = static_cast<HTMLDocument*>(dl->doc())->domain().deprecatedString();
    83        
     80
    8481        RefPtr<SubresourceLoader> loader = SubresourceLoader::create(dl->doc()->frame(),
    8582            this, request, req->shouldSkipCanLoadCheck(), req->sendResourceLoadCallbacks());
  • trunk/WebCore/loader/mac/LoaderNSURLExtras.m

    r29663 r30243  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    44 *
     
    215215    if ([filename length] == 0 || [lastPathComponent isEqualToString:@"/"]) {
    216216        // lastPathComponent is no good, try the host.
    217         NSString *host = (NSString *)(KURL(url).host());
     217        NSString *host = KURL(url).host();
    218218        filename = filenameByFixingIllegalCharacters(host);
    219219        if ([filename length] == 0) {
  • trunk/WebCore/page/ContextMenuController.cpp

    r29958 r30243  
    4444#include "HitTestResult.h"
    4545#include "InspectorController.h"
    46 #include "KURL.h"
    4746#include "MouseEvent.h"
    4847#include "Node.h"
  • trunk/WebCore/page/mac/EventHandlerMac.mm

    r28888 r30243  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "BlockExceptions.h"
    3030#include "ClipboardMac.h"
    31 #include "Cursor.h"
    32 #include "Document.h"
    33 #include "DragController.h"
    3431#include "EventNames.h"
    35 #include "FloatPoint.h"
    3632#include "FocusController.h"
    37 #include "FoundationExtras.h"
    3833#include "FrameLoader.h"
    3934#include "Frame.h"
    40 #include "FrameTree.h"
    4135#include "FrameView.h"
    42 #include "HTMLFrameOwnerElement.h"
    43 #include "HTMLFrameSetElement.h"
    44 #include "HitTestRequest.h"
    45 #include "HitTestResult.h"
    4636#include "KeyboardEvent.h"
    4737#include "MouseEventWithHitTestResults.h"
     
    149139
    150140    // RSS view needs arrow key keypress events.
    151     if (isSafari && document->url().startsWith("feed:", false) || document->url().startsWith("feeds:", false))
     141    if (isSafari && document->url().protocolIs("feed") || document->url().protocolIs("feeds"))
    152142        return true;
    153143    Settings* settings = m_frame->settings();
  • trunk/WebCore/page/mac/WebCoreFrameBridge.mm

    r30024 r30243  
    11/*
    2  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com)
    44 * Copyright (C) 2006 David Smith (catfish.man@gmail.com)
     
    628628- (NSURL *)URLWithAttributeString:(NSString *)string
    629629{
    630     Document *doc = m_frame->document();
     630    Document* doc = m_frame->document();
    631631    if (!doc)
    632632        return nil;
    633633    // FIXME: is parseURL appropriate here?
    634     DeprecatedString rel = parseURL(string).deprecatedString();
    635     return KURL(doc->completeURL(rel)).getNSURL();
     634    return doc->completeURL(parseURL(string));
    636635}
    637636
     
    748747- (NSURL *)baseURL
    749748{
    750     return m_frame->loader()->completeURL(m_frame->document()->baseURL()).getNSURL();
     749    return m_frame->document()->baseURL();
    751750}
    752751
  • trunk/WebCore/platform/KURL.cpp

    r30075 r30243  
    2929#include "CString.h"
    3030#include "PlatformString.h"
    31 #include "RegularExpression.h"
    3231#include "TextEncoding.h"
    33 #include <wtf/Vector.h>
     32
    3433#if USE(ICU_UNICODE)
    3534#include <unicode/uidna.h>
     
    4342namespace WebCore {
    4443
     44typedef Vector<char, 512> CharBuffer;
     45typedef Vector<UChar, 512> UCharBuffer;
     46
     47// FIXME: This file makes too much use of the + operator on String.
     48// We either have to optimize that operator so it doesn't involve
     49// so many allocations, or change this to use Vector<UChar> instead.
     50
    4551enum URLCharacterClasses {
    4652    // alpha
     
    6773    PathSegmentEndChar = 1 << 5,
    6874
    69     // digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f"
    70     HexDigitChar = 1 << 6,
    71 
    7275    // not allowed in path
    73     BadChar = 1 << 7
    74 
     76    BadChar = 1 << 6
    7577};
    7678
     
    7981static const unsigned char characterClassTable[256] = {
    8082    /* 0 nul */ PathSegmentEndChar,    /* 1 soh */ BadChar,
    81     /* 2 stx */ BadChar,    /* 3 etx */ BadChar,   
     83    /* 2 stx */ BadChar,    /* 3 etx */ BadChar,
    8284    /* 4 eot */ BadChar,    /* 5 enq */ BadChar,    /* 6 ack */ BadChar,    /* 7 bel */ BadChar,
    83     /* 8 bs */ BadChar,     /* 9 ht */ BadChar,    /* 10 nl */ BadChar,    /* 11 vt */ BadChar,
     85    /* 8 bs */ BadChar,     /* 9 ht */ BadChar,     /* 10 nl */ BadChar,    /* 11 vt */ BadChar,
    8486    /* 12 np */ BadChar,    /* 13 cr */ BadChar,    /* 14 so */ BadChar,    /* 15 si */ BadChar,
    8587    /* 16 dle */ BadChar,   /* 17 dc1 */ BadChar,   /* 18 dc2 */ BadChar,   /* 19 dc3 */ BadChar,
     
    8890    /* 28 fs */ BadChar,    /* 29 gs */ BadChar,    /* 30 rs */ BadChar,    /* 31 us */ BadChar,
    8991    /* 32 sp */ BadChar,    /* 33  ! */ UserInfoChar,
    90     /* 34  " */ BadChar,    /* 35  # */ PathSegmentEndChar | BadChar,   
     92    /* 34  " */ BadChar,    /* 35  # */ PathSegmentEndChar | BadChar,
    9193    /* 36  $ */ UserInfoChar,    /* 37  % */ UserInfoChar | HostnameChar | IPv6Char | BadChar,
    9294    /* 38  & */ UserInfoChar,    /* 39  ' */ UserInfoChar,
    93     /* 40  ( */ UserInfoChar,    /* 41  ) */ UserInfoChar,   
     95    /* 40  ( */ UserInfoChar,    /* 41  ) */ UserInfoChar,
    9496    /* 42  * */ UserInfoChar,    /* 43  + */ SchemeChar | UserInfoChar,
    95     /* 44  , */ UserInfoChar,   
    96     /* 45  - */ SchemeChar | UserInfoChar | HostnameChar, 
    97     /* 46  . */ SchemeChar | UserInfoChar | HostnameChar,   
     97    /* 44  , */ UserInfoChar,
     98    /* 45  - */ SchemeChar | UserInfoChar | HostnameChar,
     99    /* 46  . */ SchemeChar | UserInfoChar | HostnameChar,
    98100    /* 47  / */ PathSegmentEndChar,
    99     /* 48  0 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    100     /* 49  1 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,   
    101     /* 50  2 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    102     /* 51  3 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    103     /* 52  4 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    104     /* 53  5 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    105     /* 54  6 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    106     /* 55  7 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    107     /* 56  8 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    108     /* 57  9 */ SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
     101    /* 48  0 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     102    /* 49  1 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,   
     103    /* 50  2 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     104    /* 51  3 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     105    /* 52  4 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     106    /* 53  5 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     107    /* 54  6 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     108    /* 55  7 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     109    /* 56  8 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     110    /* 57  9 */ SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
    109111    /* 58  : */ UserInfoChar | IPv6Char,    /* 59  ; */ UserInfoChar,
    110112    /* 60  < */ BadChar,    /* 61  = */ UserInfoChar,
    111113    /* 62  > */ BadChar,    /* 63  ? */ PathSegmentEndChar | BadChar,
    112114    /* 64  @ */ 0,
    113     /* 65  A */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,   
    114     /* 66  B */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    115     /* 67  C */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    116     /* 68  D */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    117     /* 69  E */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    118     /* 70  F */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
     115    /* 65  A */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,   
     116    /* 66  B */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     117    /* 67  C */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     118    /* 68  D */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     119    /* 69  E */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     120    /* 70  F */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
    119121    /* 71  G */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar,
    120122    /* 72  H */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar,
     
    142144    /* 95  _ */ UserInfoChar | HostnameChar,
    143145    /* 96  ` */ 0,
    144     /* 97  a */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    145     /* 98  b */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    146     /* 99  c */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    147     /* 100  d */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    148     /* 101  e */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
    149     /* 102  f */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | HexDigitChar | IPv6Char,
     146    /* 97  a */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     147    /* 98  b */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     148    /* 99  c */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     149    /* 100  d */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     150    /* 101  e */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
     151    /* 102  f */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar | IPv6Char,
    150152    /* 103  g */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar,
    151153    /* 104  h */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar,
     
    205207
    206208static int copyPathRemovingDots(char* dst, const char* src, int srcStart, int srcEnd);
    207 static char* encodeRelativeString(const KURL &base, const DeprecatedString& rel, const TextEncoding&);
    208 static DeprecatedString substituteBackslashes(const DeprecatedString &string);
    209 
    210 static inline bool isSchemeFirstChar(unsigned char c) { return characterClassTable[c] & SchemeFirstChar; }
    211 static inline bool isSchemeChar(unsigned char c) { return characterClassTable[c] & SchemeChar; }
     209static void encodeRelativeString(const String& rel, const TextEncoding&, CharBuffer& ouput);
     210static String substituteBackslashes(const String&);
     211
     212static inline bool isSchemeFirstChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & SchemeFirstChar; }
     213static inline bool isSchemeFirstChar(UChar c) { return c <= 0xff && (characterClassTable[c] & SchemeFirstChar); }
     214static inline bool isSchemeChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & SchemeChar; }
     215static inline bool isSchemeChar(UChar c) { return c <= 0xff && (characterClassTable[c] & SchemeChar); }
    212216static inline bool isUserInfoChar(unsigned char c) { return characterClassTable[c] & UserInfoChar; }
    213217static inline bool isHostnameChar(unsigned char c) { return characterClassTable[c] & HostnameChar; }
    214218static inline bool isIPv6Char(unsigned char c) { return characterClassTable[c] & IPv6Char; }
    215 static inline bool isPathSegmentEndChar(unsigned char c) { return characterClassTable[c] & PathSegmentEndChar; }
     219static inline bool isPathSegmentEndChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & PathSegmentEndChar; }
     220static inline bool isPathSegmentEndChar(UChar c) { return c <= 0xff && (characterClassTable[c] & PathSegmentEndChar); }
    216221static inline bool isBadChar(unsigned char c) { return characterClassTable[c] & BadChar; }
    217 static inline bool isHexDigit(unsigned char c) { return characterClassTable[c] & HexDigitChar; }
    218 
    219 static inline int hexDigitValue(unsigned char c)
    220 {
    221     ASSERT(isHexDigit(c));
     222
     223static inline int hexDigitValue(UChar c)
     224{
     225    ASSERT(isASCIIHexDigit(c));
    222226    if (c < 'A')
    223227        return c - '0';
     
    225229}
    226230
     231// Copies the source to the destination, assuming all the source characters are
     232// ASCII. The destination buffer must be large enough. Null characters are allowed
     233// in the source string, and no attempt is made to null-terminate the result.
     234static void copyASCII(const UChar* src, int length, char* dest)
     235{
     236    for (int i = 0; i < length; i++)
     237        dest[i] = static_cast<char>(src[i]);
     238}
     239
     240// FIXME: Move to PlatformString.h eventually.
     241// Returns the index of the first index in string |s| of any of the characters
     242// in |toFind|. |toFind| should be a null-terminated string, all characters up
     243// to the null will be searched. Returns int if not found.
     244static int findFirstOf(const UChar* s, int sLen, int startPos, const char* toFind)
     245{
     246    for (int i = startPos; i < sLen; i++) {
     247        const char* cur = toFind;
     248        while (*cur) {
     249            if (s[i] == *(cur++))
     250                return i;
     251        }
     252    }
     253    return -1;
     254}
     255
    227256// KURL
    228257
    229 KURL::KURL() : m_isValid(false)
    230 {
    231 }
    232 
    233 KURL::KURL(const char *url)
    234 {
    235     if (url && url[0] == '/') {
    236          // 5 for "file:", 1 for terminator
    237         size_t urlLength = strlen(url) + 1;
    238         Vector<char, 2048> buffer(urlLength + 5);
    239         buffer[0] = 'f';
    240         buffer[1] = 'i';
    241         buffer[2] = 'l';
    242         buffer[3] = 'e';
    243         buffer[4] = ':';
    244         memcpy(&buffer[5], url, urlLength);
    245         parse(buffer.data(), 0);
    246     } else
     258inline bool KURL::protocolIs(const String& string, const char* protocol)
     259{
     260    return WebCore::protocolIs(string, protocol);
     261}
     262
     263KURL::KURL()
     264    : m_isValid(false)
     265{
     266}
     267
     268KURL::KURL(const char* url)
     269{
     270    if (!url || url[0] != '/') {
    247271        parse(url, 0);
    248 }
    249 
    250 KURL::KURL(const DeprecatedString &url)
    251 {
    252     if (!url.isEmpty() && url[0] == '/') {
    253         // 5 for "file:", 1 for terminator
    254         Vector<char, 2048> buffer(url.length() + 6);
    255         buffer[0] = 'f';
    256         buffer[1] = 'i';
    257         buffer[2] = 'l';
    258         buffer[3] = 'e';
    259         buffer[4] = ':';
    260         url.copyLatin1(&buffer[5]);
    261         parse(buffer.data(), 0);
    262     } else
    263         parse(url.ascii(), &url);
    264 }
    265 
    266 KURL::KURL(const KURL& base, const DeprecatedString& relative)
     272        return;
     273    }
     274
     275    size_t urlLength = strlen(url) + 1;
     276    CharBuffer buffer(urlLength + 5); // 5 for "file:".
     277    buffer[0] = 'f';
     278    buffer[1] = 'i';
     279    buffer[2] = 'l';
     280    buffer[3] = 'e';
     281    buffer[4] = ':';
     282    memcpy(&buffer[5], url, urlLength);
     283    parse(buffer.data(), 0);
     284}
     285
     286KURL::KURL(const String& url)
     287{
     288    if (url[0] != '/') {
     289        parse(url);
     290        return;
     291    }
     292
     293    CharBuffer buffer(url.length() + 6); // 5 for "file:", 1 for terminator.
     294    buffer[0] = 'f';
     295    buffer[1] = 'i';
     296    buffer[2] = 'l';
     297    buffer[3] = 'e';
     298    buffer[4] = ':';
     299    copyASCII(url.characters(), url.length(), &buffer[5]);
     300    buffer[url.length() + 4] = '\0'; // Need null terminator.
     301
     302    parse(buffer.data(), 0);
     303}
     304
     305KURL::KURL(const KURL& base, const String& relative)
    267306{
    268307    init(base, relative, UTF8Encoding());
    269308}
    270309
    271 KURL::KURL(const KURL& base, const DeprecatedString& relative, const TextEncoding& encoding)
     310KURL::KURL(const KURL& base, const String& relative, const TextEncoding& encoding)
    272311{
    273312    init(base, relative, encoding);
    274313}
    275314
    276 void KURL::init(const KURL &base, const DeprecatedString &relative, const TextEncoding& encoding)
     315void KURL::init(const KURL& base, const String& relative, const TextEncoding& encoding)
    277316{
    278317    // Allow at least absolute URLs to resolve against an empty URL.
    279318    if (!base.m_isValid && !base.isEmpty()) {
     319        m_string = relative;
    280320        m_isValid = false;
    281321        return;
    282322    }
    283    
    284     bool absolute = false;
    285 
    286     // for compatibility with Win IE, we must treat backslashes as if they were slashes, as long as we're not dealing with the javascript: schema
    287     DeprecatedString substitutedRelative;
    288     bool shouldSubstituteBackslashes = relative.contains('\\') && !(relative.startsWith("javascript:", false) || relative.startsWith("data:", false));
    289     if (shouldSubstituteBackslashes)
    290         substitutedRelative = substituteBackslashes(relative);
    291 
    292     const DeprecatedString &rel = shouldSubstituteBackslashes ? substitutedRelative : relative;
    293    
    294     bool allASCII = rel.isAllASCII();
    295     char *strBuffer;
    296     const char *str;
     323
     324    // For compatibility with Win IE, treat backslashes as if they were slashes,
     325    // as long as we're not dealing with javascript: or data: URLs.
     326    String rel = relative;
     327    if (rel.contains('\\') && !(protocolIs(rel, "javascript") || protocolIs(rel, "data")))
     328        rel = substituteBackslashes(rel);
     329
     330    String* originalString = &rel;
     331
     332    bool allASCII = charactersAreAllASCII(rel.characters(), rel.length());
     333    CharBuffer strBuffer;
     334    char* str;
     335    size_t len;
    297336    if (allASCII) {
    298         strBuffer = 0;
    299         str = rel.ascii();
     337        len = rel.length();
     338        strBuffer.resize(len + 1);
     339        copyASCII(rel.characters(), len, strBuffer.data());
     340        strBuffer[len] = 0;
     341        str = strBuffer.data();
    300342    } else {
    301         strBuffer = encodeRelativeString(base, rel, encoding);
    302         str = strBuffer;
    303     }
    304    
    305     // workaround for sites that put leading whitespace whitespace on
    306     // URL references
    307     bool strippedStart = false;
     343        originalString = 0;
     344        encodeRelativeString(rel, encoding, strBuffer);
     345        str = strBuffer.data();
     346        len = strlen(str);
     347    }
     348
     349    // Get rid of leading whitespace.
    308350    while (*str == ' ') {
     351        originalString = 0;
    309352        str++;
    310         strippedStart = true;
    311     }
    312 
    313     // workaround for trailing whitespace - a bit more complicated cause we have to copy
    314     // it would be even better to replace null-termination with a length parameter
    315     int len = strlen(str);
    316     int charsToChopOffEnd = 0;
    317     for (int pos = len - 1; pos >= 0 && str[pos] == ' '; pos--) {
    318         charsToChopOffEnd++;
    319     }
    320     if (charsToChopOffEnd > 0) {
    321         char *newStrBuffer = (char *)fastMalloc((len + 1) - charsToChopOffEnd);
    322         strncpy(newStrBuffer, str, len - charsToChopOffEnd);
    323         newStrBuffer[len - charsToChopOffEnd] = '\0';
    324         fastFree(strBuffer);
    325         strBuffer = newStrBuffer;
    326         str = strBuffer;
     353        --len;
     354    }
     355
     356    // Get rid of trailing whitespace.
     357    while (len && str[len - 1] == ' ') {
     358        originalString = 0;
     359        str[--len] = '\0';
    327360    }
    328361
     
    332365    // scheme, meaning that it will have a colon before the first
    333366    // non-scheme element.
    334     const char *p = str;
     367    bool absolute = false;
     368    char* p = str;
    335369    if (isSchemeFirstChar(*p)) {
    336370        ++p;
     
    339373        }
    340374        if (*p == ':') {
    341             if (p[1] != '/' && base.protocol().lower() == DeprecatedString(str, p - str).lower() && base.isHierarchical())
     375            if (p[1] != '/' && equalIgnoringCase(base.protocol(), String(str, p - str)) && base.isHierarchical()) {
    342376                str = p + 1;
    343             else
     377                originalString = 0;
     378            } else
    344379                absolute = true;
    345380        }
     
    347382
    348383    if (absolute) {
    349         parse(str, (allASCII && !strippedStart && (charsToChopOffEnd == 0)) ? &rel : 0);
     384        parse(str, originalString);
    350385    } else {
    351386        // If the base is empty or opaque (e.g. data: or javascript:), then the URL is invalid
    352387        // unless the relative URL is a single fragment.
    353388        if (!base.isHierarchical()) {
    354             if (str[0] == '#') {
    355                 DeprecatedString newURL = base.urlString.left(base.queryEndPos) + str;
    356                 parse(newURL.ascii(), &newURL);
    357             } else
     389            if (str[0] == '#')
     390                parse(base.m_string.left(base.queryEndPos) + str);
     391            else {
     392                m_string = relative;
    358393                m_isValid = false;
    359            
    360             if (strBuffer)
    361                 fastFree(strBuffer);
     394            }
    362395            return;
    363396        }
    364397
    365         switch(str[0]) {
     398        switch (str[0]) {
    366399        case '\0':
    367400            // the reference must be empty - the RFC says this is a
    368401            // reference to the same document
    369             {
    370                 *this = base;
    371                 break;
    372             }
     402            *this = base;
     403            break;
    373404        case '#':
    374405            // must be fragment-only reference
    375             {
    376                 DeprecatedString newURL = base.urlString.left(base.queryEndPos) + str;
    377                 parse(newURL.ascii(), &newURL);
    378                 break;
    379             }
     406            parse(base.m_string.left(base.queryEndPos) + str);
     407            break;
    380408        case '?':
    381409            // query-only reference, special case needed for non-URL results
    382             {
    383                 DeprecatedString newURL = base.urlString.left(base.pathEndPos) + str;
    384                 parse(newURL.ascii(), &newURL);
    385                 break;
    386             }
     410            parse(base.m_string.left(base.pathEndPos) + str);
     411            break;
    387412        case '/':
    388413            // must be net-path or absolute-path reference
    389             {
    390                 if (str[1] == '/') {
    391                     // net-path
    392                     DeprecatedString newURL = base.urlString.left(base.schemeEndPos + 1) + str;
    393                     parse(newURL.ascii(), &newURL);
    394                 } else {
    395                     // abs-path
    396                     DeprecatedString newURL = base.urlString.left(base.portEndPos) + str;
    397                     parse(newURL.ascii(), &newURL);
    398                 }
    399                 break;
     414            if (str[1] == '/') {
     415                // net-path
     416                parse(base.m_string.left(base.schemeEndPos + 1) + str);
     417            } else {
     418                // abs-path
     419                parse(base.m_string.left(base.portEndPos) + str);
    400420            }
     421            break;
    401422        default:
    402423            {
     
    404425
    405426                // Base part plus relative part plus one possible slash added in between plus terminating \0 byte.
    406                 Vector<char, 2048> buffer(base.pathEndPos + 1 + strlen(str) + 1);
    407 
    408                 char *bufferPos = buffer.data();
    409                
     427                CharBuffer buffer(base.pathEndPos + 1 + len + 1);
     428
     429                char* bufferPos = buffer.data();
     430
    410431                // first copy everything before the path from the base
    411                 const char *baseString = base.urlString.ascii();
    412                 const char *baseStringStart = baseString;
    413                 const char *pathStart = baseStringStart + base.portEndPos;
    414                 while (baseStringStart < pathStart) {
     432                unsigned baseLength = base.m_string.length();
     433                const UChar* baseCharacters = base.m_string.characters();
     434                CharBuffer baseStringBuffer(baseLength);
     435                for (unsigned i = 0; i < baseLength; ++i)
     436                    baseStringBuffer[i] = static_cast<char>(baseCharacters[i]);
     437                const char* baseString = baseStringBuffer.data();
     438                const char* baseStringStart = baseString;
     439                const char* pathStart = baseStringStart + base.portEndPos;
     440                while (baseStringStart < pathStart)
    415441                    *bufferPos++ = *baseStringStart++;
    416                 }
    417                 char *bufferPathStart = bufferPos;
    418 
    419                 // now copy the base path
    420                 const char *baseStringEnd = baseString + base.pathEndPos;
    421                
     442                char* bufferPathStart = bufferPos;
     443
     444                // now copy the base path
     445                const char* baseStringEnd = baseString + base.pathEndPos;
     446
    422447                // go back to the last slash
    423                 while (baseStringEnd > baseStringStart && baseStringEnd[-1] != '/') {
     448                while (baseStringEnd > baseStringStart && baseStringEnd[-1] != '/')
    424449                    baseStringEnd--;
    425                 }
    426                
     450
    427451                if (baseStringEnd == baseStringStart) {
    428452                    // no path in base, add a path separator if necessary
    429                     if (base.schemeEndPos + 1 != base.pathEndPos && *str != '\0' && *str != '?' && *str != '#') {
     453                    if (base.schemeEndPos + 1 != base.pathEndPos && *str != '\0' && *str != '?' && *str != '#')
    430454                        *bufferPos++ = '/';
    431                     }
    432455                } else {
    433456                    bufferPos += copyPathRemovingDots(bufferPos, baseStringStart, 0, baseStringEnd - baseStringStart);
    434457                }
    435458
    436                 const char *relStringStart = str;
    437                 const char *relStringPos = relStringStart;
    438                
     459                const char* relStringStart = str;
     460                const char* relStringPos = relStringStart;
     461
    439462                while (*relStringPos != '\0' && *relStringPos != '?' && *relStringPos != '#') {
    440463                    if (relStringPos[0] == '.' && bufferPos[-1] == '/') {
     
    442465                            // skip over "." segment
    443466                            relStringPos += 1;
    444                             if (relStringPos[0] == '/') {
     467                            if (relStringPos[0] == '/')
    445468                                relStringPos++;
    446                             }
    447469                            continue;
    448470                        } else if (relStringPos[1] == '.' && isPathSegmentEndChar(relStringPos[2])) {
     
    452474                            // relies on this.
    453475                            relStringPos += 2;
    454                             if (relStringPos[0] == '/') {
     476                            if (relStringPos[0] == '/')
    455477                                relStringPos++;
    456                             }
    457                             if (bufferPos > bufferPathStart + 1) {
     478                            if (bufferPos > bufferPathStart + 1)
    458479                                bufferPos--;
    459                             }
    460                             while (bufferPos > bufferPathStart + 1  && bufferPos[-1] != '/') {
     480                            while (bufferPos > bufferPathStart + 1  && bufferPos[-1] != '/')
    461481                                bufferPos--;
    462                             }
    463482                            continue;
    464483                        }
    465484                    }
    466                    
     485
    467486                    *bufferPos = *relStringPos;
    468487                    relStringPos++;
     
    475494
    476495                parse(buffer.data(), 0);
    477                
     496
    478497                ASSERT(strlen(buffer.data()) + 1 <= buffer.size());
    479498                break;
     
    481500        }
    482501    }
    483    
    484     if (strBuffer) {
    485         fastFree(strBuffer);
    486     }
    487502}
    488503
     
    492507}
    493508
    494 DeprecatedString KURL::lastPathComponent() const
     509String KURL::lastPathComponent() const
    495510{
    496511    if (!hasPath())
    497         return DeprecatedString();
     512        return String();
    498513
    499514    int end = pathEndPos - 1;
    500     if (urlString[end] == '/')
     515    if (m_string[end] == '/')
    501516        --end;
    502517
    503     int start = urlString.findRev('/', end);
     518    int start = m_string.reverseFind('/', end);
    504519    if (start < portEndPos)
    505         return DeprecatedString();
     520        return String();
    506521    ++start;
    507522
    508     return urlString.mid(start, end - start + 1);
    509 }
    510 
    511 DeprecatedString KURL::protocol() const
     523    return m_string.substring(start, end - start + 1);
     524}
     525
     526String KURL::protocol() const
     527{
     528    if (!m_isValid)
     529        return String();
     530
     531    return m_string.left(schemeEndPos);
     532}
     533
     534String KURL::host() const
     535{
     536    if (!m_isValid)
     537        return String();
     538
     539    int start = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;
     540    return decodeURLEscapeSequences(m_string.substring(start, hostEndPos - start));
     541}
     542
     543unsigned short KURL::port() const
     544{
     545    if (!m_isValid)
     546        return 0;
     547
     548    if (hostEndPos == portEndPos)
     549        return 0;
     550
     551    int number = m_string.substring(hostEndPos + 1, portEndPos - hostEndPos - 1).toInt();
     552    if (number < 0 || number > 0xFFFF)
     553        return 0;
     554    return number;
     555}
     556
     557String KURL::pass() const
     558{
     559    if (!m_isValid)
     560        return String();
     561
     562    if (passwordEndPos == userEndPos)
     563        return String();
     564
     565    return decodeURLEscapeSequences(m_string.substring(userEndPos + 1, passwordEndPos - userEndPos - 1));
     566}
     567
     568String KURL::user() const
     569{
     570    if (!m_isValid)
     571        return String();
     572
     573    return decodeURLEscapeSequences(m_string.substring(userStartPos, userEndPos - userStartPos));
     574}
     575
     576String KURL::ref() const
     577{
     578    if (!m_isValid || fragmentEndPos == queryEndPos)
     579        return String();
     580
     581    return m_string.substring(queryEndPos + 1, fragmentEndPos - (queryEndPos + 1));
     582}
     583
     584bool KURL::hasRef() const
     585{
     586    return m_isValid && fragmentEndPos != queryEndPos;
     587}
     588
     589static inline void assertProtocolIsGood(const char* protocol)
     590{
     591#ifndef NDEBUG
     592    const char* p = protocol;
     593    while (*p) {
     594        ASSERT(*p > ' ' && *p < 0x7F && !(*p >= 'A' && *p <= 'Z'));
     595        ++p;
     596    }
     597#endif
     598}
     599
     600bool KURL::protocolIs(const char* protocol) const
     601{
     602    // Do the comparison without making a new string object.
     603    assertProtocolIsGood(protocol);
     604    if (!m_isValid)
     605        return false;
     606    for (int i = 0; i < schemeEndPos; ++i) {
     607        if (!protocol[i] || toASCIILower(m_string[i]) != protocol[i])
     608            return false;
     609    }
     610    return !protocol[schemeEndPos]; // We should have consumed all characters in the argument.
     611}
     612
     613String KURL::query() const
     614{
     615    if (!m_isValid)
     616        return String();
     617
     618    return m_string.substring(pathEndPos, queryEndPos - pathEndPos);
     619}
     620
     621String KURL::path() const
     622{
     623    if (!m_isValid)
     624        return String();
     625
     626    return decodeURLEscapeSequences(m_string.substring(portEndPos, pathEndPos - portEndPos));
     627}
     628
     629void KURL::setProtocol(const String& s)
    512630{
    513631    if (!m_isValid) {
    514         return DeprecatedString();
    515     }
    516 
    517     return urlString.left(schemeEndPos);
    518 }
    519 
    520 DeprecatedString KURL::host() const
    521 {
    522     if (!m_isValid) {
    523         return DeprecatedString();
    524     }
    525 
    526     int start = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;
    527     return decode_string(urlString.mid(start, hostEndPos - start));
    528 }
    529 
    530 unsigned short int KURL::port() const
    531 {
    532     if (!m_isValid) {
    533         return 0;
    534     }
    535 
    536     if (hostEndPos != portEndPos) {
    537         bool ok;
    538         unsigned short result = urlString.mid(hostEndPos + 1, portEndPos - hostEndPos - 1).toUShort(&ok);
    539         if (!ok) {
    540             result = 0;
    541         }
    542         return result;
    543     }
    544 
    545     return 0;
    546 }
    547 
    548 DeprecatedString KURL::pass() const
    549 {
    550     if (!m_isValid) {
    551         return DeprecatedString();
    552     }
    553 
    554     if (passwordEndPos == userEndPos) {
    555         return DeprecatedString();
    556     }
    557 
    558     return decode_string(urlString.mid(userEndPos + 1, passwordEndPos - userEndPos - 1));
    559 }
    560 
    561 DeprecatedString KURL::user() const
    562 {
    563     if (!m_isValid) {
    564         return DeprecatedString();
    565     }
    566 
    567     return decode_string(urlString.mid(userStartPos, userEndPos - userStartPos));
    568 }
    569 
    570 DeprecatedString KURL::ref() const
    571 {
    572     if (!m_isValid || fragmentEndPos == queryEndPos) {
    573         return DeprecatedString();
    574     }
    575 
    576     return urlString.mid(queryEndPos + 1, fragmentEndPos - (queryEndPos + 1));
    577 }
    578 
    579 bool KURL::hasRef() const
    580 {
    581     return m_isValid && fragmentEndPos != queryEndPos;
    582 }
    583 
    584 DeprecatedString KURL::query() const
    585 {
    586     if (!m_isValid) {
    587         return DeprecatedString();
    588     }
    589 
    590     return urlString.mid(pathEndPos, queryEndPos - pathEndPos);
    591 }
    592 
    593 DeprecatedString KURL::path() const
    594 {
    595     if (!m_isValid) {
    596         return DeprecatedString();
    597     }
    598 
    599     return decode_string(urlString.mid(portEndPos, pathEndPos - portEndPos));
    600 }
    601 
    602 void KURL::setProtocol(const DeprecatedString &s)
    603 {
    604     if (!m_isValid) {
    605         DeprecatedString newURL = s + ":" + urlString;
    606         parse(newURL.ascii(), &newURL);
     632        parse(s + ":" + m_string);
    607633        return;
    608634    }
    609635
    610     DeprecatedString newURL = s + urlString.mid(schemeEndPos);
    611     parse(newURL.ascii(), &newURL);
    612 }
    613 
    614 void KURL::setHost(const DeprecatedString &s)
    615 {
    616     if (m_isValid) {
    617         bool slashSlashNeeded = userStartPos == schemeEndPos + 1;
    618         int hostStart = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;
    619        
    620         DeprecatedString newURL = urlString.left(hostStart) + (slashSlashNeeded ? "//" : DeprecatedString()) + s + urlString.mid(hostEndPos);
    621         parse(newURL.ascii(), &newURL);
    622     }
     636    parse(s + m_string.substring(schemeEndPos));
     637}
     638
     639void KURL::setHost(const String& s)
     640{
     641    if (!m_isValid)
     642        return;
     643
     644    bool slashSlashNeeded = userStartPos == schemeEndPos + 1;
     645    int hostStart = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;
     646
     647    parse(m_string.left(hostStart) + (slashSlashNeeded ? "//" : "") + s + m_string.substring(hostEndPos));
    623648}
    624649
    625650void KURL::setPort(unsigned short i)
    626651{
    627     if (m_isValid) {
    628         bool colonNeeded = portEndPos == hostEndPos;
    629         int portStart = (colonNeeded ? hostEndPos : hostEndPos + 1);
    630         DeprecatedString newURL = urlString.left(portStart) + (colonNeeded ? ":" : DeprecatedString()) + DeprecatedString::number(i) + urlString.mid(portEndPos);
    631         parse(newURL.ascii(), &newURL);
    632     }
    633 }
    634 
    635 void KURL::setHostAndPort(const DeprecatedString& hostAndPort)
    636 {
    637     if (m_isValid) {
    638         bool slashSlashNeeded = userStartPos == schemeEndPos + 1;
    639         int hostStart = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;
    640        
    641         DeprecatedString newURL = urlString.left(hostStart) + (slashSlashNeeded ? "//" : DeprecatedString()) + hostAndPort + urlString.mid(portEndPos);
    642         parse(newURL.ascii(), &newURL);
    643     }
    644 }
    645 
    646 void KURL::setUser(const DeprecatedString &user)
    647 {
    648     if (m_isValid) {
    649         DeprecatedString u;
    650         int end = userEndPos;
    651         if (!user.isEmpty()) {
    652             u = user;
    653             if (userStartPos == schemeEndPos + 1)
    654                 u = "//" + u;
    655             // Add '@' if we didn't have one before.
    656             if (end == hostEndPos || (end == passwordEndPos && urlString[end] != '@'))
    657                 u += '@';
    658         } else {
    659             // Remove '@' if we now have neither user nor password.
    660             if (userEndPos == passwordEndPos && end != hostEndPos && urlString[end] == '@')
    661                 end += 1;
    662         }
    663         const DeprecatedString newURL = urlString.left(userStartPos) + u + urlString.mid(end);
    664         parse(newURL.ascii(), &newURL);
    665     }
    666 }
    667 
    668 void KURL::setPass(const DeprecatedString &password)
    669 {
    670     if (m_isValid) {
    671         DeprecatedString p;
    672         int end = passwordEndPos;
    673         if (!password.isEmpty()) {
    674             p = ':' + password + '@';
    675             if (userEndPos == schemeEndPos + 1)
    676                 p = "//" + p;
    677             // Eat the existing '@' since we are going to add our own.
    678             if (end != hostEndPos && urlString[end] == '@')
    679                 end += 1;
    680         } else {
    681             // Remove '@' if we now have neither user nor password.
    682             if (userStartPos == userEndPos && end != hostEndPos && urlString[end] == '@')
    683                 end += 1;
    684         }
    685         const DeprecatedString newURL = urlString.left(userEndPos) + p + urlString.mid(end);
    686         parse(newURL.ascii(), &newURL);
    687     }
    688 }
    689 
    690 void KURL::setRef(const DeprecatedString &s)
    691 {
    692     if (m_isValid) {
    693         DeprecatedString newURL = urlString.left(queryEndPos) + (s.isEmpty() ? DeprecatedString() : "#" + s);
    694         parse(newURL.ascii(), &newURL);
    695     }
    696 }
    697 
    698 void KURL::setQuery(const DeprecatedString &query)
    699 {
    700     if (m_isValid) {
    701         DeprecatedString q;
    702         if (!query.isNull() && (query.isEmpty() || query[0] != '?')) {
    703             q = "?" + query;
    704         } else {
    705             q = query;
    706         }
    707 
    708         DeprecatedString newURL = urlString.left(pathEndPos) + q + urlString.mid(queryEndPos);
    709         parse(newURL.ascii(), &newURL);
    710     }
    711 }
    712 
    713 void KURL::setPath(const DeprecatedString &s)
    714 {
    715     if (m_isValid) {
    716         DeprecatedString newURL = urlString.left(portEndPos) + encode_string(s) + urlString.mid(pathEndPos);
    717         parse(newURL.ascii(), &newURL);
    718     }
    719 }
    720 
    721 DeprecatedString KURL::prettyURL() const
    722 {
    723     if (!m_isValid) {
    724         return urlString;
    725     }
    726 
    727     DeprecatedString result = protocol() + ":";
    728 
    729     DeprecatedString authority;
     652    if (!m_isValid)
     653        return;
     654
     655    bool colonNeeded = portEndPos == hostEndPos;
     656    int portStart = (colonNeeded ? hostEndPos : hostEndPos + 1);
     657
     658    parse(m_string.left(portStart) + (colonNeeded ? ":" : "") + String::number(i) + m_string.substring(portEndPos));
     659}
     660
     661void KURL::setHostAndPort(const String& hostAndPort)
     662{
     663    if (!m_isValid)
     664        return;
     665
     666    bool slashSlashNeeded = userStartPos == schemeEndPos + 1;
     667    int hostStart = (passwordEndPos == userStartPos) ? passwordEndPos : passwordEndPos + 1;
     668
     669    parse(m_string.left(hostStart) + (slashSlashNeeded ? "//" : "") + hostAndPort + m_string.substring(portEndPos));
     670}
     671
     672void KURL::setUser(const String& user)
     673{
     674    if (!m_isValid)
     675        return;
     676
     677    String u;
     678    int end = userEndPos;
     679    if (!user.isEmpty()) {
     680        u = user;
     681        if (userStartPos == schemeEndPos + 1)
     682            u = "//" + u;
     683        // Add '@' if we didn't have one before.
     684        if (end == hostEndPos || (end == passwordEndPos && m_string[end] != '@'))
     685            u.append('@');
     686    } else {
     687        // Remove '@' if we now have neither user nor password.
     688        if (userEndPos == passwordEndPos && end != hostEndPos && m_string[end] == '@')
     689            end += 1;
     690    }
     691    parse(m_string.left(userStartPos) + u + m_string.substring(end));
     692}
     693
     694void KURL::setPass(const String& password)
     695{
     696    if (!m_isValid)
     697        return;
     698
     699    String p;
     700    int end = passwordEndPos;
     701    if (!password.isEmpty()) {
     702        p = ":" + password + "@";
     703        if (userEndPos == schemeEndPos + 1)
     704            p = "//" + p;
     705        // Eat the existing '@' since we are going to add our own.
     706        if (end != hostEndPos && m_string[end] == '@')
     707            end += 1;
     708    } else {
     709        // Remove '@' if we now have neither user nor password.
     710        if (userStartPos == userEndPos && end != hostEndPos && m_string[end] == '@')
     711            end += 1;
     712    }
     713    parse(m_string.left(userEndPos) + p + m_string.substring(end));
     714}
     715
     716void KURL::setRef(const String& s)
     717{
     718    if (!m_isValid)
     719        return;
     720    parse(m_string.left(queryEndPos) + (s.isEmpty() ? "" : "#" + s));
     721}
     722
     723void KURL::setQuery(const String& query)
     724{
     725    if (!m_isValid)
     726        return;
     727
     728    if ((query.isEmpty() || query[0] != '?') && !query.isNull())
     729        parse(m_string.left(pathEndPos) + "?" + query + m_string.substring(queryEndPos));
     730    else
     731        parse(m_string.left(pathEndPos) + query + m_string.substring(queryEndPos));
     732
     733}
     734
     735void KURL::setPath(const String& s)
     736{
     737    if (!m_isValid)
     738        return;
     739
     740    parse(m_string.left(portEndPos) + encodeWithURLEscapeSequences(s) + m_string.substring(pathEndPos));
     741}
     742
     743String KURL::prettyURL() const
     744{
     745    if (!m_isValid)
     746        return m_string;
     747
     748    Vector<UChar> result;
     749
     750    append(result, protocol());
     751    result.append(':');
     752
     753    Vector<UChar> authority;
    730754
    731755    if (hostEndPos != passwordEndPos) {
    732756        if (userEndPos != userStartPos) {
    733             authority += user();
    734             authority += "@";
    735         }
    736         authority += host();
     757            append(authority, user());
     758            authority.append('@');
     759        }
     760        append(authority, host());
    737761        if (port() != 0) {
    738             authority += ":";
    739             authority += DeprecatedString::number(port());
    740         }
    741     }
    742 
    743     if (!authority.isEmpty())
    744         result += "//" + authority;
    745     else if (protocol() == "file")
    746         result += "//";
    747 
    748     result += path();
    749     result += query();
     762            authority.append(':');
     763            append(authority, String::number(port()));
     764        }
     765    }
     766
     767    if (!authority.isEmpty()) {
     768        result.append('/');
     769        result.append('/');
     770        result.append(authority);
     771    } else if (protocolIs("file")) {
     772        result.append('/');
     773        result.append('/');
     774    }
     775
     776    append(result, path());
     777    append(result, query());
    750778
    751779    if (fragmentEndPos != queryEndPos) {
    752         result += "#" + ref();
    753     }
    754 
    755     return result;
    756 }
    757 
    758 DeprecatedString KURL::decode_string(const DeprecatedString& urlString)
    759 {
    760     return decode_string(urlString, UTF8Encoding());
    761 }
    762 
    763 DeprecatedString KURL::decode_string(const DeprecatedString& urlString, const TextEncoding& encoding)
    764 {
    765     DeprecatedString result("");
    766 
    767     Vector<char, 2048> buffer(0);
    768 
    769     int length = urlString.length();
     780        result.append('#');
     781        append(result, ref());
     782    }
     783
     784    return String::adopt(result);
     785}
     786
     787String decodeURLEscapeSequences(const String& str)
     788{
     789    return decodeURLEscapeSequences(str, UTF8Encoding());
     790}
     791
     792String decodeURLEscapeSequences(const String& str, const TextEncoding& encoding)
     793{
     794    Vector<UChar> result;
     795
     796    CharBuffer buffer;
     797
     798    int length = str.length();
    770799    int decodedPosition = 0;
    771800    int searchPosition = 0;
    772801    int encodedRunPosition;
    773     while ((encodedRunPosition = urlString.find('%', searchPosition)) >= 0) {
     802    while ((encodedRunPosition = str.find('%', searchPosition)) >= 0) {
    774803        // Find the sequence of %-escape codes.
    775804        int encodedRunEnd = encodedRunPosition;
    776805        while (length - encodedRunEnd >= 3
    777                 && urlString[encodedRunEnd] == '%'
    778                 && isHexDigit(urlString[encodedRunEnd + 1].latin1())
    779                 && isHexDigit(urlString[encodedRunEnd + 2].latin1()))
     806                && str[encodedRunEnd] == '%'
     807                && isASCIIHexDigit(str[encodedRunEnd + 1])
     808                && isASCIIHexDigit(str[encodedRunEnd + 2]))
    780809            encodedRunEnd += 3;
    781810        if (encodedRunEnd == encodedRunPosition) {
     
    785814        searchPosition = encodedRunEnd;
    786815
    787         // Copy the entire %-escape sequence into an 8-bit buffer.
    788         int encodedRunLength = encodedRunEnd - encodedRunPosition;
    789         buffer.clear();
    790         buffer.grow(encodedRunLength + 1);
    791         urlString.copyLatin1(buffer.data(), encodedRunPosition, encodedRunLength);
    792 
    793816        // Decode the %-escapes into bytes.
    794         char *p = buffer.data();
    795         const char *q = buffer.data();
    796         while (*q) {
     817        unsigned runLength = (encodedRunEnd - encodedRunPosition) / 3;
     818        buffer.resize(runLength);
     819        char* p = buffer.data();
     820        const UChar* q = str.characters() + encodedRunPosition;
     821        for (unsigned i = 0; i < runLength; ++i) {
    797822            *p++ = (hexDigitValue(q[1]) << 4) | hexDigitValue(q[2]);
    798823            q += 3;
     
    805830
    806831        // Build up the string with what we just skipped and what we just decoded.
    807         result.append(urlString.mid(decodedPosition, encodedRunPosition - decodedPosition));
    808         result.append(reinterpret_cast<const DeprecatedChar*>(decoded.characters()), decoded.length());
     832        result.append(str.characters() + decodedPosition, encodedRunPosition - decodedPosition);
     833        result.append(decoded.characters(), decoded.length());
    809834        decodedPosition = encodedRunEnd;
    810835    }
    811836
    812     result.append(urlString.mid(decodedPosition, length - decodedPosition));
    813     return result;
     837    result.append(str.characters() + decodedPosition, length - decodedPosition);
     838
     839    return String::adopt(result);
    814840}
    815841
     
    820846    // read the contents of the clipboard on a drag, even without a drop.
    821847    // Likewise with using the FrameLoader::shouldTreatURLAsLocal() function.
    822     return equalIgnoringCase(protocol(), "file");
    823 }
    824 
    825 static void appendEscapingBadChars(char*& buffer, const char *strStart, size_t length)
    826 {
    827     char *p = buffer;
    828 
    829     const char *str = strStart;
    830     const char *strEnd = strStart + length;
     848    return protocolIs("file");
     849}
     850
     851static void appendEscapingBadChars(char*& buffer, const char* strStart, size_t length)
     852{
     853    char* p = buffer;
     854
     855    const char* str = strStart;
     856    const char* strEnd = strStart + length;
    831857    while (str < strEnd) {
    832858        unsigned char c = *str++;
     
    843869        }
    844870    }
    845    
     871
    846872    buffer = p;
    847873}
    848874
    849875// copy a path, accounting for "." and ".." segments
    850 static int copyPathRemovingDots(char *dst, const char *src, int srcStart, int srcEnd)
    851 {
    852     char *bufferPathStart = dst;
     876static int copyPathRemovingDots(char* dst, const char* src, int srcStart, int srcEnd)
     877{
     878    char* bufferPathStart = dst;
    853879
    854880    // empty path is a special case, and need not have a leading slash
    855881    if (srcStart != srcEnd) {
    856         const char *baseStringStart = src + srcStart;
    857         const char *baseStringEnd = src + srcEnd;
    858         const char *baseStringPos = baseStringStart;
     882        const char* baseStringStart = src + srcStart;
     883        const char* baseStringEnd = src + srcEnd;
     884        const char* baseStringPos = baseStringStart;
    859885
    860886        // this code is unprepared for paths that do not begin with a
     
    905931}
    906932
    907 static inline bool hasSlashDotOrDotDot(const char *str)
    908 {
    909     const unsigned char *p = reinterpret_cast<const unsigned char *>(str);
     933static inline bool hasSlashDotOrDotDot(const char* str)
     934{
     935    const unsigned char* p = reinterpret_cast<const unsigned char*>(str);
    910936    if (!*p)
    911937        return false;
     
    924950}
    925951
    926 void KURL::parse(const char *url, const DeprecatedString *originalString)
     952void KURL::parse(const String& string)
     953{
     954    // FIXME: This throws away the high bytes of all the characters in the string!
     955    CharBuffer buffer(string.length() + 1);
     956    copyASCII(string.characters(), string.length(), buffer.data());
     957    buffer[string.length()] = '\0';
     958    parse(buffer.data(), &string);
     959}
     960
     961void KURL::parse(const char* url, const String* originalString)
    927962{
    928963    m_isValid = true;
     
    930965    if (!url || url[0] == '\0') {
    931966        // valid URL must be non-empty
     967        m_string = originalString ? *originalString : url;
    932968        m_isValid = false;
    933         urlString = url;
    934969        return;
    935970    }
     
    937972    if (!isSchemeFirstChar(url[0])) {
    938973        // scheme must start with an alphabetic character
     974        m_string = originalString ? *originalString : url;
    939975        m_isValid = false;
    940         urlString = url;
    941976        return;
    942977    }
     
    949984
    950985    if (url[schemeEnd] != ':') {
     986        m_string = originalString ? *originalString : url;
    951987        m_isValid = false;
    952         urlString = url;
    953988        return;
    954989    }
     
    9681003        // part after the scheme must be a net_path, parse the authority section
    9691004
    970         // FIXME: authority characters may be scanned twice
     1005        // FIXME: Authority characters may be scanned twice.
    9711006        userStart += 2;
    9721007        userEnd = userStart;
     
    9791014            userEnd++;
    9801015        }
    981        
     1016
    9821017        if (url[userEnd] == '@') {
    9831018            // actual end of the userinfo, start on the host
     
    9991034        } else {
    10001035            // invalid character
     1036            m_string = originalString ? *originalString : url;
    10011037            m_isValid = false;
    1002             urlString = url;
    10031038            return;
    10041039        }
     
    10161051            } else {
    10171052                // invalid character
     1053                m_string = originalString ? *originalString : url;
    10181054                m_isValid = false;
    1019                 urlString = url;
    10201055                return;
    10211056            }
     
    10401075        if (!isPathSegmentEndChar(url[portEnd])) {
    10411076            // invalid character
     1077            m_string = originalString ? *originalString : url;
    10421078            m_isValid = false;
    1043             urlString = url;
    10441079            return;
    10451080        }
     
    10511086        portStart = portEnd = hostEnd;
    10521087    }
    1053        
     1088
    10541089    int pathStart = portEnd;
    10551090    int pathEnd = pathStart;
     
    10621097        while (url[pathEnd] != '\0' && url[pathEnd] != '?' && url[pathEnd] != '#')
    10631098            pathEnd++;
    1064        
     1099
    10651100        queryStart = pathEnd;
    10661101        queryEnd = queryStart;
     
    10691104                queryEnd++;
    10701105        }
    1071        
     1106
    10721107        fragmentStart = queryEnd;
    10731108        fragmentEnd = fragmentStart;
     
    10771112            while (url[fragmentEnd] != '\0')
    10781113                fragmentEnd++;
    1079         }       
     1114        }
    10801115    }
    10811116    else {
     
    10831118            pathEnd++;
    10841119        }
    1085    
     1120
    10861121        queryStart = pathEnd;
    10871122        queryEnd = queryStart;
     
    10911126            }
    10921127        }
    1093        
     1128
    10941129        fragmentStart = queryEnd;
    10951130        fragmentEnd = fragmentStart;
     
    11121147    // copy in the scheme
    11131148    const char *schemeEndPtr = url + schemeEnd;
    1114     while (strPtr < schemeEndPtr) {
     1149    while (strPtr < schemeEndPtr)
    11151150        *p++ = *strPtr++;
    1116     }
    11171151    schemeEndPos = p - buffer.data();
    11181152
     
    11411175        && matchLetter(url[3], 'e')
    11421176        && url[4] == ':';
    1143        
     1177
    11441178    // File URLs need a host part unless it is just file:// or file://localhost
    11451179    bool degenFilePath = pathStart == pathEnd
    11461180        && (hostStart == hostEnd
    11471181            || hostIsLocalHost);
    1148    
     1182
    11491183    bool haveNonHostAuthorityPart = userStart != userEnd || passwordStart != passwordEnd || portStart != portEnd;
    11501184
     
    11691203        // copy in the user
    11701204        strPtr = url + userStart;
    1171         const char *userEndPtr = url + userEnd;
    1172         while (strPtr < userEndPtr) {
     1205        const char* userEndPtr = url + userEnd;
     1206        while (strPtr < userEndPtr)
    11731207            *p++ = *strPtr++;
    1174         }
    11751208        userEndPos = p - buffer.data();
    1176        
     1209
    11771210        // copy in the password
    11781211        if (passwordEnd != passwordStart) {
    11791212            *p++ = ':';
    11801213            strPtr = url + passwordStart;
    1181             const char *passwordEndPtr = url + passwordEnd;
    1182             while (strPtr < passwordEndPtr) {
     1214            const char* passwordEndPtr = url + passwordEnd;
     1215            while (strPtr < passwordEndPtr)
    11831216                *p++ = *strPtr++;
    1184             }
    11851217        }
    11861218        passwordEndPos = p - buffer.data();
    1187        
     1219
    11881220        // If we had any user info, add "@"
    1189         if (p - buffer.data() != userStartPos) {
     1221        if (p - buffer.data() != userStartPos)
    11901222            *p++ = '@';
    1191         }
    1192        
     1223
    11931224        // copy in the host, except in the case of a file URL with authority="localhost"
    11941225        if (!(isFile && hostIsLocalHost && !haveNonHostAuthorityPart)) {
    11951226            strPtr = url + hostStart;
    1196             const char *hostEndPtr = url + hostEnd;
    1197             while (strPtr < hostEndPtr) {
     1227            const char* hostEndPtr = url + hostEnd;
     1228            while (strPtr < hostEndPtr)
    11981229                *p++ = *strPtr++;
    1199             }
    12001230        }
    12011231        hostEndPos = p - buffer.data();
    1202        
     1232
    12031233        // copy in the port
    12041234        if (hostEnd != portStart) {
     
    12061236            strPtr = url + portStart;
    12071237            const char *portEndPtr = url + portEnd;
    1208             while (strPtr < portEndPtr) {
     1238            while (strPtr < portEndPtr)
    12091239                *p++ = *strPtr++;
    1210             }
    12111240        }
    12121241        portEndPos = p - buffer.data();
     
    12171246    // For canonicalization, ensure we have a '/' for no path.
    12181247    // Only do this for http and https.
    1219     if (isHTTPorHTTPS && pathEnd - pathStart == 0) {
     1248    if (isHTTPorHTTPS && pathEnd - pathStart == 0)
    12201249        *p++ = '/';
    1221     }
    1222        
     1250
    12231251    // add path, escaping bad characters
    1224    
    12251252    if (hierarchical && hasSlashDotOrDotDot(url)) {
    1226         Vector<char, 4096> path_buffer(pathEnd - pathStart + 1);
     1253        CharBuffer path_buffer(pathEnd - pathStart + 1);
    12271254        copyPathRemovingDots(path_buffer.data(), url, pathStart, pathEnd);
    12281255        appendEscapingBadChars(p, path_buffer.data(), strlen(path_buffer.data()));
     
    12311258
    12321259    pathEndPos = p - buffer.data();
    1233    
    1234    
     1260
    12351261    // add query, escaping bad characters
    12361262    appendEscapingBadChars(p, url + queryStart, queryEnd - queryStart);
    12371263    queryEndPos = p - buffer.data();
    1238    
     1264
    12391265    // add fragment, escaping bad characters
    12401266    if (fragmentEnd != queryEnd) {
     
    12441270    fragmentEndPos = p - buffer.data();
    12451271
     1272    ASSERT(p - buffer.data() <= (int)buffer.size());
     1273
    12461274    // If we didn't end up actually changing the original string and
    1247     // it started as a DeprecatedString, just reuse it, to avoid extra
    1248     // allocation.
    1249     if (originalString && strncmp(buffer.data(), url, fragmentEndPos) == 0) {
    1250         urlString = *originalString;
    1251     } else
    1252         urlString = DeprecatedString(buffer.data(), fragmentEndPos);
    1253 
    1254     ASSERT(p - buffer.data() <= (int)buffer.size());
    1255 }
    1256 
    1257 bool operator==(const KURL &a, const KURL &b)
    1258 {
    1259     return a.urlString == b.urlString;
     1275    // it was already in a String, reuse it to avoid extra allocation.
     1276    if (originalString && strncmp(buffer.data(), url, fragmentEndPos) == 0)
     1277        m_string = *originalString;
     1278    else
     1279        m_string = String(buffer.data(), fragmentEndPos);
    12601280}
    12611281
    12621282bool equalIgnoringRef(const KURL& a, const KURL& b)
    12631283{
    1264     return a.urlString.left(a.queryEndPos) == b.urlString.left(b.queryEndPos);
    1265 }
    1266 
    1267 DeprecatedString KURL::encode_string(const DeprecatedString& notEncodedString)
    1268 {
    1269     DeprecatedCString asUTF8 = notEncodedString.utf8();
    1270    
    1271     Vector<char, 4096> buffer(asUTF8.length() * 3 + 1);
    1272     char *p = buffer.data();
    1273 
    1274     const char *str = asUTF8;
    1275     const char *strEnd = str + asUTF8.length();
     1284    if (a.queryEndPos != b.queryEndPos)
     1285        return false;
     1286    unsigned queryLength = a.queryEndPos;
     1287    for (unsigned i = 0; i < queryLength; ++i)
     1288        if (a.string()[i] != b.string()[i])
     1289            return false;
     1290    return true;
     1291}
     1292
     1293String encodeWithURLEscapeSequences(const String& notEncodedString)
     1294{
     1295    CString asUTF8 = notEncodedString.utf8();
     1296
     1297    CharBuffer buffer(asUTF8.length() * 3 + 1);
     1298    char* p = buffer.data();
     1299
     1300    const char* str = asUTF8.data();
     1301    const char* strEnd = str + asUTF8.length();
    12761302    while (str < strEnd) {
    12771303        unsigned char c = *str++;
     
    12831309            *p++ = c;
    12841310    }
    1285    
    1286     DeprecatedString result(buffer.data(), p - buffer.data());
    1287    
    1288     ASSERT(p - buffer.data() <= (int)buffer.size());
    1289 
    1290     return result;
    1291 }
    1292 
    1293 static DeprecatedString encodeHostname(const DeprecatedString &s)
     1311
     1312    ASSERT(p - buffer.data() <= static_cast<int>(buffer.size()));
     1313
     1314    return String(buffer.data(), p - buffer.data());
     1315}
     1316
     1317// Appends the punycoded hostname identified by the given string and length to
     1318// the output buffer. The result will not be null terminated.
     1319static void appendEncodedHostname(UCharBuffer& buffer, const UChar* str, unsigned strLen)
    12941320{
    12951321    // Needs to be big enough to hold an IDN-encoded name.
     
    12971323    const unsigned hostnameBufferLength = 2048;
    12981324
    1299     if (s.isAllASCII() || s.length() > hostnameBufferLength)
    1300         return s;
     1325    if (strLen > hostnameBufferLength || charactersAreAllASCII(str, strLen))
     1326        buffer.append(str, strLen);
    13011327
    13021328#if USE(ICU_UNICODE)
    1303     UChar buffer[hostnameBufferLength];   
     1329    UChar hostnameBuffer[hostnameBufferLength];
    13041330    UErrorCode error = U_ZERO_ERROR;
    1305     int32_t numCharactersConverted = uidna_IDNToASCII
    1306         (reinterpret_cast<const UChar *>(s.unicode()), s.length(), buffer, hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, 0, &error);
    1307     if (error != U_ZERO_ERROR) {
    1308         return s;
    1309     }
    1310     return DeprecatedString(reinterpret_cast<DeprecatedChar *>(buffer), numCharactersConverted);
     1331    int32_t numCharactersConverted = uidna_IDNToASCII(str, strLen, hostnameBuffer,
     1332        hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, 0, &error);
     1333    if (error != U_ZERO_ERROR)
     1334        buffer.append(hostnameBuffer, numCharactersConverted);
    13111335#elif USE(QT4_UNICODE)
    1312     QByteArray result = QUrl::toAce(s);
    1313     return DeprecatedString(result.constData(), result.length());
     1336    QByteArray result = QUrl::toAce(s); // FIXME: This is wrong, but I don't know what it should be.
     1337    buffer.append(result.constData, result.length());
    13141338#endif
    13151339}
    13161340
    1317 static Vector<pair<int, int> > findHostnamesInMailToURL(const DeprecatedString &s)
     1341static void findHostnamesInMailToURL(const UChar* str, int strLen, Vector<pair<int, int> >& nameRanges)
    13181342{
    13191343    // In a mailto: URL, host names come after a '@' character and end with a '>' or ',' or '?' or end of string character.
     
    13211345    // When we find a '?' character, we are past the part of the URL that contains host names.
    13221346
    1323     Vector<pair<int, int> > a;
     1347    nameRanges.clear();
    13241348
    13251349    int p = 0;
    13261350    while (1) {
    13271351        // Find start of host name or of quoted string.
    1328         int hostnameOrStringStart = s.find(RegularExpression("[\"@?]"), p);
    1329         if (hostnameOrStringStart == -1) {
    1330             return a;
    1331         }
    1332         DeprecatedChar c = s[hostnameOrStringStart];
     1352        int hostnameOrStringStart = findFirstOf(str, strLen, p, "\"@?");
     1353        if (hostnameOrStringStart == -1)
     1354            return;
     1355        UChar c = str[hostnameOrStringStart];
    13331356        p = hostnameOrStringStart + 1;
    13341357
    1335         if (c == '?') {
    1336             return a;
    1337         }
    1338        
     1358        if (c == '?')
     1359            return;
     1360
    13391361        if (c == '@') {
    13401362            // Find end of host name.
    13411363            int hostnameStart = p;
    1342             int hostnameEnd = s.find(RegularExpression("[>,?]"), p);
     1364            int hostnameEnd = findFirstOf(str, strLen, p, ">,?");
    13431365            bool done;
    13441366            if (hostnameEnd == -1) {
    1345                 hostnameEnd = s.length();
     1367                hostnameEnd = strLen;
    13461368                done = true;
    13471369            } else {
     
    13501372            }
    13511373
    1352             a.append(make_pair(hostnameStart, hostnameEnd));
     1374            nameRanges.append(make_pair(hostnameStart, hostnameEnd));
    13531375
    13541376            if (done)
    1355                 return a;
     1377                return;
    13561378        } else {
    13571379            // Skip quoted string.
    13581380            ASSERT(c == '"');
    13591381            while (1) {
    1360                 int escapedCharacterOrStringEnd = s.find(RegularExpression("[\"\\]"), p);
     1382                int escapedCharacterOrStringEnd = findFirstOf(str, strLen, p, "\"\\");
    13611383                if (escapedCharacterOrStringEnd == -1)
    1362                     return a;
    1363 
    1364                 c = s[escapedCharacterOrStringEnd];
     1384                    return;
     1385
     1386                c = str[escapedCharacterOrStringEnd];
    13651387                p = escapedCharacterOrStringEnd + 1;
    1366                
     1388
    13671389                // If we are the end of the string, then break from the string loop back to the host name loop.
    13681390                if (c == '"')
    13691391                    break;
    1370                
     1392
    13711393                // Skip escaped character.
    13721394                ASSERT(c == '\\');
    1373                 if (p == static_cast<int>(s.length()))
    1374                     return a;
     1395                if (p == strLen)
     1396                    return;
    13751397
    13761398                ++p;
     
    13801402}
    13811403
    1382 static bool findHostnameInHierarchicalURL(const DeprecatedString &s, int &startOffset, int &endOffset)
     1404static bool findHostnameInHierarchicalURL(const UChar* str, int strLen, int& startOffset, int& endOffset)
    13831405{
    13841406    // Find the host name in a hierarchical URL.
    1385     // It comes after a "://" sequence, with scheme characters preceding.
    1386     // If ends with the end of the string or a ":" or a path segment ending character.
     1407    // It comes after a "://" sequence, with scheme characters preceding, and
     1408    // this should be the first colon in the string.
     1409    // It ends with the end of the string or a ":" or a path segment ending character.
    13871410    // If there is a "@" character, the host part is just the part after the "@".
    1388     int separator = s.find("://");
    1389     if (separator <= 0) {
     1411    int separator = findFirstOf(str, strLen, 0, ":");
     1412    if (separator == -1 || separator + 2 >= strLen ||
     1413        str[separator + 1] != '/' || str[separator + 2] != '/')
    13901414        return false;
    1391     }
    13921415
    13931416    // Check that all characters before the :// are valid scheme characters.
    1394     if (!isSchemeFirstChar(s[0].latin1())) {
     1417    if (!isSchemeFirstChar(str[0]))
    13951418        return false;
    1396     }
    13971419    for (int i = 1; i < separator; ++i) {
    1398         if (!isSchemeChar(s[i].latin1())) {
     1420        if (!isSchemeChar(str[i]))
    13991421            return false;
    1400         }
    14011422    }
    14021423
     
    14051426
    14061427    // Find terminating character.
    1407     int length = s.length();
    1408     int hostnameEnd = length;
    1409     for (int i = authorityStart; i < length; ++i) {
    1410         char c = s[i].latin1();
    1411         if (c == ':' || (isPathSegmentEndChar(c) && c != '\0')) {
     1428    int hostnameEnd = strLen;
     1429    for (int i = authorityStart; i < strLen; ++i) {
     1430        UChar c = str[i];
     1431        if (c == ':' || (isPathSegmentEndChar(c) && c != 0)) {
    14121432            hostnameEnd = i;
    14131433            break;
     
    14161436
    14171437    // Find "@" for the start of the host name.
    1418     int userInfoTerminator = s.find('@', authorityStart);
     1438    int userInfoTerminator = findFirstOf(str, strLen, authorityStart, "@");
    14191439    int hostnameStart;
    1420     if (userInfoTerminator == -1 || userInfoTerminator > hostnameEnd) {
     1440    if (userInfoTerminator == -1 || userInfoTerminator > hostnameEnd)
    14211441        hostnameStart = authorityStart;
    1422     } else {
     1442    else
    14231443        hostnameStart = userInfoTerminator + 1;
    1424     }
    14251444
    14261445    startOffset = hostnameStart;
     
    14291448}
    14301449
    1431 static DeprecatedString encodeHostnames(const DeprecatedString &s)
    1432 {
    1433     if (s.startsWith("mailto:", false)) {
    1434         const Vector<pair<int, int> > hostnameRanges = findHostnamesInMailToURL(s);
     1450// Converts all hostnames found in the given input to punycode, preserving the
     1451// rest of the URL unchanged. The output will NOT be null-terminated.
     1452static void encodeHostnames(const String& str, UCharBuffer& output)
     1453{
     1454    output.clear();
     1455
     1456    if (protocolIs(str, "mailto")) {
     1457        Vector<pair<int, int> > hostnameRanges;
     1458        findHostnamesInMailToURL(str.characters(), str.length(), hostnameRanges);
    14351459        int n = hostnameRanges.size();
    1436         if (n != 0) {
    1437             DeprecatedString result;
    1438             unsigned p = 0;
    1439             for (int i = 0; i < n; ++i) {
    1440                 const pair<int, int> &r = hostnameRanges[i];
    1441                 result += s.mid(p, r.first);
    1442                 result += encodeHostname(s.mid(r.first, r.second - r.first));
    1443                 p = r.second;
    1444             }
    1445             result += s.mid(p);
    1446             return result;
    1447         }
     1460        int p = 0;
     1461        for (int i = 0; i < n; ++i) {
     1462            const pair<int, int>& r = hostnameRanges[i];
     1463            output.append(&str.characters()[p], r.first - p);
     1464            appendEncodedHostname(output, &str.characters()[r.first], r.second - r.first);
     1465            p = r.second;
     1466        }
     1467        // This will copy either everything after the last hostname, or the
     1468        // whole thing if there is no hostname.
     1469        output.append(&str.characters()[p], str.length() - p);
    14481470    } else {
    14491471        int hostStart, hostEnd;
    1450         if (findHostnameInHierarchicalURL(s, hostStart, hostEnd)) {
    1451             return s.left(hostStart) + encodeHostname(s.mid(hostStart, hostEnd - hostStart)) + s.mid(hostEnd);
    1452         }
    1453     }
    1454     return s;
    1455 }
    1456 
    1457 static char *encodeRelativeString(const KURL &base, const DeprecatedString &rel, const TextEncoding& encoding)
    1458 {
    1459     DeprecatedString s = encodeHostnames(rel);
    1460 
    1461     char *strBuffer;
     1472        if (findHostnameInHierarchicalURL(str.characters(), str.length(), hostStart, hostEnd)) {
     1473            output.append(str.characters(), hostStart); // Before hostname.
     1474            appendEncodedHostname(output, &str.characters()[hostStart], hostEnd - hostStart);
     1475            output.append(&str.characters()[hostEnd], str.length() - hostEnd); // After hostname.
     1476        } else {
     1477            // No hostname to encode, return the input.
     1478            output.append(str.characters(), str.length());
     1479        }
     1480    }
     1481}
     1482
     1483static void encodeRelativeString(const String& rel, const TextEncoding& encoding, CharBuffer& output)
     1484{
     1485    UCharBuffer s;
     1486    encodeHostnames(rel, s);
    14621487
    14631488    TextEncoding pathEncoding(UTF8Encoding());
    1464     TextEncoding otherEncoding = (encoding.isValid() && !rel.startsWith("mailto:", false)) ? encoding : UTF8Encoding();
    1465    
     1489    TextEncoding otherEncoding = (encoding.isValid() && !protocolIs(rel, "mailto")) ? encoding : UTF8Encoding();
     1490
    14661491    int pathEnd = -1;
    14671492    if (pathEncoding != otherEncoding) {
    1468         pathEnd = s.find(RegularExpression("[?#]"));
    1469     }
     1493        // Find the first instance of either # or ?, keep pathEnd at -1 otherwise.
     1494        pathEnd = findFirstOf(s.data(), s.size(), 0, "#?");
     1495    }
     1496
    14701497    if (pathEnd == -1) {
    1471         CString decoded = pathEncoding.encode(reinterpret_cast<const UChar*>(s.unicode()), s.length());
    1472         int decodedLength = decoded.length();
    1473         strBuffer = static_cast<char *>(fastMalloc(decodedLength + 1));
    1474         memcpy(strBuffer, decoded.data(), decodedLength);
    1475         strBuffer[decodedLength] = 0;
     1498        CString decoded = pathEncoding.encode(s.data(), s.size());
     1499        output.resize(decoded.length());
     1500        memcpy(output.data(), decoded.data(), decoded.length());
    14761501    } else {
    1477         int length = s.length();
    1478         CString pathDecoded = pathEncoding.encode(reinterpret_cast<const UChar*>(s.unicode()), pathEnd);
    1479         CString otherDecoded = otherEncoding.encode(reinterpret_cast<const UChar*>(s.unicode()) + pathEnd, length - pathEnd);
    1480         int pathDecodedLength = pathDecoded.length();
    1481         int otherDecodedLength = otherDecoded.length();
    1482         strBuffer = static_cast<char *>(fastMalloc(pathDecodedLength + otherDecodedLength + 1));
    1483         memcpy(strBuffer, pathDecoded.data(), pathDecodedLength);
    1484         memcpy(strBuffer + pathDecodedLength, otherDecoded.data(), otherDecodedLength);
    1485         strBuffer[pathDecodedLength + otherDecodedLength] = 0;
    1486     }
    1487 
    1488     return strBuffer;
    1489 }
    1490 
    1491 static DeprecatedString substituteBackslashes(const DeprecatedString &string)
     1502        CString pathDecoded = pathEncoding.encode(s.data(), pathEnd);
     1503        CString otherDecoded = otherEncoding.encode(s.data() + pathEnd, s.size() - pathEnd);
     1504
     1505        output.resize(pathDecoded.length() + otherDecoded.length());
     1506        memcpy(output.data(), pathDecoded.data(), pathDecoded.length());
     1507        memcpy(output.data() + pathDecoded.length(), otherDecoded.data(), otherDecoded.length());
     1508    }
     1509    output.append('\0'); // null-terminate the output.
     1510}
     1511
     1512static String substituteBackslashes(const String& string)
    14921513{
    14931514    int questionPos = string.find('?');
    14941515    int hashPos = string.find('#');
    1495     unsigned pathEnd;
    1496    
    1497     if (hashPos >= 0 && (questionPos < 0 || questionPos > hashPos)) {
     1516    int pathEnd;
     1517
     1518    if (hashPos >= 0 && (questionPos < 0 || questionPos > hashPos))
    14981519        pathEnd = hashPos;
    1499     } else if (questionPos >= 0) {
     1520    else if (questionPos >= 0)
    15001521        pathEnd = questionPos;
    1501     } else {
     1522    else
    15021523        pathEnd = string.length();
    1503     }
    1504 
    1505     return string.left(pathEnd).replace('\\','/') + string.mid(pathEnd);
     1524
     1525    return string.left(pathEnd).replace('\\','/') + string.substring(pathEnd);
    15061526}
    15071527
     
    15101530    if (!m_isValid)
    15111531        return false;
    1512     ASSERT(urlString[schemeEndPos] == ':');
    1513     return urlString[schemeEndPos + 1] == '/';
     1532    ASSERT(m_string[schemeEndPos] == ':');
     1533    return m_string[schemeEndPos + 1] == '/';
     1534}
     1535
     1536void KURL::copyToBuffer(CharBuffer& buffer) const
     1537{
     1538    // FIXME: This throws away the high bytes of all the characters in the string!
     1539    // That's fine for a valid URL, which is all ASCII, but not for invalid URLs.
     1540    buffer.resize(m_string.length());
     1541    copyASCII(m_string.characters(), m_string.length(), buffer.data());
     1542}
     1543
     1544bool protocolIs(const String& url, const char* protocol)
     1545{
     1546    // Do the comparison without making a new string object.
     1547    assertProtocolIsGood(protocol);
     1548    for (int i = 0; ; ++i) {
     1549        if (!protocol[i])
     1550            return url[i] == ':';
     1551        if (toASCIILower(url[i]) != protocol[i])
     1552            return false;
     1553    }
     1554}
     1555
     1556const KURL& blankURL()
     1557{
     1558    static KURL staticBlankURL("about:blank");
     1559    return staticBlankURL;
    15141560}
    15151561
     
    15171563void KURL::print() const
    15181564{
    1519     printf("%s\n", urlString.ascii());
     1565    printf("%s\n", m_string.utf8().data());
    15201566}
    15211567#endif
  • trunk/WebCore/platform/KURL.h

    r30078 r30243  
    11/*
    2  * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#define KURL_h
    2828
    29 #include "DeprecatedString.h"
    3029#include "PlatformString.h"
    31 #include <wtf/Platform.h>
    3230
    3331#if PLATFORM(CF)
    34 typedef const struct __CFURL * CFURLRef;
     32typedef const struct __CFURL* CFURLRef;
    3533#endif
    3634
     
    4240#endif
    4341#endif
     42
    4443#if PLATFORM(QT)
    4544class QUrl;
     
    4847namespace WebCore {
    4948
    50     class KURL;
    51     class TextEncoding;
    52 
    53     bool operator==(const KURL&, const KURL&);
    54     inline bool operator!=(const KURL &a, const KURL &b) { return !(a == b); }
    55 
    56     bool equalIgnoringRef(const KURL&, const KURL&);
     49class TextEncoding;
    5750
    5851class KURL {
    5952public:
     53    // Generates a URL which contains a null string.
    6054    KURL();
    61     KURL(const char*);
    62     KURL(const KURL&, const DeprecatedString&);
    63     KURL(const KURL&, const DeprecatedString&, const TextEncoding&);
    64     KURL(const DeprecatedString&);
     55
     56    // The argument is an absolute URL string. The string is assumed to be
     57    // already encoded.
     58    // FIXME: This constructor has a special case for strings that start with
     59    // "/", prepending "file://" to such strings; it would be good to get
     60    // rid of that special case.
     61    explicit KURL(const char*);
     62
     63    // The argument is an absolute URL string. The string is assumed to be
     64    // already encoded.
     65    // FIXME: For characters with codes other than 0000-00FF will be chopped
     66    // off, so this call is currently not safe to use with arbitrary strings.
     67    // FIXME: This constructor has a special case for strings that start with
     68    // "/", prepending "file://" to such strings; it would be good to get
     69    // rid of that special case.
     70    explicit KURL(const String&);
     71
     72    // Resolves the relative URL with the given base URL. If provided, the
     73    // TextEncoding is used to encode non-ASCII characers. The base URL can be
     74    // null or empty, in which case the relative URL will be interpreted as
     75    // absolute.
     76    // FIXME: If the base URL is invalid, this always creates an invalid
     77    // URL. Instead I think it would be better to treat all invalid base URLs
     78    // the same way we treate null and empty base URLs.
     79    KURL(const KURL& base, const String& relative);
     80    KURL(const KURL& base, const String& relative, const TextEncoding&);
     81
     82    // FIXME: The above functions should be harmonized so that passing a
     83    // base of null or the empty string gives the same result as the
     84    // standard String constructor.
     85
     86    bool isNull() const { return m_string.isNull(); }
     87    bool isEmpty() const { return m_string.isEmpty(); }
     88
     89    // Returns true if this URL has a path. Note that "http://foo.com/" has a
     90    // path of "/", so this function will return true. Only invalid or
     91    // non-hierarchical (like "javascript:") URLs will have no path.
     92    bool hasPath() const;
     93
     94    const String& string() const { return m_string; }
     95
     96    String protocol() const;
     97    String host() const;
     98    unsigned short port() const;
     99    String user() const;
     100    String pass() const;
     101    String path() const;
     102    String lastPathComponent() const;
     103    String query() const; // Includes the "?".
     104    String ref() const; // Does *not* include the "#".
     105    bool hasRef() const;
     106
     107    String prettyURL() const;
     108    String fileSystemPath() const;
     109
     110    // Returns true if the current URL's protocol is the same as the null-
     111    // terminated ASCII argument. The argument must be lower-case.
     112    bool protocolIs(const char*) const;
     113    bool isLocalFile() const;
     114
     115    void setProtocol(const String&);
     116    void setHost(const String&);
     117
     118    // Setting the port to 0 will clear any port from the URL.
     119    void setPort(unsigned short);
     120
     121    // Input is like "foo.com" or "foo.com:8000".
     122    void setHostAndPort(const String&);
     123
     124    void setUser(const String&);
     125    void setPass(const String&);
     126
     127    // If you pass an empty path for HTTP or HTTPS URLs, the resulting path
     128    // will be "/".
     129    void setPath(const String&);
     130
     131    // The query may begin with a question mark, or, if not, one will be added
     132    // for you. Setting the query to the empty string will leave a "?" in the
     133    // URL (with nothing after it). To clear the query, pass a null string.
     134    void setQuery(const String&);
     135
     136    void setRef(const String&);
     137
     138    friend bool equalIgnoringRef(const KURL&, const KURL&);
     139
     140    operator KJS::UString() const { return m_string; }
     141
     142#if PLATFORM(CF)
     143    KURL(CFURLRef);
     144    CFURLRef createCFURL() const;
     145#endif
     146
    65147#if PLATFORM(MAC)
    66148    KURL(NSURL*);
    67 #endif
    68 #if PLATFORM(CF)
    69     KURL(CFURLRef);
    70 #endif
     149    operator NSURL*() const;
     150#endif
     151#ifdef __OBJC__
     152    operator NSString*() const { return m_string; }
     153#endif
     154
    71155#if PLATFORM(QT)
    72156    KURL(const QUrl&);
    73 #endif
    74 
    75     bool isNull() const { return urlString.isNull(); }
    76     bool isEmpty() const { return urlString.isEmpty(); }
    77 
    78     bool hasPath() const;
    79 
    80     String string() const { return urlString; }
    81     const DeprecatedString& deprecatedString() const { return urlString; }
    82 
    83     DeprecatedString protocol() const;
    84     DeprecatedString host() const;
    85     unsigned short int port() const;
    86     DeprecatedString user() const;
    87     DeprecatedString pass() const;
    88     DeprecatedString path() const;
    89     DeprecatedString lastPathComponent() const;
    90     DeprecatedString query() const;
    91     DeprecatedString ref() const;
    92     bool hasRef() const;
    93 
    94     DeprecatedString encodedHtmlRef() const { return ref(); }
    95 
    96     void setProtocol(const DeprecatedString &);
    97     void setHost(const DeprecatedString &);
    98     void setPort(unsigned short int);
    99     void setHostAndPort(const DeprecatedString&);
    100     void setUser(const DeprecatedString &);
    101     void setPass(const DeprecatedString &);
    102     void setPath(const DeprecatedString &);
    103     void setQuery(const DeprecatedString &);
    104     void setRef(const DeprecatedString &);
    105 
    106     DeprecatedString prettyURL() const;
    107 
    108 #if PLATFORM(CF)
    109     CFURLRef createCFURL() const;
    110 #endif
    111 #if PLATFORM(MAC)
    112     NSURL *getNSURL() const;
    113 #endif
    114 #if PLATFORM(QT)
    115157    operator QUrl() const;
    116158#endif
    117 
    118     bool isLocalFile() const;
    119     String fileSystemPath() const;
    120 
    121     static DeprecatedString decode_string(const DeprecatedString&);
    122     static DeprecatedString decode_string(const DeprecatedString&, const TextEncoding&);
    123     static DeprecatedString encode_string(const DeprecatedString&);
    124    
    125     friend bool operator==(const KURL &, const KURL &);
    126159
    127160#ifndef NDEBUG
     
    131164private:
    132165    bool isHierarchical() const;
    133     void init(const KURL&, const DeprecatedString&, const TextEncoding&);
    134     void parse(const char *url, const DeprecatedString *originalString);
    135 
    136     DeprecatedString urlString;
     166    void init(const KURL&, const String&, const TextEncoding&);
     167    static bool protocolIs(const String&, const char*);
     168    void copyToBuffer(Vector<char, 512>& buffer) const;
     169
     170    // Parses the given URL. The originalString parameter allows for an
     171    // optimization: When the source is the same as the fixed-up string,
     172    // it will use the passed-in string instead of allocating a new one.
     173    void parse(const String&);
     174    void parse(const char* url, const String* originalString);
     175
     176    String m_string;
    137177    bool m_isValid;
    138178    int schemeEndPos;
     
    145185    int queryEndPos;
    146186    int fragmentEndPos;
    147    
    148     friend bool equalIgnoringRef(const KURL& a, const KURL& b);
    149187};
    150188
     189bool operator==(const KURL&, const KURL&);
     190bool operator==(const KURL&, const String&);
     191bool operator==(const String&, const KURL&);
     192bool operator!=(const KURL&, const KURL&);
     193bool operator!=(const KURL&, const String&);
     194bool operator!=(const String&, const KURL&);
     195
     196bool equalIgnoringRef(const KURL&, const KURL&);
     197
     198const KURL& blankURL();
     199
     200// Functions to do URL operations on strings.
     201// These are operations that aren't faster on a parsed URL.
     202
     203bool protocolIs(const String& url, const char* protocol);
     204
     205// Unescapes the given string using URL escaping rules, given an optional
     206// encoding (defaulting to UTF-8 otherwise). DANGER: If the URL has "%00"
     207// in it, the resulting string will have embedded null characters!
     208String decodeURLEscapeSequences(const String&);
     209String decodeURLEscapeSequences(const String&, const TextEncoding&);
     210
     211String encodeWithURLEscapeSequences(const String&);
     212
     213// Inlines.
     214
     215inline bool operator==(const KURL& a, const KURL& b)
     216{
     217    return a.string() == b.string();
     218}
     219
     220inline bool operator==(const KURL& a, const String& b)
     221{
     222    return a.string() == b;
     223}
     224
     225inline bool operator==(const String& a, const KURL& b)
     226{
     227    return a == b.string();
     228}
     229
     230inline bool operator!=(const KURL& a, const KURL& b)
     231{
     232    return a.string() != b.string();
     233}
     234
     235inline bool operator!=(const KURL& a, const String& b)
     236{
     237    return a.string() != b;
     238}
     239
     240inline bool operator!=(const String& a, const KURL& b)
     241{
     242    return a != b.string();
     243}
     244
    151245}
    152246
  • trunk/WebCore/platform/cf/KURLCFNet.cpp

    r30078 r30243  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#include <wtf/RetainPtr.h>
    30 #include <wtf/Vector.h>
    3130#include <CoreFoundation/CFURL.h>
    3231
     
    3736KURL::KURL(CFURLRef url)
    3837{
    39     if (url) {
    40         CFIndex bytesLength = CFURLGetBytes(url, 0, 0);
    41         Vector<char, 2048> buffer(bytesLength + 6); // 6 for "file:", 1 for NUL terminator
    42         char* bytes = &buffer[5];
    43         CFURLGetBytes(url, (UInt8*)bytes, bytesLength);
    44         bytes[bytesLength] = '\0';
    45         if (bytes[0] == '/') {
    46             buffer[0] = 'f';
    47             buffer[1] = 'i';
    48             buffer[2] = 'l';
    49             buffer[3] = 'e';
    50             buffer[4] = ':';
    51             parse(buffer.data(), 0);
    52         } else
    53             parse(bytes, 0);
    54     } else
    55         parse("", 0);
     38    if (!url) {
     39        parse(0, 0);
     40        return;
     41    }
     42
     43    CFIndex bytesLength = CFURLGetBytes(url, 0, 0);
     44    Vector<char, 512> buffer(bytesLength + 6); // 5 for "file:", 1 for null character to end C string
     45    char* bytes = &buffer[5];
     46    CFURLGetBytes(url, reinterpret_cast<UInt8*>(bytes), bytesLength);
     47    if (bytes[0] != '/') {
     48        parse(bytes, 0);
     49        return;
     50    }
     51    bytes[bytesLength] = '\0';
     52
     53    buffer[0] = 'f';
     54    buffer[1] = 'i';
     55    buffer[2] = 'l';
     56    buffer[3] = 'e';
     57    buffer[4] = ':';
     58
     59    parse(buffer.data(), 0);
    5660}
    5761
    5862CFURLRef KURL::createCFURL() const
    5963{
    60     const UInt8 *bytes = (const UInt8 *)urlString.latin1();
     64    // FIXME: What should this return for invalid URLs?
     65    // Currently it throws away the high bytes of the characters in the string in that case,
     66    // which is clearly wrong.
     67
     68    Vector<char, 512> buffer;
     69    copyToBuffer(buffer);
     70
    6171    // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components
    6272    // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which
    6373    // could either be a malformed string or bytes in a different encoding, like Shift-JIS, so we fall back
    6474    // onto using ISO Latin-1 in those cases.
    65     CFURLRef result = CFURLCreateAbsoluteURLWithBytes(0, bytes, urlString.length(), kCFStringEncodingUTF8, 0, true);
     75    CFURLRef result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingUTF8, 0, true);
    6676    if (!result)
    67         result = CFURLCreateAbsoluteURLWithBytes(0, bytes, urlString.length(), kCFStringEncodingISOLatin1, 0, true);
     77        result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingISOLatin1, 0, true);
    6878    return result;
    6979}
     
    8090    CFURLPathStyle pathStyle = kCFURLPOSIXPathStyle;
    8191#endif
    82 
    83     RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyFileSystemPath(cfURL.get(), pathStyle));
    84     return path.get();
     92    return RetainPtr<CFStringRef>(AdoptCF, CFURLCopyFileSystemPath(cfURL.get(), pathStyle)).get();
    8593}
    8694
  • trunk/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r29861 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    164164   
    165165    // Disable streaming support for now, <rdar://problem/5693967>
    166     if (url.startsWith("rtsp:"))
    167         return;
    168    
    169     NSDictionary* movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
    170                                      KURL(url.deprecatedString()).getNSURL(), QTMovieURLAttribute,
     166    if (protocolIs(url, "rtsp"))
     167        return;
     168
     169    NSURL *cocoaURL = KURL(url);
     170    NSDictionary *movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
     171                                     cocoaURL, QTMovieURLAttribute,
    171172                                     [NSNumber numberWithBool:YES], QTMoviePreventExternalURLLinksAttribute,
    172173                                     [NSNumber numberWithBool:YES], QTSecurityPolicyNoCrossSiteAttribute,
     
    177178   
    178179    // FIXME: Find a proper way to detect streaming content.
    179     m_isStreaming = url.startsWith("rtsp:");
     180    m_isStreaming = protocolIs(url, "rtsp");
    180181   
    181182    if (!m_qtMovie)
  • trunk/WebCore/platform/mac/ClipboardMac.mm

    r29805 r30243  
    11/*
    2  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#import "ClipboardMac.h"
    2828
    29 #import "CachedImage.h"
    30 #import "Document.h"
    3129#import "DOMElementInternal.h"
    3230#import "DragClient.h"
    3331#import "DragController.h"
    3432#import "Editor.h"
    35 #import "EventHandler.h"
    36 #import "FloatRect.h"
    3733#import "FoundationExtras.h"
    38 #import "Frame.h"
    39 #import "HTMLImageElement.h"
    4034#import "Image.h"
    4135#import "Page.h"
    4236#import "Pasteboard.h"
    43 #import "Range.h"
    4437#import "RenderImage.h"
    45 #import "WebCoreFrameBridge.h"
    4638#import "WebCoreSystemInterface.h"
    47 
    48 @class WebArchive;
    4939
    5040namespace WebCore {
     
    333323    ASSERT(frame);
    334324    if (Page* page = frame->page())
    335         page->dragController()->client()->declareAndWriteDragImage(m_pasteboard.get(), [DOMElement _wrapElement:element], url.getNSURL(), title, frame);
     325        page->dragController()->client()->declareAndWriteDragImage(m_pasteboard.get(), [DOMElement _wrapElement:element], url, title, frame);
    336326}
    337327   
  • trunk/WebCore/platform/mac/CookieJar.mm

    r29566 r30243  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#import "CookieJar.h"
    2828
     29#import "BlockExceptions.h"
    2930#import "KURL.h"
    30 #import "BlockExceptions.h"
    31 #import "PlatformString.h"
    32 
    3331#import <wtf/RetainPtr.h>
    3432
    3533#ifdef BUILDING_ON_TIGER
    36 typedef unsigned int NSUInteger;
     34typedef unsigned NSUInteger;
    3735#endif
    3836
     
    4341    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    4442
    45     NSURL *cookieURL = url.getNSURL();
     43    NSURL *cookieURL = url;
    4644    NSArray *cookiesForURL = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL];
    4745
     
    7169        return;
    7270
    73     NSURL *cookieURL = url.getNSURL();
     71    NSURL *cookieURL = url;
    7472   
    7573    // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034>
     
    7876   
    7977    NSArray *cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:[NSDictionary dictionaryWithObject:cookieString forKey:@"Set-Cookie"] forURL:cookieURL];
    80     [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:cookies forURL:cookieURL mainDocumentURL:policyBaseURL.getNSURL()];   
     78    [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:cookies forURL:cookieURL mainDocumentURL:policyBaseURL];
    8179
    8280    END_BLOCK_OBJC_EXCEPTIONS;
  • trunk/WebCore/platform/mac/KURLMac.mm

    r25085 r30243  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
     26#import "config.h"
    2727#import "KURL.h"
    2828
    2929#import "FoundationExtras.h"
    30 #import <wtf/Assertions.h>
    31 #import <wtf/Vector.h>
    3230
    3331namespace WebCore {
     
    3533KURL::KURL(NSURL *url)
    3634{
    37     if (url) {
    38         CFIndex bytesLength = CFURLGetBytes((CFURLRef)url, 0, 0);
    39         Vector<char, 2048> buffer(bytesLength + 6);  // 5 for "file:", 1 for NUL terminator
    40         char *bytes = &buffer[5];
    41         CFURLGetBytes((CFURLRef)url, (UInt8 *)bytes, bytesLength);
    42         bytes[bytesLength] = '\0';
    43         if (bytes[0] == '/') {
    44             buffer[0] = 'f';
    45             buffer[1] = 'i';
    46             buffer[2] = 'l';
    47             buffer[3] = 'e';
    48             buffer[4] = ':';
    49             parse(buffer.data(), 0);
    50         } else
    51             parse(bytes, 0);
    52     } else
     35    if (!url) {
    5336        parse(0, 0);
     37        return;
     38    }
     39
     40    CFIndex bytesLength = CFURLGetBytes(reinterpret_cast<CFURLRef>(url), 0, 0);
     41    Vector<char, 512> buffer(bytesLength + 6); // 5 for "file:", 1 for null character to end C string
     42    char* bytes = &buffer[5];
     43    CFURLGetBytes(reinterpret_cast<CFURLRef>(url), reinterpret_cast<UInt8*>(bytes), bytesLength);
     44    bytes[bytesLength] = '\0';
     45    if (bytes[0] != '/') {
     46        parse(bytes, 0);
     47        return;
     48    }
     49
     50    buffer[0] = 'f';
     51    buffer[1] = 'i';
     52    buffer[2] = 'l';
     53    buffer[3] = 'e';
     54    buffer[4] = ':';
     55
     56    parse(buffer.data(), 0);
    5457}
    5558
    56 NSURL *KURL::getNSURL() const
     59KURL::operator NSURL *() const
    5760{
    58     if (urlString.isNull())
     61    if (isNull())
    5962        return nil;
    6063
    61     // CFURL can't hold an empty URL, unlike NSURL
     64    // CFURL can't hold an empty URL, unlike NSURL.
    6265    if (isEmpty())
    6366        return [NSURL URLWithString:@""];
  • trunk/WebCore/platform/mac/PasteboardMac.mm

    r29663 r30243  
    211211    ASSERT(!url.isEmpty());
    212212   
    213     NSURL *cocoaURL = url.getNSURL();
     213    NSURL *cocoaURL = url;
    214214    NSString *userVisibleString = frame->editor()->client()->userVisibleString(cocoaURL);
    215215   
     
    271271    Frame* frame = node->document()->frame();
    272272
    273     NSURL *cocoaURL = url.getNSURL();
     273    NSURL *cocoaURL = url;
    274274    ASSERT(cocoaURL);
    275275
  • trunk/WebCore/platform/mac/SSLKeyGeneratorMac.mm

    r16556 r30243  
    11/*
    2  * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747    return [[WebCoreKeyGenerator sharedGenerator] signedPublicKeyAndChallengeStringWithStrengthIndex:keySizeIndex
    4848                                                                                           challenge:challengeString
    49                                                                                              pageURL:url.getNSURL()];
     49                                                                                             pageURL:url];
    5050}
    5151
  • trunk/WebCore/platform/network/HTTPParsers.cpp

    r29805 r30243  
    11/*
    22 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
    3  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    104104String filenameFromHTTPContentDisposition(const String& value)
    105105{
    106     Vector<String> keyValuePairs = value.split(';');
     106    Vector<String> keyValuePairs;
     107    value.split(';', keyValuePairs);
    107108
    108109    unsigned length = keyValuePairs.size();
  • trunk/WebCore/platform/network/ResourceHandle.cpp

    r30122 r30243  
    11/*
    2  * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    174174
    175175    // Allow ports 21 and 22 for FTP URLs, as Mozilla does.
    176     if ((port == 21 || port == 22) && request.url().deprecatedString().startsWith("ftp:", false))
     176    if ((port == 21 || port == 22) && request.url().protocolIs("ftp"))
    177177        return true;
    178178
    179179    // Allow any port number in a file URL, since the port number is ignored.
    180     if (request.url().deprecatedString().startsWith("file:", false))
     180    if (request.url().protocolIs("file"))
    181181        return true;
    182182
  • trunk/WebCore/platform/network/cf/ResourceErrorCF.cpp

    r28691 r30243  
    121121            RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString());
    122122            CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get());
    123             RetainPtr<CFURLRef> url(AdoptCF, KURL(m_failingURL.deprecatedString()).createCFURL());
     123            RetainPtr<CFURLRef> url(AdoptCF, KURL(m_failingURL).createCFURL());
    124124            CFDictionarySetValue(userInfo.get(), failingURLKey, url.get());
    125125        }
  • trunk/WebCore/platform/network/curl/ResourceHandleManager.cpp

    r30145 r30243  
    173173            String location = d->m_response.httpHeaderField("location");
    174174            if (!location.isEmpty()) {
    175                 KURL newURL = KURL(job->request().url(), location.deprecatedString());
     175                KURL newURL = KURL(job->request().url(), location);
    176176
    177177                ResourceRequest redirectedRequest = job->request();
     
    464464static void parseDataUrl(ResourceHandle* handle)
    465465{
    466     DeprecatedString data = handle->request().url().deprecatedString();
     466    String data = handle->request().url().string();
    467467
    468468    ASSERT(data.startsWith("data:", false));
    469469
    470     DeprecatedString header;
     470    String header;
    471471    bool base64 = false;
    472472
    473473    int index = data.find(',');
    474474    if (index != -1) {
    475         header = data.mid(5, index - 5).lower();
    476         data = data.mid(index + 1);
     475        header = data.substring(5, index - 5).lower();
     476        data = data.substring(index + 1);
    477477
    478478        if (header.endsWith(";base64")) {
     
    481481        }
    482482    } else
    483         data = DeprecatedString();
    484 
    485     data = KURL::decode_string(data);
     483        data = String();
     484
     485    data = decodeURLEscapeSequences(data);
    486486
    487487    if (base64 && !data.isEmpty()) {
     
    490490#ifdef USE_GLIB_BASE64
    491491        gsize outLength;
    492         guchar* out = g_base64_decode(data.ascii(), &outLength);
    493         data = DeprecatedString(reinterpret_cast<char*>(out), outLength);
     492        guchar* out = g_base64_decode(data.latin1().data(), &outLength);
     493        data = String(reinterpret_cast<char*>(out), outLength);
    494494        g_free(out);
    495495#else
    496496        Vector<char> out;
    497         if (base64Decode(data.ascii(), data.length(), out))
    498             data = DeprecatedString(out.data(), out.size());
     497        if (base64Decode(data..latin1().data(), data.length(), out))
     498            data = String(out.data(), out.size());
    499499        else
    500             data = DeprecatedString();
     500            data = String();
    501501#endif
    502502    }
     
    525525{
    526526    KURL kurl = job->request().url();
    527     String protocol = kurl.protocol();
    528 
    529     if (equalIgnoringCase(protocol, "data")) {
     527
     528    if (kurl.protocolIs("data")) {
    530529        parseDataUrl(job);
    531530        return;
     
    536535
    537536    ResourceHandleInternal* d = job->getInternal();
    538     DeprecatedString url = kurl.deprecatedString();
     537    String url = kurl.string();
    539538
    540539    if (kurl.isLocalFile()) {
    541         DeprecatedString query = kurl.query();
     540        String query = kurl.query();
    542541        // Remove any query part sent to a local file.
    543542        if (!query.isEmpty())
    544543            url = url.left(url.find(query));
    545544        // Determine the MIME type based on the path.
    546         d->m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(String(url)));
     545        d->m_response.setMimeType(MIMETypeRegistry::getMIMETypeForPath(url));
    547546    }
    548547
     
    569568    // url must remain valid through the request
    570569    ASSERT(!d->m_url);
    571     d->m_url = strdup(url.ascii());
     570    d->m_url = strdup(url.latin1().data());
    572571    curl_easy_setopt(d->m_handle, CURLOPT_URL, d->m_url);
    573572
     
    612611    if (ret && ret != CURLM_CALL_MULTI_PERFORM) {
    613612#ifndef NDEBUG
    614         printf("Error %d starting job %s\n", ret, job->request().url().deprecatedString().ascii());
     613        printf("Error %d starting job %s\n", ret, job->request().url().string().latin1().data());
    615614#endif
    616615        job->cancel();
  • trunk/WebCore/platform/network/mac/ResourceErrorMac.mm

    r29663 r30243  
    11// -*- mode: c++; c-basic-offset: 4 -*-
    22/*
    3  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    2626
    2727#import "config.h"
     28#import "ResourceError.h"
     29
    2830#import "KURL.h"
    29 #import "ResourceError.h"
    3031#import <Foundation/Foundation.h>
    3132
     
    6465
    6566        if (!m_failingURL.isEmpty()) {
     67            NSURL *cocoaURL = KURL(m_failingURL);
    6668            [userInfo.get() setValue:m_failingURL forKey:@"NSErrorFailingURLStringKey"];
    67             [userInfo.get() setValue:KURL(m_failingURL.deprecatedString()).getNSURL() forKey:@"NSErrorFailingURLKey"];
     69            [userInfo.get() setValue:cocoaURL forKey:@"NSErrorFailingURLKey"];
    6870        }
    6971
     
    7577
    7678} // namespace WebCore
    77 
  • trunk/WebCore/platform/network/mac/ResourceRequest.h

    r29837 r30243  
    11// -*- mode: c++; c-basic-offset: 4 -*-
    22/*
    3  * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
     3 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
    44 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
    55 *
     
    4343    public:
    4444        ResourceRequest(const String& url)
    45             : ResourceRequestBase(KURL(url.deprecatedString()), UseProtocolCachePolicy)
     45            : ResourceRequestBase(KURL(url), UseProtocolCachePolicy)
    4646        {
    4747        }
  • trunk/WebCore/platform/network/mac/ResourceRequestMac.mm

    r29663 r30243  
    7676
    7777    if (nsRequest)
    78         [nsRequest setURL:url().getNSURL()];
     78        [nsRequest setURL:url()];
    7979    else
    80         nsRequest = [[NSMutableURLRequest alloc] initWithURL:url().getNSURL()];
     80        nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()];
    8181   
    8282    wkSupportsMultipartXMixedReplace(nsRequest);
     
    8484    [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
    8585    [nsRequest setTimeoutInterval:timeoutInterval()];
    86     [nsRequest setMainDocumentURL:mainDocumentURL().getNSURL()];
     86    [nsRequest setMainDocumentURL:mainDocumentURL()];
    8787    if (!httpMethod().isEmpty())
    8888        [nsRequest setHTTPMethod:httpMethod()];
  • trunk/WebCore/platform/network/mac/ResourceResponseMac.mm

    r29663 r30243  
    5252        else
    5353            expectedContentLength = static_cast<NSInteger>(m_expectedContentLength);
    54         const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url.getNSURL() MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
     54        const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
    5555    }
    5656    return m_nsResponse.get();
  • trunk/WebCore/platform/qt/ClipboardQt.cpp

    r29663 r30243  
    259259   
    260260    QList<QUrl> urls;
    261     urls.append(QUrl(frame->document()->completeURL(url.deprecatedString())));
     261    urls.append(frame->document()->completeURL(url.string()));
    262262    if (!m_writableData)
    263263        m_writableData = new QMimeData;
  • trunk/WebCore/platform/text/CString.h

    r30122 r30243  
    4141
    4242        char* data() { return m_vector.data(); }
    43         unsigned length() const { return m_vector.size(); }
     43        size_t length() const { return m_vector.size(); }
    4444
    4545    private:
  • trunk/WebCore/platform/text/PlatformString.h

    r29805 r30243  
    133133    static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
    134134
    135     Vector<String> split(const String& separator, bool allowEmptyEntries = false) const;
    136     Vector<String> split(UChar separator, bool allowEmptyEntries = false) const;
     135    void split(const String& separator, Vector<String>& result) const;
     136    void split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const;
     137    void split(UChar separator, Vector<String>& result) const;
     138    void split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const;
    137139
    138140    int toInt(bool* ok = 0) const;
     
    230232inline bool operator!(const String& str) { return str.isNull(); }
    231233
     234bool charactersAreAllASCII(const UChar*, size_t);
     235
     236void append(Vector<UChar>&, const String&);
     237
    232238#ifdef __OBJC__
    233239// This is for situations in WebKit where the long standing behavior has been
     
    237243#endif
    238244
     245inline bool charactersAreAllASCII(const UChar* characters, size_t length)
     246{
     247    UChar ored = 0;
     248    for (size_t i = 0; i < length; ++i)
     249        ored |= characters[i];
     250    return !(ored & 0xFF80);
     251}
     252
     253inline void append(Vector<UChar>& vector, const String& string)
     254{
     255    vector.append(string.characters(), string.length());
     256}
     257
    239258}
    240259
  • trunk/WebCore/platform/text/String.cpp

    r29481 r30243  
    473473}
    474474
    475 Vector<String> String::split(const String& separator, bool allowEmptyEntries) const
    476 {
    477     Vector<String> result;
    478    
     475void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const
     476{
     477    result.clear();
     478
    479479    int startPos = 0;
    480480    int endPos;
     
    484484        startPos = endPos + separator.length();
    485485    }
    486     if (allowEmptyEntries || startPos != (int)length())
     486    if (allowEmptyEntries || startPos != static_cast<int>(length()))
    487487        result.append(substring(startPos));
    488    
    489     return result;
    490 }
    491 
    492 Vector<String> String::split(UChar separator, bool allowEmptyEntries) const
    493 {
    494     Vector<String> result;
    495  
    496     return split(String(&separator, 1), allowEmptyEntries);
     488}
     489
     490void String::split(const String& separator, Vector<String>& result) const
     491{
     492    return split(separator, false, result);
     493}
     494
     495void String::split(UChar separator, bool allowEmptyEntries, Vector<String>& result) const
     496{
     497    result.clear();
     498
     499    int startPos = 0;
     500    int endPos;
     501    while ((endPos = find(separator, startPos)) != -1) {
     502        if (allowEmptyEntries || startPos != endPos)
     503            result.append(substring(startPos, endPos - startPos));
     504        startPos = endPos + 1;
     505    }
     506    if (allowEmptyEntries || startPos != static_cast<int>(length()))
     507        result.append(substring(startPos));
     508}
     509
     510void String::split(UChar separator, Vector<String>& result) const
     511{
     512    return split(String(&separator, 1), false, result);
    497513}
    498514
  • trunk/WebCore/platform/win/BString.cpp

    r27363 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "AtomicString.h"
    3030#include "DeprecatedString.h"
     31#include "KURL.h"
    3132#include "PlatformString.h"
    3233#include <tchar.h>
     
    6667    else
    6768        m_bstr = SysAllocStringLen(s.characters(), s.length());
     69}
     70
     71BString::BString(const KURL& url)
     72{
     73    if (url.isNull())
     74        m_bstr = 0;
     75    else
     76        m_bstr = SysAllocStringLen(url.string().characters(), url.string().length());
    6877}
    6978
  • trunk/WebCore/platform/win/BString.h

    r27363 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3737    class AtomicString;
    3838    class DeprecatedString;
     39    class KURL;
    3940    class String;
    4041
     
    4748        BString(const DeprecatedString&);
    4849        BString(const AtomicString&);
     50        BString(const KURL&);
    4951#if PLATFORM(CF)
    5052        BString(CFStringRef);
  • trunk/WebCore/platform/win/ClipboardUtilitiesWin.cpp

    r29663 r30243  
    175175
    176176    // fill in needed data
    177     startHTML.append(String::format("%010u", startHTMLOffset).deprecatedString().utf8());
    178     endHTML.append(String::format("%010u", endHTMLOffset).deprecatedString().utf8());
    179     startFragment.append(String::format("%010u", startFragmentOffset).deprecatedString().utf8());
    180     endFragment.append(String::format("%010u", endFragmentOffset).deprecatedString().utf8());
     177    startHTML.append(String::format("%010u", startHTMLOffset).utf8().data());
     178    endHTML.append(String::format("%010u", endHTMLOffset).utf8().data());
     179    startFragment.append(String::format("%010u", startFragmentOffset).utf8().data());
     180    endFragment.append(String::format("%010u", endFragmentOffset).utf8().data());
    181181    startMarkup.append(markupUTF8.data());
    182182
  • trunk/WebCore/platform/win/ClipboardWin.cpp

    r29663 r30243  
    3131#include "csshelper.h"
    3232#include "CString.h"
    33 #include "DeprecatedString.h"
    3433#include "Document.h"
    3534#include "DragData.h"
     
    141140            // the path.  If we can't find it, or we're coming up with the name for a link
    142141            // we just use the entire url.
    143             KURL kurl(url.deprecatedString());
     142            KURL kurl(url);
    144143            String lastComponent;
    145144            if (!isLink && !(lastComponent = kurl.lastPathComponent()).isEmpty()) {
     
    227226
    228227    if (url.isLocalFile()) {
    229         DeprecatedString path = url.path();
     228        String localPath = url.path();
    230229        // windows does not enjoy a leading slash on paths
    231         if (path[0] == '/')
    232             path = path.mid(1);
    233         String localPath = path.ascii();
     230        if (localPath[0] == '/')
     231            localPath = localPath.substring(1);
    234232        LPCTSTR localPathStr = localPath.charactersWithNullTermination();
    235233        if (wcslen(localPathStr) + 1 < MAX_PATH)
     
    504502}
    505503
    506 bool ClipboardWin::setData(const String &type, const String &data)
     504bool ClipboardWin::setData(const String& type, const String& data)
    507505{
    508506    // FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941>
     
    514512
    515513    if (winType == ClipboardDataTypeURL)
    516         return WebCore::writeURL(m_writableDataObject.get(), data.deprecatedString(), String(), false, true);
     514        return WebCore::writeURL(m_writableDataObject.get(), KURL(data), String(), false, true);
    517515
    518516    if (winType == ClipboardDataTypeText) {
     
    720718    ExceptionCode ec = 0;
    721719
    722     medium.hGlobal = createGlobalData(markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer(ec)->document()->url()));
     720    medium.hGlobal = createGlobalData(markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
     721        selectedRange->startContainer(ec)->document()->url().string()));
    723722    if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
    724723        ::GlobalFree(medium.hGlobal);
  • trunk/WebCore/platform/win/PasteboardWin.cpp

    r29663 r30243  
    117117    if (::OpenClipboard(m_owner)) {
    118118        ExceptionCode ec = 0;
    119         HGLOBAL cbData = createGlobalData(markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer(ec)->document()->url()));
     119        HGLOBAL cbData = createGlobalData(markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
     120            selectedRange->startContainer(ec)->document()->url().string()));
    120121        if (!::SetClipboardData(HTMLClipboardFormat, cbData))
    121122            ::GlobalFree(cbData);
  • trunk/WebCore/plugins/PluginStream.cpp

    r30135 r30243  
    131131    // Some plugins (Flash) expect that javascript URLs are passed back decoded as this is the
    132132    // format used when requesting the URL.
    133     if (responseURL.string().startsWith("javascript:", false))
    134         m_stream.url = strdup(responseURL.decode_string(responseURL.deprecatedString()).utf8());
     133    if (responseURL.protocolIs("javascript"))
     134        m_stream.url = strdup(decodeURLEscapeSequences(responseURL.string()).utf8().data());
    135135    else
    136         m_stream.url = strdup(responseURL.deprecatedString().utf8());
     136        m_stream.url = strdup(responseURL.string().utf8().data());
    137137   
    138138    CString mimeTypeStr = m_resourceResponse.mimeType().utf8();
     
    268268            m_stream.url = 0;
    269269        }
    270         m_pluginFuncs->urlnotify(m_instance, m_resourceRequest.url().deprecatedString().utf8(), m_reason, m_notifyData);
     270        m_pluginFuncs->urlnotify(m_instance, m_resourceRequest.url().string().utf8().data(), m_reason, m_notifyData);
    271271    }
    272272
  • trunk/WebCore/plugins/win/PluginViewWin.cpp

    r30218 r30243  
    209209static String scriptStringIfJavaScriptURL(const KURL& url)
    210210{
    211     if (!url.string().startsWith("javascript:", false))
     211    if (!url.protocolIs("javascript"))
    212212        return String();
    213213
    214214    // This returns an unescaped string
    215     return KURL::decode_string(url.deprecatedString().mid(11));
     215    return decodeURLEscapeSequences(url.string().substring(11));
    216216}
    217217
     
    879879                KJS::JSLock::DropAllLocks dropAllLocks;
    880880                setCallingPlugin(true);
    881                 m_plugin->pluginFuncs()->urlnotify(m_instance, requestURL.deprecatedString().utf8(), NPRES_DONE, request->notifyData());
     881                m_plugin->pluginFuncs()->urlnotify(m_instance, requestURL.string().utf8().data(), NPRES_DONE, request->notifyData());
    882882                setCallingPlugin(false);
    883883            }
     
    15651565    , m_isStarted(false)
    15661566    , m_url(url)
    1567     , m_baseURL(m_parentFrame->loader()->completeURL(m_parentFrame->document()->baseURL()))
     1567    , m_baseURL(m_parentFrame->loader()->completeURL(m_parentFrame->document()->baseURL().string()))
    15681568    , m_status(PluginStatusLoadedSuccessfully)
    15691569    , m_requestTimer(this, &PluginView::requestTimerFired)
  • trunk/WebCore/rendering/HitTestResult.cpp

    r29663 r30243  
    11/*
    2  * This file is part of the HTML rendering engine for KDE.
    3  *
    4  * Copyright (C) 2006 Apple Computer, Inc.
     2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
    53 *
    64 * This library is free software; you can redistribute it and/or
     
    2422#include "HitTestResult.h"
    2523
    26 #include "CSSHelper.h"
    27 #include "Document.h"
    2824#include "Frame.h"
    2925#include "FrameTree.h"
    3026#include "HTMLAnchorElement.h"
    31 #include "HTMLElement.h"
    3227#include "HTMLImageElement.h"
    3328#include "HTMLInputElement.h"
    3429#include "HTMLNames.h"
    35 #include "KURL.h"
    3630#include "PlatformScrollBar.h"
    3731#include "RenderImage.h"
    38 #include "RenderObject.h"
    3932#include "SelectionController.h"
    4033
     
    242235        return KURL();
    243236   
    244     return KURL(m_innerNonSharedNode->document()->completeURL(parseURL(urlString).deprecatedString()));
     237    return m_innerNonSharedNode->document()->completeURL(parseURL(urlString));
    245238}
    246239
     
    260253        return KURL();
    261254
    262     return KURL(m_innerURLElement->document()->completeURL(parseURL(urlString).deprecatedString()));
     255    return m_innerURLElement->document()->completeURL(parseURL(urlString));
    263256}
    264257
  • trunk/WebCore/rendering/RenderFrameSet.cpp

    r25754 r30243  
    330330   
    331331    // If we still have some left over space we probably ended up with a remainder of
    332     // a division. We can not spread it evenly anymore. If we have any percentage
     332    // a division. We cannot spread it evenly anymore. If we have any percentage
    333333    // columns/rows simply spread the remainder equally over all available percentage columns,
    334334    // regardless of their size.
  • trunk/WebCore/rendering/RenderImage.cpp

    r29630 r30243  
    1 /**
    2  * This file is part of the DOM implementation for KDE.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
     
    75 *           (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
    86 *           (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
    9  * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
     7 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    108 *
    119 * This library is free software; you can redistribute it and/or
     
    226224
    227225            if (!m_altText.isEmpty()) {
    228                 DeprecatedString text = m_altText.deprecatedString();
     226                String text = m_altText;
    229227                text.replace('\\', backslashAsCurrencySymbol());
    230228                context->setFont(style()->font());
     
    237235                // Only draw the alt text if it'll fit within the content box,
    238236                // and only if it fits above the error image.
    239                 TextRun textRun(reinterpret_cast<const UChar*>(text.unicode()), text.length());
     237                TextRun textRun(text.characters(), text.length());
    240238                int textWidth = font.width(textRun);
    241239                if (errorPictureDrawn) {
     
    268266{
    269267    HTMLImageElement* i = element() && element()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(element()) : 0;
    270     return i ? i->document()->getImageMap(i->imageMap()) : 0;
     268    return i ? i->document()->getImageMap(i->useMap()) : 0;
    271269}
    272270
  • trunk/WebCore/rendering/RenderObject.cpp

    r29647 r30243  
    16691669}
    16701670
    1671 void RenderObject::addPDFURLRect(GraphicsContext* graphicsContext, IntRect rect)
    1672 {
     1671void RenderObject::addPDFURLRect(GraphicsContext* context, const IntRect& rect)
     1672{
     1673    if (rect.isEmpty())
     1674        return;
    16731675    Node* node = element();
    1674     if (node) {
    1675         if (graphicsContext) {
    1676             if (rect.width() > 0 && rect.height() > 0) {
    1677                 Element* element = static_cast<Element*>(node);
    1678                 String href;
    1679                 if (element->isLink())
    1680                     href = element->getAttribute(hrefAttr);
    1681 
    1682                 if (!href.isNull()) {
    1683                     KURL link = element->document()->completeURL(href.deprecatedString());
    1684                     graphicsContext->setURLForRect(link, rect);
    1685                 }
    1686             }
    1687         }
    1688     }
     1676    if (!node || !node->isLink() || !node->isElementNode())
     1677        return;
     1678    const AtomicString& href = static_cast<Element*>(node)->getAttribute(hrefAttr);
     1679    if (href.isNull())
     1680        return;
     1681    context->setURLForRect(node->document()->completeURL(href), rect);
    16891682}
    16901683
  • trunk/WebCore/rendering/RenderObject.h

    r29649 r30243  
    44 *           (C) 2000 Dirk Mueller (mueller@kde.org)
    55 *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
    6  * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    77 *
    88 * This library is free software; you can redistribute it and/or
     
    489489    void layoutIfNeeded() { if (needsLayout()) layout(); }
    490490
    491     // used for element state updates that can not be fixed with a
     491    // used for element state updates that cannot be fixed with a
    492492    // repaint and do not need a relayout
    493493    virtual void updateFromElement() { }
     
    672672    IntRect paintingRootRect(IntRect& topLevelRect);
    673673
    674     void addPDFURLRect(GraphicsContext*, IntRect);
     674    void addPDFURLRect(GraphicsContext*, const IntRect&);
    675675
    676676    virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
  • trunk/WebCore/rendering/RenderPartObject.cpp

    r30114 r30243  
    1 /**
    2  * This file is part of the KDE project.
    3  *
     1/*
    42 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    53 *           (C) 2000 Simon Hausmann <hausmann@kde.org>
    64 *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
    7  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    86 *
    97 * This library is free software; you can redistribute it and/or
     
    2321 *
    2422 */
     23
    2524#include "config.h"
    2625#include "RenderPartObject.h"
    2726
    28 #include "Document.h"
    29 #include "EventHandler.h"
    3027#include "Frame.h"
    3128#include "FrameLoader.h"
     
    3835#include "HTMLObjectElement.h"
    3936#include "HTMLParamElement.h"
    40 #include "KURL.h"
    4137#include "MIMETypeRegistry.h"
    4238#include "Page.h"
    43 #include "RenderView.h"
    4439#include "Text.h"
    4540
     
    6257}
    6358
    64 static bool isURLAllowed(Document *doc, const String &url)
    65 {
    66     KURL newURL(doc->completeURL(url.deprecatedString()));
    67     newURL.setRef(DeprecatedString::null);
    68    
     59static bool isURLAllowed(Document* doc, const String& url)
     60{
    6961    if (doc->frame()->page()->frameCount() >= 200)
    7062        return false;
     
    7264    // We allow one level of self-reference because some sites depend on that.
    7365    // But we don't allow more than one.
     66    KURL completeURL = doc->completeURL(url);
    7467    bool foundSelfReference = false;
    75     for (Frame *frame = doc->frame(); frame; frame = frame->tree()->parent()) {
    76         KURL frameURL = frame->loader()->url();
    77         frameURL.setRef(DeprecatedString::null);
    78         if (frameURL == newURL) {
     68    for (Frame* frame = doc->frame(); frame; frame = frame->tree()->parent()) {
     69        if (equalIgnoringRef(frame->loader()->url(), completeURL)) {
    7970            if (foundSelfReference)
    8071                return false;
     
    10394    else if (classId.contains("6BF52A52-394A-11d3-B153-00C04F79FAA6"))
    10495        serviceType = "application/x-mplayer2";
    105     else if (!classId.isEmpty())
    106         // We have a clsid, means this is activex (Niko)
     96    else if (!classId.isEmpty()) {
     97        // We have a clsid, means this is Active X (Niko)
    10798        serviceType = "application/x-activex-handler";
    108     // TODO: add more plugins here
     99    }
    109100}
    110101
     
    140131      if (embed) {
    141132          embedOrObject = (HTMLElement *)embed;
    142           url = embed->url;
    143           serviceType = embed->m_serviceType;
     133          url = embed->url();
     134          serviceType = embed->serviceType();
    144135      } else
    145136          embedOrObject = (HTMLElement *)o;
     
    232223      HTMLEmbedElement *o = static_cast<HTMLEmbedElement*>(element());
    233224      o->setNeedWidgetUpdate(false);
    234       url = o->url;
    235       serviceType = o->m_serviceType;
     225      url = o->url();
     226      serviceType = o->serviceType();
    236227
    237228      if (url.isEmpty() && serviceType.isEmpty())
  • trunk/WebCore/rendering/RenderText.cpp

    r29483 r30243  
    4343namespace WebCore {
    4444
     45// FIXME: Move to StringImpl.h eventually.
    4546static inline bool charactersAreAllASCII(StringImpl* text)
    4647{
    47     const UChar* chars = text->characters();
    48     unsigned length = text->length();
    49     UChar ored = 0;
    50     for (unsigned i = 0; i < length; ++i)
    51         ored |= chars[i];
    52     return !(ored & 0xFF80);
     48    return charactersAreAllASCII(text->characters(), text->length());
    5349}
    5450
  • trunk/WebCore/rendering/SVGRenderSupport.cpp

    r29663 r30243  
    1 /**
    2  * This file is part of the DOM implementation for WebKit.
    3  *
     1/*
    42 * Copyright (C) 2007 Rob Buis <buis@kde.org>
    53 *           (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
     
    139137        svgContainer->setDrawsContents(true);
    140138
     139    item->layoutIfNeeded();
    141140    item->paint(info, 0, 0);
    142141
  • trunk/WebCore/rendering/SVGRenderTreeAsText.h

    r29663 r30243  
    2929#if ENABLE(SVG)
    3030
    31 #include "DeprecatedString.h"
    3231#include "TextStream.h"
    3332
  • trunk/WebCore/svg/SVGImageLoader.cpp

    r28639 r30243  
    5252    CachedImage *newImage = 0;
    5353    if (!imageElement->href().isEmpty()) {
    54         DeprecatedString uri = imageElement->baseURI().deprecatedString();
     54        KURL uri = imageElement->baseURI();
    5555        if (!uri.isEmpty())
    56             uri = KURL(uri, imageElement->href().deprecatedString()).deprecatedString();
     56            uri = KURL(uri, imageElement->href());
    5757        else
    58             uri = imageElement->href().deprecatedString();
    59         newImage = doc->docLoader()->requestImage(uri);
     58            uri = KURL(imageElement->href());
     59        newImage = doc->docLoader()->requestImage(uri.string());
    6060    }
    6161
    62     CachedImage *oldImage = image();
     62    CachedImage* oldImage = image();
    6363    if (newImage != oldImage) {
    6464        setLoadingImage(newImage);
  • trunk/WebCore/svg/graphics/SVGImage.cpp

    r29663 r30243  
    11/*
    22 * Copyright (C) 2006 Eric Seidel (eric@webkit.org)
     3 * Copyright (C) 2008 Apple, Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2627#include "config.h"
    2728#if ENABLE(SVG)
     29#include "SVGImage.h"
    2830
    2931#include "CachedPage.h"
     
    4042#include "ResourceError.h"
    4143#include "SVGDocument.h"
    42 #include "SVGImage.h"
    4344#include "SVGLength.h"
    4445#include "SVGRenderSupport.h"
     
    139140    context->translate(dstRect.location().x(), dstRect.location().y());
    140141    context->scale(FloatSize(dstRect.width()/srcRect.width(), dstRect.height()/srcRect.height()));
     142   
     143    if (m_frame->view()->needsLayout())
     144        m_frame->view()->layout();
    141145    m_frame->paint(context, enclosingIntRect(srcRect));
     146
    142147    context->restore();
    143148
     
    198203        m_frame->loader()->commitProvisionalLoad(0);
    199204        m_frame->loader()->setResponseMIMEType("image/svg+xml");
    200         m_frame->loader()->begin("placeholder.svg"); // create the empty document
     205        m_frame->loader()->begin(KURL()); // create the empty document
    201206        m_frame->loader()->write(m_data->data(), m_data->size());
    202207        m_frame->loader()->end();
  • trunk/WebCore/xml/XMLHttpRequest.cpp

    r30122 r30243  
    11/*
    2  *  This file is part of the KDE libraries
    3  *  Copyright (C) 2004, 2006 Apple Computer, Inc.
     2 *  Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
    43 *  Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
    54 *  Copyright (C) 2007 Julien Chaffraix <julien.chaffraix@gmail.com>
     
    2423
    2524#include "CString.h"
    26 #include "Cache.h"
    2725#include "DOMImplementation.h"
    2826#include "Event.h"
     
    3028#include "EventListener.h"
    3129#include "EventNames.h"
    32 #include "ExceptionCode.h"
    33 #include "FormData.h"
    3430#include "Frame.h"
    3531#include "FrameLoader.h"
    36 #include "HTMLDocument.h"
    3732#include "HTTPParsers.h"
    3833#include "Page.h"
    39 #include "PlatformString.h"
    40 #include "RegularExpression.h"
    41 #include "ResourceHandle.h"
    42 #include "ResourceRequest.h"
    4334#include "Settings.h"
    4435#include "SubresourceLoader.h"
    45 #include "TextEncoding.h"
    4636#include "TextResourceDecoder.h"
    4737#include "XMLHttpRequestException.h"
    4838#include "kjs_binding.h"
    49 #include <kjs/protect.h>
    50 #include <wtf/Vector.h>
    5139
    5240namespace WebCore {
     
    174162            m_responseXML = m_doc->implementation()->createDocument(0);
    175163            m_responseXML->open();
    176             m_responseXML->setURL(m_url.deprecatedString());
     164            m_responseXML->setURL(m_url);
    177165            // FIXME: set Last-Modified and cookies (currently, those are only available for HTMLDocuments).
    178166            m_responseXML->write(String(m_responseText));
     
    323311
    324312    // but a remote document can only load from the same port on the server
    325     KURL documentURL = m_doc->url();
     313    KURL documentURL(m_doc->url());
    326314    if (documentURL.protocol().lower() == url.protocol().lower()
    327315            && documentURL.host().lower() == url.host().lower()
     
    373361        || methodUpper == "OPTIONS" || methodUpper == "POST" || methodUpper == "PROPFIND" || methodUpper == "PROPPATCH" || methodUpper == "PUT"
    374362        || methodUpper == "UNLOCK")
    375         m_method = methodUpper.deprecatedString();
     363        m_method = methodUpper;
    376364    else
    377         m_method = method.deprecatedString();
     365        m_method = method;
    378366
    379367    m_async = async;
     
    385373{
    386374    KURL urlWithCredentials(url);
    387     urlWithCredentials.setUser(user.deprecatedString());
     375    urlWithCredentials.setUser(user);
    388376   
    389377    open(method, urlWithCredentials, async, ec);
     
    393381{
    394382    KURL urlWithCredentials(url);
    395     urlWithCredentials.setUser(user.deprecatedString());
    396     urlWithCredentials.setPass(password.deprecatedString());
     383    urlWithCredentials.setUser(user);
     384    urlWithCredentials.setPass(password);
    397385   
    398386    open(method, urlWithCredentials, async, ec);
     
    473461    {
    474462        KJS::JSLock lock;
    475         gcProtectNullTolerant(KJS::ScriptInterpreter::getDOMObject(this));
     463        gcProtectNullTolerant(ScriptInterpreter::getDOMObject(this));
    476464    }
    477465 
     
    508496    {
    509497        KJS::JSLock lock;
    510         KJS::JSValue* wrapper = KJS::ScriptInterpreter::getDOMObject(this);
     498        KJS::JSValue* wrapper = ScriptInterpreter::getDOMObject(this);
    511499        KJS::gcUnprotectNullTolerant(wrapper);
    512500   
  • trunk/WebCore/xml/XMLHttpRequest.h

    r29073 r30243  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    3  *  This file is part of the KDE libraries
    4  *  Copyright (C) 2003, 2006 Apple Computer, Inc.
     2 *  Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
    53 *  Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
    64 *
     
    2422
    2523#include "EventTarget.h"
    26 #include "HTTPHeaderMap.h"
    27 #include "KURL.h"
    28 #include "PlatformString.h"
    2924#include "ResourceResponse.h"
    30 #include "StringHash.h"
    3125#include "SubresourceLoaderClient.h"
    32 #include <kjs/ustring.h>
    33 
    34 #include <wtf/HashMap.h>
    35 #include <wtf/Vector.h>
    3626
    3727namespace WebCore {
    3828
     29class Document;
    3930class TextResourceDecoder;
    40 class Document;
    41 class Event;
    42 class EventListener;
    43 class String;
    44 
    45 typedef int ExceptionCode;
    4631
    4732// these exact numeric values are important because JS expects them
     
    129114
    130115    KURL m_url;
    131     DeprecatedString m_method;
     116    String m_method;
    132117    HTTPHeaderMap m_requestHeaders;
    133118    String m_mimeTypeOverride;
  • trunk/WebCore/xml/XSLImportRule.cpp

    r28639 r30243  
    1 /**
     1/*
    22 * This file is part of the XSL implementation.
    33 *
    4  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     4 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    8989    if (!parentSheet->href().isNull())
    9090        // use parent styleheet's URL as the base URL
    91         absHref = KURL(parentSheet->href().deprecatedString(), m_strHref.deprecatedString()).string();
     91        absHref = KURL(KURL(parentSheet->href()), m_strHref).string();
    9292   
    9393    // Check for a cycle in our import chain.  If we encounter a stylesheet
  • trunk/WebCore/xml/XSLStyleSheet.cpp

    r27302 r30243  
    1 /**
     1/*
    22 * This file is part of the XSL implementation.
    33 *
    4  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
     4 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    191191            if (IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "import")) {
    192192                xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar*)"href", XSLT_NAMESPACE);               
    193                 loadChildSheet(DeprecatedString::fromUtf8((const char*)uriRef));
     193                loadChildSheet(String::fromUTF8((const char*)uriRef));
    194194                xmlFree(uriRef);
    195195            } else
     
    202202            if (curr->type == XML_ELEMENT_NODE && IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "include")) {
    203203                xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar*)"href", XSLT_NAMESPACE);
    204                 loadChildSheet(DeprecatedString::fromUtf8((const char*)uriRef));
     204                loadChildSheet(String::fromUTF8((const char*)uriRef));
    205205                xmlFree(uriRef);
    206206            }
     
    210210}
    211211
    212 void XSLStyleSheet::loadChildSheet(const DeprecatedString& href)
     212void XSLStyleSheet::loadChildSheet(const String& href)
    213213{
    214214    RefPtr<XSLImportRule> childRule = new XSLImportRule(this, href);
  • trunk/WebCore/xml/XSLStyleSheet.h

    r25754 r30243  
    22 * This file is part of the XSL implementation.
    33 *
    4  * Copyright (C) 2004, 2006 Apple Computer, Inc.
     4 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
     
    5252
    5353    void loadChildSheets();
    54     void loadChildSheet(const DeprecatedString& href);
     54    void loadChildSheet(const String& href);
    5555
    5656    xsltStylesheetPtr compileStyleSheet();
  • trunk/WebCore/xml/XSLTProcessor.cpp

    r29905 r30243  
    1 /**
     1/*
    22 * This file is part of the XSL implementation.
    33 *
    4  * Copyright (C) 2004, 2005, 2006, 2007 Apple, Inc.
     4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved.
    55 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@webkit.org>
    66 *
     
    113113            xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt;
    114114            xmlChar* base = xmlNodeGetBase(context->document->doc, context->node);
    115             KURL url((const char*)base, (const char*)uri);
     115            KURL url(KURL(reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri));
    116116            xmlFree(base);
    117117            ResourceError error;
     
    294294{
    295295    if (!cachedStylesheet && stylesheetRootNode) {
    296         cachedStylesheet = new XSLStyleSheet(stylesheetRootNode->parent() ? stylesheetRootNode->parent() : stylesheetRootNode, stylesheetRootNode->document()->url());
     296        cachedStylesheet = new XSLStyleSheet(stylesheetRootNode->parent() ? stylesheetRootNode->parent() : stylesheetRootNode,
     297            stylesheetRootNode->document()->url().string());
    297298        cachedStylesheet->parseString(createMarkup(stylesheetRootNode));
    298299    }
     
    313314        sourceDoc = (xmlDocPtr)ownerDocument->transformSource();
    314315    if (!sourceDoc) {
    315         sourceDoc = (xmlDocPtr)xmlDocPtrForString(ownerDocument->docLoader(), createMarkup(sourceNode), sourceIsDocument ? ownerDocument->url() : DeprecatedString());
     316        sourceDoc = (xmlDocPtr)xmlDocPtrForString(ownerDocument->docLoader(), createMarkup(sourceNode),
     317            sourceIsDocument ? ownerDocument->url().string() : String());
    316318        shouldDelete = (sourceDoc != 0);
    317319    }
  • trunk/WebKit/gtk/ChangeLog

    r30228 r30243  
     12008-02-14  Darin Adler  <darin@apple.com>
     2
     3        * webkit/webkitwebframe.cpp: Removed DeprecatedString use to try to keep it building.
     4        * webkit/webkitwebview.cpp: Ditto.
     5
    162008-02-14  Holger Hans Peter Freyther  <zecke@selfish.org>
    27
  • trunk/WebKit/gtk/webkit/webkitwebframe.cpp

    r30227 r30243  
    364364
    365365    // TODO: Use the ResourceRequest carried by WebKitNetworkRequest when it is implemented.
    366     DeprecatedString string = DeprecatedString::fromUtf8(webkit_network_request_get_uri(request));
     366    String string = String::fromUTF8(webkit_network_request_get_uri(request));
    367367    coreFrame->loader()->load(ResourceRequest(KURL(string)));
    368368}
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r30226 r30243  
    14751475
    14761476    Frame* frame = core(webView)->mainFrame();
    1477     DeprecatedString string = DeprecatedString::fromUtf8(uri);
    1478     frame->loader()->load(ResourceRequest(KURL(string)));
     1477    frame->loader()->load(ResourceRequest(KURL(String::fromUTF8(uri))));
    14791478}
    14801479
     
    14931492    Frame* frame = core(webView)->mainFrame();
    14941493
    1495     KURL url(baseUri ? DeprecatedString::fromUtf8(baseUri) : "");
     1494    KURL url(baseUri ? String::fromUTF8(baseUri) : "");
    14961495    RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(strdup(content), strlen(content));
    14971496    SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL("about:blank"), url);
  • trunk/WebKit/mac/ChangeLog

    r30239 r30243  
     12008-02-14  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        - updated for WebCore KURL changes
     6
     7        * History/WebHistoryItem.mm:
     8        (-[WebHistoryItem URL]): Removed getNSURL call.
     9        * Misc/WebElementDictionary.mm:
     10        (-[WebElementDictionary _absoluteImageURL]): Ditto.
     11        (-[WebElementDictionary _absoluteLinkURL]): Ditto.
     12        * Misc/WebNSAttributedStringExtras.mm:
     13        (fileWrapperForElement): Ditto.
     14        (+[NSAttributedString _web_attributedStringFromRange:]): Ditto.
     15        * Misc/WebNSURLExtras.mm:
     16        (-[NSString _webkit_stringByReplacingValidPercentEscapes]): Updated
     17        for function name change.
     18        * WebCoreSupport/WebContextMenuClient.mm:
     19        (WebContextMenuClient::downloadURL): Removed getNSURL call.
     20        * WebCoreSupport/WebDragClient.mm:
     21        (WebDragClient::createDragImageForLink): Ditto.
     22        * WebCoreSupport/WebFrameLoaderClient.mm:
     23        (WebFrameLoaderClient::dispatchWillPerformClientRedirect): Ditto.
     24        (WebFrameLoaderClient::startDownload): Ditto.
     25        (WebFrameLoaderClient::updateGlobalHistoryForStandardLoad): Ditto.
     26        (WebFrameLoaderClient::updateGlobalHistoryForReload): Ditto.
     27        (WebFrameLoaderClient::cancelledError): Ditto.
     28        (WebFrameLoaderClient::blockedError): Ditto.
     29        (WebFrameLoaderClient::cannotShowURLError): Ditto.
     30        (WebFrameLoaderClient::interruptForPolicyChangeError): Ditto.
     31        (WebFrameLoaderClient::cannotShowMIMETypeError): Ditto.
     32        (WebFrameLoaderClient::fileDoesNotExistError): Ditto.
     33        (WebFrameLoaderClient::willUseArchive): Ditto.
     34        (WebFrameLoaderClient::setTitle): Ditto.
     35        (WebFrameLoaderClient::actionDictionary): Ditto.
     36        (WebFrameLoaderClient::createFrame): Ditto.
     37        (WebFrameLoaderClient::objectContentType): Ditto.
     38        (WebFrameLoaderClient::createPlugin): Ditto.
     39        (WebFrameLoaderClient::createJavaAppletWidget): Ditto.
     40        * WebView/WebDataSource.mm:
     41        (-[WebDataSource _URL]): Ditto.
     42        (-[WebDataSource _initWithDocumentLoader:]): Ditto.
     43        (-[WebDataSource unreachableURL]): Ditto.
     44        * WebView/WebHTMLView.mm:
     45        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): Ditto.
     46
    1472008-02-14  Stephanie Lewis  <slewis@apple.com>
    248
  • trunk/WebKit/mac/History/WebHistoryItem.mm

    r25275 r30243  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    465465    ASSERT_MAIN_THREAD();
    466466    KURL url = core(_private)->url();
    467     return url.isEmpty() ? nil : url.getNSURL();
     467    if (url.isEmpty())
     468        return nil;
     469    return url;
    468470}
    469471
  • trunk/WebKit/mac/Misc/WebElementDictionary.mm

    r29663 r30243  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3636#import "WebView.h"
    3737#import "WebViewPrivate.h"
    38 
    39 #import <WebKit/DOMCore.h>
    40 #import <WebKit/DOMExtensions.h>
    4138#import <WebCore/Frame.h>
    4239#import <WebCore/HitTestResult.h>
     
    4441#import <WebCore/KURL.h>
    4542#import <WebCore/WebCoreObjCExtras.h>
     43#import <WebKit/DOMCore.h>
     44#import <WebKit/DOMExtensions.h>
    4645
    4746using namespace WebCore;
     
    206205- (NSURL *)_absoluteImageURL
    207206{
    208     return _result->absoluteImageURL().getNSURL();
     207    return _result->absoluteImageURL();
    209208}
    210209
     
    221220- (NSURL *)_absoluteLinkURL
    222221{
    223     return _result->absoluteLinkURL().getNSURL();
     222    return _result->absoluteLinkURL();
    224223}
    225224
  • trunk/WebKit/mac/Misc/WebNSAttributedStringExtras.mm

    r29250 r30243  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
     2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9595    const AtomicString& attr = e->getAttribute(srcAttr);
    9696    if (!attr.isEmpty()) {
    97         NSURL *URL = KURL(e->document()->completeURL(attr.deprecatedString())).getNSURL();
     97        NSURL *URL = e->document()->completeURL(attr);
    9898        wrapper = [[kit(e->document()->frame()) _dataSource] _fileWrapperForURL:URL];
    9999    }
     
    423423                // will have corrected any illegally nested <a> elements.
    424424                if (linkStartNode && currentNode == linkStartNode) {
    425                     String href = parseURL(linkStartNode->getAttribute(hrefAttr));
    426                     KURL kURL = linkStartNode->document()->frame()->loader()->completeURL(href.deprecatedString());
    427                    
    428                     NSURL *URL = kURL.getNSURL();
     425                    NSURL *URL = linkStartNode->document()->frame()->loader()->completeURL(parseURL(linkStartNode->getAttribute(hrefAttr)));
    429426                    NSRange tempRange = { linkStartLocation, [result length]-linkStartLocation }; // workaround for 4213314
    430427                    [result addAttribute:NSLinkAttributeName value:URL range:tempRange];
  • trunk/WebKit/mac/Misc/WebNSURLExtras.mm

    r26676 r30243  
    11/*
    2  * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
    33 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
    44 *
     
    803803- (NSString *)_webkit_stringByReplacingValidPercentEscapes
    804804{
    805     DeprecatedString s = KURL::decode_string(DeprecatedString::fromNSString(self));
    806     return s.getNSString();
     805    return decodeURLEscapeSequences(self);
    807806}
    808807
  • trunk/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm

    r25396 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    296296void WebContextMenuClient::downloadURL(const KURL& url)
    297297{
    298     [m_webView _downloadURL:url.getNSURL()];
     298    [m_webView _downloadURL:url];
    299299}
    300300
  • trunk/WebKit/mac/WebCoreSupport/WebDragClient.mm

    r29663 r30243  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    122122    if (!frame)
    123123        return nil;
    124     WebHTMLView* htmlView = (WebHTMLView*)[[kit(frame) frameView] documentView];
     124    WebHTMLView *htmlView = (WebHTMLView *)[[kit(frame) frameView] documentView];
    125125    NSString *label = 0;
    126126    if (!title.isEmpty())
    127         label = (NSString*)title;
    128     return [htmlView _dragImageForURL:[url.getNSURL() _web_userVisibleString] withLabel:label];
     127        label = title;
     128    NSURL *cocoaURL = url;
     129    return [htmlView _dragImageForURL:[cocoaURL _web_userVisibleString] withLabel:label];
    129130}
    130131
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r28672 r30243  
    11/*
    2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    427427}
    428428
    429 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& URL, double delay, double fireDate)
     429void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& url, double delay, double fireDate)
    430430{
    431431    WebView *webView = getWebView(m_webFrame.get());
    432432    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
    433     if (implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc)
    434         CallFrameLoadDelegate(implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc, webView, @selector(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:), URL.getNSURL(), delay, [NSDate dateWithTimeIntervalSince1970:fireDate], m_webFrame.get());
     433    if (implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc) {
     434        NSURL *cocoaURL = url;
     435        CallFrameLoadDelegate(implementations->willPerformClientRedirectToURLDelayFireDateForFrameFunc, webView, @selector(webView:willPerformClientRedirectToURL:delay:fireDate:forFrame:), cocoaURL, delay, [NSDate dateWithTimeIntervalSince1970:fireDate], m_webFrame.get());
     436    }
    435437}
    436438
     
    678680{
    679681    // FIXME: Should download full request.
    680     WebDownload *download = [getWebView(m_webFrame.get()) _downloadURL:request.url().getNSURL()];
     682    WebDownload *download = [getWebView(m_webFrame.get()) _downloadURL:request.url()];
    681683   
    682684    setOriginalURLForDownload(download, request);
     
    716718void WebFrameLoaderClient::updateGlobalHistoryForStandardLoad(const KURL& url)
    717719{
    718     NSURL *nsurl = url.getNSURL();
    719     WebHistoryItem *entry = [[WebHistory optionalSharedHistory] addItemForURL:nsurl];
     720    NSURL *cocoaURL = url;
     721    WebHistoryItem *entry = [[WebHistory optionalSharedHistory] addItemForURL:cocoaURL];
    720722    String pageTitle = core(m_webFrame.get())->loader()->documentLoader()->title();
    721723    if (pageTitle.length())
     
    728730{
    729731    WebHistory *sharedHistory = [WebHistory optionalSharedHistory];
    730     WebHistoryItem *item = [sharedHistory itemForURL:url.getNSURL()];
     732    WebHistoryItem *item = [sharedHistory itemForURL:url];
    731733    if (item)
    732734        [sharedHistory setLastVisitedTimeInterval:[NSDate timeIntervalSinceReferenceDate] forItem:item];
     
    743745ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request)
    744746{
    745     return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url().getNSURL()];
     747    return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()];
    746748}
    747749   
    748750ResourceError WebFrameLoaderClient::blockedError(const ResourceRequest& request)
    749751{
    750     return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotUseRestrictedPort URL:request.url().getNSURL()];
     752    return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotUseRestrictedPort URL:request.url()];
    751753}
    752754
    753755ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest& request)
    754756{
    755     return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotShowURL URL:request.url().getNSURL()];
     757    return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotShowURL URL:request.url()];
    756758}
    757759
    758760ResourceError WebFrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest& request)
    759761{
    760     return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorFrameLoadInterruptedByPolicyChange URL:request.url().getNSURL()];
     762    return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorFrameLoadInterruptedByPolicyChange URL:request.url()];
    761763}
    762764
    763765ResourceError WebFrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& response)
    764766{
    765     return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:WebKitErrorCannotShowMIMEType URL:response.url().getNSURL()];
     767    return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:WebKitErrorCannotShowMIMEType URL:response.url()];
    766768}
    767769
    768770ResourceError WebFrameLoaderClient::fileDoesNotExistError(const ResourceResponse& response)
    769771{
    770     return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist URL:response.url().getNSURL()];   
     772    return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist URL:response.url()];   
    771773}
    772774
     
    791793    if (!canUseArchivedResource(request.nsURLRequest()))
    792794        return false;
    793     WebResource *resource = [dataSource(core(m_webFrame.get())->loader()->activeDocumentLoader()) _archivedSubresourceForURL:originalURL.getNSURL()];
     795    WebResource *resource = [dataSource(core(m_webFrame.get())->loader()->activeDocumentLoader()) _archivedSubresourceForURL:originalURL];
    794796    if (!resource)
    795797        return false;
     
    943945void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL)
    944946{
    945     NSURL* nsURL = canonicalURL(URL.getNSURL());
     947    NSURL* nsURL = canonicalURL(URL);
    946948    if(!nsURL)
    947949        return;
     
    11151117            modifierFlags |= NSCommandKeyMask;
    11161118    }
     1119    NSURL *originalURL = action.url();
    11171120    if (const MouseEvent* mouseEvent = findMouseEvent(event)) {
    11181121        IntPoint point(mouseEvent->pageX(), mouseEvent->pageY());
     
    11241127            [NSNumber numberWithInt:mouseEvent->button()], WebActionButtonKey,
    11251128            [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey,
    1126             action.url().getNSURL(), WebActionOriginalURLKey,
     1129            originalURL, WebActionOriginalURLKey,
    11271130            nil];
    11281131        [element release];
     
    11321135        [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey,
    11331136        [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey,
    1134         action.url().getNSURL(), WebActionOriginalURLKey,
     1137        originalURL, WebActionOriginalURLKey,
    11351138        nil];
    11361139}
     
    11491152   
    11501153    return [bridge createChildFrameNamed:name
    1151                    withURL:url.getNSURL()
     1154                   withURL:url
    11521155                   referrer:referrer
    11531156                   ownerElement:ownerElement
     
    11641167    WebFrameBridge* bridge = m_webFrame->_private->bridge;
    11651168    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    1166     return [bridge determineObjectFromMIMEType:mimeType URL:url.getNSURL()];
     1169    return [bridge determineObjectFromMIMEType:mimeType URL:url];
    11671170    END_BLOCK_OBJC_EXCEPTIONS;
    11681171    return ObjectContentNone;
     
    11851188    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    11861189    return new Widget([bridge viewForPluginWithFrame:NSMakeRect(0, 0, size.width(), size.height())
    1187                                                  URL:url.getNSURL()
     1190                                                 URL:url
    11881191                                      attributeNames:nsArray(paramNames)
    11891192                                     attributeValues:nsArray(paramValues)
     
    12131216                            attributeNames:nsArray(paramNames)
    12141217                            attributeValues:nsArray(paramValues)
    1215                             baseURL:baseURL.getNSURL()
     1218                            baseURL:baseURL
    12161219                            DOMElement:[DOMElement _wrapElement:element]]);   
    12171220    END_BLOCK_OBJC_EXCEPTIONS;
  • trunk/WebKit/mac/WebView/WebDataSource.mm

    r28639 r30243  
    11/*
    2  * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    320320- (NSURL *)_URL
    321321{
    322     KURL URL = _private->loader->url();
    323     return URL.isEmpty() ? nil : URL.getNSURL();
     322    KURL url = _private->loader->url();
     323    if (url.isEmpty())
     324        return nil;
     325    return url;
    324326}
    325327
     
    383385    loader->ref();
    384386       
    385     LOG(Loading, "creating datasource for %@", _private->loader->request().url().getNSURL());
     387    LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(_private->loader->request().url()));
    386388   
    387389    ++WebDataSourceCount;
     
    477479- (NSURL *)unreachableURL
    478480{
    479     KURL URL = _private->loader->unreachableURL();
    480     return URL.isEmpty() ? nil : URL.getNSURL();
     481    KURL unreachableURL = _private->loader->unreachableURL();
     482    if (unreachableURL.isEmpty())
     483        return nil;
     484    return unreachableURL;
    481485}
    482486
  • trunk/WebKit/mac/WebView/WebHTMLView.mm

    r30005 r30243  
    11/*
    2  * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    33 *           (C) 2006, 2007 Graham Dennis (graham.dennis@gmail.com)
    44 *
     
    31113111        KURL imageURL = page->dragController()->draggingImageURL();
    31123112        ASSERT(!imageURL.isEmpty());
    3113         draggingImageURL = imageURL.getNSURL();
     3113        draggingImageURL = imageURL;
    31143114
    31153115        wrapper = [[self _dataSource] _fileWrapperForURL:draggingImageURL];
  • trunk/WebKit/win/ChangeLog

    r30230 r30243  
     12008-02-14  Darin Adler  <darin@apple.com>
     2
     3        - updated for WebCore KURL changes
     4
     5        * MarshallingHelpers.cpp:
     6        (MarshallingHelpers::BSTRToKURL): Removed deprecatedString call.
     7        (MarshallingHelpers::KURLToBSTR): Tweaked for efficiency.
     8        * WebContextMenuClient.cpp:
     9        (WebContextMenuClient::searchWithGoogle): Updated for KURL changes.
     10        * WebDataSource.cpp:
     11        (WebDataSource::unreachableURL): Ditto.
     12        * WebDownload.cpp:
     13        (WebDownload::init): Ditto.
     14        (WebDownload::initWithRequest): Ditto.
     15        * WebFrame.cpp:
     16        (WebFrame::loadData): Ditto.
     17        (WebFrame::loadURLIntoChild): Ditto.
     18        (WebFrame::objectContentType): Ditto.
     19        * WebResource.cpp:
     20        (WebResource::initWithData): Ditto.
     21        * WebURLResponse.cpp:
     22        (WebURLResponse::createInstance): Ditto.
     23        (WebURLResponse::initWithURL): Ditto.
     24        * WebView.cpp:
     25        (WebView::userAgentForURL): Ditto.
     26        (WebView::copyURL): Ditto.
     27        (WebView::notifyPreferencesChanged): Ditto.
     28
    1292008-02-14  Alexey Proskuryakov  <ap@webkit.org>
    230
  • trunk/WebKit/win/MarshallingHelpers.cpp

    r28639 r30243  
    4343KURL MarshallingHelpers::BSTRToKURL(BSTR urlStr)
    4444{
    45     return KURL(String(urlStr, SysStringLen(urlStr)).deprecatedString());
     45    return KURL(String(urlStr, SysStringLen(urlStr)));
    4646}
    4747
    4848BSTR MarshallingHelpers::KURLToBSTR(const KURL& url)
    4949{
    50     String urlString(url.string());
    51     return SysAllocStringLen(urlString.characters(), urlString.length());
     50    return SysAllocStringLen(url.string().characters(), url.string().length());
    5251}
    5352
  • trunk/WebKit/win/WebContextMenuClient.cpp

    r29230 r30243  
    152152    String searchString = frame->selectedText();
    153153    searchString.stripWhiteSpace();
    154     DeprecatedString encoded = KURL::encode_string(searchString.deprecatedString());
    155     encoded.replace(DeprecatedString("%20"), DeprecatedString("+"));
     154    String encoded = encodeWithURLEscapeSequences(searchString);
     155    encoded.replace("%20", "+");
    156156   
    157157    String url("http://www.google.com/search?q=");
    158     url.append(String(encoded));
     158    url.append(encoded);
    159159    url.append("&ie=UTF-8&oe=UTF-8");
    160160
  • trunk/WebKit/win/WebDataSource.cpp

    r30180 r30243  
    246246{
    247247    KURL unreachableURL = m_loader->unreachableURL();
    248     BString urlString((LPOLESTR)unreachableURL.deprecatedString().unicode(), unreachableURL.deprecatedString().length());
     248    BString urlString((LPOLESTR)unreachableURL.string().characters(), unreachableURL.string().length());
    249249
    250250    *url = urlString.release();
  • trunk/WebKit/win/WebDownload.cpp

    r28639 r30243  
    2828#include "WebDownload.h"
    2929
     30#include "CString.h"
    3031#include "DefaultDownloadDelegate.h"
    3132#include "MarshallingHelpers.h"
     
    103104    if (!m_download) {
    104105        ASSERT_NOT_REACHED();
    105         LOG_ERROR("WebDownload - Failed to create WebDownload from existing connection (%s)", request.url().deprecatedString().ascii());
     106        LOG_ERROR("WebDownload - Failed to create WebDownload from existing connection (%s)", request.url().string().utf8().data());
    106107    } else
    107         LOG(Download, "WebDownload - Created WebDownload %p from existing connection (%s)", this, request.url().deprecatedString().ascii());
     108        LOG(Download, "WebDownload - Created WebDownload %p from existing connection (%s)", this, request.url().string().utf8().data());
    108109
    109110    // The CFURLDownload either starts successfully and retains the CFURLConnection,
     
    131132    CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode);
    132133
    133     LOG(Download, "WebDownload - Initialized download of url %s in WebDownload %p", url.deprecatedString().ascii(), this);
     134    LOG(Download, "WebDownload - Initialized download of url %s in WebDownload %p", url.string().utf8().data(), this);
    134135}
    135136
     
    233234    CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode);
    234235
    235     LOG(Download, "WebDownload - initWithRequest complete, started download of url %s", webRequest->resourceRequest().url().deprecatedString().ascii());
     236    LOG(Download, "WebDownload - initWithRequest complete, started download of url %s", webRequest->resourceRequest().url().string().utf8().data());
    236237    return S_OK;
    237238}
  • trunk/WebKit/win/WebFrame.cpp

    r30203 r30243  
    631631
    632632    String encodingString(textEncodingName, SysStringLen(textEncodingName));
    633     KURL baseKURL = DeprecatedString((DeprecatedChar*)baseURL, SysStringLen(baseURL));
    634     KURL failingKURL = DeprecatedString((DeprecatedChar*)failingURL, SysStringLen(failingURL));
     633    KURL baseKURL(String(baseURL, SysStringLen(baseURL)));
     634    KURL failingKURL(String(failingURL, SysStringLen(failingURL)));
    635635
    636636    ResourceRequest request(baseKURL);
     
    13691369            // onLoad handlers, of any redirects that happened. An example of where
    13701370            // this is needed is Radar 3213556.
    1371             url = childItem->originalURLString().deprecatedString();
     1371            url = childItem->originalURL();
    13721372            // These behaviors implied by these loadTypes should apply to the child frames
    13731373            childLoadType = loadType;
     
    24282428    String mimeType = mimeTypeIn;
    24292429    if (mimeType.isEmpty())
    2430         mimeType = MIMETypeRegistry::getMIMETypeForExtension(url.path().mid(url.path().findRev('.')+1));
     2430        mimeType = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1));
    24312431
    24322432    if (mimeType.isEmpty())
  • trunk/WebKit/win/WebResource.cpp

    r28639 r30243  
    104104{
    105105    m_data = data;
    106     m_url = KURL(String(url).deprecatedString());
     106    m_url = KURL(String(url));
    107107    m_mimeType = String(mimeType);
    108108    m_textEncodingName = String(textEncodingName);
  • trunk/WebKit/win/WebURLResponse.cpp

    r28639 r30243  
    3636#pragma warning( push, 0 )
    3737#include <WebCore/BString.h>
    38 #include <WebCore/DeprecatedString.h>
    3938#include <WebCore/KURL.h>
    4039#include <WebCore/ResourceHandle.h>
     
    223222    WebURLResponse* instance = new WebURLResponse();
    224223    // fake an http response - so it has the IWebHTTPURLResponse interface
    225     instance->m_response = ResourceResponse(String("http://").deprecatedString(), String(), 0, String(), String());
     224    instance->m_response = ResourceResponse(KURL("http://"), String(), 0, String(), String());
    226225    instance->AddRef();
    227226    return instance;
     
    291290    /* [in] */ BSTR textEncodingName)
    292291{
    293     m_response = ResourceResponse(String(url).deprecatedString(), String(mimeType), expectedContentLength, String(textEncodingName), String());
     292    m_response = ResourceResponse(KURL(url), String(mimeType), expectedContentLength, String(textEncodingName), String());
    294293    return S_OK;
    295294}
  • trunk/WebKit/win/WebView.cpp

    r30180 r30243  
    24342434    /* [retval][out] */ BSTR* userAgent)
    24352435{
    2436     DeprecatedString urlStr((DeprecatedChar*)url, SysStringLen(url));
     2436    String urlStr(url, SysStringLen(url));
    24372437    String userAgentString = this->userAgentForKURL(KURL(urlStr));
    24382438    *userAgent = SysAllocStringLen(userAgentString.characters(), userAgentString.length());
     
    35583558{
    35593559    String temp(url, SysStringLen(url));
    3560     m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp.deprecatedString()), "");
     3560    m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp), "");
    35613561    return S_OK;
    35623562}
     
    38703870        SysFreeString(str);
    38713871    } else {
    3872         settings->setUserStyleSheetLocation(KURL(DeprecatedString("")));
     3872        settings->setUserStyleSheetLocation(KURL());
    38733873    }
    38743874
  • trunk/WebKit/wx/ChangeLog

    r30204 r30243  
     12008-02-14  Darin Adler  <darin@apple.com>
     2
     3        * WebView.cpp: Removed use of DeprecatedString to keep this compiling.
     4
    152008-02-11  Kevin Ollivier <kevino@theolliviers.com>
    26
  • trunk/WebKit/wx/WebView.cpp

    r30204 r30243  
    2626#include "config.h"
    2727#include "CString.h"
    28 #include "DeprecatedString.h"
    2928#include "Document.h"
    3029#include "Element.h"
Note: See TracChangeset for help on using the changeset viewer.