Changeset 30243 in webkit
- Timestamp:
- Feb 14, 2008, 9:03:55 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 177 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r30240 r30243 1 2008-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 1 585 2008-02-14 Ada Chan <adachan@apple.com> 2 586 -
trunk/WebCore/WebCore.base.exp
r30196 r30243 360 360 __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE 361 361 __ZN7WebCore21reportThreadViolationEPKc 362 __ZN7WebCore24decodeURLEscapeSequencesERKNS_6StringE 362 363 __ZN7WebCore24notifyHistoryItemChangedE 363 364 __ZN7WebCore26CSSMutableStyleDeclarationC1Ev … … 372 373 __ZN7WebCore4FontD1Ev 373 374 __ZN7WebCore4FontaSERKS0_ 374 __ZN7WebCore4KURL13decode_stringERKNS_16DeprecatedStringE375 375 __ZN7WebCore4KURLC1EP5NSURL 376 __ZN7WebCore4KURLC1ERKNS_ 16DeprecatedStringE376 __ZN7WebCore4KURLC1ERKNS_6StringE 377 377 __ZN7WebCore4KURLC1Ev 378 378 __ZN7WebCore4Node17stopIgnoringLeaksEv … … 459 459 __ZN7WebCore7IntSizeC1ERK7_NSSize 460 460 __ZN7WebCore7nsColorERKNS_5ColorE 461 __ZN7WebCore8Document11completeURLERKNS_ 16DeprecatedStringE461 __ZN7WebCore8Document11completeURLERKNS_6StringE 462 462 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE 463 463 __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE … … 539 539 __ZN7WebCore9pageCacheEv 540 540 __ZN7WebCoreeqERKNS_19ResourceRequestBaseES2_ 541 __ZN7WebCoreeqERKNS_4KURLES2_542 541 __ZNK7WebCore11CachedImage5imageEv 543 542 __ZNK7WebCore11ContextMenu19platformDescriptionEv … … 637 636 __ZNK7WebCore4KURL4hostEv 638 637 __ZNK7WebCore4KURL4pathEv 639 __ZNK7WebCore4KURL 8getNSURLEv638 __ZNK7WebCore4KURLcvP5NSURLEv 640 639 __ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv 641 640 __ZNK7WebCore5Frame10isFrameSetEv -
trunk/WebCore/bindings/js/JSAttrCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #include "JSAttr.h" 31 31 32 #include "Attr.h"33 #include "Document.h"34 #include "ExceptionCode.h"35 32 #include "HTMLFrameElementBase.h" 36 33 #include "HTMLNames.h" 37 #include "PlatformString.h" 38 #include "kjs_binding.h" 39 #include "kjs_dom.h" 34 35 using namespace KJS; 40 36 41 37 namespace WebCore { … … 43 39 using namespace HTMLNames; 44 40 45 void JSAttr::setValue( KJS::ExecState* exec, KJS::JSValue* value)41 void JSAttr::setValue(ExecState* exec, JSValue* value) 46 42 { 47 43 Attr* imp = static_cast<Attr*>(impl()); … … 49 45 50 46 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 } 55 52 } 56 53 57 54 ExceptionCode ec = 0; 58 55 imp->setValue(attrValue, ec); 59 KJS::setDOMException(exec, ec);56 setDOMException(exec, ec); 60 57 } 61 58 -
trunk/WebCore/bindings/js/JSAudioConstructor.h
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 namespace WebCore { 35 35 36 class JSAudioConstructor : public KJS::DOMObject {36 class JSAudioConstructor : public DOMObject { 37 37 public: 38 38 JSAudioConstructor(KJS::ExecState*, Document*); -
trunk/WebCore/bindings/js/JSCSSRuleCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 32 32 #include "CSSMediaRule.h" 33 33 #include "CSSPageRule.h" 34 #include "CSSRule.h"35 34 #include "CSSStyleRule.h" 36 35 #include "JSCSSCharsetRule.h" … … 40 39 #include "JSCSSPageRule.h" 41 40 #include "JSCSSStyleRule.h" 42 #include "kjs_binding.h" 41 42 using namespace KJS; 43 43 44 44 namespace WebCore { 45 45 46 KJS::JSValue* toJS(KJS::ExecState* exec, CSSRule* rule)46 JSValue* toJS(ExecState* exec, CSSRule* rule) 47 47 { 48 48 if (!rule) 49 return KJS::jsNull();49 return jsNull(); 50 50 51 KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(rule);51 DOMObject* ret = ScriptInterpreter::getDOMObject(rule); 52 52 53 53 if (ret) … … 78 78 } 79 79 80 KJS::ScriptInterpreter::putDOMObject(rule, ret);80 ScriptInterpreter::putDOMObject(rule, ret); 81 81 return ret; 82 82 } -
trunk/WebCore/bindings/js/JSCSSValueCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "CSSPrimitiveValue.h" 30 #include "CSSValue.h"31 30 #include "CSSValueList.h" 32 31 #include "JSCSSPrimitiveValue.h" 33 32 #include "JSCSSValueList.h" 34 #include "kjs_binding.h"35 33 36 34 #if ENABLE(SVG) … … 41 39 #endif 42 40 41 using namespace KJS; 42 43 43 namespace WebCore { 44 44 45 KJS::JSValue* toJS(KJS::ExecState* exec, CSSValue* value)45 JSValue* toJS(ExecState* exec, CSSValue* value) 46 46 { 47 47 if (!value) 48 return KJS::jsNull();48 return jsNull(); 49 49 50 KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(value);50 DOMObject* ret = ScriptInterpreter::getDOMObject(value); 51 51 52 52 if (ret) … … 66 66 ret = new JSCSSValue(JSCSSValuePrototype::self(exec), value); 67 67 68 KJS::ScriptInterpreter::putDOMObject(value, ret);68 ScriptInterpreter::putDOMObject(value, ret); 69 69 return ret; 70 70 } -
trunk/WebCore/bindings/js/JSDocumentCustom.cpp
r29663 r30243 22 22 23 23 #include "DOMWindow.h" 24 #include "Document.h"25 24 #include "Frame.h" 26 25 #include "FrameLoader.h" … … 29 28 #include "JSHTMLDocument.h" 30 29 #include "JSLocation.h" 31 #include "kjs_binding.h"32 30 #include "kjs_proxy.h" 33 31 … … 37 35 #endif 38 36 37 using namespace KJS; 38 39 39 namespace WebCore { 40 41 using namespace KJS;42 40 43 41 void JSDocument::mark() … … 53 51 return jsNull(); 54 52 55 KJS::Window* win = KJS::Window::retrieveWindow(frame);53 Window* win = Window::retrieveWindow(frame); 56 54 ASSERT(win); 57 55 return win->location(); … … 70 68 Frame* activeFrame = static_cast<JSDOMWindow*>(exec->dynamicGlobalObject())->impl()->frame(); 71 69 if (activeFrame) 72 str = activeFrame->document()->completeURL(str) ;70 str = activeFrame->document()->completeURL(str).string(); 73 71 74 72 bool userGesture = activeFrame->scriptProxy()->processingUserGesture(); … … 97 95 // back/forward cache. 98 96 if (doc->frame()) 99 KJS::Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);97 Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly); 100 98 else { 101 99 size_t nodeCount = 0; -
trunk/WebCore/bindings/js/JSElementCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #include "JSElement.h" 32 32 33 #include "Attr.h"34 #include "Document.h"35 #include "Element.h"36 33 #include "ExceptionCode.h" 37 34 #include "HTMLFrameElementBase.h" 38 35 #include "HTMLNames.h" 39 #include "PlatformString.h" 40 #include "kjs_binding.h" 41 #include "kjs_dom.h" 36 37 using namespace KJS; 42 38 43 39 namespace WebCore { … … 45 41 using namespace HTMLNames; 46 42 47 static inline bool allowSettingSrcToJavascriptURL( KJS::ExecState* exec, Element* element, String name, Stringvalue)43 static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value) 48 44 { 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")) { 50 46 HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(element); 51 47 if (!checkNodeSecurity(exec, frame->contentDocument())) … … 55 51 } 56 52 57 KJS::JSValue* JSElement::setAttribute(KJS::ExecState* exec, const KJS::List& args)53 JSValue* JSElement::setAttribute(ExecState* exec, const List& args) 58 54 { 59 55 ExceptionCode ec = 0; … … 63 59 Element* imp = impl(); 64 60 if (!allowSettingSrcToJavascriptURL(exec, imp, name, value)) 65 return KJS::jsUndefined();61 return jsUndefined(); 66 62 67 63 imp->setAttribute(name, value, ec); 68 KJS::setDOMException(exec, ec);69 return KJS::jsUndefined();64 setDOMException(exec, ec); 65 return jsUndefined(); 70 66 } 71 67 72 KJS::JSValue* JSElement::setAttributeNode(KJS::ExecState* exec, const KJS::List& args)68 JSValue* JSElement::setAttributeNode(ExecState* exec, const List& args) 73 69 { 74 70 ExceptionCode ec = 0; … … 77 73 if (!newAttrOk) { 78 74 setDOMException(exec, TYPE_MISMATCH_ERR); 79 return KJS::jsUndefined();75 return jsUndefined(); 80 76 } 81 77 82 78 Element* imp = impl(); 83 79 if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value())) 84 return KJS::jsUndefined();80 return jsUndefined(); 85 81 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); 88 84 return result; 89 85 } 90 86 91 KJS::JSValue* JSElement::setAttributeNS(KJS::ExecState* exec, const KJS::List& args)87 JSValue* JSElement::setAttributeNS(ExecState* exec, const List& args) 92 88 { 93 89 ExceptionCode ec = 0; … … 98 94 Element* imp = impl(); 99 95 if (!allowSettingSrcToJavascriptURL(exec, imp, qualifiedName, value)) 100 return KJS::jsUndefined();96 return jsUndefined(); 101 97 102 98 imp->setAttributeNS(namespaceURI, qualifiedName, value, ec); 103 KJS::setDOMException(exec, ec);104 return KJS::jsUndefined();99 setDOMException(exec, ec); 100 return jsUndefined(); 105 101 } 106 102 107 KJS::JSValue* JSElement::setAttributeNodeNS(KJS::ExecState* exec, const KJS::List& args)103 JSValue* JSElement::setAttributeNodeNS(ExecState* exec, const List& args) 108 104 { 109 105 ExceptionCode ec = 0; … … 111 107 Attr* newAttr = toAttr(args[0], newAttrOk); 112 108 if (!newAttrOk) { 113 KJS::setDOMException(exec, TYPE_MISMATCH_ERR);114 return KJS::jsUndefined();109 setDOMException(exec, TYPE_MISMATCH_ERR); 110 return jsUndefined(); 115 111 } 116 112 117 113 Element* imp = impl(); 118 114 if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value())) 119 return KJS::jsUndefined();115 return jsUndefined(); 120 116 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); 123 119 return result; 124 120 } -
trunk/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #include "JSHTMLFrameElement.h" 31 31 32 #include "Document.h"33 32 #include "HTMLFrameElement.h" 34 #include "PlatformString.h" 35 #include "kjs_binding.h" 36 #include "kjs_dom.h" 33 34 using namespace KJS; 37 35 38 36 namespace WebCore { 39 37 40 static inline bool allowSettingJavascriptURL( KJS::ExecState* exec, HTMLFrameElement* imp, Stringvalue)38 static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* imp, const String& value) 41 39 { 42 if ( value.startsWith("javascript:", false)) {40 if (protocolIs(value, "javascript")) { 43 41 if (!checkNodeSecurity(exec, imp->contentDocument())) 44 42 return false; … … 47 45 } 48 46 49 void JSHTMLFrameElement::setSrc( KJS::ExecState* exec, KJS::JSValue* value)47 void JSHTMLFrameElement::setSrc(ExecState* exec, JSValue* value) 50 48 { 51 49 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); 52 String srcValue = KJS::valueToStringWithNullCheck(exec, value);50 String srcValue = valueToStringWithNullCheck(exec, value); 53 51 54 52 if (!allowSettingJavascriptURL(exec, imp, srcValue)) … … 59 57 } 60 58 61 void JSHTMLFrameElement::setLocation( KJS::ExecState* exec, KJS::JSValue* value)59 void JSHTMLFrameElement::setLocation(ExecState* exec, JSValue* value) 62 60 { 63 61 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); 64 String locationValue = KJS::valueToStringWithNullCheck(exec, value);62 String locationValue = valueToStringWithNullCheck(exec, value); 65 63 66 64 if (!allowSettingJavascriptURL(exec, imp, locationValue)) -
trunk/WebCore/bindings/js/JSHTMLIFrameElementCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #include "JSHTMLIFrameElement.h" 31 31 32 #include "Document.h"33 32 #include "HTMLIFrameElement.h" 34 #include "PlatformString.h" 35 #include "kjs_binding.h" 36 #include "kjs_dom.h" 33 34 using namespace KJS; 37 35 38 36 namespace WebCore { 39 37 40 void JSHTMLIFrameElement::setSrc( KJS::ExecState* exec, KJS::JSValue* value)38 void JSHTMLIFrameElement::setSrc(ExecState* exec, JSValue* value) 41 39 { 42 40 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")) { 45 45 if (!checkNodeSecurity(exec, imp->contentDocument())) 46 46 return; … … 48 48 49 49 imp->setSrc(srcValue); 50 return;51 50 } 52 51 -
trunk/WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp
r30040 r30243 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 26 26 #include "Text.h" 27 27 28 using namespace KJS; 29 28 30 namespace WebCore { 29 31 30 using namespace KJS; 31 32 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* d) 33 : KJS::DOMObject(exec->lexicalGlobalObject()->objectPrototype()) 34 , m_doc(d) 32 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document) 33 : DOMObject(exec->lexicalGlobalObject()->objectPrototype()) 34 , m_document(document) 35 35 { 36 36 putDirect(exec->propertyNames().length, jsNumber(4), ReadOnly|DontDelete|DontEnum); … … 44 44 JSObject* JSHTMLOptionElementConstructor::construct(ExecState* exec, const List& args) 45 45 { 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)); 62 61 } 63 62 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())); 66 68 } 67 69 -
trunk/WebCore/bindings/js/JSHTMLOptionElementConstructor.h
r29663 r30243 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 26 26 namespace WebCore { 27 27 28 class JSHTMLOptionElementConstructor : public KJS::DOMObject {28 class JSHTMLOptionElementConstructor : public DOMObject { 29 29 public: 30 30 JSHTMLOptionElementConstructor(KJS::ExecState*, Document*); 31 31 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); 33 33 private: 34 RefPtr<Document> m_doc ;34 RefPtr<Document> m_document; 35 35 }; 36 36 -
trunk/WebCore/bindings/js/JSLocation.cpp
r30157 r30243 27 27 #include "Frame.h" 28 28 #include "FrameLoader.h" 29 #include "PlatformString.h"30 29 #include "kjs_proxy.h" 31 30 #include "kjs_window.h" … … 138 137 return; 139 138 140 DeprecatedString str = value->toString(exec);139 String str = value->toString(exec); 141 140 KURL url = m_frame->loader()->url(); 142 141 bool sameDomainAccess = allowsAccessFromFrame(exec, m_frame); … … 153 152 switch (entry->value.intValue) { 154 153 case Href: { 154 // FIXME: Why isn't this security check needed for the other properties, like Host, below? 155 155 Frame* frame = Window::retrieveActive(exec)->impl()->frame(); 156 156 if (!frame) … … 161 161 break; 162 162 } 163 case Hash: {163 case Hash: 164 164 if (str.startsWith("#")) 165 str = str. mid(1);165 str = str.substring(1); 166 166 if (url.ref() == str) 167 167 return; 168 168 url.setRef(str); 169 169 break; 170 } 171 case Host: { 170 case Host: 172 171 url.setHostAndPort(str); 173 172 break; 174 }175 173 case Hostname: 176 174 url.setHost(str); … … 179 177 url.setPath(str); 180 178 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 } 184 187 case Protocol: 185 188 url.setProtocol(str); … … 200 203 201 204 Frame* activeFrame = Window::retrieveActive(exec)->impl()->frame(); 202 if (!url. deprecatedString().startsWith("javascript:", false) || sameDomainAccess) {205 if (!url.protocolIs("javascript") || sameDomainAccess) { 203 206 bool userGesture = activeFrame->scriptProxy()->processingUserGesture(); 204 207 m_frame->loader()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), false, userGesture); … … 235 238 if (!activeFrame->loader()->shouldAllowNavigation(frame)) 236 239 return jsUndefined(); 237 DeprecatedString str = args[0]->toString(exec);240 String str = args[0]->toString(exec); 238 241 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))) { 240 243 bool userGesture = activeFrame->scriptProxy()->processingUserGesture(); 241 244 frame->loader()->scheduleLocationChange(activeFrame->loader()->completeURL(str).string(), activeFrame->loader()->outgoingReferrer(), true, userGesture); … … 259 262 return jsUndefined(); 260 263 261 if (!frame->loader()->url(). deprecatedString().startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {264 if (!frame->loader()->url().protocolIs("javascript") || (window && window->allowsAccessFrom(exec))) { 262 265 bool userGesture = Window::retrieveActive(exec)->impl()->frame()->scriptProxy()->processingUserGesture(); 263 266 frame->loader()->scheduleRefresh(userGesture); … … 281 284 const Window* window = Window::retrieveWindow(frame); 282 285 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))) { 284 287 bool userGesture = activeFrame->scriptProxy()->processingUserGesture(); 285 288 // We want a new history item if this JS was called via a user gesture -
trunk/WebCore/bindings/js/JSLocation.h
r30157 r30243 31 31 class Frame; 32 32 33 class JSLocation : public KJS::DOMObject {34 typedef KJS::DOMObject Base;33 class JSLocation : public DOMObject { 34 typedef DOMObject Base; 35 35 36 36 friend class KJS::Window; -
trunk/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "NamedNodeMap.h" 30 #include "PlatformString.h"31 30 #include "kjs_binding.h" 32 31 #include "kjs_dom.h" 33 32 33 using namespace KJS; 34 34 35 namespace WebCore { 35 36 36 bool JSNamedNodeMap::canGetItemsForName( KJS::ExecState*, NamedNodeMap* impl, const KJS::Identifier& propertyName)37 bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, const Identifier& propertyName) 37 38 { 38 39 return impl->getNamedItem(propertyName); 39 40 } 40 41 41 KJS::JSValue* JSNamedNodeMap::nameGetter(KJS::ExecState* exec, KJS::JSObject* originalObject, const KJS::Identifier& propertyName, const KJS::PropertySlot& slot)42 JSValue* JSNamedNodeMap::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 42 43 { 43 44 JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(slot.slotBase()); 44 return KJS::toJS(exec, thisObj->impl()->getNamedItem(propertyName));45 return toJS(exec, thisObj->impl()->getNamedItem(propertyName)); 45 46 } 46 47 -
trunk/WebCore/bindings/js/JSNamedNodesCollection.cpp
r29663 r30243 42 42 // so it shouldn't be a problem that it's storing all the nodes (with the same name). (David) 43 43 JSNamedNodesCollection::JSNamedNodesCollection(KJS::JSObject* prototype, const Vector<RefPtr<Node> >& nodes) 44 : KJS::DOMObject(prototype)44 : DOMObject(prototype) 45 45 , m_nodes(nodes) 46 46 { -
trunk/WebCore/bindings/js/JSNamedNodesCollection.h
r29663 r30243 36 36 // Internal class, used for the collection return by e.g. document.forms.myinput 37 37 // when multiple nodes have the same name. 38 class JSNamedNodesCollection : public KJS::DOMObject {38 class JSNamedNodesCollection : public DOMObject { 39 39 public: 40 40 JSNamedNodesCollection(KJS::JSObject* prototype, const Vector<RefPtr<Node> >&); -
trunk/WebCore/bindings/js/JSXMLHttpRequest.cpp
r29508 r30243 32 32 #include "kjs_window.h" 33 33 34 using namespace KJS; 35 using namespace WebCore; 36 34 37 #include "JSXMLHttpRequest.lut.h" 35 38 36 namespace KJS { 37 38 using namespace WebCore; 39 40 ////////////////////// JSXMLHttpRequest Object //////////////////////// 39 namespace WebCore { 41 40 42 41 /* Source for JSXMLHttpRequestPrototypeTable. … … 251 250 } 252 251 253 254 252 JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState* exec, JSObject* thisObj, const List& args) 255 253 { … … 267 265 if (!frame) 268 266 return jsUndefined(); 269 KURL url = frame->loader()->completeURL( DeprecatedString(args[1]->toString(exec)));267 KURL url = frame->loader()->completeURL(args[1]->toString(exec)); 270 268 271 269 bool async = true; … … 299 297 300 298 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 { 305 302 // converting certain values (like null) to object can set an exception 306 303 if (exec->hadException()) -
trunk/WebCore/bindings/js/JSXMLHttpRequest.h
r29508 r30243 1 // -*- c-basic-offset: 2 -*-2 1 /* 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. 5 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> 6 4 * … … 30 28 class Document; 31 29 32 }33 34 namespace KJS {35 36 30 class JSXMLHttpRequestConstructorImp : public DOMObject { 37 31 public: 38 JSXMLHttpRequestConstructorImp( ExecState*, WebCore::Document*);32 JSXMLHttpRequestConstructorImp(KJS::ExecState*, Document*); 39 33 40 34 virtual bool implementsConstruct() const; 41 virtual JSObject* construct(ExecState*, constList&);35 virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&); 42 36 43 37 private: 44 RefPtr< WebCore::Document> doc;38 RefPtr<Document> doc; 45 39 }; 46 40 47 41 class JSXMLHttpRequest : public DOMObject { 48 42 public: 49 JSXMLHttpRequest( JSObject* prototype, WebCore::Document*);43 JSXMLHttpRequest(KJS::JSObject* prototype, Document*); 50 44 ~JSXMLHttpRequest(); 51 45 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; 54 48 enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status, 55 49 StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader, OverrideMIMEType, 56 50 AddEventListener, RemoveEventListener, DispatchEvent }; 57 51 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; } 63 57 virtual void mark(); 64 58 65 WebCore::XMLHttpRequest* impl() const { return m_impl.get(); }59 XMLHttpRequest* impl() const { return m_impl.get(); } 66 60 67 61 private: 68 RefPtr< WebCore::XMLHttpRequest> m_impl;62 RefPtr<XMLHttpRequest> m_impl; 69 63 }; 70 64 71 JSValue* jsXMLHttpRequestPrototypeFunctionAbort(ExecState*, JSObject*, constList&);72 JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(ExecState*, JSObject*, constList&);73 JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(ExecState*, JSObject*, constList&);74 JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState*, JSObject*, constList&);75 JSValue* jsXMLHttpRequestPrototypeFunctionSend(ExecState*, JSObject*, constList&);76 JSValue* jsXMLHttpRequestPrototypeFunctionSetRequestHeader(ExecState*, JSObject*, constList&);77 JSValue* jsXMLHttpRequestPrototypeFunctionOverrideMIMEType(ExecState*, JSObject*, constList&);78 JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(ExecState*, JSObject*, constList&);79 JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(ExecState*, JSObject*, constList&);80 JSValue* jsXMLHttpRequestPrototypeFunctionDispatchEvent(ExecState*, JSObject*, constList&);65 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionAbort(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 66 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 67 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 68 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionOpen(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 69 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionSend(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 70 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionSetRequestHeader(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 71 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionOverrideMIMEType(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 72 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 73 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 74 KJS::JSValue* jsXMLHttpRequestPrototypeFunctionDispatchEvent(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 81 75 82 } // namespace KJS76 } // namespace WebCore 83 77 84 78 #endif // JSXMLHttpRequest_h -
trunk/WebCore/bindings/js/JSXSLTProcessor.cpp
r29508 r30243 1 1 /* 2 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 32 32 #include "XSLTProcessor.h" 33 #include "JSXSLTProcessor.lut.h"34 33 #include "kjs_dom.h" 35 34 #include "JSDocument.h" … … 37 36 #include "DocumentFragment.h" 38 37 38 using namespace KJS; 39 39 using namespace WebCore; 40 40 41 namespace KJS { 41 #include "JSXSLTProcessor.lut.h" 42 43 namespace WebCore { 42 44 43 45 const ClassInfo JSXSLTProcessor::info = { "XSLTProcessor", 0, 0 }; … … 72 74 JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState* exec, JSObject* thisObj, const List& args) 73 75 { 74 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))76 if (!thisObj->inherits(&JSXSLTProcessor::info)) 75 77 return throwError(exec, TypeError); 76 78 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 88 90 JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState* exec, JSObject* thisObj, const List& args) 89 91 { 90 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))92 if (!thisObj->inherits(&JSXSLTProcessor::info)) 91 93 return throwError(exec, TypeError); 92 94 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 105 107 JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState* exec, JSObject* thisObj, const List& args) 106 108 { 107 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))109 if (!thisObj->inherits(&JSXSLTProcessor::info)) 108 110 return throwError(exec, TypeError); 109 111 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 123 125 JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(ExecState* exec, JSObject* thisObj, const List& args) 124 126 { 125 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))127 if (!thisObj->inherits(&JSXSLTProcessor::info)) 126 128 return throwError(exec, TypeError); 127 129 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 138 140 JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(ExecState* exec, JSObject* thisObj, const List& args) 139 141 { 140 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))142 if (!thisObj->inherits(&JSXSLTProcessor::info)) 141 143 return throwError(exec, TypeError); 142 144 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 154 156 JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState* exec, JSObject* thisObj, const List& args) 155 157 { 156 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))158 if (!thisObj->inherits(&JSXSLTProcessor::info)) 157 159 return throwError(exec, TypeError); 158 160 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 168 170 JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(ExecState* exec, JSObject* thisObj, const List& args) 169 171 { 170 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))172 if (!thisObj->inherits(&JSXSLTProcessor::info)) 171 173 return throwError(exec, TypeError); 172 174 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 178 180 JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState* exec, JSObject* thisObj, const List& args) 179 181 { 180 if (!thisObj->inherits(& KJS::JSXSLTProcessor::info))182 if (!thisObj->inherits(&JSXSLTProcessor::info)) 181 183 return throwError(exec, TypeError); 182 184 XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl(); … … 186 188 } 187 189 188 XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState *exec)190 XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState* exec) 189 191 : DOMObject(exec->lexicalGlobalObject()->objectPrototype()) 190 192 { -
trunk/WebCore/bindings/js/JSXSLTProcessor.h
r29508 r30243 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 32 32 33 33 namespace WebCore { 34 class XSLTProcessor; 35 } 34 35 class XSLTProcessor; 36 36 37 37 // Eventually we should implement XSLTException: … … 39 39 // http://bugs.webkit.org/show_bug.cgi?id=5446 40 40 41 namespace KJS {42 43 41 class JSXSLTProcessor : public DOMObject { 44 42 public: 45 JSXSLTProcessor( JSObject* prototype);43 JSXSLTProcessor(KJS::JSObject* prototype); 46 44 ~JSXSLTProcessor(); 47 45 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; 50 48 51 WebCore::XSLTProcessor *impl() const { return m_impl.get(); } 49 XSLTProcessor* impl() const { return m_impl.get(); } 50 52 51 private: 53 RefPtr< WebCore::XSLTProcessor> m_impl;52 RefPtr<XSLTProcessor> m_impl; 54 53 }; 55 54 56 55 class XSLTProcessorConstructorImp : public DOMObject { 57 56 public: 58 XSLTProcessorConstructorImp( ExecState*);57 XSLTProcessorConstructorImp(KJS::ExecState*); 59 58 60 59 virtual bool implementsConstruct() const; 61 virtual JSObject* construct(ExecState*, constList&);60 virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&); 62 61 }; 63 62 64 JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState*, JSObject*, constList&);65 JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState*, JSObject*, constList&);66 JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState*, JSObject*, constList&);67 JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(ExecState*, JSObject*, constList&);68 JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(ExecState*, JSObject*, constList&);69 JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState*, JSObject*, constList&);70 JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(ExecState*, JSObject*, constList&);71 JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState*, JSObject*, constList&);63 KJS::JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 64 KJS::JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 65 KJS::JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 66 KJS::JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 67 KJS::JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 68 KJS::JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 69 KJS::JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 70 KJS::JSValue* jsXSLTProcessorPrototypeFunctionReset(KJS::ExecState*, KJS::JSObject*, const KJS::List&); 72 71 73 } // namespace KJS72 } // namespace WebCore 74 73 75 74 #endif // ENABLE(XSLT) -
trunk/WebCore/bindings/js/kjs_binding.cpp
r30157 r30243 37 37 #include "JSRangeException.h" 38 38 #include "JSXMLHttpRequestException.h" 39 #include "KURL.h" 39 40 #include "RangeException.h" 40 41 #include "XMLHttpRequestException.h" … … 52 53 53 54 using namespace KJS; 54 using namespace WebCore; 55 56 namespace WebCore { 57 55 58 using namespace HTMLNames; 56 57 // FIXME: Move all this stuff into the WebCore namespace.58 59 namespace KJS {60 59 61 60 typedef HashMap<void*, DOMObject*> DOMObjectMap; … … 263 262 } 264 263 264 JSValue* jsStringOrNull(const KURL& url) 265 { 266 if (url.isNull()) 267 return jsNull(); 268 return jsString(url.string()); 269 } 270 271 JSValue* jsStringOrUndefined(const KURL& url) 272 { 273 if (url.isNull()) 274 return jsUndefined(); 275 return jsString(url.string()); 276 } 277 278 JSValue* jsStringOrFalse(const KURL& url) 279 { 280 if (url.isNull()) 281 return jsBoolean(false); 282 return jsString(url.string()); 283 } 284 265 285 String valueToStringWithNullCheck(ExecState* exec, JSValue* val) 266 286 { … … 321 341 } 322 342 323 } // namespace KJS324 325 namespace WebCore {326 327 343 bool allowsAccessFromFrame(ExecState* exec, Frame* frame) 328 344 { -
trunk/WebCore/bindings/js/kjs_binding.h
r30157 r30243 32 32 33 33 namespace WebCore { 34 34 35 class AtomicString; 35 36 class Document; 36 37 class Event; 37 38 class Frame; 39 class KURL; 38 40 class Node; 39 41 class String; … … 45 47 class SVGElement; 46 48 #endif 47 }48 49 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 { 55 52 protected: 56 explicit DOMObject( JSValue* prototype) // FIXME: this should take a JSObject once JSLocation has a real prototype53 explicit DOMObject(KJS::JSValue* prototype) // FIXME: this should take a JSObject once JSLocation has a real prototype 57 54 : JSObject(prototype) 58 55 { 59 56 // DOMObject destruction is not thread-safe because DOMObjects wrap 60 57 // unsafe WebCore DOM data structures. 61 Collector::collectOnMainThreadOnly(this);58 KJS::Collector::collectOnMainThreadOnly(this); 62 59 } 63 60 … … 70 67 }; 71 68 72 class ScriptInterpreter : public Interpreter {69 class ScriptInterpreter : public KJS::Interpreter { 73 70 public: 74 71 static DOMObject* getDOMObject(void* objectHandle); … … 76 73 static void forgetDOMObject(void* objectHandle); 77 74 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*); 84 81 }; 85 82 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) 90 85 { 91 86 if (!domObj) 92 return jsNull();87 return KJS::jsNull(); 93 88 if (DOMObject* ret = ScriptInterpreter::getDOMObject(domObj)) 94 89 return ret; … … 99 94 100 95 #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) 105 98 { 106 99 if (!domObj) 107 return jsNull();100 return KJS::jsNull(); 108 101 if (DOMObject* ret = ScriptInterpreter::getDOMObject(domObj)) 109 102 return ret; … … 115 108 116 109 // 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); 118 111 119 112 // Helper class to call setDOMException on exit without adding lots of separate calls to that function. 120 113 class DOMExceptionTranslator : Noncopyable { 121 114 public: 122 explicit DOMExceptionTranslator( ExecState* exec) : m_exec(exec), m_code(0) { }115 explicit DOMExceptionTranslator(KJS::ExecState* exec) : m_exec(exec), m_code(0) { } 123 116 ~DOMExceptionTranslator() { setDOMException(m_exec, m_code); } 124 operator WebCore::ExceptionCode&() { return m_code; }117 operator ExceptionCode&() { return m_code; } 125 118 private: 126 ExecState* m_exec;127 WebCore::ExceptionCode m_code;119 KJS::ExecState* m_exec; 120 ExceptionCode m_code; 128 121 }; 129 122 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 133 125 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 137 128 138 WebCore::String valueToStringWithNullCheck(ExecState*, JSValue*); // null String if the valueis null139 WebCore::String valueToStringWithUndefinedOrNullCheck(ExecState*, JSValue*); // null String if the value is null or undefined129 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 140 131 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&); 142 135 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 144 138 145 namespace WebCore { 139 template <typename T> inline KJS::JSValue* toJS(KJS::ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); } 146 140 147 141 // Helpers for Window, History, and Location classes to implement cross-domain policy. … … 151 145 bool allowsAccessFromFrame(KJS::ExecState*, Frame*, String& message); 152 146 void printErrorMessageForFrame(Frame*, const String& message); 153 154 147 KJS::JSValue* nonCachingStaticFunctionGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier& propertyName, const KJS::PropertySlot&); 155 148 KJS::JSValue* objectToStringFunctionGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier& propertyName, const KJS::PropertySlot&); -
trunk/WebCore/bindings/js/kjs_css.h
r29134 r30243 29 29 namespace WebCore { 30 30 31 class JSRGBColor : public KJS::DOMObject {31 class JSRGBColor : public DOMObject { 32 32 public: 33 33 JSRGBColor(KJS::JSObject* prototype, unsigned color); -
trunk/WebCore/bindings/js/kjs_events.cpp
r29508 r30243 35 35 #include "JSEvent.h" 36 36 #include "JSEventTargetNode.h" 37 #include "KURL.h"38 37 #include "Page.h" 39 38 #include "kjs_proxy.h" -
trunk/WebCore/bindings/js/kjs_events.h
r29508 r30243 98 98 KJS::JSValue* getNodeEventListener(Node*, const AtomicString& eventType); 99 99 100 class JSClipboard : public KJS::DOMObject {100 class JSClipboard : public DOMObject { 101 101 public: 102 102 JSClipboard(KJS::JSObject* prototype, Clipboard*); -
trunk/WebCore/bindings/js/kjs_html.h
r25754 r30243 32 32 class JSHTMLElement; 33 33 34 class ImageConstructorImp : public KJS::DOMObject {34 class ImageConstructorImp : public DOMObject { 35 35 public: 36 36 ImageConstructorImp(KJS::ExecState*, Document*); -
trunk/WebCore/bindings/js/kjs_navigator.cpp
r30015 r30243 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 4 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) 5 4 * 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. 7 6 * 8 7 * This library is free software; you can redistribute it and/or … … 65 64 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB 66 65 66 using namespace KJS; 67 67 using namespace WebCore; 68 68 69 namespace KJS{69 namespace WebCore { 70 70 71 71 class PluginBase : public DOMObject { 72 72 public: 73 PluginBase(ExecState *exec);73 PluginBase(ExecState*); 74 74 virtual ~PluginBase(); 75 75 … … 78 78 protected: 79 79 static void cachePluginDataIfNecessary(); 80 static Vector<PluginInfo*> *plugins;81 static Vector<MimeClassInfo*> *mimes;80 static Vector<PluginInfo*>* plugins; 81 static Vector<MimeClassInfo*>* mimes; 82 82 83 83 private: … … 88 88 class Plugins : public PluginBase { 89 89 public: 90 Plugins(ExecState *exec) : PluginBase(exec) {};91 virtual bool getOwnPropertySlot(ExecState 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; 93 93 virtual const ClassInfo* classInfo() const { return &info; } 94 94 static const ClassInfo info; 95 95 enum { Length }; 96 96 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&); 99 99 }; 100 100 … … 103 103 class MimeTypes : public PluginBase { 104 104 public: 105 MimeTypes(ExecState *exec) : PluginBase(exec) { };106 virtual bool getOwnPropertySlot(ExecState 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; 108 108 virtual const ClassInfo* classInfo() const { return &info; } 109 109 static const ClassInfo info; 110 110 enum { Length }; 111 111 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&); 114 114 }; 115 115 116 116 class Plugin : public PluginBase { 117 117 public: 118 Plugin(ExecState *exec, PluginInfo *info) : PluginBase(exec), m_info(info) { }119 virtual bool getOwnPropertySlot(ExecState 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; 121 121 virtual const ClassInfo* classInfo() const { return &info; } 122 122 static const ClassInfo info; 123 123 enum { Name, Filename, Description, Length }; 124 124 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; 129 129 }; 130 130 131 131 class MimeType : public PluginBase { 132 132 public: 133 MimeType( ExecState *exec, MimeClassInfo *info) : PluginBase(exec), m_info(info) { }134 virtual bool getOwnPropertySlot(ExecState 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; 136 136 virtual const ClassInfo* classInfo() const { return &info; } 137 137 static const ClassInfo info; 138 138 enum { Type, Suffixes, Description, EnabledPlugin }; 139 139 private: 140 MimeClassInfo *m_info;140 MimeClassInfo* m_info; 141 141 }; 142 142 143 } // namespace143 } 144 144 145 145 #include "kjs_navigator.lut.h" 146 146 147 namespace KJS{147 namespace WebCore { 148 148 149 149 const ClassInfo Plugins::info = { "PluginArray", 0, &PluginsTable }; … … 152 152 const ClassInfo MimeType::info = { "MimeType", 0, &MimeTypeTable }; 153 153 154 Vector<PluginInfo*> *KJS::PluginBase::plugins = 0;155 Vector<MimeClassInfo*> *KJS::PluginBase::mimes = 0;156 int KJS::PluginBase::m_plugInCacheRefCount = 0;154 Vector<PluginInfo*>* PluginBase::plugins = 0; 155 Vector<MimeClassInfo*>* PluginBase::mimes = 0; 156 int PluginBase::m_plugInCacheRefCount = 0; 157 157 158 158 const ClassInfo Navigator::info = { "Navigator", 0, &NavigatorTable }; … … 182 182 } 183 183 184 bool Navigator::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)184 bool Navigator::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 185 185 { 186 186 return getStaticPropertySlot<Navigator, JSObject>(exec, &NavigatorTable, this, propertyName, slot); … … 301 301 */ 302 302 303 JSValue *Plugins::getValueProperty(ExecState *exec, int token) const303 JSValue* Plugins::getValueProperty(ExecState* exec, int token) const 304 304 { 305 305 ASSERT(token == Length); … … 307 307 } 308 308 309 JSValue *Plugins::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)309 JSValue* Plugins::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 310 310 { 311 311 return new Plugin(exec, plugins->at(slot.index())); 312 312 } 313 313 314 JSValue *Plugins::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)314 JSValue* Plugins::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 315 315 { 316 316 AtomicString atomicPropertyName = propertyName; 317 317 Vector<PluginInfo*>::iterator end = plugins->end(); 318 318 for (Vector<PluginInfo*>::iterator itr = plugins->begin(); itr != end; itr++) { 319 PluginInfo *pl = *itr;319 PluginInfo* pl = *itr; 320 320 if (pl->name == atomicPropertyName) 321 321 return new Plugin(exec, pl); … … 324 324 } 325 325 326 bool Plugins::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)326 bool Plugins::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 327 327 { 328 328 const HashEntry* entry = Lookup::findEntry(&PluginsTable, propertyName); … … 364 364 */ 365 365 366 JSValue *MimeTypes::getValueProperty(ExecState *exec, int token) const366 JSValue* MimeTypes::getValueProperty(ExecState* exec, int token) const 367 367 { 368 368 ASSERT(token == Length); … … 370 370 } 371 371 372 JSValue *MimeTypes::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)372 JSValue* MimeTypes::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 373 373 { 374 374 return new MimeType(exec, mimes->at(slot.index())); 375 375 } 376 376 377 JSValue *MimeTypes::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)377 JSValue* MimeTypes::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 378 378 { 379 379 AtomicString atomicPropertyName = propertyName; 380 380 Vector<MimeClassInfo*>::iterator end = mimes->end(); 381 381 for (Vector<MimeClassInfo*>::iterator itr = mimes->begin(); itr != end; itr++) { 382 MimeClassInfo *m = (*itr);382 MimeClassInfo* m = (*itr); 383 383 if (m->type == atomicPropertyName) 384 384 return new MimeType(exec, m); … … 387 387 } 388 388 389 bool MimeTypes::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)389 bool MimeTypes::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 390 390 { 391 391 const HashEntry* entry = Lookup::findEntry(&MimeTypesTable, propertyName); … … 428 428 */ 429 429 430 JSValue *Plugin::getValueProperty(ExecState *exec, int token) const430 JSValue* Plugin::getValueProperty(ExecState* exec, int token) const 431 431 { 432 432 switch (token) { … … 445 445 } 446 446 447 JSValue *Plugin::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)448 { 449 Plugin *thisObj = static_cast<Plugin*>(slot.slotBase());447 JSValue* Plugin::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 448 { 449 Plugin* thisObj = static_cast<Plugin*>(slot.slotBase()); 450 450 return new MimeType(exec, thisObj->m_info->mimes.at(slot.index())); 451 451 } 452 452 453 JSValue *Plugin::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)454 { 455 Plugin *thisObj = static_cast<Plugin*>(slot.slotBase());453 JSValue* Plugin::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 454 { 455 Plugin* thisObj = static_cast<Plugin*>(slot.slotBase()); 456 456 AtomicString atomicPropertyName = propertyName; 457 457 Vector<MimeClassInfo*>::iterator end = thisObj->m_info->mimes.end(); 458 458 for (Vector<MimeClassInfo*>::iterator itr = thisObj->m_info->mimes.begin(); itr != end; itr++) { 459 MimeClassInfo *m = (*itr);459 MimeClassInfo* m = (*itr); 460 460 if (m->type == atomicPropertyName) 461 461 return new MimeType(exec, m); … … 465 465 466 466 467 bool Plugin::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)467 bool Plugin::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 468 468 { 469 469 const HashEntry* entry = Lookup::findEntry(&PluginTable, propertyName); … … 505 505 */ 506 506 507 JSValue *MimeType::getValueProperty(ExecState *exec, int token) const507 JSValue* MimeType::getValueProperty(ExecState* exec, int token) const 508 508 { 509 509 switch (token) { … … 528 528 } 529 529 530 bool MimeType::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)530 bool MimeType::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 531 531 { 532 532 return getStaticValueSlot<MimeType, PluginBase>(exec, &MimeTypeTable, this, propertyName, slot); … … 541 541 JSValue* navigatorProtoFuncJavaEnabled(ExecState* exec, JSObject* thisObj, const List&) 542 542 { 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()); 549 548 } 550 549 -
trunk/WebCore/bindings/js/kjs_navigator.h
r29508 r30243 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 * This file is part of the KDE libraries4 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 4 * 6 5 * This library is free software; you can redistribute it and/or … … 25 24 26 25 namespace WebCore { 26 27 27 class Frame; 28 }29 28 30 namespace KJS { 29 class Navigator : public DOMObject { 30 public: 31 Navigator(KJS::JSObject* prototype, Frame*); 31 32 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; 35 37 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 }; 46 40 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&); 49 48 50 49 } // namespace -
trunk/WebCore/bindings/js/kjs_window.cpp
r30157 r30243 292 292 HashMap<String, String> map; 293 293 294 Vector<String> features = featuresArg.split(';'); 294 Vector<String> features; 295 featuresArg.split(';', features); 295 296 Vector<String>::const_iterator end = features.end(); 296 297 for (Vector<String>::const_iterator it = features.begin(); it != end; ++it) { … … 360 361 newWindow->putDirect("dialogArguments", dialogArgs); 361 362 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); 364 365 bool userGesture = activeFrame->scriptProxy()->processingUserGesture(); 365 366 366 367 if (created) { 367 newFrame->loader()->changeLocation( KURL(completedURL.deprecatedString()), activeFrame->loader()->outgoingReferrer(), false, userGesture);368 newFrame->loader()->changeLocation(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture); 368 369 if (Document* oldDoc = openerFrame->document()) 369 370 newFrame->document()->setBaseURL(oldDoc->baseURL()); 370 371 } 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); 372 373 } 373 374 … … 705 706 return; 706 707 String dstUrl = p->loader()->completeURL(value->toString(exec)).string(); 707 if (! dstUrl.startsWith("javascript:", false) || allowsAccessFrom(exec)) {708 if (!protocolIs(dstUrl, "javascript") || allowsAccessFrom(exec)) { 708 709 bool userGesture = p->scriptProxy()->processingUserGesture(); 709 710 // We want a new history item if this JS was called via a user gesture … … 889 890 // FIXME: this error message should contain more specifics of why the same origin check has failed. 890 891 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()); 892 893 return false; 893 894 } … … 1138 1139 String completedURL; 1139 1140 if (!urlString.isEmpty()) 1140 completedURL = activeFrame->document()->completeURL(urlString) ;1141 completedURL = activeFrame->document()->completeURL(urlString).string(); 1141 1142 1142 1143 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)))) { 1144 1145 bool userGesture = activeFrame->scriptProxy()->processingUserGesture(); 1145 1146 frame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture); -
trunk/WebCore/bindings/objc/DOM.mm
r30089 r30243 580 580 WebCore::Element* element = [self _element]; 581 581 ASSERT(element); 582 return WebCore::KURL(element->document()->completeURL(parseURL(element->getAttribute(name)).deprecatedString())).getNSURL();582 return element->document()->completeURL(parseURL(element->getAttribute(name))); 583 583 } 584 584 -
trunk/WebCore/bindings/objc/DOMHTML.mm
r24771 r30243 37 37 #import "HTMLInputElement.h" 38 38 #import "HTMLObjectElement.h" 39 #import "KURL.h"40 39 #import "Range.h" 41 40 #import "RenderTextControl.h" … … 64 63 - (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString 65 64 { 66 NSURL *baseURL = WebCore::KURL([self _document]->completeURL(WebCore::parseURL(baseURLString)).deprecatedString()).getNSURL();65 NSURL *baseURL = [self _document]->completeURL(WebCore::parseURL(baseURLString)); 67 66 return [self createDocumentFragmentWithMarkupString:markupString baseURL:baseURL]; 68 67 } -
trunk/WebCore/bindings/scripts/CodeGeneratorCOM.pm
r30182 r30243 310 310 311 311 if ($codeGenerator->IsStringType($type)) { 312 $CPPImplementationWebCoreIncludes{" PlatformString.h"} = 1;312 $CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1; 313 313 $CPPImplementationWebCoreIncludes{"BString.h"} = 1; 314 $CPPImplementationWebCoreIncludes{" AtomicString.h"} = 1;314 $CPPImplementationWebCoreIncludes{"KURL.h"} = 1; 315 315 return; 316 316 } -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r30102 r30243 117 117 118 118 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; 120 120 return "JS" . $codeGenerator->StripModule($dataNode->parents(0)); 121 121 } … … 1191 1191 push(@implContent, " ${className}* thisObj = static_cast<$className*>(slot.slotBase());\n"); 1192 1192 if (IndexGetterReturnsStrings($implClassName)) { 1193 $implIncludes{" PlatformString.h"} = 1;1193 $implIncludes{"KURL.h"} = 1; 1194 1194 push(@implContent, " return jsStringOrNull(thisObj->impl()->item(slot.index()));\n"); 1195 1195 } else { … … 1214 1214 push(@implContent, "{\n"); 1215 1215 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"); 1217 1217 } 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"); 1219 1219 } 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"); 1221 1221 } 1222 1222 push(@implContent, "}\n"); … … 1445 1445 1446 1446 if ($codeGenerator->IsStringType($type)) { 1447 $implIncludes{" PlatformString.h"} = 1;1447 $implIncludes{"KURL.h"} = 1; 1448 1448 my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"}; 1449 1449 if (defined $conv) { -
trunk/WebCore/bindings/scripts/CodeGeneratorObjC.pm
r29073 r30243 4 4 # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> 5 5 # 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. 7 7 # 8 8 # This library is free software; you can redistribute it and/or … … 537 537 538 538 if ($codeGenerator->IsStringType($type)) { 539 $implIncludes{" PlatformString.h"} = 1;539 $implIncludes{"KURL.h"} = 1; 540 540 return; 541 541 } -
trunk/WebCore/bridge/mac/WebCoreAXObject.mm
r29250 r30243 1 1 /* 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. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1100 1100 if ([attributeName isEqualToString: NSAccessibilityURLAttribute]) { 1101 1101 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; 1109 1105 } 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; 1115 1109 } 1116 1110 return nil; … … 1673 1667 // NOTE: color attributes are handled specially because -[NSMutableAttributedString addAttribute: value: range:] does not merge 1674 1668 // identical colors. Workaround is to not replace an existing color attribute if it matches what we are adding. This also means 1675 // we can 1669 // we cannot just pre-remove all inherited attributes on the appended string, so we have to remove the irrelevant ones individually. 1676 1670 1677 1671 // remove inherited attachment from prior AXAttributedStringAppendReplaced -
trunk/WebCore/bridge/mac/WebCoreScriptDebugger.mm
r28608 r30243 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 60 60 61 61 // 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()]; 62 static 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()]; 66 67 } 67 68 68 69 // convert UString to NSURL 69 static NSURL *toNSURL(const UString &s) 70 { 71 if (s.isEmpty()) return nil; 72 return KURL(DeprecatedString(s)).getNSURL(); 70 static NSURL *toNSURL(const UString& s) 71 { 72 if (s.isEmpty()) 73 return nil; 74 return KURL(s); 73 75 } 74 76 … … 138 140 }; 139 141 140 141 142 142 // WebCoreScriptDebugger 143 143 // … … 160 160 { 161 161 if ((self = [super init])) { 162 _delegate 162 _delegate = delegate; 163 163 _globalObj = [_delegate globalObject]; 164 164 _debugger = new WebCoreScriptDebuggerImp(self, [_globalObj _rootObject]->globalObject()); … … 187 187 @end 188 188 189 190 191 189 @implementation WebCoreScriptDebugger (WebCoreScriptDebuggerInternal) 192 190 … … 206 204 207 205 @end 208 209 210 206 211 207 // WebCoreScriptCallFrame … … 256 252 @end 257 253 258 259 260 254 @implementation WebCoreScriptCallFrame 261 255 … … 276 270 return _caller; 277 271 } 278 279 272 280 273 // Returns an array of scope objects (most local first). … … 302 295 } 303 296 304 305 297 // Returns the name of the function for this frame, if available. 306 298 // Returns nil for anonymous functions and for the global frame. … … 309 301 { 310 302 if (_state->scopeNode()) { 311 FunctionImp *func = _state->function();303 FunctionImp* func = _state->function(); 312 304 if (func) { 313 305 Identifier fn = func->functionName(); … … 318 310 } 319 311 320 321 312 // Returns the pending exception for this frame (nil if none). 322 313 … … 326 317 return [self _convertValueToObjcValue:_state->exception()]; 327 318 } 328 329 319 330 320 // 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 /* 4 2 * (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. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 63 61 if (loader) 64 62 m_image = loader->requestImage(url); 65 else 63 else { 66 64 // 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 } 68 67 69 68 if (m_image) -
trunk/WebCore/css/CSSImportRule.cpp
r30147 r30243 29 29 #include "DocLoader.h" 30 30 #include "Document.h" 31 #include "KURL.h"32 31 #include "MediaList.h" 33 32 … … 92 91 if (!parentSheet->href().isNull()) 93 92 // 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(); 95 94 96 95 // Check for a cycle in our import chain. If we encounter a stylesheet -
trunk/WebCore/css/CSSParser.cpp
r30208 r30243 55 55 #include "FontFamilyValue.h" 56 56 #include "FontValue.h" 57 #include "KURL.h"58 57 #include "MediaList.h" 59 58 #include "MediaQueryExp.h" … … 817 816 if (strict || coords.size() == 0) { 818 817 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)); 822 820 } 823 821 } … … 877 875 String uri = parseURL(domString(value->string)); 878 876 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); 882 878 valueList->next(); 883 879 } … … 1084 1080 if (val->unit == CSSPrimitiveValue::CSS_URI) { 1085 1081 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); 1089 1084 } 1090 1085 if (!parsedValue) … … 1835 1830 // url 1836 1831 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); 1839 1833 } else if (val->unit == Value::Function) { 1840 1834 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) … … 1902 1896 String uri = parseURL(domString(valueList->current()->string)); 1903 1897 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); 1906 1899 return true; 1907 1900 } … … 2732 2725 if (val->unit == CSSPrimitiveValue::CSS_URI && !expectComma) { 2733 2726 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); 2735 2728 uriValue = parsedValue; 2736 2729 allowFormat = true; … … 3287 3280 return false; 3288 3281 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)); 3291 3283 while ((val = valueList->next())) { 3292 3284 if (context.allowNumber() && validUnit(val, FInteger|FNonNeg|FPercent, true)) { … … 3926 3918 typedef int yy_state_type; 3927 3919 typedef 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. 3929 3921 #define YY_SC_TO_UI(c) (c > 0xff ? 0xff : c) 3930 3922 #define YY_DO_BEFORE_ACTION \ … … 3941 3933 #define yyterminate() yyTok = END_TOKEN; return yyTok 3942 3934 #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. 3944 3936 // The macro is used in the tokenizer grammar with lines containing 3945 3937 // BEGIN(mediaqueries) and BEGIN(initial). yy_start acts as index to 3946 3938 // tokenizer transition table, and 'mediaqueries' and 'initial' are 3947 3939 // 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). 3949 3941 #define BEGIN yy_start = 1 + 2 * 3950 3942 -
trunk/WebCore/css/CSSStyleSelector.cpp
r30208 r30243 232 232 #endif 233 233 234 static CSSStyleSelector::Encoded url *currentEncodedURL = 0;234 static CSSStyleSelector::EncodedURL* currentEncodedURL = 0; 235 235 static PseudoState pseudoState; 236 236 … … 320 320 KURL u = url; 321 321 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('/'); 326 326 m_encodedURL.path = m_encodedURL.file; 327 327 if (pos > 0) { 328 328 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(); 333 333 } 334 334 … … 704 704 DeprecatedString u = cu.string(); 705 705 if (length && characters[0] == '/') 706 u.prepend( currentEncodedURL->host);706 u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->prefix.characters()), currentEncodedURL->prefix.length()); 707 707 else if (length && characters[0] == '#') 708 u.prepend( currentEncodedURL->file);708 u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->file.characters()), currentEncodedURL->file.length()); 709 709 else 710 u.prepend( currentEncodedURL->path);710 u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->path.characters()), currentEncodedURL->path.length()); 711 711 cleanpath(u); 712 712 pseudoState = historyContains(reinterpret_cast<const UChar*>(u.unicode()), u.length()) -
trunk/WebCore/css/CSSStyleSelector.h
r29647 r30243 1 1 /* 2 * This file is part of the CSS implementation for KDE.3 *4 2 * 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. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 101 99 bool strictParsing; 102 100 103 struct Encoded url{104 DeprecatedString host; //also contains protocol105 DeprecatedString path;106 DeprecatedString file;101 struct EncodedURL { 102 String prefix; // protocol, host, etc. 103 String path; 104 String file; 107 105 } m_encodedURL; 108 106 -
trunk/WebCore/css/MediaList.cpp
r25754 r30243 188 188 CSSParser p(true); 189 189 190 Vector<String> list = value.split(','); 190 Vector<String> list; 191 value.split(',', list); 191 192 Vector<String>::const_iterator end = list.end(); 192 193 for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) { -
trunk/WebCore/css/StyleBase.cpp
r25754 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 3 * 1999 Waldo Bastian (bastian@kde.org) 6 4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch) 7 5 * 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. 9 7 * 10 8 * This library is free software; you can redistribute it and/or … … 46 44 } 47 45 48 String StyleBase::baseURL() 46 KURL StyleBase::baseURL() const 49 47 { 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. 53 50 54 StyleSheet* sheet = stylesheet(); 55 51 StyleSheet* sheet = const_cast<StyleBase*>(this)->stylesheet(); 56 52 if (!sheet) 57 return String(); 58 53 return KURL(); 59 54 if (!sheet->href().isNull()) 60 return sheet->href(); 61 62 // find parent 55 return KURL(sheet->href()); 63 56 if (sheet->parent()) 64 57 return sheet->parent()->baseURL(); 65 66 58 if (!sheet->ownerNode()) 67 return String(); 68 59 return KURL(); 69 60 return sheet->ownerNode()->document()->baseURL(); 70 61 } -
trunk/WebCore/css/StyleBase.h
r30122 r30243 1 1 /* 2 * This file is part of the CSS implementation for KDE.3 *4 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 3 * Copyright (C) 1999 Waldo Bastian (bastian@kde.org) 6 4 * 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. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 32 30 class String; 33 31 class StyleSheet; 32 class KURL; 34 33 35 34 // a style class which has a parent (almost all have) … … 48 47 49 48 // returns the url of the style sheet this object belongs to 50 String baseURL();49 KURL baseURL() const; 51 50 52 51 virtual bool isStyleSheet() const { return false; } -
trunk/WebCore/dom/Document.cpp
r30195 r30243 408 408 { 409 409 KJS::JSLock lock; 410 KJS::ScriptInterpreter::forgetAllDOMNodesForDocument(this);410 ScriptInterpreter::forgetAllDOMNodesForDocument(this); 411 411 } 412 412 … … 829 829 } 830 830 831 StringDocument::documentURI() const831 KURL Document::documentURI() const 832 832 { 833 833 return m_baseURL; 834 834 } 835 835 836 void Document::setDocumentURI(const String &uri)837 { 838 m_baseURL = uri.deprecatedString();839 } 840 841 StringDocument::baseURI() const842 { 843 return documentURI();836 void Document::setDocumentURI(const String& uri) 837 { 838 m_baseURL = KURL(uri); 839 } 840 841 KURL Document::baseURI() const 842 { 843 return m_baseURL; 844 844 } 845 845 … … 1324 1324 // This is work that we should probably do in clear(), but we can't have it 1325 1325 // 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()) 1328 1328 setURL(parent->baseURL()); 1329 if (m_baseURL.isEmpty() || m_baseURL == "about:blank")1329 if (m_baseURL.isEmpty() || m_baseURL == blankURL()) 1330 1330 setBaseURL(parent->baseURL()); 1331 1331 } … … 1617 1617 } 1618 1618 1619 void Document::setURL(const DeprecatedString& url)1619 void Document::setURL(const KURL& url) 1620 1620 { 1621 1621 if (url == m_url) … … 1624 1624 m_url = url; 1625 1625 if (m_styleSelector) 1626 m_styleSelector->setEncodedURL( m_url);1626 m_styleSelector->setEncodedURL(url); 1627 1627 1628 1628 m_isAllowedToLoadLocalResources = shouldBeAllowedToLoadLocalResources(); … … 1631 1631 bool Document::shouldBeAllowedToLoadLocalResources() const 1632 1632 { 1633 if (FrameLoader::shouldTreatURLAsLocal(m_url ))1633 if (FrameLoader::shouldTreatURLAsLocal(m_url.string())) 1634 1634 return true; 1635 1635 … … 1642 1642 return false; 1643 1643 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()) 1645 1645 return true; 1646 1646 … … 1648 1648 } 1649 1649 1650 void Document::setBaseURL(const DeprecatedString& baseURL)1650 void Document::setBaseURL(const KURL& baseURL) 1651 1651 { 1652 m_baseURL = baseURL; 1652 m_baseURL = baseURL; 1653 1653 if (m_elemSheet) 1654 m_elemSheet->setHref( m_baseURL);1654 m_elemSheet->setHref(baseURL.string()); 1655 1655 } 1656 1656 … … 1688 1688 { 1689 1689 if (!m_elemSheet) 1690 m_elemSheet = new CSSStyleSheet(this, baseURL() );1690 m_elemSheet = new CSSStyleSheet(this, baseURL().string()); 1691 1691 return m_elemSheet.get(); 1692 1692 } … … 1695 1695 { 1696 1696 if (!m_mappedElementSheet) 1697 m_mappedElementSheet = new CSSStyleSheet(this, baseURL() );1697 m_mappedElementSheet = new CSSStyleSheet(this, baseURL().string()); 1698 1698 return m_mappedElementSheet.get(); 1699 1699 } … … 1848 1848 url = frame->loader()->url().string(); 1849 1849 else 1850 url = completeURL(url) ;1850 url = completeURL(url).string(); 1851 1851 frame->loader()->scheduleHTTPRedirection(delay, url); 1852 1852 } … … 2181 2181 if (title != m_preferredStylesheetSet) 2182 2182 sheet = 0; 2183 2184 #if ENABLE(SVG)2185 if (!n->isHTMLElement())2186 title = title.deprecatedString().replace('&', "&&");2187 #endif2188 2183 } 2189 2184 } … … 2608 2603 void Document::setCookie(const String& value) 2609 2604 { 2610 setCookies(this, url(), policyBaseURL() .deprecatedString(), value);2605 setCookies(this, url(), policyBaseURL(), value); 2611 2606 } 2612 2607 … … 2786 2781 } 2787 2782 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 documents2793 // 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 returnurl;2783 KURL 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; 2797 2792 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()); 2809 2795 } 2810 2796 -
trunk/WebCore/dom/Document.h
r30195 r30243 33 33 #include "HTMLCollection.h" 34 34 #include "HTMLFormElement.h" 35 #include "KURL.h" 35 36 #include "StringHash.h" 36 37 #include "Timer.h" … … 219 220 void setXMLStandalone(bool, ExceptionCode&); 220 221 221 StringdocumentURI() const;222 KURL documentURI() const; 222 223 void setDocumentURI(const String&); 223 224 224 virtual StringbaseURI() const;225 virtual KURL baseURI() const; 225 226 226 227 PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&); … … 372 373 bool wellFormed() const { return m_wellFormed; } 373 374 374 DeprecatedString url() const { return m_url.isEmpty() ? "about:blank": m_url; }375 void setURL(const DeprecatedString& url);376 377 DeprecatedStringbaseURL() const { return m_baseURL.isEmpty() ? url() : m_baseURL; }378 void setBaseURL(const DeprecatedString& baseURL);379 380 StringbaseTarget() 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; } 381 382 void setBaseTarget(const String& baseTarget) { m_baseTarget = baseTarget; } 382 383 383 DeprecatedString completeURL(const DeprecatedString &); 384 String completeURL(const String&); 384 KURL completeURL(const String&); 385 385 386 386 // from cachedObjectClient … … 571 571 String lastModified() const; 572 572 573 StringpolicyBaseURL() 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; } 575 575 576 576 // The following implements the rule from HTML 4 for what valid names are. … … 701 701 Tokenizer* m_tokenizer; 702 702 bool m_wellFormed; 703 DeprecatedStringm_url;704 DeprecatedStringm_baseURL;703 KURL m_url; 704 KURL m_baseURL; 705 705 String m_baseTarget; 706 706 … … 814 814 ImageMapsByName m_imageMapsByName; 815 815 816 Stringm_policyBaseURL;816 KURL m_policyBaseURL; 817 817 818 818 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 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (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. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 32 30 namespace WebCore { 33 31 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) 32 DocumentType::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) 36 38 { 37 39 } 38 40 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) 41 DocumentType::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) 41 46 { 42 47 } 43 48 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) 49 DocumentType::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) 47 56 { 48 57 } … … 75 84 } 76 85 77 StringDocumentType::baseURI() const86 KURL DocumentType::baseURI() const 78 87 { 79 return String();88 return KURL(); 80 89 } 81 90 … … 92 101 PassRefPtr<Node> DocumentType::cloneNode(bool /*deep*/) 93 102 { 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. 95 105 return 0; 96 106 } -
trunk/WebCore/dom/DocumentType.h
r25754 r30243 49 49 String internalSubset() const { return m_subset; } 50 50 51 virtual StringbaseURI() const;51 virtual KURL baseURI() const; 52 52 53 53 // Other methods (not part of DOM) -
trunk/WebCore/dom/Element.cpp
r30117 r30243 5 5 * (C) 2001 Dirk Mueller (mueller@kde.org) 6 6 * (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. 8 8 * (C) 2007 Eric Seidel (eric@webkit.org) 9 9 * … … 38 38 #include "HTMLElement.h" 39 39 #include "HTMLNames.h" 40 #include "KURL.h"41 40 #include "NamedAttrMap.h" 42 41 #include "NodeList.h" … … 563 562 } 564 563 565 String Element::baseURI() const 566 { 567 KURL xmlbase(getAttribute(baseAttr).deprecatedString()); 568 569 if (!xmlbase.protocol().isEmpty()) 570 return xmlbase.string(); 564 KURL Element::baseURI() const 565 { 566 KURL base(getAttribute(baseAttr)); 567 if (!base.protocol().isEmpty()) 568 return base; 571 569 572 570 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()); 577 579 } 578 580 -
trunk/WebCore/dom/Element.h
r30112 r30243 110 110 virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); } 111 111 112 virtual StringbaseURI() const;112 virtual KURL baseURI() const; 113 113 114 114 // DOM methods overridden from parent classes -
trunk/WebCore/dom/Node.cpp
r30237 r30243 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (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. 6 6 * Copyright (C) 2007 Trolltech ASA 7 7 * … … 43 43 #include "HTMLNames.h" 44 44 #include "HTMLNames.h" 45 #include "KURL.h"46 45 #include "Logging.h" 47 46 #include "NameNodeList.h" … … 153 152 { 154 153 KJS::JSLock lock; 155 KJS::ScriptInterpreter::updateDOMNodeDocument(this, m_document.get(), doc);154 ScriptInterpreter::updateDOMNodeDocument(this, m_document.get(), doc); 156 155 } 157 156 m_document = doc; … … 1283 1282 } 1284 1283 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(); 1284 NamedAttrMap* Node::attributes() const 1285 { 1286 return 0; 1287 } 1288 1289 KURL Node::baseURI() const 1290 { 1291 return parentNode() ? parentNode()->baseURI() : KURL(); 1297 1292 } 1298 1293 -
trunk/WebCore/dom/Node.h
r30112 r30243 45 45 class IntRect; 46 46 class KeyboardEvent; 47 class KURL; 47 48 class NamedAttrMap; 48 49 class NodeList; … … 107 108 virtual NamedAttrMap* attributes() const; 108 109 109 virtual StringbaseURI() const;110 virtual KURL baseURI() const; 110 111 111 112 // 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 /* 4 2 * 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. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 20 18 * Boston, MA 02110-1301, USA. 21 19 */ 20 22 21 #include "config.h" 23 22 #include "ProcessingInstruction.h" … … 157 156 #if ENABLE(XSLT) 158 157 if (m_isXSL) 159 m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href) );158 m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href).string()); 160 159 else 161 160 #endif … … 165 164 charset = document()->frame()->loader()->encoding(); 166 165 167 m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href) , charset);166 m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href).string(), charset); 168 167 } 169 168 if (m_cachedSheet) -
trunk/WebCore/dom/StyleElement.cpp
r29663 r30243 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 2006, 2007 Rob Buis 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. 5 4 * 6 5 * This library is free software; you can redistribute it and/or … … 19 18 * Boston, MA 02110-1301, USA. 20 19 */ 20 21 21 #include "config.h" 22 22 #include "StyleElement.h" … … 57 57 return; 58 58 59 String text = "";59 Vector<UChar> text; 60 60 61 61 for (Node* c = e->firstChild(); c; c = c->nextSibling()) 62 62 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()); 64 64 65 createSheet(e, text);65 createSheet(e, String::adopt(text)); 66 66 } 67 67 … … 75 75 } 76 76 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"))) { 79 80 RefPtr<MediaList> mediaList = new MediaList((CSSStyleSheet*)0, media(), e->isHTMLElement()); 80 81 MediaQueryEvaluator screenEval("screen", true); -
trunk/WebCore/dom/XMLTokenizer.cpp
r30236 r30243 864 864 scriptCode += static_cast<CharacterData*>(child)->data(); 865 865 } 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); 867 867 } 868 868 … … 1293 1293 #if ENABLE(XSLT) 1294 1294 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())); 1296 1296 1297 1297 m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets. … … 1442 1442 1443 1443 #if ENABLE(XSLT) 1444 void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const DeprecatedString& url)1444 void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const String& url) 1445 1445 { 1446 1446 if (source.isEmpty()) … … 1461 1461 xmlDocPtr sourceDoc = xmlReadMemory(reinterpret_cast<const char*>(source.characters()), 1462 1462 source.length() * sizeof(UChar), 1463 url. ascii(),1463 url.latin1().data(), 1464 1464 BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", 1465 1465 XSLT_PARSE_OPTIONS); -
trunk/WebCore/dom/XMLTokenizer.h
r28639 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * 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. 6 4 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 5 * Copyright (C) 2007 Trolltech ASA … … 171 169 172 170 #if ENABLE(XSLT) 173 void* xmlDocPtrForString(DocLoader*, const String& source, const DeprecatedString& url);171 void* xmlDocPtrForString(DocLoader*, const String& source, const String& url); 174 172 void setLoaderForLibXMLCallbacks(DocLoader*); 175 173 #endif -
trunk/WebCore/editing/markup.cpp
r29452 r30243 1 1 /* 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. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 #include "HTMLNames.h" 47 47 #include "InlineTextBox.h" 48 #include "KURL.h"49 48 #include "Logging.h" 50 49 #include "ProcessingInstruction.h" … … 87 86 }; 88 87 89 static inline void appendString(Vector<UChar>& result, const String& str)90 {91 result.append(str.characters(), str.length());92 }93 94 88 static void appendAttributeValue(Vector<UChar>& result, const String& attr) 95 89 { … … 107 101 case '&': 108 102 result.append(uchars + lastCopiedFrom, i - lastCopiedFrom); 109 append String(result, ampEntity);103 append(result, ampEntity); 110 104 lastCopiedFrom = i + 1; 111 105 break; 112 106 case '<': 113 107 result.append(uchars + lastCopiedFrom, i - lastCopiedFrom); 114 append String(result, ltEntity);108 append(result, ltEntity); 115 109 lastCopiedFrom = i + 1; 116 110 break; 117 111 case '"': 118 112 result.append(uchars + lastCopiedFrom, i - lastCopiedFrom); 119 append String(result, quotEntity);113 append(result, quotEntity); 120 114 lastCopiedFrom = i + 1; 121 115 } … … 167 161 result.append(uchars + lastCopiedFrom, i - lastCopiedFrom); 168 162 if (c == '&') 169 append String(result, ampEntity);163 append(result, ampEntity); 170 164 else 171 append String(result, ltEntity);165 append(result, ltEntity); 172 166 lastCopiedFrom = i + 1; 173 167 } … … 182 176 } 183 177 184 static void appendQuotedURLAttributeValue(Vector<UChar>& result, StringurlString)178 static void appendQuotedURLAttributeValue(Vector<UChar>& result, const String& urlString) 185 179 { 186 180 UChar quoteChar = '\"'; 187 if (urlString.stripWhiteSpace().startsWith("javascript:", false)) { 181 String strippedURLString = urlString.stripWhiteSpace(); 182 if (protocolIs(strippedURLString, "javascript")) { 188 183 // minimal escaping for javascript urls 189 if ( urlString.contains('\"')) {190 if ( urlString.contains('\''))191 urlString.replace('\"', """);184 if (strippedURLString.contains('"')) { 185 if (strippedURLString.contains('\'')) 186 strippedURLString.replace('\"', """); 192 187 else 193 188 quoteChar = '\''; 194 189 } 195 190 result.append(quoteChar); 196 append String(result, urlString);191 append(result, strippedURLString); 197 192 result.append(quoteChar); 198 193 return; 199 194 } 200 195 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. 202 197 result.append(quoteChar); 203 198 appendAttributeValue(result, urlString); … … 332 327 static const String xmlns("xmlns"); 333 328 result.append(' '); 334 append String(result, xmlns);329 append(result, xmlns); 335 330 if (!prefix.isEmpty()) { 336 331 result.append(':'); 337 append String(result, prefix);332 append(result, prefix); 338 333 } 339 334 … … 373 368 } 374 369 case Node::COMMENT_NODE: 375 append String(result, static_cast<const Comment*>(node)->toString());370 append(result, static_cast<const Comment*>(node)->toString()); 376 371 break; 377 372 case Node::DOCUMENT_NODE: { … … 380 375 const DocumentType* docType = static_cast<const Document*>(node)->doctype(); 381 376 if (docType) 382 append String(result, docType->toString());377 append(result, docType->toString()); 383 378 break; 384 379 } … … 386 381 break; 387 382 case Node::DOCUMENT_TYPE_NODE: 388 append String(result, static_cast<const DocumentType*>(node)->toString());383 append(result, static_cast<const DocumentType*>(node)->toString()); 389 384 break; 390 385 case Node::PROCESSING_INSTRUCTION_NODE: 391 append String(result, static_cast<const ProcessingInstruction*>(node)->toString());386 append(result, static_cast<const ProcessingInstruction*>(node)->toString()); 392 387 break; 393 388 case Node::ELEMENT_NODE: { … … 395 390 const Element* el = static_cast<const Element*>(node); 396 391 bool convert = convertBlocksToInlines & isBlock(const_cast<Node*>(node)); 397 append String(result, el->nodeNamePreservingCase());392 append(result, el->nodeNamePreservingCase()); 398 393 NamedAttrMap *attrs = el->attributes(); 399 394 unsigned length = attrs->length(); … … 409 404 410 405 if (documentIsHTML) 411 append String(result, attr->name().localName());406 append(result, attr->name().localName()); 412 407 else 413 append String(result, attr->name().toString());408 append(result, attr->name().toString()); 414 409 415 410 result.append('='); … … 438 433 if (style->length() > 0) { 439 434 static const String stylePrefix(" style=\""); 440 append String(result, stylePrefix);435 append(result, stylePrefix); 441 436 appendAttributeValue(result, style->cssText()); 442 437 result.append('\"'); … … 453 448 } 454 449 case Node::CDATA_SECTION_NODE: 455 append String(result, static_cast<const CDATASection*>(node)->toString());450 append(result, static_cast<const CDATASection*>(node)->toString()); 456 451 break; 457 452 case Node::ATTRIBUTE_NODE: … … 504 499 result.append('<'); 505 500 result.append('/'); 506 append String(result, static_cast<const Element*>(node)->nodeNamePreservingCase());501 append(result, static_cast<const Element*>(node)->nodeNamePreservingCase()); 507 502 result.append('>'); 508 503 } … … 541 536 Vector<AttributeChange> changes; 542 537 543 KURL baseURLAsKURL(baseURL.deprecatedString());538 KURL parsedBaseURL(baseURL); 544 539 545 540 Node* end = node->traverseNextSibling(); … … 551 546 for (unsigned i = 0; i < length; i++) { 552 547 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())); 557 550 } 558 551 } … … 623 616 624 617 for (size_t i = preCount; i > 0; --i) 625 append String(result, preMarkups[i - 1]);618 append(result, preMarkups[i - 1]); 626 619 627 620 for (size_t i = 0; i < postCount; ++i) 628 append String(result, postMarkups[i]);621 append(result, postMarkups[i]); 629 622 630 623 return String::adopt(result); … … 807 800 Vector<UChar> openTag; 808 801 static const String divStyle("<div style=\""); 809 append String(openTag, divStyle);802 append(openTag, divStyle); 810 803 appendAttributeValue(openTag, style->cssText()); 811 804 openTag.append('\"'); … … 849 842 Vector<UChar> openTag; 850 843 const String spanClassStyle = String("<span class=\"" AppleStyleSpanClass "\" style=\""); 851 append String(openTag, spanClassStyle);844 append(openTag, spanClassStyle); 852 845 appendAttributeValue(openTag, style->cssText()); 853 846 openTag.append('\"'); … … 891 884 RefPtr<DocumentFragment> fragment = element->createContextualFragment(markup); 892 885 893 if (fragment && !baseURL.isEmpty() && baseURL != "about:blank"&& baseURL != document->baseURL())886 if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL()) 894 887 completeURLs(fragment.get(), baseURL); 895 888 … … 923 916 } 924 917 925 static void fillContainerFromString(ContainerNode* paragraph, const DeprecatedString& string)918 static void fillContainerFromString(ContainerNode* paragraph, const String& string) 926 919 { 927 920 Document* document = paragraph->document(); … … 936 929 ASSERT(string.find('\n') == -1); 937 930 938 DeprecatedStringList tabList = DeprecatedStringList::split('\t', string, true); 939 DeprecatedString tabText = ""; 931 Vector<String> tabList; 932 string.split('\t', true, tabList); 933 String tabText = ""; 940 934 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]; 944 938 945 939 // append the non-tab textual part … … 950 944 tabText = ""; 951 945 } 952 RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, tabList.isEmpty()));946 RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries)); 953 947 paragraph->appendChild(textNode.release(), ec); 954 948 ASSERT(ec == 0); … … 957 951 // there is a tab after every entry, except the last entry 958 952 // (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'); 961 955 else if (!tabText.isEmpty()) { 962 956 paragraph->appendChild(createTabSpanElement(document, tabText), ec); … … 986 980 return fragment.release(); 987 981 988 DeprecatedString string = text.deprecatedString();982 String string = text; 989 983 string.replace("\r\n", "\n"); 990 984 string.replace('\r', '\n'); … … 1016 1010 bool useClonesOfEnclosingBlock = !block->hasTagName(bodyTag); 1017 1011 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]; 1022 1017 1023 1018 RefPtr<Element> element; 1024 if (s.isEmpty() && list.isEmpty()) {1019 if (s.isEmpty() && i + 1 == numLines) { 1025 1020 // For last line, use the "magic BR" rather than a P. 1026 1021 element = document->createElementNS(xhtmlNamespaceURI, "br", ec); -
trunk/WebCore/history/HistoryItem.cpp
r30122 r30243 177 177 KURL HistoryItem::url() const 178 178 { 179 return KURL(m_urlString .deprecatedString());179 return KURL(m_urlString); 180 180 } 181 181 182 182 KURL HistoryItem::originalURL() const 183 183 { 184 return KURL(m_originalURLString .deprecatedString());184 return KURL(m_originalURLString); 185 185 } 186 186 -
trunk/WebCore/history/HistoryItem.h
r30001 r30243 30 30 #include "FormData.h" 31 31 #include "IntPoint.h" 32 #include "KURL.h"33 32 #include "PlatformString.h" 34 33 #include <wtf/RefCounted.h> -
trunk/WebCore/html/HTMLAnchorElement.cpp
r30044 r30243 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (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. 6 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 7 * … … 198 198 int y = e->pageY() - absy; 199 199 url += "?"; 200 url += DeprecatedString::number(x);200 url += String::number(x); 201 201 url += ","; 202 url += DeprecatedString::number(y);202 url += String::number(y); 203 203 } else { 204 204 evt->setDefaultHandled(); … … 329 329 } 330 330 331 StringHTMLAnchorElement::href() const331 KURL HTMLAnchorElement::href() const 332 332 { 333 333 return document()->completeURL(getAttribute(hrefAttr)); … … 416 416 String HTMLAnchorElement::hash() const 417 417 { 418 return '#' + KURL(href().deprecatedString()).ref();418 return "#" + href().ref(); 419 419 } 420 420 421 421 String HTMLAnchorElement::host() const 422 422 { 423 return KURL(href().deprecatedString()).host();423 return href().host(); 424 424 } 425 425 426 426 String HTMLAnchorElement::hostname() const 427 427 { 428 KURL url(href() .deprecatedString());429 if (url.port() ==0)428 KURL url(href()); 429 if (url.port() == 0) 430 430 return url.host(); 431 else 432 return url.host() + ":" + String::number(url.port()); 431 return url.host() + ":" + String::number(url.port()); 433 432 } 434 433 435 434 String HTMLAnchorElement::pathname() const 436 435 { 437 return KURL(href().deprecatedString()).path();436 return href().path(); 438 437 } 439 438 440 439 String HTMLAnchorElement::port() const 441 440 { 442 return DeprecatedString::number(KURL(href().deprecatedString()).port());441 return String::number(href().port()); 443 442 } 444 443 445 444 String HTMLAnchorElement::protocol() const 446 445 { 447 return KURL(href().deprecatedString()).protocol() + ":";446 return href().protocol() + ":"; 448 447 } 449 448 450 449 String HTMLAnchorElement::search() const 451 450 { 452 return KURL(href().deprecatedString()).query();451 return href().query(); 453 452 } 454 453 … … 460 459 String HTMLAnchorElement::toString() const 461 460 { 462 return href() ;461 return href().string(); 463 462 } 464 463 -
trunk/WebCore/html/HTMLAnchorElement.h
r25754 r30243 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (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. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 28 28 29 29 namespace WebCore { 30 31 class String;32 30 33 31 class HTMLAnchorElement : public HTMLElement { … … 61 59 void setCoords(const String&); 62 60 63 Stringhref() const;61 KURL href() const; 64 62 void setHref(const String&); 65 63 -
trunk/WebCore/html/HTMLAppletElement.cpp
r30112 r30243 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (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. 8 6 * Copyright (C) 2007 Trolltech ASA 9 7 * … … 23 21 * Boston, MA 02110-1301, USA. 24 22 */ 23 25 24 #include "config.h" 26 25 #include "HTMLAppletElement.h" … … 37 36 using namespace HTMLNames; 38 37 39 HTMLAppletElement::HTMLAppletElement(Document *doc)40 : HTMLPlugInElement(appletTag, doc)38 HTMLAppletElement::HTMLAppletElement(Document* doc) 39 : HTMLPlugInElement(appletTag, doc) 41 40 { 42 41 } … … 50 49 } 51 50 52 void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)51 void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr) 53 52 { 54 53 if (attr->name() == altAttr || … … 62 61 String newNameAttr = attr->value(); 63 62 if (inDocument() && document()->isHTMLDocument()) { 64 HTMLDocument *doc = static_cast<HTMLDocument*>(document());63 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 65 64 doc->removeNamedItem(oldNameAttr); 66 65 doc->addNamedItem(newNameAttr); … … 70 69 String newIdAttr = attr->value(); 71 70 if (inDocument() && document()->isHTMLDocument()) { 72 HTMLDocument *doc = static_cast<HTMLDocument*>(document());71 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 73 72 doc->removeDocExtraNamedItem(oldIdAttr); 74 73 doc->addDocExtraNamedItem(newIdAttr); … … 84 83 { 85 84 if (document()->isHTMLDocument()) { 86 HTMLDocument *doc = static_cast<HTMLDocument*>(document());85 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 87 86 doc->addNamedItem(oldNameAttr); 88 87 doc->addDocExtraNamedItem(oldIdAttr); … … 95 94 { 96 95 if (document()->isHTMLDocument()) { 97 HTMLDocument *doc = static_cast<HTMLDocument*>(document());96 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 98 97 doc->removeNamedItem(oldNameAttr); 99 98 doc->removeDocExtraNamedItem(oldIdAttr); … … 103 102 } 104 103 105 bool HTMLAppletElement::rendererIsNeeded(RenderStyle *style)104 bool HTMLAppletElement::rendererIsNeeded(RenderStyle* style) 106 105 { 107 106 return !getAttribute(codeAttr).isNull(); 108 107 } 109 108 110 RenderObject *HTMLAppletElement::createRenderer(RenderArena *arena, RenderStyle *style)109 RenderObject* HTMLAppletElement::createRenderer(RenderArena* arena, RenderStyle* style) 111 110 { 112 111 Settings* settings = document()->settings(); … … 126 125 args.set("archive", archive); 127 126 128 args.set("baseURL", document()->baseURL() );127 args.set("baseURL", document()->baseURL().string()); 129 128 130 129 const AtomicString& mayScript = getAttribute(mayscriptAttr); … … 141 140 142 141 #if USE(JAVASCRIPTCORE_BINDINGS) 143 KJS::Bindings::Instance *HTMLAppletElement::getInstance() const142 KJS::Bindings::Instance* HTMLAppletElement::getInstance() const 144 143 { 145 144 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 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) … … 21 19 * Boston, MA 02110-1301, USA. 22 20 */ 21 23 22 #include "config.h" 24 23 #include "HTMLAreaElement.h" 25 24 26 25 #include "Document.h" 26 #include "FloatRect.h" 27 27 #include "HTMLNames.h" 28 #include "FloatRect.h"29 28 #include "HitTestResult.h" 30 29 #include "RenderObject.h" … … 180 179 } 181 180 182 StringHTMLAreaElement::href() const181 KURL HTMLAreaElement::href() const 183 182 { 184 183 return document()->completeURL(getAttribute(hrefAttr)); -
trunk/WebCore/html/HTMLAreaElement.h
r25754 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * Copyright (C) 2004 Apple Computer, Inc.4 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 36 34 class HTMLAreaElement : public HTMLAnchorElement { 37 35 public: 38 enum Shape { Default, Poly, Rect, Circle, Unknown };39 40 36 HTMLAreaElement(Document*); 41 37 ~HTMLAreaElement(); … … 61 57 void setCoords(const String&); 62 58 63 Stringhref() const;59 KURL href() const; 64 60 void setHref(const String&); 65 61 … … 75 71 void setTarget(const String&); 76 72 77 protected: 73 private: 74 enum Shape { Default, Poly, Rect, Circle, Unknown }; 78 75 Path getRegion(const IntSize&) const; 79 76 Path region; -
trunk/WebCore/html/HTMLBaseElement.cpp
r28639 r30243 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 7 * Copyright (C) 2003 Apple Computer, Inc.5 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 37 35 using namespace HTMLNames; 38 36 39 HTMLBaseElement::HTMLBaseElement(Document *doc)37 HTMLBaseElement::HTMLBaseElement(Document* doc) 40 38 : HTMLElement(baseTag, doc) 41 39 { … … 46 44 } 47 45 48 void HTMLBaseElement::parseMappedAttribute(MappedAttribute *attr)46 void HTMLBaseElement::parseMappedAttribute(MappedAttribute* attr) 49 47 { 50 48 if (attr->name() == hrefAttr) { … … 70 68 // Since the document doesn't have a base element... 71 69 // (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()); 74 72 } 75 73 … … 80 78 81 79 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)); 83 81 84 82 if (!m_target.isEmpty()) -
trunk/WebCore/html/HTMLBodyElement.cpp
r25754 r30243 1 /* *1 /* 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 5 5 * (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. 7 7 * 8 8 * This library is free software; you can redistribute it and/or … … 89 89 String url = parseURL(attr->value()); 90 90 if (!url.isEmpty()) 91 addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url) );91 addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string()); 92 92 } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) { 93 93 addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value()); … … 181 181 } 182 182 183 void HTMLBodyElement::setALink(const String &value)183 void HTMLBodyElement::setALink(const String& value) 184 184 { 185 185 setAttribute(alinkAttr, value); … … 191 191 } 192 192 193 void HTMLBodyElement::setBackground(const String &value)193 void HTMLBodyElement::setBackground(const String& value) 194 194 { 195 195 setAttribute(backgroundAttr, value); … … 201 201 } 202 202 203 void HTMLBodyElement::setBgColor(const String &value)203 void HTMLBodyElement::setBgColor(const String& value) 204 204 { 205 205 setAttribute(bgcolorAttr, value); … … 211 211 } 212 212 213 void HTMLBodyElement::setLink(const String &value)213 void HTMLBodyElement::setLink(const String& value) 214 214 { 215 215 setAttribute(linkAttr, value); … … 221 221 } 222 222 223 void HTMLBodyElement::setText(const String &value)223 void HTMLBodyElement::setText(const String& value) 224 224 { 225 225 setAttribute(textAttr, value); … … 231 231 } 232 232 233 void HTMLBodyElement::setVLink(const String &value)233 void HTMLBodyElement::setVLink(const String& value) 234 234 { 235 235 setAttribute(vlinkAttr, value); … … 242 242 doc->updateLayoutIgnorePendingStylesheets(); 243 243 FrameView* view = doc->view(); 244 245 244 return view ? view->contentsX() : 0; 246 245 } … … 262 261 doc->updateLayoutIgnorePendingStylesheets(); 263 262 FrameView* view = doc->view(); 264 265 263 return view ? view->contentsY() : 0; 266 264 } … … 282 280 doc->updateLayoutIgnorePendingStylesheets(); 283 281 FrameView* view = doc->view(); 284 285 282 return view ? view->contentsHeight() : 0; 286 283 } … … 292 289 doc->updateLayoutIgnorePendingStylesheets(); 293 290 FrameView* view = doc->view(); 294 295 291 return view ? view->contentsWidth() : 0; 296 292 } -
trunk/WebCore/html/HTMLEmbedElement.cpp
r29913 r30243 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (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. 8 6 * Copyright (C) 2007 Trolltech ASA 9 7 * … … 23 21 * Boston, MA 02110-1301, USA. 24 22 */ 23 25 24 #include "config.h" 26 25 #include "HTMLEmbedElement.h" … … 65 64 } 66 65 67 KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const66 KJS::Bindings::Instance* HTMLEmbedElement::getInstance() const 68 67 { 69 68 Frame* frame = document()->frame(); … … 107 106 m_serviceType = m_serviceType.left(pos); 108 107 } else if (attr->name() == codeAttr || attr->name() == srcAttr) 109 url = parseURL(val).deprecatedString();108 m_url = parseURL(val); 110 109 else if (attr->name() == pluginpageAttr || attr->name() == pluginspageAttr) 111 110 m_pluginPage = val; … … 128 127 } 129 128 130 bool HTMLEmbedElement::rendererIsNeeded(RenderStyle *style)131 { 132 Frame *frame = document()->frame();129 bool HTMLEmbedElement::rendererIsNeeded(RenderStyle* style) 130 { 131 Frame* frame = document()->frame(); 133 132 if (!frame) 134 133 return false; 135 134 136 Node *p = parentNode();135 Node* p = parentNode(); 137 136 if (p && p->hasTagName(objectTag)) { 138 137 ASSERT(p->renderer()); … … 143 142 } 144 143 145 RenderObject *HTMLEmbedElement::createRenderer(RenderArena *arena, RenderStyle *style)144 RenderObject* HTMLEmbedElement::createRenderer(RenderArena* arena, RenderStyle* style) 146 145 { 147 146 return new (arena) RenderPartObject(this); … … 172 171 { 173 172 if (document()->isHTMLDocument()) { 174 HTMLDocument *doc = static_cast<HTMLDocument*>(document());173 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 175 174 doc->addNamedItem(oldNameAttr); 176 175 } … … 196 195 { 197 196 if (document()->isHTMLDocument()) { 198 HTMLDocument *doc = static_cast<HTMLDocument*>(document());197 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 199 198 doc->removeNamedItem(oldNameAttr); 200 199 } … … 216 215 } 217 216 218 bool HTMLEmbedElement::isURLAttribute(Attribute *attr) const217 bool HTMLEmbedElement::isURLAttribute(Attribute* attr) const 219 218 { 220 219 return attr->name() == srcAttr; -
trunk/WebCore/html/HTMLEmbedElement.h
r29913 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (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. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 68 66 void setType(const String&); 69 67 70 DeprecatedString url; 68 const String& url() const { return m_url; } 69 const String& serviceType() const { return m_serviceType; } 70 71 private: 72 String m_url; 71 73 String m_pluginPage; 72 74 String m_serviceType; -
trunk/WebCore/html/HTMLFormElement.cpp
r29989 r30243 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (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. 6 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 7 * … … 87 87 } 88 88 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); 89 bool HTMLFormElement::formWouldHaveSecureSubmission(const String& url) 90 { 91 return document()->completeURL(url).protocolIs("https"); 95 92 } 96 93 … … 103 100 { 104 101 if (document()->isHTMLDocument()) { 105 HTMLDocument *doc = static_cast<HTMLDocument*>(document());102 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 106 103 doc->addNamedItem(oldNameAttr); 107 104 } … … 113 110 { 114 111 if (document()->isHTMLDocument()) { 115 HTMLDocument *doc = static_cast<HTMLDocument*>(document());112 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 116 113 doc->removeNamedItem(oldNameAttr); 117 114 } … … 150 147 for (unsigned i = 0; i < formElements.size(); ++i) { 151 148 if (formElements[i]->hasLocalName(inputTag)) { 152 HTMLInputElement *element = static_cast<HTMLInputElement*>(formElements[i]);149 HTMLInputElement* element = static_cast<HTMLInputElement*>(formElements[i]); 153 150 if (element->isSuccessfulSubmitButton() && element->renderer()) { 154 151 submitFound = true; … … 168 165 // http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1 169 166 // same safe characters as Netscape for compatibility 170 static const char *safe = "-._*";167 static const char* safe = "-._*"; 171 168 int elen = e.length(); 172 169 DeprecatedCString encoded((elen + e.contains('\n')) * 3 + 1); … … 247 244 String str = m_acceptcharset; 248 245 str.replace(',', ' '); 249 Vector<String> charsets = str.split(' '); 246 Vector<String> charsets; 247 str.split(' ', charsets); 250 248 Vector<String>::const_iterator end = charsets.end(); 251 249 for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it) … … 313 311 314 312 if (!static_cast<HTMLInputElement*>(current)->value().isEmpty()) { 315 DeprecatedString mimeType = MIMETypeRegistry::getMIMETypeForPath(path).deprecatedString();313 String mimeType = MIMETypeRegistry::getMIMETypeForPath(path); 316 314 if (!mimeType.isEmpty()) { 317 315 hstr += "\r\nContent-Type: "; 318 hstr += mimeType. ascii();316 hstr += mimeType.latin1().deprecatedCString(); 319 317 } 320 318 } … … 365 363 bool HTMLFormElement::isMailtoForm() const 366 364 { 367 return m_url.startsWith("mailto:", false);365 return protocolIs(m_url, "mailto"); 368 366 } 369 367 … … 445 443 void HTMLFormElement::submit(Event* event, bool activateSubmitButton) 446 444 { 447 FrameView *view = document()->view();448 Frame *frame = document()->frame();445 FrameView* view = document()->view(); 446 Frame* frame = document()->frame(); 449 447 if (!view || !frame) 450 448 return; … … 483 481 484 482 if (!m_url) 485 m_url = document()->url() ;483 m_url = document()->url().string(); 486 484 487 485 if (m_post) { … … 497 495 if (equalIgnoringCase(enctype(), "text/plain")) { 498 496 // 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"); 500 498 } 501 499 data = new FormData((String("body=") + encodeCString(body.utf8())).replace('+', "%20").latin1()); … … 520 518 void HTMLFormElement::reset() 521 519 { 522 Frame *frame = document()->frame();520 Frame* frame = document()->frame(); 523 521 if (m_inreset || !frame) 524 522 return; … … 539 537 } 540 538 541 void HTMLFormElement::parseMappedAttribute(MappedAttribute *attr)539 void HTMLFormElement::parseMappedAttribute(MappedAttribute* attr) 542 540 { 543 541 if (attr->name() == actionAttr) … … 567 565 String newNameAttr = attr->value(); 568 566 if (inDocument() && document()->isHTMLDocument()) { 569 HTMLDocument *doc = static_cast<HTMLDocument*>(document());567 HTMLDocument* doc = static_cast<HTMLDocument*>(document()); 570 568 doc->removeNamedItem(oldNameAttr); 571 569 doc->addNamedItem(newNameAttr); … … 586 584 } 587 585 588 unsigned HTMLFormElement::formElementIndex(HTMLGenericFormElement *e)586 unsigned HTMLFormElement::formElementIndex(HTMLGenericFormElement* e) 589 587 { 590 588 // Check for the special case where this element is the very last thing in … … 594 592 if (e->traverseNextNode(this)) { 595 593 unsigned i = 0; 596 for (Node *node = this; node; node = node->traverseNextNode(this)) {594 for (Node* node = this; node; node = node->traverseNextNode(this)) { 597 595 if (node == e) 598 596 return i; 599 597 if (node->isHTMLElement() 600 && static_cast<HTMLElement 601 && static_cast<HTMLGenericFormElement 598 && static_cast<HTMLElement*>(node)->isGenericFormElement() 599 && static_cast<HTMLGenericFormElement*>(node)->form() == this) 602 600 ++i; 603 601 } … … 619 617 } 620 618 621 bool HTMLFormElement::isURLAttribute(Attribute *attr) const619 bool HTMLFormElement::isURLAttribute(Attribute* attr) const 622 620 { 623 621 return attr->name() == actionAttr; 624 622 } 625 623 626 void HTMLFormElement::registerImgElement(HTMLImageElement *e)624 void HTMLFormElement::registerImgElement(HTMLImageElement* e) 627 625 { 628 626 imgElements.append(e); 629 627 } 630 628 631 void HTMLFormElement::removeImgElement(HTMLImageElement *e)629 void HTMLFormElement::removeImgElement(HTMLImageElement* e) 632 630 { 633 631 removeFromVector(imgElements, e); -
trunk/WebCore/html/HTMLFrameElementBase.cpp
r27125 r30243 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) 7 5 * (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. 9 7 * 10 8 * This library is free software; you can redistribute it and/or … … 23 21 * Boston, MA 02110-1301, USA. 24 22 */ 23 25 24 #include "config.h" 26 25 #include "HTMLFrameElementBase.h" … … 62 61 return true; 63 62 64 KURL completeURL(document()->completeURL(URLString.deprecatedString())); 65 completeURL.setRef(DeprecatedString::null); 63 KURL completeURL(document()->completeURL(URLString)); 66 64 67 65 // Don't allow more than 200 total frames in a set. This seems … … 69 67 // frameset pages can quickly bring the program to its knees with 70 68 // 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 73 70 // 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()) { 76 73 if (parentFrame->page()->frameCount() > 200) 77 74 return false; 75 } 78 76 79 77 // We allow one level of self-reference because some sites depend on that. … … 81 79 bool foundSelfReference = false; 82 80 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)) { 86 82 if (foundSelfReference) 87 83 return false; … … 101 97 102 98 if (m_URL.isEmpty()) 103 m_URL = "about:blank";99 m_URL = blankURL().string(); 104 100 105 101 Frame* parentFrame = document()->frame(); … … 204 200 } 205 201 206 StringHTMLFrameElementBase::location() const202 KURL HTMLFrameElementBase::location() const 207 203 { 208 204 return src(); … … 303 299 } 304 300 305 StringHTMLFrameElementBase::src() const301 KURL HTMLFrameElementBase::src() const 306 302 { 307 303 return document()->completeURL(getAttribute(srcAttr)); -
trunk/WebCore/html/HTMLFrameElementBase.h
r29722 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (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. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 41 39 virtual void attach(); 42 40 43 Stringlocation() const;41 KURL location() const; 44 42 void setLocation(const String&); 45 43 … … 75 73 void setScrolling(const String&); 76 74 77 Stringsrc() const;75 KURL src() const; 78 76 void setSrc(const String&); 79 77 -
trunk/WebCore/html/HTMLImageElement.cpp
r29185 r30243 117 117 usemap = attr->value(); 118 118 else 119 usemap = document()->completeURL(parseURL(attr->value())) ;119 usemap = document()->completeURL(parseURL(attr->value())).string(); 120 120 m_isLink = !attr->isNull(); 121 121 } else if (attrName == ismapAttr) … … 343 343 } 344 344 345 StringHTMLImageElement::longDesc() const345 KURL HTMLImageElement::longDesc() const 346 346 { 347 347 return document()->completeURL(getAttribute(longdescAttr)); … … 353 353 } 354 354 355 StringHTMLImageElement::lowsrc() const355 KURL HTMLImageElement::lowsrc() const 356 356 { 357 357 return document()->completeURL(getAttribute(lowsrcAttr)); … … 363 363 } 364 364 365 StringHTMLImageElement::src() const365 KURL HTMLImageElement::src() const 366 366 { 367 367 return document()->completeURL(getAttribute(srcAttr)); -
trunk/WebCore/html/HTMLImageElement.h
r26992 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * Copyright (C) 2004 Apple Computer, Inc.4 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 26 24 #define HTMLImageElement_h 27 25 26 #include "GraphicsTypes.h" 28 27 #include "HTMLElement.h" 29 #include "GraphicsTypes.h"30 28 #include "HTMLImageLoader.h" 31 29 32 30 namespace WebCore { 33 class HTMLFormElement; 31 32 class HTMLFormElement; 34 33 35 34 class HTMLImageElement : public HTMLElement { … … 63 62 String altText() const; 64 63 65 String imageMap() const { return usemap; }66 67 64 virtual bool isURLAttribute(Attribute*) const; 68 65 … … 94 91 void setIsMap(bool); 95 92 96 StringlongDesc() const;93 KURL longDesc() const; 97 94 void setLongDesc(const String&); 98 95 99 Stringlowsrc() const;96 KURL lowsrc() const; 100 97 void setLowsrc(const String&); 101 98 102 Stringsrc() const;99 KURL src() const; 103 100 void setSrc(const String&); 104 101 … … 117 114 118 115 bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); } 119 protected: 116 117 private: 120 118 HTMLImageLoader m_imageLoader; 121 119 String usemap; -
trunk/WebCore/html/HTMLInputElement.cpp
r29098 r30243 1450 1450 } 1451 1451 1452 StringHTMLInputElement::src() const1452 KURL HTMLInputElement::src() const 1453 1453 { 1454 1454 return document()->completeURL(getAttribute(srcAttr)); -
trunk/WebCore/html/HTMLInputElement.h
r29204 r30243 31 31 32 32 class HTMLImageLoader; 33 class KURL; 33 34 class Selection; 34 35 … … 167 168 void setSize(unsigned); 168 169 169 Stringsrc() const;170 KURL src() const; 170 171 void setSrc(const String&); 171 172 -
trunk/WebCore/html/HTMLLinkElement.cpp
r30147 r30243 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 7 * Copyright (C) 2003 Apple Computer, Inc.5 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 22 20 * Boston, MA 02110-1301, USA. 23 21 */ 22 24 23 #include "config.h" 25 24 #include "HTMLLinkElement.h" … … 109 108 process(); 110 109 } else if (attr->name() == hrefAttr) { 111 m_url = document()->completeURL(parseURL(attr->value())) ;110 m_url = document()->completeURL(parseURL(attr->value())).string(); 112 111 process(); 113 112 } else if (attr->name() == typeAttr) { … … 139 138 // Tokenize the rel attribute and set bits based on specific keywords that we find. 140 139 rel.replace('\n', ' '); 141 Vector<String> list = rel.split(' '); 140 Vector<String> list; 141 rel.split(' ', list); 142 142 Vector<String>::const_iterator end = list.end(); 143 143 for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) { … … 275 275 } 276 276 277 StringHTMLLinkElement::href() const277 KURL HTMLLinkElement::href() const 278 278 { 279 279 return document()->completeURL(getAttribute(hrefAttr)); -
trunk/WebCore/html/HTMLLinkElement.h
r30147 r30243 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * Copyright (C) 2003 Apple Computer, Inc.4 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. 7 5 * 8 6 * This library is free software; you can redistribute it and/or … … 22 20 * 23 21 */ 22 24 23 #ifndef HTMLLinkElement_h 25 24 #define HTMLLinkElement_h 26 25 26 #include "CSSStyleSheet.h" 27 #include "CachedResourceClient.h" 27 28 #include "HTMLElement.h" 28 #include "CachedResourceClient.h"29 #include "CSSStyleSheet.h"30 29 31 30 namespace WebCore { 32 31 33 32 class CachedCSSStyleSheet; 33 class KURL; 34 34 35 class HTMLLinkElement : public HTMLElement, public CachedResourceClient 36 { 35 class HTMLLinkElement : public HTMLElement, public CachedResourceClient { 37 36 public: 38 37 HTMLLinkElement(Document*); … … 48 47 void setCharset(const String&); 49 48 50 Stringhref() const;49 KURL href() const; 51 50 void setHref(const String&); 52 51 -
trunk/WebCore/html/HTMLMediaElement.cpp
r30151 r30243 1 1 /* 2 * Copyright (C) 2007, 2008 Apple Inc. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 227 227 } 228 228 229 StringHTMLMediaElement::src() const229 KURL HTMLMediaElement::src() const 230 230 { 231 231 return document()->completeURL(getAttribute(srcAttr)); … … 820 820 continue; 821 821 } 822 mediaSrc = source->src() ;822 mediaSrc = source->src().string(); 823 823 break; 824 824 } … … 826 826 } 827 827 if (!mediaSrc.isEmpty()) 828 mediaSrc = document()->completeURL(mediaSrc) ;828 mediaSrc = document()->completeURL(mediaSrc).string(); 829 829 return mediaSrc; 830 830 } -
trunk/WebCore/html/HTMLMediaElement.h
r30043 r30243 38 38 class MediaError; 39 39 class TimeRanges; 40 class KURL; 40 41 41 42 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient { … … 72 73 73 74 // network state 74 Stringsrc() const;75 KURL src() const; 75 76 void setSrc(const String&); 76 77 String currentSrc() const; -
trunk/WebCore/html/HTMLObjectElement.cpp
r30112 r30243 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (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. 6 6 * Copyright (C) 2007 Trolltech ASA 7 7 * … … 261 261 bool HTMLObjectElement::isImageType() 262 262 { 263 if (m_serviceType.isEmpty() && m_url.startsWith("data:")) {263 if (m_serviceType.isEmpty() && protocolIs(m_url, "data")) { 264 264 // Extract the MIME type from the data URL. 265 265 int index = m_url.find(';'); … … 379 379 } 380 380 381 StringHTMLObjectElement::data() const381 KURL HTMLObjectElement::data() const 382 382 { 383 383 return document()->completeURL(getAttribute(dataAttr)); -
trunk/WebCore/html/HTMLObjectElement.h
r30112 r30243 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 * (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. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 30 30 31 31 class HTMLImageLoader; 32 class KURL; 32 33 33 34 class HTMLObjectElement : public HTMLPlugInElement { … … 80 81 void setCodeType(const String&); 81 82 82 Stringdata() const;83 KURL data() const; 83 84 void setData(const String&); 84 85 -
trunk/WebCore/html/HTMLOptGroupElement.cpp
r30112 r30243 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (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. 6 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 7 * … … 161 161 String HTMLOptGroupElement::groupLabelText() const 162 162 { 163 DeprecatedString itemText = getAttribute(labelAttr).deprecatedString();163 String itemText = getAttribute(labelAttr); 164 164 165 165 itemText.replace('\\', document()->backslashAsCurrencySymbol()); -
trunk/WebCore/html/HTMLParser.cpp
r30127 r30243 1478 1478 message.replace("%tag2", tag2); 1479 1479 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 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (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. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 22 20 * Boston, MA 02110-1301, USA. 23 21 */ 22 24 23 #include "config.h" 25 24 #include "HTMLScriptElement.h" … … 41 40 using namespace EventNames; 42 41 43 HTMLScriptElement::HTMLScriptElement(Document *doc)42 HTMLScriptElement::HTMLScriptElement(Document* doc) 44 43 : HTMLElement(scriptTag, doc) 45 44 , m_cachedScript(0) … … 55 54 } 56 55 57 bool HTMLScriptElement::isURLAttribute(Attribute *attr) const56 bool HTMLScriptElement::isURLAttribute(Attribute* attr) const 58 57 { 59 58 return attr->name() == srcAttr; … … 66 65 // we evaluate the script. 67 66 if (!m_createdByParser && inDocument() && firstChild()) 68 evaluateScript(document()->url() , text());67 evaluateScript(document()->url().string(), text()); 69 68 HTMLElement::childrenChanged(changedByParser); 70 69 } 71 70 72 void HTMLScriptElement::parseMappedAttribute(MappedAttribute *attr)71 void HTMLScriptElement::parseMappedAttribute(MappedAttribute* attr) 73 72 { 74 73 const QualifiedName& attrName = attr->name(); … … 140 139 String scriptString = text(); 141 140 if (!scriptString.isEmpty()) 142 evaluateScript(document()->url() , scriptString);141 evaluateScript(document()->url().string(), scriptString); 143 142 } 144 143 … … 155 154 void HTMLScriptElement::notifyFinished(CachedResource* o) 156 155 { 157 CachedScript *cs = static_cast<CachedScript*>(o);156 CachedScript* cs = static_cast<CachedScript*>(o); 158 157 159 158 ASSERT(cs == m_cachedScript); … … 246 245 String HTMLScriptElement::text() const 247 246 { 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()) { 251 250 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); 256 255 } 257 256 … … 266 265 } 267 266 268 if (numChildren > 0) {267 if (numChildren > 0) 269 268 removeChildren(); 270 }271 269 272 270 appendChild(document()->createTextNode(value.impl()), ec); … … 279 277 } 280 278 281 void HTMLScriptElement::setHtmlFor(const String &/*value*/)279 void HTMLScriptElement::setHtmlFor(const String& /*value*/) 282 280 { 283 281 // DOM Level 1 says: reserved for future use. … … 290 288 } 291 289 292 void HTMLScriptElement::setEvent(const String &/*value*/)290 void HTMLScriptElement::setEvent(const String& /*value*/) 293 291 { 294 292 // DOM Level 1 says: reserved for future use. … … 315 313 } 316 314 317 StringHTMLScriptElement::src() const315 KURL HTMLScriptElement::src() const 318 316 { 319 317 return document()->completeURL(getAttribute(srcAttr)); -
trunk/WebCore/html/HTMLScriptElement.h
r30112 r30243 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 * (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. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 70 70 void setDefer(bool); 71 71 72 Stringsrc() const;72 KURL src() const; 73 73 void setSrc(const String&); 74 74 -
trunk/WebCore/html/HTMLSourceElement.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #include "HTMLDocument.h" 32 32 #include "HTMLMediaElement.h" 33 #include "HTMLNames.h" 33 34 34 35 using namespace std; … … 57 58 } 58 59 59 StringHTMLSourceElement::src() const60 KURL HTMLSourceElement::src() const 60 61 { 61 62 return document()->completeURL(getAttribute(srcAttr)); -
trunk/WebCore/html/HTMLSourceElement.h
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 #include "HTMLElement.h" 32 #include "HTMLNames.h"33 32 #include <limits> 34 33 35 34 namespace WebCore { 36 35 37 using namespace HTMLNames; 38 39 class MediaError; 40 36 class KURL; 37 41 38 class HTMLSourceElement : public HTMLElement { 42 39 public: … … 49 46 virtual void insertedIntoDocument(); 50 47 51 Stringsrc() const;48 KURL src() const; 52 49 String media() const; 53 50 String type() const; -
trunk/WebCore/html/HTMLTableElement.cpp
r29647 r30243 352 352 String url = parseURL(attr->value()); 353 353 if (!url.isEmpty()) 354 addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url) );354 addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string()); 355 355 } else if (attr->name() == frameAttr) { 356 356 // Cache the value of "frame" so that the table can examine it later. -
trunk/WebCore/html/HTMLTablePartElement.cpp
r25754 r30243 67 67 String url = parseURL(attr->value()); 68 68 if (!url.isEmpty()) 69 addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url) );69 addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string()); 70 70 } else if (attr->name() == bordercolorAttr) { 71 71 if (!attr->value().isEmpty()) { -
trunk/WebCore/html/HTMLTextAreaElement.cpp
r30112 r30243 257 257 // Code elsewhere normalizes line endings added by the user via the keyboard or pasting. 258 258 // We must normalize line endings coming from JS. 259 DeprecatedString valueWithNormalizedLineEndings = value.deprecatedString();259 String valueWithNormalizedLineEndings = value; 260 260 valueWithNormalizedLineEndings.replace("\r\n", "\n"); 261 261 valueWithNormalizedLineEndings.replace("\r", "\n"); -
trunk/WebCore/html/HTMLTokenizer.cpp
r30127 r30243 511 511 return state; 512 512 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; 514 514 515 515 SegmentedString *savedPrependingSrc = currentPrependingSrc; … … 1221 1221 if (settings && settings->isJavaScriptEnabled()) { 1222 1222 if ((a = currToken.attrs->getAttributeItem(srcAttr))) 1223 scriptSrc = m_doc->completeURL(parseURL(a->value())) ;1223 scriptSrc = m_doc->completeURL(parseURL(a->value())).string(); 1224 1224 if ((a = currToken.attrs->getAttributeItem(charsetAttr))) 1225 1225 scriptSrcCharset = a->value().domString().stripWhiteSpace(); … … 1616 1616 if (dest > buffer) { 1617 1617 #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()); 1620 1620 ASSERT(0); 1621 1621 } … … 1637 1637 DeprecatedString name = currToken.tagName.deprecatedString(); 1638 1638 DeprecatedString text; 1639 if (currToken.text)1639 if (currToken.text) 1640 1640 text = DeprecatedConstString(currToken.text->unicode(), currToken.text->length()).deprecatedString(); 1641 1641 … … 1718 1718 // FIXME: this should really be done for all script loads or the same effect should be achieved by other 1719 1719 // means, like javascript suspend/resume 1720 m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded() && p endingScripts.head()->url().startsWith("file:", false);1720 m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded() && protocolIs(pendingScripts.head()->url(), "file"); 1721 1721 if (m_hasScriptsWaitingForStylesheets) 1722 1722 return; -
trunk/WebCore/html/HTMLVideoElement.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 84 84 } 85 85 86 void HTMLVideoElement::parseMappedAttribute(MappedAttribute *attr)86 void HTMLVideoElement::parseMappedAttribute(MappedAttribute* attr) 87 87 { 88 88 const QualifiedName& attrName = attr->name(); … … 141 141 } 142 142 143 StringHTMLVideoElement::poster() const143 KURL HTMLVideoElement::poster() const 144 144 { 145 145 return document()->completeURL(getAttribute(posterAttr)); … … 151 151 } 152 152 153 bool HTMLVideoElement::isURLAttribute(Attribute *attr) const153 bool HTMLVideoElement::isURLAttribute(Attribute* attr) const 154 154 { 155 155 return attr->name() == posterAttr; -
trunk/WebCore/html/HTMLVideoElement.h
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 59 59 int videoHeight() const; 60 60 61 Stringposter() const;61 KURL poster() const; 62 62 void setPoster(const String&); 63 63 -
trunk/WebCore/html/HTMLViewSourceDocument.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 25 25 #include "config.h" 26 #include "HTMLViewSourceDocument.h" 27 26 28 #include "DOMImplementation.h" 27 #include "HTMLViewSourceDocument.h"28 29 #include "HTMLTokenizer.h" 29 30 #include "HTMLHtmlElement.h" … … 39 40 #include "HTMLNames.h" 40 41 41 namespace WebCore 42 { 42 namespace WebCore { 43 43 44 44 using namespace HTMLNames; … … 249 249 250 250 // 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); 252 253 unsigned size = lines.size(); 253 254 for (unsigned i = 0; i < size; i++) { -
trunk/WebCore/loader/DocLoader.cpp
r29322 r30243 1 1 /* 2 This file is part of the KDE libraries3 4 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 5 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 6 4 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. 8 6 9 7 This library is free software; you can redistribute it and/or … … 66 64 { 67 65 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 69 71 if (m_cachePolicy == CachePolicyVerify) { 70 72 if (!m_reloadedURLs.contains(fullURL.string())) { … … 142 144 CachedResource* DocLoader::requestResource(CachedResource::Type type, const String& url, const String* charset, bool skipCanLoadCheck, bool sendResourceLoadCallbacks) 143 145 { 144 KURL fullURL = m_doc->completeURL(url .deprecatedString());146 KURL fullURL = m_doc->completeURL(url); 145 147 146 148 if (cache()->disabled()) { -
trunk/WebCore/loader/FTPDirectoryDocument.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "CharacterNames.h" 30 30 #include "CString.h" 31 #include "Element.h"32 31 #include "HTMLNames.h" 33 32 #include "HTMLTableElement.h" 34 #include "HTMLTableSectionElement.h"35 33 #include "HTMLTokenizer.h" 36 #include "KURL.h"37 34 #include "LocalizedStrings.h" 38 35 #include "Logging.h" … … 42 39 #include "SharedBuffer.h" 43 40 #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 #endif50 41 51 42 #if PLATFORM(QT) … … 61 52 class FTPDirectoryTokenizer : public HTMLTokenizer { 62 53 public: 63 FTPDirectoryTokenizer(HTMLDocument* doc);54 FTPDirectoryTokenizer(HTMLDocument*); 64 55 65 56 virtual bool write(const SegmentedString&, bool appendData); … … 150 141 ExceptionCode ec; 151 142 152 String fullURL = m_doc->baseURL() ;143 String fullURL = m_doc->baseURL().string(); 153 144 if (fullURL[fullURL.length() - 1] == '/') 154 145 fullURL.append(filename); … … 308 299 ListResult result; 309 300 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); 314 302 315 303 // 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 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Trolltech ASA 4 4 * … … 413 413 KURL scriptURL; 414 414 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(); 418 418 } else 419 419 url = completeURL(urlString); … … 473 473 // it's being added to the child list. It would be a good idea to 474 474 // create the child first, then invoke the loader separately. 475 if (url.isEmpty() || url == "about:blank") {475 if (url.isEmpty() || url == blankURL()) { 476 476 frame->loader()->completed(); 477 477 frame->loader()->checkCompleted(); … … 502 502 return; 503 503 504 DeprecatedString urlString = u.deprecatedString(); 505 if (urlString.startsWith("javascript:", false)) { 504 if (u.protocolIs("javascript")) { 506 505 m_isExecutingJavaScriptFormAction = true; 507 506 executeIfJavaScriptURL(u, false, false); … … 533 532 if (!query.isEmpty()) 534 533 query.append('&'); 535 u.setQuery( (query + body).deprecatedString());534 u.setQuery(query + body); 536 535 } 537 536 538 537 if (strcmp(action, "GET") == 0) { 539 u.setQuery(formData->flattenToString() .deprecatedString());538 u.setQuery(formData->flattenToString()); 540 539 } else { 541 540 if (!isMailtoForm) … … 650 649 // If this isn't a top level frame, return nothing 651 650 if (m_frame->tree() && m_frame->tree()->parent()) 652 return "";653 651 return KURL(); 652 654 653 // If we have an iconURL from a Link element, return that 655 654 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 658 657 // 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 662 661 KURL url; 663 662 url.setProtocol(m_URL.protocol()); … … 688 687 689 688 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()) 691 690 m_URL.setPath("/"); 692 691 m_workingURL = m_URL; … … 710 709 // implicitly precedes document.write. 711 710 cancelRedirection(); 712 if (m_frame->document()->url() != "about:blank")711 if (m_frame->document()->url() != blankURL()) 713 712 m_URL = m_frame->document()->url(); 714 713 } … … 716 715 bool FrameLoader::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument) 717 716 { 718 if (!url. deprecatedString().startsWith("javascript:", false))717 if (!url.protocolIs("javascript")) 719 718 return false; 720 719 721 String script = KURL::decode_string(url.deprecatedString().mid(strlen("javascript:")));720 String script = decodeURLEscapeSequences(url.string().substring(strlen("javascript:"))); 722 721 JSValue* result = executeScript(script, userGesture); 723 722 … … 860 859 url = m_URL.string(); 861 860 else 862 url = m_frame->document()->completeURL(url) ;861 url = m_frame->document()->completeURL(url).string(); 863 862 864 863 scheduleHTTPRedirection(delay, url); … … 898 897 899 898 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()); 903 902 m_outgoingReferrer = ref.string(); 904 903 m_URL = url; 905 KURL baseurl; 906 904 KURL baseURL; 907 905 if (!m_URL.isEmpty()) 908 base url= m_URL;906 baseURL = m_URL; 909 907 910 908 RefPtr<Document> document = DOMImplementation::instance()->createDocument(m_responseMIMEType, m_frame, m_frame->inViewSourceMode()); 911 909 m_frame->setDocument(document); 912 910 913 document->setURL(m_URL .deprecatedString());911 document->setURL(m_URL); 914 912 // We prefer m_baseURL over m_URL because m_URL changes when we are 915 913 // about to load a new page. 916 document->setBaseURL(base url.deprecatedString());914 document->setBaseURL(baseURL); 917 915 if (m_decoder) 918 916 document->setDecoder(m_decoder.get()); … … 1186 1184 { 1187 1185 // If our URL has no ref, then we have no place we need to jump to. 1188 // OTOH if csstarget was set previously, we want to set it to 0, recalc1186 // OTOH If CSS target was set previously, we want to set it to 0, recalc 1189 1187 // 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())); 1203 1199 } 1204 1200 … … 1327 1323 { 1328 1324 ASSERT(m_frame->document()); 1329 return m_frame->document()->completeURL(url) .deprecatedString();1325 return m_frame->document()->completeURL(url); 1330 1326 } 1331 1327 … … 1344 1340 // If the URL we're going to navigate to is the same as the current one, except for the 1345 1341 // 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)) { 1348 1344 changeLocation(url, referrer, lockHistory, wasUserGesture); 1349 1345 return; … … 1771 1767 // the right NPObjects. See <rdar://problem/5197041> for more information. 1772 1768 && !m_containsPlugIns 1773 && !m_URL.protocol ().startsWith("https")1769 && !m_URL.protocolIs("https") 1774 1770 && m_frame->document() 1775 1771 && !m_frame->document()->applets()->length() … … 1796 1792 setPolicyBaseURL(m_frame->tree()->parent()->document()->policyBaseURL()); 1797 1793 else 1798 setPolicyBaseURL(m_URL .string());1799 } 1800 1801 void FrameLoader::setPolicyBaseURL(const String& s)1794 setPolicyBaseURL(m_URL); 1795 } 1796 1797 void FrameLoader::setPolicyBaseURL(const KURL& url) 1802 1798 { 1803 1799 if (m_frame->document()) 1804 m_frame->document()->setPolicyBaseURL( s);1800 m_frame->document()->setPolicyBaseURL(url); 1805 1801 for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) 1806 child->loader()->setPolicyBaseURL( s);1802 child->loader()->setPolicyBaseURL(url); 1807 1803 } 1808 1804 … … 1848 1844 case ScheduledRedirection::locationChange: 1849 1845 case ScheduledRedirection::locationChangeDuringLoad: 1850 clientRedirected( m_scheduledRedirection->url.deprecatedString(),1846 clientRedirected(KURL(m_scheduledRedirection->url), 1851 1847 m_scheduledRedirection->delay, 1852 1848 currentTime() + m_redirectionTimer.nextFireInterval(), … … 1947 1943 1948 1944 ASSERT(frame()->document()); 1949 if (url. deprecatedString().startsWith("file:", false)) {1945 if (url.protocolIs("file")) { 1950 1946 if (!canLoad(url, frame()->document()) && !canLoad(url, referrer)) { 1951 1947 FrameLoader::reportLocalLoadFailed(m_frame->page(), url.string()); … … 2173 2169 bool FrameLoader::shouldHideReferrer(const KURL& url, const String& referrer) 2174 2170 { 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"); 2177 2173 2178 2174 if (!referrerIsWebURL) … … 2182 2178 return false; 2183 2179 2184 bool URLIsSecureURL = url. deprecatedString().startsWith("https:", false);2180 bool URLIsSecureURL = url.protocolIs("https"); 2185 2181 2186 2182 return !URLIsSecureURL; … … 2359 2355 // FIXME: this error message should contain more specifics of why the navigation change is not allowed. 2360 2356 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()); 2362 2358 2363 2359 if (KJS::Interpreter::shouldPrintExceptions()) … … 2559 2555 url = pdl->responseURL(); 2560 2556 if (url.isEmpty()) 2561 url = "about:blank";2557 url = blankURL(); 2562 2558 2563 2559 didOpenURL(url); … … 2749 2745 KURL url = cachedPage.url(); 2750 2746 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()) 2752 2748 url.setPath("/"); 2753 2749 … … 3827 3823 // See bug 3368236 and related bugs for more information. 3828 3824 if (url.isEmpty()) 3829 url = KURL("about:blank");3825 url = blankURL(); 3830 3826 if (originalURL.isEmpty()) 3831 originalURL = KURL("about:blank");3827 originalURL = blankURL(); 3832 3828 3833 3829 RefPtr<HistoryItem> item = new HistoryItem(url, m_frame->tree()->name(), m_frame->tree()->parent() ? m_frame->tree()->parent()->tree()->name() : "", docLoader ? docLoader->title() : ""); … … 4576 4572 4577 4573 if (baseURLString.isEmpty()) 4578 baseURLString = m_frame->document()->baseURL() ;4574 baseURLString = m_frame->document()->baseURL().string(); 4579 4575 KURL baseURL = completeURL(baseURLString); 4580 4576 … … 4793 4789 createDocument(m_responseMIMEType, m_frame, m_frame->inViewSourceMode()); 4794 4790 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); 4797 4793 if (m_decoder) 4798 4794 newDoc->setDecoder(m_decoder.get()); -
trunk/WebCore/loader/FrameLoader.h
r30001 r30243 479 479 480 480 void updatePolicyBaseURL(); 481 void setPolicyBaseURL(const String&);481 void setPolicyBaseURL(const KURL&); 482 482 483 483 // Also not cool. -
trunk/WebCore/loader/ImageDocument.cpp
r30170 r30243 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 168 168 imageElement->setAttribute(styleAttr, "-webkit-user-select: none"); 169 169 imageElement->setLoadManually(true); 170 imageElement->setSrc(url() );170 imageElement->setSrc(url().string()); 171 171 172 172 body->appendChild(imageElement, ec); -
trunk/WebCore/loader/PluginDocument.cpp
r29663 r30243 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 89 89 90 90 m_embedElement->setAttribute(nameAttr, "plugin"); 91 m_embedElement->setSrc(m_doc->url() );91 m_embedElement->setSrc(m_doc->url().string()); 92 92 m_embedElement->setType(m_doc->frame()->loader()->responseMIMEType()); 93 93 -
trunk/WebCore/loader/icon/IconDatabase.cpp
r29922 r30243 219 219 { 220 220 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. 225 223 // We should go our of our way to only copy it if we have to store it 226 224 227 if (!isOpen() )225 if (!isOpen() || pageURLOriginal.isEmpty()) 228 226 return defaultIcon(size); 229 227 -
trunk/WebCore/loader/icon/IconLoader.h
r29663 r30243 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #define IconLoader_h 28 28 29 #include "KURL.h"30 29 #include "SubresourceLoaderClient.h" 31 30 #include <memory> 31 #include <wtf/Forward.h> 32 32 #include <wtf/Noncopyable.h> 33 #include <wtf/ PassRefPtr.h>33 #include <wtf/RefPtr.h> 34 34 35 35 namespace WebCore { 36 36 37 37 class Frame; 38 class KURL; 38 39 class SharedBuffer; 39 40 -
trunk/WebCore/loader/loader.cpp
r28639 r30243 4 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 5 5 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. 7 7 8 8 This library is free software; you can redistribute it and/or … … 75 75 76 76 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()) 78 78 r.setPath("/"); 79 79 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 84 81 RefPtr<SubresourceLoader> loader = SubresourceLoader::create(dl->doc()->frame(), 85 82 this, request, req->shouldSkipCanLoadCheck(), req->sendResourceLoadCallbacks()); -
trunk/WebCore/loader/mac/LoaderNSURLExtras.m
r29663 r30243 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 4 4 * … … 215 215 if ([filename length] == 0 || [lastPathComponent isEqualToString:@"/"]) { 216 216 // lastPathComponent is no good, try the host. 217 NSString *host = (NSString *)(KURL(url).host());217 NSString *host = KURL(url).host(); 218 218 filename = filenameByFixingIllegalCharacters(host); 219 219 if ([filename length] == 0) { -
trunk/WebCore/page/ContextMenuController.cpp
r29958 r30243 44 44 #include "HitTestResult.h" 45 45 #include "InspectorController.h" 46 #include "KURL.h"47 46 #include "MouseEvent.h" 48 47 #include "Node.h" -
trunk/WebCore/page/mac/EventHandlerMac.mm
r28888 r30243 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "BlockExceptions.h" 30 30 #include "ClipboardMac.h" 31 #include "Cursor.h"32 #include "Document.h"33 #include "DragController.h"34 31 #include "EventNames.h" 35 #include "FloatPoint.h"36 32 #include "FocusController.h" 37 #include "FoundationExtras.h"38 33 #include "FrameLoader.h" 39 34 #include "Frame.h" 40 #include "FrameTree.h"41 35 #include "FrameView.h" 42 #include "HTMLFrameOwnerElement.h"43 #include "HTMLFrameSetElement.h"44 #include "HitTestRequest.h"45 #include "HitTestResult.h"46 36 #include "KeyboardEvent.h" 47 37 #include "MouseEventWithHitTestResults.h" … … 149 139 150 140 // 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")) 152 142 return true; 153 143 Settings* settings = m_frame->settings(); -
trunk/WebCore/page/mac/WebCoreFrameBridge.mm
r30024 r30243 1 1 /* 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov (ap@nypop.com) 4 4 * Copyright (C) 2006 David Smith (catfish.man@gmail.com) … … 628 628 - (NSURL *)URLWithAttributeString:(NSString *)string 629 629 { 630 Document *doc = m_frame->document();630 Document* doc = m_frame->document(); 631 631 if (!doc) 632 632 return nil; 633 633 // FIXME: is parseURL appropriate here? 634 DeprecatedString rel = parseURL(string).deprecatedString(); 635 return KURL(doc->completeURL(rel)).getNSURL(); 634 return doc->completeURL(parseURL(string)); 636 635 } 637 636 … … 748 747 - (NSURL *)baseURL 749 748 { 750 return m_frame-> loader()->completeURL(m_frame->document()->baseURL()).getNSURL();749 return m_frame->document()->baseURL(); 751 750 } 752 751 -
trunk/WebCore/platform/KURL.cpp
r30075 r30243 29 29 #include "CString.h" 30 30 #include "PlatformString.h" 31 #include "RegularExpression.h"32 31 #include "TextEncoding.h" 33 #include <wtf/Vector.h> 32 34 33 #if USE(ICU_UNICODE) 35 34 #include <unicode/uidna.h> … … 43 42 namespace WebCore { 44 43 44 typedef Vector<char, 512> CharBuffer; 45 typedef 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 45 51 enum URLCharacterClasses { 46 52 // alpha … … 67 73 PathSegmentEndChar = 1 << 5, 68 74 69 // digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f"70 HexDigitChar = 1 << 6,71 72 75 // not allowed in path 73 BadChar = 1 << 7 74 76 BadChar = 1 << 6 75 77 }; 76 78 … … 79 81 static const unsigned char characterClassTable[256] = { 80 82 /* 0 nul */ PathSegmentEndChar, /* 1 soh */ BadChar, 81 /* 2 stx */ BadChar, /* 3 etx */ BadChar, 83 /* 2 stx */ BadChar, /* 3 etx */ BadChar, 82 84 /* 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, 84 86 /* 12 np */ BadChar, /* 13 cr */ BadChar, /* 14 so */ BadChar, /* 15 si */ BadChar, 85 87 /* 16 dle */ BadChar, /* 17 dc1 */ BadChar, /* 18 dc2 */ BadChar, /* 19 dc3 */ BadChar, … … 88 90 /* 28 fs */ BadChar, /* 29 gs */ BadChar, /* 30 rs */ BadChar, /* 31 us */ BadChar, 89 91 /* 32 sp */ BadChar, /* 33 ! */ UserInfoChar, 90 /* 34 " */ BadChar, /* 35 # */ PathSegmentEndChar | BadChar, 92 /* 34 " */ BadChar, /* 35 # */ PathSegmentEndChar | BadChar, 91 93 /* 36 $ */ UserInfoChar, /* 37 % */ UserInfoChar | HostnameChar | IPv6Char | BadChar, 92 94 /* 38 & */ UserInfoChar, /* 39 ' */ UserInfoChar, 93 /* 40 ( */ UserInfoChar, /* 41 ) */ UserInfoChar, 95 /* 40 ( */ UserInfoChar, /* 41 ) */ UserInfoChar, 94 96 /* 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, 98 100 /* 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, 109 111 /* 58 : */ UserInfoChar | IPv6Char, /* 59 ; */ UserInfoChar, 110 112 /* 60 < */ BadChar, /* 61 = */ UserInfoChar, 111 113 /* 62 > */ BadChar, /* 63 ? */ PathSegmentEndChar | BadChar, 112 114 /* 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, 119 121 /* 71 G */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar, 120 122 /* 72 H */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar, … … 142 144 /* 95 _ */ UserInfoChar | HostnameChar, 143 145 /* 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, 150 152 /* 103 g */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar, 151 153 /* 104 h */ SchemeFirstChar | SchemeChar | UserInfoChar | HostnameChar, … … 205 207 206 208 static 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; } 209 static void encodeRelativeString(const String& rel, const TextEncoding&, CharBuffer& ouput); 210 static String substituteBackslashes(const String&); 211 212 static inline bool isSchemeFirstChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & SchemeFirstChar; } 213 static inline bool isSchemeFirstChar(UChar c) { return c <= 0xff && (characterClassTable[c] & SchemeFirstChar); } 214 static inline bool isSchemeChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & SchemeChar; } 215 static inline bool isSchemeChar(UChar c) { return c <= 0xff && (characterClassTable[c] & SchemeChar); } 212 216 static inline bool isUserInfoChar(unsigned char c) { return characterClassTable[c] & UserInfoChar; } 213 217 static inline bool isHostnameChar(unsigned char c) { return characterClassTable[c] & HostnameChar; } 214 218 static inline bool isIPv6Char(unsigned char c) { return characterClassTable[c] & IPv6Char; } 215 static inline bool isPathSegmentEndChar(unsigned char c) { return characterClassTable[c] & PathSegmentEndChar; } 219 static inline bool isPathSegmentEndChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & PathSegmentEndChar; } 220 static inline bool isPathSegmentEndChar(UChar c) { return c <= 0xff && (characterClassTable[c] & PathSegmentEndChar); } 216 221 static 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 223 static inline int hexDigitValue(UChar c) 224 { 225 ASSERT(isASCIIHexDigit(c)); 222 226 if (c < 'A') 223 227 return c - '0'; … … 225 229 } 226 230 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. 234 static 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. 244 static 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 227 256 // KURL 228 257 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 258 inline bool KURL::protocolIs(const String& string, const char* protocol) 259 { 260 return WebCore::protocolIs(string, protocol); 261 } 262 263 KURL::KURL() 264 : m_isValid(false) 265 { 266 } 267 268 KURL::KURL(const char* url) 269 { 270 if (!url || url[0] != '/') { 247 271 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 286 KURL::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 305 KURL::KURL(const KURL& base, const String& relative) 267 306 { 268 307 init(base, relative, UTF8Encoding()); 269 308 } 270 309 271 KURL::KURL(const KURL& base, const DeprecatedString& relative, const TextEncoding& encoding)310 KURL::KURL(const KURL& base, const String& relative, const TextEncoding& encoding) 272 311 { 273 312 init(base, relative, encoding); 274 313 } 275 314 276 void KURL::init(const KURL &base, const DeprecatedString &relative, const TextEncoding& encoding)315 void KURL::init(const KURL& base, const String& relative, const TextEncoding& encoding) 277 316 { 278 317 // Allow at least absolute URLs to resolve against an empty URL. 279 318 if (!base.m_isValid && !base.isEmpty()) { 319 m_string = relative; 280 320 m_isValid = false; 281 321 return; 282 322 } 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; 297 336 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(); 300 342 } else { 301 strBuffer = encodeRelativeString(base, rel, encoding);302 str = strBuffer;303 }304 305 // workaround for sites that put leading whitespace whitespace on306 // 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. 308 350 while (*str == ' ') { 351 originalString = 0; 309 352 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'; 327 360 } 328 361 … … 332 365 // scheme, meaning that it will have a colon before the first 333 366 // non-scheme element. 334 const char *p = str; 367 bool absolute = false; 368 char* p = str; 335 369 if (isSchemeFirstChar(*p)) { 336 370 ++p; … … 339 373 } 340 374 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()) { 342 376 str = p + 1; 343 else 377 originalString = 0; 378 } else 344 379 absolute = true; 345 380 } … … 347 382 348 383 if (absolute) { 349 parse(str, (allASCII && !strippedStart && (charsToChopOffEnd == 0)) ? &rel : 0);384 parse(str, originalString); 350 385 } else { 351 386 // If the base is empty or opaque (e.g. data: or javascript:), then the URL is invalid 352 387 // unless the relative URL is a single fragment. 353 388 if (!base.isHierarchical()) { 354 if (str[0] == '#') {355 DeprecatedString newURL = base.urlString.left(base.queryEndPos) + str;356 parse(newURL.ascii(), &newURL);357 } else389 if (str[0] == '#') 390 parse(base.m_string.left(base.queryEndPos) + str); 391 else { 392 m_string = relative; 358 393 m_isValid = false; 359 360 if (strBuffer) 361 fastFree(strBuffer); 394 } 362 395 return; 363 396 } 364 397 365 switch (str[0]) {398 switch (str[0]) { 366 399 case '\0': 367 400 // the reference must be empty - the RFC says this is a 368 401 // reference to the same document 369 { 370 *this = base; 371 break; 372 } 402 *this = base; 403 break; 373 404 case '#': 374 405 // 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; 380 408 case '?': 381 409 // 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; 387 412 case '/': 388 413 // 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); 400 420 } 421 break; 401 422 default: 402 423 { … … 404 425 405 426 // 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 410 431 // 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) 415 441 *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 422 447 // go back to the last slash 423 while (baseStringEnd > baseStringStart && baseStringEnd[-1] != '/') {448 while (baseStringEnd > baseStringStart && baseStringEnd[-1] != '/') 424 449 baseStringEnd--; 425 } 426 450 427 451 if (baseStringEnd == baseStringStart) { 428 452 // 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 != '#') 430 454 *bufferPos++ = '/'; 431 }432 455 } else { 433 456 bufferPos += copyPathRemovingDots(bufferPos, baseStringStart, 0, baseStringEnd - baseStringStart); 434 457 } 435 458 436 const char *relStringStart = str;437 const char *relStringPos = relStringStart;438 459 const char* relStringStart = str; 460 const char* relStringPos = relStringStart; 461 439 462 while (*relStringPos != '\0' && *relStringPos != '?' && *relStringPos != '#') { 440 463 if (relStringPos[0] == '.' && bufferPos[-1] == '/') { … … 442 465 // skip over "." segment 443 466 relStringPos += 1; 444 if (relStringPos[0] == '/') {467 if (relStringPos[0] == '/') 445 468 relStringPos++; 446 }447 469 continue; 448 470 } else if (relStringPos[1] == '.' && isPathSegmentEndChar(relStringPos[2])) { … … 452 474 // relies on this. 453 475 relStringPos += 2; 454 if (relStringPos[0] == '/') {476 if (relStringPos[0] == '/') 455 477 relStringPos++; 456 } 457 if (bufferPos > bufferPathStart + 1) { 478 if (bufferPos > bufferPathStart + 1) 458 479 bufferPos--; 459 } 460 while (bufferPos > bufferPathStart + 1 && bufferPos[-1] != '/') { 480 while (bufferPos > bufferPathStart + 1 && bufferPos[-1] != '/') 461 481 bufferPos--; 462 }463 482 continue; 464 483 } 465 484 } 466 485 467 486 *bufferPos = *relStringPos; 468 487 relStringPos++; … … 475 494 476 495 parse(buffer.data(), 0); 477 496 478 497 ASSERT(strlen(buffer.data()) + 1 <= buffer.size()); 479 498 break; … … 481 500 } 482 501 } 483 484 if (strBuffer) {485 fastFree(strBuffer);486 }487 502 } 488 503 … … 492 507 } 493 508 494 DeprecatedString KURL::lastPathComponent() const509 String KURL::lastPathComponent() const 495 510 { 496 511 if (!hasPath()) 497 return DeprecatedString();512 return String(); 498 513 499 514 int end = pathEndPos - 1; 500 if ( urlString[end] == '/')515 if (m_string[end] == '/') 501 516 --end; 502 517 503 int start = urlString.findRev('/', end);518 int start = m_string.reverseFind('/', end); 504 519 if (start < portEndPos) 505 return DeprecatedString();520 return String(); 506 521 ++start; 507 522 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 526 String KURL::protocol() const 527 { 528 if (!m_isValid) 529 return String(); 530 531 return m_string.left(schemeEndPos); 532 } 533 534 String 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 543 unsigned 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 557 String 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 568 String KURL::user() const 569 { 570 if (!m_isValid) 571 return String(); 572 573 return decodeURLEscapeSequences(m_string.substring(userStartPos, userEndPos - userStartPos)); 574 } 575 576 String 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 584 bool KURL::hasRef() const 585 { 586 return m_isValid && fragmentEndPos != queryEndPos; 587 } 588 589 static 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 600 bool 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 613 String KURL::query() const 614 { 615 if (!m_isValid) 616 return String(); 617 618 return m_string.substring(pathEndPos, queryEndPos - pathEndPos); 619 } 620 621 String KURL::path() const 622 { 623 if (!m_isValid) 624 return String(); 625 626 return decodeURLEscapeSequences(m_string.substring(portEndPos, pathEndPos - portEndPos)); 627 } 628 629 void KURL::setProtocol(const String& s) 512 630 { 513 631 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); 607 633 return; 608 634 } 609 635 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 639 void 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)); 623 648 } 624 649 625 650 void KURL::setPort(unsigned short i) 626 651 { 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 661 void 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 672 void 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 694 void 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 716 void KURL::setRef(const String& s) 717 { 718 if (!m_isValid) 719 return; 720 parse(m_string.left(queryEndPos) + (s.isEmpty() ? "" : "#" + s)); 721 } 722 723 void 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 735 void 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 743 String 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; 730 754 731 755 if (hostEndPos != passwordEndPos) { 732 756 if (userEndPos != userStartPos) { 733 a uthority += user();734 authority += "@";735 } 736 a uthority += host();757 append(authority, user()); 758 authority.append('@'); 759 } 760 append(authority, host()); 737 761 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()); 750 778 751 779 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 787 String decodeURLEscapeSequences(const String& str) 788 { 789 return decodeURLEscapeSequences(str, UTF8Encoding()); 790 } 791 792 String decodeURLEscapeSequences(const String& str, const TextEncoding& encoding) 793 { 794 Vector<UChar> result; 795 796 CharBuffer buffer; 797 798 int length = str.length(); 770 799 int decodedPosition = 0; 771 800 int searchPosition = 0; 772 801 int encodedRunPosition; 773 while ((encodedRunPosition = urlString.find('%', searchPosition)) >= 0) {802 while ((encodedRunPosition = str.find('%', searchPosition)) >= 0) { 774 803 // Find the sequence of %-escape codes. 775 804 int encodedRunEnd = encodedRunPosition; 776 805 while (length - encodedRunEnd >= 3 777 && urlString[encodedRunEnd] == '%'778 && is HexDigit(urlString[encodedRunEnd + 1].latin1())779 && is HexDigit(urlString[encodedRunEnd + 2].latin1()))806 && str[encodedRunEnd] == '%' 807 && isASCIIHexDigit(str[encodedRunEnd + 1]) 808 && isASCIIHexDigit(str[encodedRunEnd + 2])) 780 809 encodedRunEnd += 3; 781 810 if (encodedRunEnd == encodedRunPosition) { … … 785 814 searchPosition = encodedRunEnd; 786 815 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 793 816 // 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) { 797 822 *p++ = (hexDigitValue(q[1]) << 4) | hexDigitValue(q[2]); 798 823 q += 3; … … 805 830 806 831 // 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()); 809 834 decodedPosition = encodedRunEnd; 810 835 } 811 836 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); 814 840 } 815 841 … … 820 846 // read the contents of the clipboard on a drag, even without a drop. 821 847 // 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 851 static 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; 831 857 while (str < strEnd) { 832 858 unsigned char c = *str++; … … 843 869 } 844 870 } 845 871 846 872 buffer = p; 847 873 } 848 874 849 875 // 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;876 static int copyPathRemovingDots(char* dst, const char* src, int srcStart, int srcEnd) 877 { 878 char* bufferPathStart = dst; 853 879 854 880 // empty path is a special case, and need not have a leading slash 855 881 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; 859 885 860 886 // this code is unprepared for paths that do not begin with a … … 905 931 } 906 932 907 static inline bool hasSlashDotOrDotDot(const char *str)908 { 909 const unsigned char *p = reinterpret_cast<const unsigned char*>(str);933 static inline bool hasSlashDotOrDotDot(const char* str) 934 { 935 const unsigned char* p = reinterpret_cast<const unsigned char*>(str); 910 936 if (!*p) 911 937 return false; … … 924 950 } 925 951 926 void KURL::parse(const char *url, const DeprecatedString *originalString) 952 void 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 961 void KURL::parse(const char* url, const String* originalString) 927 962 { 928 963 m_isValid = true; … … 930 965 if (!url || url[0] == '\0') { 931 966 // valid URL must be non-empty 967 m_string = originalString ? *originalString : url; 932 968 m_isValid = false; 933 urlString = url;934 969 return; 935 970 } … … 937 972 if (!isSchemeFirstChar(url[0])) { 938 973 // scheme must start with an alphabetic character 974 m_string = originalString ? *originalString : url; 939 975 m_isValid = false; 940 urlString = url;941 976 return; 942 977 } … … 949 984 950 985 if (url[schemeEnd] != ':') { 986 m_string = originalString ? *originalString : url; 951 987 m_isValid = false; 952 urlString = url;953 988 return; 954 989 } … … 968 1003 // part after the scheme must be a net_path, parse the authority section 969 1004 970 // FIXME: authority characters may be scanned twice1005 // FIXME: Authority characters may be scanned twice. 971 1006 userStart += 2; 972 1007 userEnd = userStart; … … 979 1014 userEnd++; 980 1015 } 981 1016 982 1017 if (url[userEnd] == '@') { 983 1018 // actual end of the userinfo, start on the host … … 999 1034 } else { 1000 1035 // invalid character 1036 m_string = originalString ? *originalString : url; 1001 1037 m_isValid = false; 1002 urlString = url;1003 1038 return; 1004 1039 } … … 1016 1051 } else { 1017 1052 // invalid character 1053 m_string = originalString ? *originalString : url; 1018 1054 m_isValid = false; 1019 urlString = url;1020 1055 return; 1021 1056 } … … 1040 1075 if (!isPathSegmentEndChar(url[portEnd])) { 1041 1076 // invalid character 1077 m_string = originalString ? *originalString : url; 1042 1078 m_isValid = false; 1043 urlString = url;1044 1079 return; 1045 1080 } … … 1051 1086 portStart = portEnd = hostEnd; 1052 1087 } 1053 1088 1054 1089 int pathStart = portEnd; 1055 1090 int pathEnd = pathStart; … … 1062 1097 while (url[pathEnd] != '\0' && url[pathEnd] != '?' && url[pathEnd] != '#') 1063 1098 pathEnd++; 1064 1099 1065 1100 queryStart = pathEnd; 1066 1101 queryEnd = queryStart; … … 1069 1104 queryEnd++; 1070 1105 } 1071 1106 1072 1107 fragmentStart = queryEnd; 1073 1108 fragmentEnd = fragmentStart; … … 1077 1112 while (url[fragmentEnd] != '\0') 1078 1113 fragmentEnd++; 1079 } 1114 } 1080 1115 } 1081 1116 else { … … 1083 1118 pathEnd++; 1084 1119 } 1085 1120 1086 1121 queryStart = pathEnd; 1087 1122 queryEnd = queryStart; … … 1091 1126 } 1092 1127 } 1093 1128 1094 1129 fragmentStart = queryEnd; 1095 1130 fragmentEnd = fragmentStart; … … 1112 1147 // copy in the scheme 1113 1148 const char *schemeEndPtr = url + schemeEnd; 1114 while (strPtr < schemeEndPtr) {1149 while (strPtr < schemeEndPtr) 1115 1150 *p++ = *strPtr++; 1116 }1117 1151 schemeEndPos = p - buffer.data(); 1118 1152 … … 1141 1175 && matchLetter(url[3], 'e') 1142 1176 && url[4] == ':'; 1143 1177 1144 1178 // File URLs need a host part unless it is just file:// or file://localhost 1145 1179 bool degenFilePath = pathStart == pathEnd 1146 1180 && (hostStart == hostEnd 1147 1181 || hostIsLocalHost); 1148 1182 1149 1183 bool haveNonHostAuthorityPart = userStart != userEnd || passwordStart != passwordEnd || portStart != portEnd; 1150 1184 … … 1169 1203 // copy in the user 1170 1204 strPtr = url + userStart; 1171 const char *userEndPtr = url + userEnd;1172 while (strPtr < userEndPtr) {1205 const char* userEndPtr = url + userEnd; 1206 while (strPtr < userEndPtr) 1173 1207 *p++ = *strPtr++; 1174 }1175 1208 userEndPos = p - buffer.data(); 1176 1209 1177 1210 // copy in the password 1178 1211 if (passwordEnd != passwordStart) { 1179 1212 *p++ = ':'; 1180 1213 strPtr = url + passwordStart; 1181 const char *passwordEndPtr = url + passwordEnd;1182 while (strPtr < passwordEndPtr) {1214 const char* passwordEndPtr = url + passwordEnd; 1215 while (strPtr < passwordEndPtr) 1183 1216 *p++ = *strPtr++; 1184 }1185 1217 } 1186 1218 passwordEndPos = p - buffer.data(); 1187 1219 1188 1220 // If we had any user info, add "@" 1189 if (p - buffer.data() != userStartPos) {1221 if (p - buffer.data() != userStartPos) 1190 1222 *p++ = '@'; 1191 } 1192 1223 1193 1224 // copy in the host, except in the case of a file URL with authority="localhost" 1194 1225 if (!(isFile && hostIsLocalHost && !haveNonHostAuthorityPart)) { 1195 1226 strPtr = url + hostStart; 1196 const char *hostEndPtr = url + hostEnd;1197 while (strPtr < hostEndPtr) {1227 const char* hostEndPtr = url + hostEnd; 1228 while (strPtr < hostEndPtr) 1198 1229 *p++ = *strPtr++; 1199 }1200 1230 } 1201 1231 hostEndPos = p - buffer.data(); 1202 1232 1203 1233 // copy in the port 1204 1234 if (hostEnd != portStart) { … … 1206 1236 strPtr = url + portStart; 1207 1237 const char *portEndPtr = url + portEnd; 1208 while (strPtr < portEndPtr) {1238 while (strPtr < portEndPtr) 1209 1239 *p++ = *strPtr++; 1210 }1211 1240 } 1212 1241 portEndPos = p - buffer.data(); … … 1217 1246 // For canonicalization, ensure we have a '/' for no path. 1218 1247 // Only do this for http and https. 1219 if (isHTTPorHTTPS && pathEnd - pathStart == 0) {1248 if (isHTTPorHTTPS && pathEnd - pathStart == 0) 1220 1249 *p++ = '/'; 1221 } 1222 1250 1223 1251 // add path, escaping bad characters 1224 1225 1252 if (hierarchical && hasSlashDotOrDotDot(url)) { 1226 Vector<char, 4096>path_buffer(pathEnd - pathStart + 1);1253 CharBuffer path_buffer(pathEnd - pathStart + 1); 1227 1254 copyPathRemovingDots(path_buffer.data(), url, pathStart, pathEnd); 1228 1255 appendEscapingBadChars(p, path_buffer.data(), strlen(path_buffer.data())); … … 1231 1258 1232 1259 pathEndPos = p - buffer.data(); 1233 1234 1260 1235 1261 // add query, escaping bad characters 1236 1262 appendEscapingBadChars(p, url + queryStart, queryEnd - queryStart); 1237 1263 queryEndPos = p - buffer.data(); 1238 1264 1239 1265 // add fragment, escaping bad characters 1240 1266 if (fragmentEnd != queryEnd) { … … 1244 1270 fragmentEndPos = p - buffer.data(); 1245 1271 1272 ASSERT(p - buffer.data() <= (int)buffer.size()); 1273 1246 1274 // 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); 1260 1280 } 1261 1281 1262 1282 bool equalIgnoringRef(const KURL& a, const KURL& b) 1263 1283 { 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 1293 String 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(); 1276 1302 while (str < strEnd) { 1277 1303 unsigned char c = *str++; … … 1283 1309 *p++ = c; 1284 1310 } 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. 1319 static void appendEncodedHostname(UCharBuffer& buffer, const UChar* str, unsigned strLen) 1294 1320 { 1295 1321 // Needs to be big enough to hold an IDN-encoded name. … … 1297 1323 const unsigned hostnameBufferLength = 2048; 1298 1324 1299 if (s .isAllASCII() || s.length() > hostnameBufferLength)1300 return s;1325 if (strLen > hostnameBufferLength || charactersAreAllASCII(str, strLen)) 1326 buffer.append(str, strLen); 1301 1327 1302 1328 #if USE(ICU_UNICODE) 1303 UChar buffer[hostnameBufferLength];1329 UChar hostnameBuffer[hostnameBufferLength]; 1304 1330 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); 1311 1335 #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()); 1314 1338 #endif 1315 1339 } 1316 1340 1317 static Vector<pair<int, int> > findHostnamesInMailToURL(const DeprecatedString &s)1341 static void findHostnamesInMailToURL(const UChar* str, int strLen, Vector<pair<int, int> >& nameRanges) 1318 1342 { 1319 1343 // In a mailto: URL, host names come after a '@' character and end with a '>' or ',' or '?' or end of string character. … … 1321 1345 // When we find a '?' character, we are past the part of the URL that contains host names. 1322 1346 1323 Vector<pair<int, int> > a;1347 nameRanges.clear(); 1324 1348 1325 1349 int p = 0; 1326 1350 while (1) { 1327 1351 // 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]; 1333 1356 p = hostnameOrStringStart + 1; 1334 1357 1335 if (c == '?') { 1336 return a; 1337 } 1338 1358 if (c == '?') 1359 return; 1360 1339 1361 if (c == '@') { 1340 1362 // Find end of host name. 1341 1363 int hostnameStart = p; 1342 int hostnameEnd = s.find(RegularExpression("[>,?]"), p);1364 int hostnameEnd = findFirstOf(str, strLen, p, ">,?"); 1343 1365 bool done; 1344 1366 if (hostnameEnd == -1) { 1345 hostnameEnd = s .length();1367 hostnameEnd = strLen; 1346 1368 done = true; 1347 1369 } else { … … 1350 1372 } 1351 1373 1352 a.append(make_pair(hostnameStart, hostnameEnd));1374 nameRanges.append(make_pair(hostnameStart, hostnameEnd)); 1353 1375 1354 1376 if (done) 1355 return a;1377 return; 1356 1378 } else { 1357 1379 // Skip quoted string. 1358 1380 ASSERT(c == '"'); 1359 1381 while (1) { 1360 int escapedCharacterOrStringEnd = s.find(RegularExpression("[\"\\]"), p);1382 int escapedCharacterOrStringEnd = findFirstOf(str, strLen, p, "\"\\"); 1361 1383 if (escapedCharacterOrStringEnd == -1) 1362 return a;1363 1364 c = s [escapedCharacterOrStringEnd];1384 return; 1385 1386 c = str[escapedCharacterOrStringEnd]; 1365 1387 p = escapedCharacterOrStringEnd + 1; 1366 1388 1367 1389 // If we are the end of the string, then break from the string loop back to the host name loop. 1368 1390 if (c == '"') 1369 1391 break; 1370 1392 1371 1393 // Skip escaped character. 1372 1394 ASSERT(c == '\\'); 1373 if (p == st atic_cast<int>(s.length()))1374 return a;1395 if (p == strLen) 1396 return; 1375 1397 1376 1398 ++p; … … 1380 1402 } 1381 1403 1382 static bool findHostnameInHierarchicalURL(const DeprecatedString &s, int &startOffset, int &endOffset)1404 static bool findHostnameInHierarchicalURL(const UChar* str, int strLen, int& startOffset, int& endOffset) 1383 1405 { 1384 1406 // 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. 1387 1410 // 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] != '/') 1390 1414 return false; 1391 }1392 1415 1393 1416 // Check that all characters before the :// are valid scheme characters. 1394 if (!isSchemeFirstChar(s [0].latin1())) {1417 if (!isSchemeFirstChar(str[0])) 1395 1418 return false; 1396 }1397 1419 for (int i = 1; i < separator; ++i) { 1398 if (!isSchemeChar(s [i].latin1())) {1420 if (!isSchemeChar(str[i])) 1399 1421 return false; 1400 }1401 1422 } 1402 1423 … … 1405 1426 1406 1427 // 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)) { 1412 1432 hostnameEnd = i; 1413 1433 break; … … 1416 1436 1417 1437 // Find "@" for the start of the host name. 1418 int userInfoTerminator = s.find('@', authorityStart);1438 int userInfoTerminator = findFirstOf(str, strLen, authorityStart, "@"); 1419 1439 int hostnameStart; 1420 if (userInfoTerminator == -1 || userInfoTerminator > hostnameEnd) {1440 if (userInfoTerminator == -1 || userInfoTerminator > hostnameEnd) 1421 1441 hostnameStart = authorityStart; 1422 } else {1442 else 1423 1443 hostnameStart = userInfoTerminator + 1; 1424 }1425 1444 1426 1445 startOffset = hostnameStart; … … 1429 1448 } 1430 1449 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. 1452 static 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); 1435 1459 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); 1448 1470 } else { 1449 1471 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 1483 static void encodeRelativeString(const String& rel, const TextEncoding& encoding, CharBuffer& output) 1484 { 1485 UCharBuffer s; 1486 encodeHostnames(rel, s); 1462 1487 1463 1488 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 1466 1491 int pathEnd = -1; 1467 1492 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 1470 1497 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()); 1476 1501 } 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 1512 static String substituteBackslashes(const String& string) 1492 1513 { 1493 1514 int questionPos = string.find('?'); 1494 1515 int hashPos = string.find('#'); 1495 unsignedpathEnd;1496 1497 if (hashPos >= 0 && (questionPos < 0 || questionPos > hashPos)) {1516 int pathEnd; 1517 1518 if (hashPos >= 0 && (questionPos < 0 || questionPos > hashPos)) 1498 1519 pathEnd = hashPos; 1499 } else if (questionPos >= 0) {1520 else if (questionPos >= 0) 1500 1521 pathEnd = questionPos; 1501 } else {1522 else 1502 1523 pathEnd = string.length(); 1503 } 1504 1505 return string.left(pathEnd).replace('\\','/') + string.mid(pathEnd); 1524 1525 return string.left(pathEnd).replace('\\','/') + string.substring(pathEnd); 1506 1526 } 1507 1527 … … 1510 1530 if (!m_isValid) 1511 1531 return false; 1512 ASSERT(urlString[schemeEndPos] == ':'); 1513 return urlString[schemeEndPos + 1] == '/'; 1532 ASSERT(m_string[schemeEndPos] == ':'); 1533 return m_string[schemeEndPos + 1] == '/'; 1534 } 1535 1536 void 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 1544 bool 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 1556 const KURL& blankURL() 1557 { 1558 static KURL staticBlankURL("about:blank"); 1559 return staticBlankURL; 1514 1560 } 1515 1561 … … 1517 1563 void KURL::print() const 1518 1564 { 1519 printf("%s\n", urlString.ascii());1565 printf("%s\n", m_string.utf8().data()); 1520 1566 } 1521 1567 #endif -
trunk/WebCore/platform/KURL.h
r30078 r30243 1 1 /* 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. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #define KURL_h 28 28 29 #include "DeprecatedString.h"30 29 #include "PlatformString.h" 31 #include <wtf/Platform.h>32 30 33 31 #if PLATFORM(CF) 34 typedef const struct __CFURL 32 typedef const struct __CFURL* CFURLRef; 35 33 #endif 36 34 … … 42 40 #endif 43 41 #endif 42 44 43 #if PLATFORM(QT) 45 44 class QUrl; … … 48 47 namespace WebCore { 49 48 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&); 49 class TextEncoding; 57 50 58 51 class KURL { 59 52 public: 53 // Generates a URL which contains a null string. 60 54 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 65 147 #if PLATFORM(MAC) 66 148 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 71 155 #if PLATFORM(QT) 72 156 KURL(const QUrl&); 73 #endif74 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 #endif111 #if PLATFORM(MAC)112 NSURL *getNSURL() const;113 #endif114 #if PLATFORM(QT)115 157 operator QUrl() const; 116 158 #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 &);126 159 127 160 #ifndef NDEBUG … … 131 164 private: 132 165 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; 137 177 bool m_isValid; 138 178 int schemeEndPos; … … 145 185 int queryEndPos; 146 186 int fragmentEndPos; 147 148 friend bool equalIgnoringRef(const KURL& a, const KURL& b);149 187 }; 150 188 189 bool operator==(const KURL&, const KURL&); 190 bool operator==(const KURL&, const String&); 191 bool operator==(const String&, const KURL&); 192 bool operator!=(const KURL&, const KURL&); 193 bool operator!=(const KURL&, const String&); 194 bool operator!=(const String&, const KURL&); 195 196 bool equalIgnoringRef(const KURL&, const KURL&); 197 198 const KURL& blankURL(); 199 200 // Functions to do URL operations on strings. 201 // These are operations that aren't faster on a parsed URL. 202 203 bool 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! 208 String decodeURLEscapeSequences(const String&); 209 String decodeURLEscapeSequences(const String&, const TextEncoding&); 210 211 String encodeWithURLEscapeSequences(const String&); 212 213 // Inlines. 214 215 inline bool operator==(const KURL& a, const KURL& b) 216 { 217 return a.string() == b.string(); 218 } 219 220 inline bool operator==(const KURL& a, const String& b) 221 { 222 return a.string() == b; 223 } 224 225 inline bool operator==(const String& a, const KURL& b) 226 { 227 return a == b.string(); 228 } 229 230 inline bool operator!=(const KURL& a, const KURL& b) 231 { 232 return a.string() != b.string(); 233 } 234 235 inline bool operator!=(const KURL& a, const String& b) 236 { 237 return a.string() != b; 238 } 239 240 inline bool operator!=(const String& a, const KURL& b) 241 { 242 return a != b.string(); 243 } 244 151 245 } 152 246 -
trunk/WebCore/platform/cf/KURLCFNet.cpp
r30078 r30243 1 1 /* 2 * Copyright (C) 2004 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include <wtf/RetainPtr.h> 30 #include <wtf/Vector.h>31 30 #include <CoreFoundation/CFURL.h> 32 31 … … 37 36 KURL::KURL(CFURLRef url) 38 37 { 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); 56 60 } 57 61 58 62 CFURLRef KURL::createCFURL() const 59 63 { 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 61 71 // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components 62 72 // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which 63 73 // could either be a malformed string or bytes in a different encoding, like Shift-JIS, so we fall back 64 74 // 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); 66 76 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); 68 78 return result; 69 79 } … … 80 90 CFURLPathStyle pathStyle = kCFURLPOSIXPathStyle; 81 91 #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(); 85 93 } 86 94 -
trunk/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
r29861 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 164 164 165 165 // 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, 171 172 [NSNumber numberWithBool:YES], QTMoviePreventExternalURLLinksAttribute, 172 173 [NSNumber numberWithBool:YES], QTSecurityPolicyNoCrossSiteAttribute, … … 177 178 178 179 // FIXME: Find a proper way to detect streaming content. 179 m_isStreaming = url.startsWith("rtsp:");180 m_isStreaming = protocolIs(url, "rtsp"); 180 181 181 182 if (!m_qtMovie) -
trunk/WebCore/platform/mac/ClipboardMac.mm
r29805 r30243 1 1 /* 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #import "ClipboardMac.h" 28 28 29 #import "CachedImage.h"30 #import "Document.h"31 29 #import "DOMElementInternal.h" 32 30 #import "DragClient.h" 33 31 #import "DragController.h" 34 32 #import "Editor.h" 35 #import "EventHandler.h"36 #import "FloatRect.h"37 33 #import "FoundationExtras.h" 38 #import "Frame.h"39 #import "HTMLImageElement.h"40 34 #import "Image.h" 41 35 #import "Page.h" 42 36 #import "Pasteboard.h" 43 #import "Range.h"44 37 #import "RenderImage.h" 45 #import "WebCoreFrameBridge.h"46 38 #import "WebCoreSystemInterface.h" 47 48 @class WebArchive;49 39 50 40 namespace WebCore { … … 333 323 ASSERT(frame); 334 324 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); 336 326 } 337 327 -
trunk/WebCore/platform/mac/CookieJar.mm
r29566 r30243 1 1 /* 2 * Copyright (C) 2003, 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #import "CookieJar.h" 28 28 29 #import "BlockExceptions.h" 29 30 #import "KURL.h" 30 #import "BlockExceptions.h"31 #import "PlatformString.h"32 33 31 #import <wtf/RetainPtr.h> 34 32 35 33 #ifdef BUILDING_ON_TIGER 36 typedef unsigned intNSUInteger;34 typedef unsigned NSUInteger; 37 35 #endif 38 36 … … 43 41 BEGIN_BLOCK_OBJC_EXCEPTIONS; 44 42 45 NSURL *cookieURL = url .getNSURL();43 NSURL *cookieURL = url; 46 44 NSArray *cookiesForURL = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL]; 47 45 … … 71 69 return; 72 70 73 NSURL *cookieURL = url .getNSURL();71 NSURL *cookieURL = url; 74 72 75 73 // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034> … … 78 76 79 77 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]; 81 79 82 80 END_BLOCK_OBJC_EXCEPTIONS; -
trunk/WebCore/platform/mac/KURLMac.mm
r25085 r30243 1 1 /* 2 * Copyright (C) 2004 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #i nclude"config.h"26 #import "config.h" 27 27 #import "KURL.h" 28 28 29 29 #import "FoundationExtras.h" 30 #import <wtf/Assertions.h>31 #import <wtf/Vector.h>32 30 33 31 namespace WebCore { … … 35 33 KURL::KURL(NSURL *url) 36 34 { 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) { 53 36 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); 54 57 } 55 58 56 NSURL *KURL::getNSURL() const59 KURL::operator NSURL *() const 57 60 { 58 if ( urlString.isNull())61 if (isNull()) 59 62 return nil; 60 63 61 // CFURL can't hold an empty URL, unlike NSURL 64 // CFURL can't hold an empty URL, unlike NSURL. 62 65 if (isEmpty()) 63 66 return [NSURL URLWithString:@""]; -
trunk/WebCore/platform/mac/PasteboardMac.mm
r29663 r30243 211 211 ASSERT(!url.isEmpty()); 212 212 213 NSURL *cocoaURL = url .getNSURL();213 NSURL *cocoaURL = url; 214 214 NSString *userVisibleString = frame->editor()->client()->userVisibleString(cocoaURL); 215 215 … … 271 271 Frame* frame = node->document()->frame(); 272 272 273 NSURL *cocoaURL = url .getNSURL();273 NSURL *cocoaURL = url; 274 274 ASSERT(cocoaURL); 275 275 -
trunk/WebCore/platform/mac/SSLKeyGeneratorMac.mm
r16556 r30243 1 1 /* 2 * Copyright (C) 2003 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 47 47 return [[WebCoreKeyGenerator sharedGenerator] signedPublicKeyAndChallengeStringWithStrengthIndex:keySizeIndex 48 48 challenge:challengeString 49 pageURL:url .getNSURL()];49 pageURL:url]; 50 50 } 51 51 -
trunk/WebCore/platform/network/HTTPParsers.cpp
r29805 r30243 1 1 /* 2 2 * 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. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 104 104 String filenameFromHTTPContentDisposition(const String& value) 105 105 { 106 Vector<String> keyValuePairs = value.split(';'); 106 Vector<String> keyValuePairs; 107 value.split(';', keyValuePairs); 107 108 108 109 unsigned length = keyValuePairs.size(); -
trunk/WebCore/platform/network/ResourceHandle.cpp
r30122 r30243 1 1 /* 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 174 174 175 175 // 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")) 177 177 return true; 178 178 179 179 // 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")) 181 181 return true; 182 182 -
trunk/WebCore/platform/network/cf/ResourceErrorCF.cpp
r28691 r30243 121 121 RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString()); 122 122 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()); 124 124 CFDictionarySetValue(userInfo.get(), failingURLKey, url.get()); 125 125 } -
trunk/WebCore/platform/network/curl/ResourceHandleManager.cpp
r30145 r30243 173 173 String location = d->m_response.httpHeaderField("location"); 174 174 if (!location.isEmpty()) { 175 KURL newURL = KURL(job->request().url(), location .deprecatedString());175 KURL newURL = KURL(job->request().url(), location); 176 176 177 177 ResourceRequest redirectedRequest = job->request(); … … 464 464 static void parseDataUrl(ResourceHandle* handle) 465 465 { 466 DeprecatedString data = handle->request().url().deprecatedString();466 String data = handle->request().url().string(); 467 467 468 468 ASSERT(data.startsWith("data:", false)); 469 469 470 DeprecatedString header;470 String header; 471 471 bool base64 = false; 472 472 473 473 int index = data.find(','); 474 474 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); 477 477 478 478 if (header.endsWith(";base64")) { … … 481 481 } 482 482 } else 483 data = DeprecatedString();484 485 data = KURL::decode_string(data);483 data = String(); 484 485 data = decodeURLEscapeSequences(data); 486 486 487 487 if (base64 && !data.isEmpty()) { … … 490 490 #ifdef USE_GLIB_BASE64 491 491 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); 494 494 g_free(out); 495 495 #else 496 496 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()); 499 499 else 500 data = DeprecatedString();500 data = String(); 501 501 #endif 502 502 } … … 525 525 { 526 526 KURL kurl = job->request().url(); 527 String protocol = kurl.protocol(); 528 529 if (equalIgnoringCase(protocol, "data")) { 527 528 if (kurl.protocolIs("data")) { 530 529 parseDataUrl(job); 531 530 return; … … 536 535 537 536 ResourceHandleInternal* d = job->getInternal(); 538 DeprecatedString url = kurl.deprecatedString();537 String url = kurl.string(); 539 538 540 539 if (kurl.isLocalFile()) { 541 DeprecatedString query = kurl.query();540 String query = kurl.query(); 542 541 // Remove any query part sent to a local file. 543 542 if (!query.isEmpty()) 544 543 url = url.left(url.find(query)); 545 544 // 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)); 547 546 } 548 547 … … 569 568 // url must remain valid through the request 570 569 ASSERT(!d->m_url); 571 d->m_url = strdup(url. ascii());570 d->m_url = strdup(url.latin1().data()); 572 571 curl_easy_setopt(d->m_handle, CURLOPT_URL, d->m_url); 573 572 … … 612 611 if (ret && ret != CURLM_CALL_MULTI_PERFORM) { 613 612 #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()); 615 614 #endif 616 615 job->cancel(); -
trunk/WebCore/platform/network/mac/ResourceErrorMac.mm
r29663 r30243 1 1 // -*- mode: c++; c-basic-offset: 4 -*- 2 2 /* 3 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 26 26 27 27 #import "config.h" 28 #import "ResourceError.h" 29 28 30 #import "KURL.h" 29 #import "ResourceError.h"30 31 #import <Foundation/Foundation.h> 31 32 … … 64 65 65 66 if (!m_failingURL.isEmpty()) { 67 NSURL *cocoaURL = KURL(m_failingURL); 66 68 [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"]; 68 70 } 69 71 … … 75 77 76 78 } // namespace WebCore 77 -
trunk/WebCore/platform/network/mac/ResourceRequest.h
r29837 r30243 1 1 // -*- mode: c++; c-basic-offset: 4 -*- 2 2 /* 3 * Copyright (C) 2003, 2006 Apple Computer, Inc.All rights reserved.3 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 5 5 * … … 43 43 public: 44 44 ResourceRequest(const String& url) 45 : ResourceRequestBase(KURL(url .deprecatedString()), UseProtocolCachePolicy)45 : ResourceRequestBase(KURL(url), UseProtocolCachePolicy) 46 46 { 47 47 } -
trunk/WebCore/platform/network/mac/ResourceRequestMac.mm
r29663 r30243 76 76 77 77 if (nsRequest) 78 [nsRequest setURL:url() .getNSURL()];78 [nsRequest setURL:url()]; 79 79 else 80 nsRequest = [[NSMutableURLRequest alloc] initWithURL:url() .getNSURL()];80 nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()]; 81 81 82 82 wkSupportsMultipartXMixedReplace(nsRequest); … … 84 84 [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; 85 85 [nsRequest setTimeoutInterval:timeoutInterval()]; 86 [nsRequest setMainDocumentURL:mainDocumentURL() .getNSURL()];86 [nsRequest setMainDocumentURL:mainDocumentURL()]; 87 87 if (!httpMethod().isEmpty()) 88 88 [nsRequest setHTTPMethod:httpMethod()]; -
trunk/WebCore/platform/network/mac/ResourceResponseMac.mm
r29663 r30243 52 52 else 53 53 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]); 55 55 } 56 56 return m_nsResponse.get(); -
trunk/WebCore/platform/qt/ClipboardQt.cpp
r29663 r30243 259 259 260 260 QList<QUrl> urls; 261 urls.append( QUrl(frame->document()->completeURL(url.deprecatedString())));261 urls.append(frame->document()->completeURL(url.string())); 262 262 if (!m_writableData) 263 263 m_writableData = new QMimeData; -
trunk/WebCore/platform/text/CString.h
r30122 r30243 41 41 42 42 char* data() { return m_vector.data(); } 43 unsignedlength() const { return m_vector.size(); }43 size_t length() const { return m_vector.size(); } 44 44 45 45 private: -
trunk/WebCore/platform/text/PlatformString.h
r29805 r30243 133 133 static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2); 134 134 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; 137 139 138 140 int toInt(bool* ok = 0) const; … … 230 232 inline bool operator!(const String& str) { return str.isNull(); } 231 233 234 bool charactersAreAllASCII(const UChar*, size_t); 235 236 void append(Vector<UChar>&, const String&); 237 232 238 #ifdef __OBJC__ 233 239 // This is for situations in WebKit where the long standing behavior has been … … 237 243 #endif 238 244 245 inline 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 253 inline void append(Vector<UChar>& vector, const String& string) 254 { 255 vector.append(string.characters(), string.length()); 256 } 257 239 258 } 240 259 -
trunk/WebCore/platform/text/String.cpp
r29481 r30243 473 473 } 474 474 475 Vector<String> String::split(const String& separator, bool allowEmptyEntries) const476 { 477 Vector<String> result;478 475 void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const 476 { 477 result.clear(); 478 479 479 int startPos = 0; 480 480 int endPos; … … 484 484 startPos = endPos + separator.length(); 485 485 } 486 if (allowEmptyEntries || startPos != (int)length())486 if (allowEmptyEntries || startPos != static_cast<int>(length())) 487 487 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 490 void String::split(const String& separator, Vector<String>& result) const 491 { 492 return split(separator, false, result); 493 } 494 495 void 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 510 void String::split(UChar separator, Vector<String>& result) const 511 { 512 return split(String(&separator, 1), false, result); 497 513 } 498 514 -
trunk/WebCore/platform/win/BString.cpp
r27363 r30243 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "AtomicString.h" 30 30 #include "DeprecatedString.h" 31 #include "KURL.h" 31 32 #include "PlatformString.h" 32 33 #include <tchar.h> … … 66 67 else 67 68 m_bstr = SysAllocStringLen(s.characters(), s.length()); 69 } 70 71 BString::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()); 68 77 } 69 78 -
trunk/WebCore/platform/win/BString.h
r27363 r30243 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 class AtomicString; 38 38 class DeprecatedString; 39 class KURL; 39 40 class String; 40 41 … … 47 48 BString(const DeprecatedString&); 48 49 BString(const AtomicString&); 50 BString(const KURL&); 49 51 #if PLATFORM(CF) 50 52 BString(CFStringRef); -
trunk/WebCore/platform/win/ClipboardUtilitiesWin.cpp
r29663 r30243 175 175 176 176 // 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()); 181 181 startMarkup.append(markupUTF8.data()); 182 182 -
trunk/WebCore/platform/win/ClipboardWin.cpp
r29663 r30243 31 31 #include "csshelper.h" 32 32 #include "CString.h" 33 #include "DeprecatedString.h"34 33 #include "Document.h" 35 34 #include "DragData.h" … … 141 140 // the path. If we can't find it, or we're coming up with the name for a link 142 141 // we just use the entire url. 143 KURL kurl(url .deprecatedString());142 KURL kurl(url); 144 143 String lastComponent; 145 144 if (!isLink && !(lastComponent = kurl.lastPathComponent()).isEmpty()) { … … 227 226 228 227 if (url.isLocalFile()) { 229 DeprecatedString path = url.path();228 String localPath = url.path(); 230 229 // 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); 234 232 LPCTSTR localPathStr = localPath.charactersWithNullTermination(); 235 233 if (wcslen(localPathStr) + 1 < MAX_PATH) … … 504 502 } 505 503 506 bool ClipboardWin::setData(const String &type, const String &data)504 bool ClipboardWin::setData(const String& type, const String& data) 507 505 { 508 506 // FIXME: Need to be able to write to the system clipboard <rdar://problem/5015941> … … 514 512 515 513 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); 517 515 518 516 if (winType == ClipboardDataTypeText) { … … 720 718 ExceptionCode ec = 0; 721 719 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())); 723 722 if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE))) 724 723 ::GlobalFree(medium.hGlobal); -
trunk/WebCore/platform/win/PasteboardWin.cpp
r29663 r30243 117 117 if (::OpenClipboard(m_owner)) { 118 118 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())); 120 121 if (!::SetClipboardData(HTMLClipboardFormat, cbData)) 121 122 ::GlobalFree(cbData); -
trunk/WebCore/plugins/PluginStream.cpp
r30135 r30243 131 131 // Some plugins (Flash) expect that javascript URLs are passed back decoded as this is the 132 132 // 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()); 135 135 else 136 m_stream.url = strdup(responseURL. deprecatedString().utf8());136 m_stream.url = strdup(responseURL.string().utf8().data()); 137 137 138 138 CString mimeTypeStr = m_resourceResponse.mimeType().utf8(); … … 268 268 m_stream.url = 0; 269 269 } 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); 271 271 } 272 272 -
trunk/WebCore/plugins/win/PluginViewWin.cpp
r30218 r30243 209 209 static String scriptStringIfJavaScriptURL(const KURL& url) 210 210 { 211 if (!url. string().startsWith("javascript:", false))211 if (!url.protocolIs("javascript")) 212 212 return String(); 213 213 214 214 // This returns an unescaped string 215 return KURL::decode_string(url.deprecatedString().mid(11));215 return decodeURLEscapeSequences(url.string().substring(11)); 216 216 } 217 217 … … 879 879 KJS::JSLock::DropAllLocks dropAllLocks; 880 880 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()); 882 882 setCallingPlugin(false); 883 883 } … … 1565 1565 , m_isStarted(false) 1566 1566 , 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())) 1568 1568 , m_status(PluginStatusLoadedSuccessfully) 1569 1569 , m_requestTimer(this, &PluginView::requestTimerFired) -
trunk/WebCore/rendering/HitTestResult.cpp
r29663 r30243 1 1 /* 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. 5 3 * 6 4 * This library is free software; you can redistribute it and/or … … 24 22 #include "HitTestResult.h" 25 23 26 #include "CSSHelper.h"27 #include "Document.h"28 24 #include "Frame.h" 29 25 #include "FrameTree.h" 30 26 #include "HTMLAnchorElement.h" 31 #include "HTMLElement.h"32 27 #include "HTMLImageElement.h" 33 28 #include "HTMLInputElement.h" 34 29 #include "HTMLNames.h" 35 #include "KURL.h"36 30 #include "PlatformScrollBar.h" 37 31 #include "RenderImage.h" 38 #include "RenderObject.h"39 32 #include "SelectionController.h" 40 33 … … 242 235 return KURL(); 243 236 244 return KURL(m_innerNonSharedNode->document()->completeURL(parseURL(urlString).deprecatedString()));237 return m_innerNonSharedNode->document()->completeURL(parseURL(urlString)); 245 238 } 246 239 … … 260 253 return KURL(); 261 254 262 return KURL(m_innerURLElement->document()->completeURL(parseURL(urlString).deprecatedString()));255 return m_innerURLElement->document()->completeURL(parseURL(urlString)); 263 256 } 264 257 -
trunk/WebCore/rendering/RenderFrameSet.cpp
r25754 r30243 330 330 331 331 // If we still have some left over space we probably ended up with a remainder of 332 // a division. We can 332 // a division. We cannot spread it evenly anymore. If we have any percentage 333 333 // columns/rows simply spread the remainder equally over all available percentage columns, 334 334 // 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 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) … … 7 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 8 6 * (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. 10 8 * 11 9 * This library is free software; you can redistribute it and/or … … 226 224 227 225 if (!m_altText.isEmpty()) { 228 DeprecatedString text = m_altText.deprecatedString();226 String text = m_altText; 229 227 text.replace('\\', backslashAsCurrencySymbol()); 230 228 context->setFont(style()->font()); … … 237 235 // Only draw the alt text if it'll fit within the content box, 238 236 // 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()); 240 238 int textWidth = font.width(textRun); 241 239 if (errorPictureDrawn) { … … 268 266 { 269 267 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; 271 269 } 272 270 -
trunk/WebCore/rendering/RenderObject.cpp
r29647 r30243 1669 1669 } 1670 1670 1671 void RenderObject::addPDFURLRect(GraphicsContext* graphicsContext, IntRect rect) 1672 { 1671 void RenderObject::addPDFURLRect(GraphicsContext* context, const IntRect& rect) 1672 { 1673 if (rect.isEmpty()) 1674 return; 1673 1675 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); 1689 1682 } 1690 1683 -
trunk/WebCore/rendering/RenderObject.h
r29649 r30243 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 5 * (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. 7 7 * 8 8 * This library is free software; you can redistribute it and/or … … 489 489 void layoutIfNeeded() { if (needsLayout()) layout(); } 490 490 491 // used for element state updates that can 491 // used for element state updates that cannot be fixed with a 492 492 // repaint and do not need a relayout 493 493 virtual void updateFromElement() { } … … 672 672 IntRect paintingRootRect(IntRect& topLevelRect); 673 673 674 void addPDFURLRect(GraphicsContext*, IntRect);674 void addPDFURLRect(GraphicsContext*, const IntRect&); 675 675 676 676 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 /* 4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 6 4 * (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. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 23 21 * 24 22 */ 23 25 24 #include "config.h" 26 25 #include "RenderPartObject.h" 27 26 28 #include "Document.h"29 #include "EventHandler.h"30 27 #include "Frame.h" 31 28 #include "FrameLoader.h" … … 38 35 #include "HTMLObjectElement.h" 39 36 #include "HTMLParamElement.h" 40 #include "KURL.h"41 37 #include "MIMETypeRegistry.h" 42 38 #include "Page.h" 43 #include "RenderView.h"44 39 #include "Text.h" 45 40 … … 62 57 } 63 58 64 static bool isURLAllowed(Document *doc, const String &url) 65 { 66 KURL newURL(doc->completeURL(url.deprecatedString())); 67 newURL.setRef(DeprecatedString::null); 68 59 static bool isURLAllowed(Document* doc, const String& url) 60 { 69 61 if (doc->frame()->page()->frameCount() >= 200) 70 62 return false; … … 72 64 // We allow one level of self-reference because some sites depend on that. 73 65 // But we don't allow more than one. 66 KURL completeURL = doc->completeURL(url); 74 67 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)) { 79 70 if (foundSelfReference) 80 71 return false; … … 103 94 else if (classId.contains("6BF52A52-394A-11d3-B153-00C04F79FAA6")) 104 95 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) 107 98 serviceType = "application/x-activex-handler"; 108 // TODO: add more plugins here99 } 109 100 } 110 101 … … 140 131 if (embed) { 141 132 embedOrObject = (HTMLElement *)embed; 142 url = embed->url ;143 serviceType = embed-> m_serviceType;133 url = embed->url(); 134 serviceType = embed->serviceType(); 144 135 } else 145 136 embedOrObject = (HTMLElement *)o; … … 232 223 HTMLEmbedElement *o = static_cast<HTMLEmbedElement*>(element()); 233 224 o->setNeedWidgetUpdate(false); 234 url = o->url ;235 serviceType = o-> m_serviceType;225 url = o->url(); 226 serviceType = o->serviceType(); 236 227 237 228 if (url.isEmpty() && serviceType.isEmpty()) -
trunk/WebCore/rendering/RenderText.cpp
r29483 r30243 43 43 namespace WebCore { 44 44 45 // FIXME: Move to StringImpl.h eventually. 45 46 static inline bool charactersAreAllASCII(StringImpl* text) 46 47 { 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()); 53 49 } 54 50 -
trunk/WebCore/rendering/SVGRenderSupport.cpp
r29663 r30243 1 /** 2 * This file is part of the DOM implementation for WebKit. 3 * 1 /* 4 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> 5 3 * (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> … … 139 137 svgContainer->setDrawsContents(true); 140 138 139 item->layoutIfNeeded(); 141 140 item->paint(info, 0, 0); 142 141 -
trunk/WebCore/rendering/SVGRenderTreeAsText.h
r29663 r30243 29 29 #if ENABLE(SVG) 30 30 31 #include "DeprecatedString.h"32 31 #include "TextStream.h" 33 32 -
trunk/WebCore/svg/SVGImageLoader.cpp
r28639 r30243 52 52 CachedImage *newImage = 0; 53 53 if (!imageElement->href().isEmpty()) { 54 DeprecatedString uri = imageElement->baseURI().deprecatedString();54 KURL uri = imageElement->baseURI(); 55 55 if (!uri.isEmpty()) 56 uri = KURL(uri, imageElement->href() .deprecatedString()).deprecatedString();56 uri = KURL(uri, imageElement->href()); 57 57 else 58 uri = imageElement->href().deprecatedString();59 newImage = doc->docLoader()->requestImage(uri );58 uri = KURL(imageElement->href()); 59 newImage = doc->docLoader()->requestImage(uri.string()); 60 60 } 61 61 62 CachedImage *oldImage = image();62 CachedImage* oldImage = image(); 63 63 if (newImage != oldImage) { 64 64 setLoadingImage(newImage); -
trunk/WebCore/svg/graphics/SVGImage.cpp
r29663 r30243 1 1 /* 2 2 * Copyright (C) 2006 Eric Seidel (eric@webkit.org) 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 26 27 #include "config.h" 27 28 #if ENABLE(SVG) 29 #include "SVGImage.h" 28 30 29 31 #include "CachedPage.h" … … 40 42 #include "ResourceError.h" 41 43 #include "SVGDocument.h" 42 #include "SVGImage.h"43 44 #include "SVGLength.h" 44 45 #include "SVGRenderSupport.h" … … 139 140 context->translate(dstRect.location().x(), dstRect.location().y()); 140 141 context->scale(FloatSize(dstRect.width()/srcRect.width(), dstRect.height()/srcRect.height())); 142 143 if (m_frame->view()->needsLayout()) 144 m_frame->view()->layout(); 141 145 m_frame->paint(context, enclosingIntRect(srcRect)); 146 142 147 context->restore(); 143 148 … … 198 203 m_frame->loader()->commitProvisionalLoad(0); 199 204 m_frame->loader()->setResponseMIMEType("image/svg+xml"); 200 m_frame->loader()->begin( "placeholder.svg"); // create the empty document205 m_frame->loader()->begin(KURL()); // create the empty document 201 206 m_frame->loader()->write(m_data->data(), m_data->size()); 202 207 m_frame->loader()->end(); -
trunk/WebCore/xml/XMLHttpRequest.cpp
r30122 r30243 1 1 /* 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. 4 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 5 4 * Copyright (C) 2007 Julien Chaffraix <julien.chaffraix@gmail.com> … … 24 23 25 24 #include "CString.h" 26 #include "Cache.h"27 25 #include "DOMImplementation.h" 28 26 #include "Event.h" … … 30 28 #include "EventListener.h" 31 29 #include "EventNames.h" 32 #include "ExceptionCode.h"33 #include "FormData.h"34 30 #include "Frame.h" 35 31 #include "FrameLoader.h" 36 #include "HTMLDocument.h"37 32 #include "HTTPParsers.h" 38 33 #include "Page.h" 39 #include "PlatformString.h"40 #include "RegularExpression.h"41 #include "ResourceHandle.h"42 #include "ResourceRequest.h"43 34 #include "Settings.h" 44 35 #include "SubresourceLoader.h" 45 #include "TextEncoding.h"46 36 #include "TextResourceDecoder.h" 47 37 #include "XMLHttpRequestException.h" 48 38 #include "kjs_binding.h" 49 #include <kjs/protect.h>50 #include <wtf/Vector.h>51 39 52 40 namespace WebCore { … … 174 162 m_responseXML = m_doc->implementation()->createDocument(0); 175 163 m_responseXML->open(); 176 m_responseXML->setURL(m_url .deprecatedString());164 m_responseXML->setURL(m_url); 177 165 // FIXME: set Last-Modified and cookies (currently, those are only available for HTMLDocuments). 178 166 m_responseXML->write(String(m_responseText)); … … 323 311 324 312 // 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()); 326 314 if (documentURL.protocol().lower() == url.protocol().lower() 327 315 && documentURL.host().lower() == url.host().lower() … … 373 361 || methodUpper == "OPTIONS" || methodUpper == "POST" || methodUpper == "PROPFIND" || methodUpper == "PROPPATCH" || methodUpper == "PUT" 374 362 || methodUpper == "UNLOCK") 375 m_method = methodUpper .deprecatedString();363 m_method = methodUpper; 376 364 else 377 m_method = method .deprecatedString();365 m_method = method; 378 366 379 367 m_async = async; … … 385 373 { 386 374 KURL urlWithCredentials(url); 387 urlWithCredentials.setUser(user .deprecatedString());375 urlWithCredentials.setUser(user); 388 376 389 377 open(method, urlWithCredentials, async, ec); … … 393 381 { 394 382 KURL urlWithCredentials(url); 395 urlWithCredentials.setUser(user .deprecatedString());396 urlWithCredentials.setPass(password .deprecatedString());383 urlWithCredentials.setUser(user); 384 urlWithCredentials.setPass(password); 397 385 398 386 open(method, urlWithCredentials, async, ec); … … 473 461 { 474 462 KJS::JSLock lock; 475 gcProtectNullTolerant( KJS::ScriptInterpreter::getDOMObject(this));463 gcProtectNullTolerant(ScriptInterpreter::getDOMObject(this)); 476 464 } 477 465 … … 508 496 { 509 497 KJS::JSLock lock; 510 KJS::JSValue* wrapper = KJS::ScriptInterpreter::getDOMObject(this);498 KJS::JSValue* wrapper = ScriptInterpreter::getDOMObject(this); 511 499 KJS::gcUnprotectNullTolerant(wrapper); 512 500 -
trunk/WebCore/xml/XMLHttpRequest.h
r29073 r30243 1 // -*- c-basic-offset: 2 -*-2 1 /* 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. 5 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> 6 4 * … … 24 22 25 23 #include "EventTarget.h" 26 #include "HTTPHeaderMap.h"27 #include "KURL.h"28 #include "PlatformString.h"29 24 #include "ResourceResponse.h" 30 #include "StringHash.h"31 25 #include "SubresourceLoaderClient.h" 32 #include <kjs/ustring.h>33 34 #include <wtf/HashMap.h>35 #include <wtf/Vector.h>36 26 37 27 namespace WebCore { 38 28 29 class Document; 39 30 class TextResourceDecoder; 40 class Document;41 class Event;42 class EventListener;43 class String;44 45 typedef int ExceptionCode;46 31 47 32 // these exact numeric values are important because JS expects them … … 129 114 130 115 KURL m_url; 131 DeprecatedString m_method;116 String m_method; 132 117 HTTPHeaderMap m_requestHeaders; 133 118 String m_mimeTypeOverride; -
trunk/WebCore/xml/XSLImportRule.cpp
r28639 r30243 1 /* *1 /* 2 2 * This file is part of the XSL implementation. 3 3 * 4 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.4 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 89 89 if (!parentSheet->href().isNull()) 90 90 // 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(); 92 92 93 93 // Check for a cycle in our import chain. If we encounter a stylesheet -
trunk/WebCore/xml/XSLStyleSheet.cpp
r27302 r30243 1 /* *1 /* 2 2 * This file is part of the XSL implementation. 3 3 * 4 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.4 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 191 191 if (IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "import")) { 192 192 xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar*)"href", XSLT_NAMESPACE); 193 loadChildSheet( DeprecatedString::fromUtf8((const char*)uriRef));193 loadChildSheet(String::fromUTF8((const char*)uriRef)); 194 194 xmlFree(uriRef); 195 195 } else … … 202 202 if (curr->type == XML_ELEMENT_NODE && IS_XSLT_ELEM(curr) && IS_XSLT_NAME(curr, "include")) { 203 203 xmlChar* uriRef = xsltGetNsProp(curr, (const xmlChar*)"href", XSLT_NAMESPACE); 204 loadChildSheet( DeprecatedString::fromUtf8((const char*)uriRef));204 loadChildSheet(String::fromUTF8((const char*)uriRef)); 205 205 xmlFree(uriRef); 206 206 } … … 210 210 } 211 211 212 void XSLStyleSheet::loadChildSheet(const DeprecatedString& href)212 void XSLStyleSheet::loadChildSheet(const String& href) 213 213 { 214 214 RefPtr<XSLImportRule> childRule = new XSLImportRule(this, href); -
trunk/WebCore/xml/XSLStyleSheet.h
r25754 r30243 2 2 * This file is part of the XSL implementation. 3 3 * 4 * Copyright (C) 2004, 2006 Apple Computer, Inc.4 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 52 52 53 53 void loadChildSheets(); 54 void loadChildSheet(const DeprecatedString& href);54 void loadChildSheet(const String& href); 55 55 56 56 xsltStylesheetPtr compileStyleSheet(); -
trunk/WebCore/xml/XSLTProcessor.cpp
r29905 r30243 1 /* *1 /* 2 2 * This file is part of the XSL implementation. 3 3 * 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple, Inc.4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple, Inc. All rights reserved. 5 5 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@webkit.org> 6 6 * … … 113 113 xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt; 114 114 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)); 116 116 xmlFree(base); 117 117 ResourceError error; … … 294 294 { 295 295 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()); 297 298 cachedStylesheet->parseString(createMarkup(stylesheetRootNode)); 298 299 } … … 313 314 sourceDoc = (xmlDocPtr)ownerDocument->transformSource(); 314 315 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()); 316 318 shouldDelete = (sourceDoc != 0); 317 319 } -
trunk/WebKit/gtk/ChangeLog
r30228 r30243 1 2008-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 1 6 2008-02-14 Holger Hans Peter Freyther <zecke@selfish.org> 2 7 -
trunk/WebKit/gtk/webkit/webkitwebframe.cpp
r30227 r30243 364 364 365 365 // 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)); 367 367 coreFrame->loader()->load(ResourceRequest(KURL(string))); 368 368 } -
trunk/WebKit/gtk/webkit/webkitwebview.cpp
r30226 r30243 1475 1475 1476 1476 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)))); 1479 1478 } 1480 1479 … … 1493 1492 Frame* frame = core(webView)->mainFrame(); 1494 1493 1495 KURL url(baseUri ? DeprecatedString::fromUtf8(baseUri) : "");1494 KURL url(baseUri ? String::fromUTF8(baseUri) : ""); 1496 1495 RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(strdup(content), strlen(content)); 1497 1496 SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : "text/html", contentEncoding ? String(contentEncoding) : "UTF-8", KURL("about:blank"), url); -
trunk/WebKit/mac/ChangeLog
r30239 r30243 1 2008-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 1 47 2008-02-14 Stephanie Lewis <slewis@apple.com> 2 48 -
trunk/WebKit/mac/History/WebHistoryItem.mm
r25275 r30243 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 465 465 ASSERT_MAIN_THREAD(); 466 466 KURL url = core(_private)->url(); 467 return url.isEmpty() ? nil : url.getNSURL(); 467 if (url.isEmpty()) 468 return nil; 469 return url; 468 470 } 469 471 -
trunk/WebKit/mac/Misc/WebElementDictionary.mm
r29663 r30243 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 #import "WebView.h" 37 37 #import "WebViewPrivate.h" 38 39 #import <WebKit/DOMCore.h>40 #import <WebKit/DOMExtensions.h>41 38 #import <WebCore/Frame.h> 42 39 #import <WebCore/HitTestResult.h> … … 44 41 #import <WebCore/KURL.h> 45 42 #import <WebCore/WebCoreObjCExtras.h> 43 #import <WebKit/DOMCore.h> 44 #import <WebKit/DOMExtensions.h> 46 45 47 46 using namespace WebCore; … … 206 205 - (NSURL *)_absoluteImageURL 207 206 { 208 return _result->absoluteImageURL() .getNSURL();207 return _result->absoluteImageURL(); 209 208 } 210 209 … … 221 220 - (NSURL *)_absoluteLinkURL 222 221 { 223 return _result->absoluteLinkURL() .getNSURL();222 return _result->absoluteLinkURL(); 224 223 } 225 224 -
trunk/WebKit/mac/Misc/WebNSAttributedStringExtras.mm
r29250 r30243 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 95 95 const AtomicString& attr = e->getAttribute(srcAttr); 96 96 if (!attr.isEmpty()) { 97 NSURL *URL = KURL(e->document()->completeURL(attr.deprecatedString())).getNSURL();97 NSURL *URL = e->document()->completeURL(attr); 98 98 wrapper = [[kit(e->document()->frame()) _dataSource] _fileWrapperForURL:URL]; 99 99 } … … 423 423 // will have corrected any illegally nested <a> elements. 424 424 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))); 429 426 NSRange tempRange = { linkStartLocation, [result length]-linkStartLocation }; // workaround for 4213314 430 427 [result addAttribute:NSLinkAttributeName value:URL range:tempRange]; -
trunk/WebKit/mac/Misc/WebNSURLExtras.mm
r26676 r30243 1 1 /* 2 * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 4 4 * … … 803 803 - (NSString *)_webkit_stringByReplacingValidPercentEscapes 804 804 { 805 DeprecatedString s = KURL::decode_string(DeprecatedString::fromNSString(self)); 806 return s.getNSString(); 805 return decodeURLEscapeSequences(self); 807 806 } 808 807 -
trunk/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm
r25396 r30243 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 296 296 void WebContextMenuClient::downloadURL(const KURL& url) 297 297 { 298 [m_webView _downloadURL:url .getNSURL()];298 [m_webView _downloadURL:url]; 299 299 } 300 300 -
trunk/WebKit/mac/WebCoreSupport/WebDragClient.mm
r29663 r30243 1 1 /* 2 * Copyright (C) 2007 Apple Inc.All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 122 122 if (!frame) 123 123 return nil; 124 WebHTMLView * htmlView = (WebHTMLView*)[[kit(frame) frameView] documentView];124 WebHTMLView *htmlView = (WebHTMLView *)[[kit(frame) frameView] documentView]; 125 125 NSString *label = 0; 126 126 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]; 129 130 } 130 131 -
trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r28672 r30243 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 427 427 } 428 428 429 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& URL, double delay, double fireDate)429 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& url, double delay, double fireDate) 430 430 { 431 431 WebView *webView = getWebView(m_webFrame.get()); 432 432 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 } 435 437 } 436 438 … … 678 680 { 679 681 // 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()]; 681 683 682 684 setOriginalURLForDownload(download, request); … … 716 718 void WebFrameLoaderClient::updateGlobalHistoryForStandardLoad(const KURL& url) 717 719 { 718 NSURL * nsurl = url.getNSURL();719 WebHistoryItem *entry = [[WebHistory optionalSharedHistory] addItemForURL: nsurl];720 NSURL *cocoaURL = url; 721 WebHistoryItem *entry = [[WebHistory optionalSharedHistory] addItemForURL:cocoaURL]; 720 722 String pageTitle = core(m_webFrame.get())->loader()->documentLoader()->title(); 721 723 if (pageTitle.length()) … … 728 730 { 729 731 WebHistory *sharedHistory = [WebHistory optionalSharedHistory]; 730 WebHistoryItem *item = [sharedHistory itemForURL:url .getNSURL()];732 WebHistoryItem *item = [sharedHistory itemForURL:url]; 731 733 if (item) 732 734 [sharedHistory setLastVisitedTimeInterval:[NSDate timeIntervalSinceReferenceDate] forItem:item]; … … 743 745 ResourceError WebFrameLoaderClient::cancelledError(const ResourceRequest& request) 744 746 { 745 return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url() .getNSURL()];747 return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled URL:request.url()]; 746 748 } 747 749 748 750 ResourceError WebFrameLoaderClient::blockedError(const ResourceRequest& request) 749 751 { 750 return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotUseRestrictedPort URL:request.url() .getNSURL()];752 return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotUseRestrictedPort URL:request.url()]; 751 753 } 752 754 753 755 ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest& request) 754 756 { 755 return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotShowURL URL:request.url() .getNSURL()];757 return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorCannotShowURL URL:request.url()]; 756 758 } 757 759 758 760 ResourceError WebFrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest& request) 759 761 { 760 return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorFrameLoadInterruptedByPolicyChange URL:request.url() .getNSURL()];762 return [NSError _webKitErrorWithDomain:WebKitErrorDomain code:WebKitErrorFrameLoadInterruptedByPolicyChange URL:request.url()]; 761 763 } 762 764 763 765 ResourceError WebFrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& response) 764 766 { 765 return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:WebKitErrorCannotShowMIMEType URL:response.url() .getNSURL()];767 return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:WebKitErrorCannotShowMIMEType URL:response.url()]; 766 768 } 767 769 768 770 ResourceError WebFrameLoaderClient::fileDoesNotExistError(const ResourceResponse& response) 769 771 { 770 return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist URL:response.url() .getNSURL()];772 return [NSError _webKitErrorWithDomain:NSURLErrorDomain code:NSURLErrorFileDoesNotExist URL:response.url()]; 771 773 } 772 774 … … 791 793 if (!canUseArchivedResource(request.nsURLRequest())) 792 794 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]; 794 796 if (!resource) 795 797 return false; … … 943 945 void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL) 944 946 { 945 NSURL* nsURL = canonicalURL(URL .getNSURL());947 NSURL* nsURL = canonicalURL(URL); 946 948 if(!nsURL) 947 949 return; … … 1115 1117 modifierFlags |= NSCommandKeyMask; 1116 1118 } 1119 NSURL *originalURL = action.url(); 1117 1120 if (const MouseEvent* mouseEvent = findMouseEvent(event)) { 1118 1121 IntPoint point(mouseEvent->pageX(), mouseEvent->pageY()); … … 1124 1127 [NSNumber numberWithInt:mouseEvent->button()], WebActionButtonKey, 1125 1128 [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey, 1126 action.url().getNSURL(), WebActionOriginalURLKey,1129 originalURL, WebActionOriginalURLKey, 1127 1130 nil]; 1128 1131 [element release]; … … 1132 1135 [NSNumber numberWithInt:action.type()], WebActionNavigationTypeKey, 1133 1136 [NSNumber numberWithInt:modifierFlags], WebActionModifierFlagsKey, 1134 action.url().getNSURL(), WebActionOriginalURLKey,1137 originalURL, WebActionOriginalURLKey, 1135 1138 nil]; 1136 1139 } … … 1149 1152 1150 1153 return [bridge createChildFrameNamed:name 1151 withURL:url .getNSURL()1154 withURL:url 1152 1155 referrer:referrer 1153 1156 ownerElement:ownerElement … … 1164 1167 WebFrameBridge* bridge = m_webFrame->_private->bridge; 1165 1168 BEGIN_BLOCK_OBJC_EXCEPTIONS; 1166 return [bridge determineObjectFromMIMEType:mimeType URL:url .getNSURL()];1169 return [bridge determineObjectFromMIMEType:mimeType URL:url]; 1167 1170 END_BLOCK_OBJC_EXCEPTIONS; 1168 1171 return ObjectContentNone; … … 1185 1188 BEGIN_BLOCK_OBJC_EXCEPTIONS; 1186 1189 return new Widget([bridge viewForPluginWithFrame:NSMakeRect(0, 0, size.width(), size.height()) 1187 URL:url .getNSURL()1190 URL:url 1188 1191 attributeNames:nsArray(paramNames) 1189 1192 attributeValues:nsArray(paramValues) … … 1213 1216 attributeNames:nsArray(paramNames) 1214 1217 attributeValues:nsArray(paramValues) 1215 baseURL:baseURL .getNSURL()1218 baseURL:baseURL 1216 1219 DOMElement:[DOMElement _wrapElement:element]]); 1217 1220 END_BLOCK_OBJC_EXCEPTIONS; -
trunk/WebKit/mac/WebView/WebDataSource.mm
r28639 r30243 1 1 /* 2 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 320 320 - (NSURL *)_URL 321 321 { 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; 324 326 } 325 327 … … 383 385 loader->ref(); 384 386 385 LOG(Loading, "creating datasource for %@", _private->loader->request().url().getNSURL());387 LOG(Loading, "creating datasource for %@", static_cast<NSURL *>(_private->loader->request().url())); 386 388 387 389 ++WebDataSourceCount; … … 477 479 - (NSURL *)unreachableURL 478 480 { 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; 481 485 } 482 486 -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r30005 r30243 1 1 /* 2 * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * (C) 2006, 2007 Graham Dennis (graham.dennis@gmail.com) 4 4 * … … 3111 3111 KURL imageURL = page->dragController()->draggingImageURL(); 3112 3112 ASSERT(!imageURL.isEmpty()); 3113 draggingImageURL = imageURL .getNSURL();3113 draggingImageURL = imageURL; 3114 3114 3115 3115 wrapper = [[self _dataSource] _fileWrapperForURL:draggingImageURL]; -
trunk/WebKit/win/ChangeLog
r30230 r30243 1 2008-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 1 29 2008-02-14 Alexey Proskuryakov <ap@webkit.org> 2 30 -
trunk/WebKit/win/MarshallingHelpers.cpp
r28639 r30243 43 43 KURL MarshallingHelpers::BSTRToKURL(BSTR urlStr) 44 44 { 45 return KURL(String(urlStr, SysStringLen(urlStr)) .deprecatedString());45 return KURL(String(urlStr, SysStringLen(urlStr))); 46 46 } 47 47 48 48 BSTR MarshallingHelpers::KURLToBSTR(const KURL& url) 49 49 { 50 String urlString(url.string()); 51 return SysAllocStringLen(urlString.characters(), urlString.length()); 50 return SysAllocStringLen(url.string().characters(), url.string().length()); 52 51 } 53 52 -
trunk/WebKit/win/WebContextMenuClient.cpp
r29230 r30243 152 152 String searchString = frame->selectedText(); 153 153 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", "+"); 156 156 157 157 String url("http://www.google.com/search?q="); 158 url.append( String(encoded));158 url.append(encoded); 159 159 url.append("&ie=UTF-8&oe=UTF-8"); 160 160 -
trunk/WebKit/win/WebDataSource.cpp
r30180 r30243 246 246 { 247 247 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()); 249 249 250 250 *url = urlString.release(); -
trunk/WebKit/win/WebDownload.cpp
r28639 r30243 28 28 #include "WebDownload.h" 29 29 30 #include "CString.h" 30 31 #include "DefaultDownloadDelegate.h" 31 32 #include "MarshallingHelpers.h" … … 103 104 if (!m_download) { 104 105 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()); 106 107 } 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()); 108 109 109 110 // The CFURLDownload either starts successfully and retains the CFURLConnection, … … 131 132 CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); 132 133 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); 134 135 } 135 136 … … 233 234 CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); 234 235 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()); 236 237 return S_OK; 237 238 } -
trunk/WebKit/win/WebFrame.cpp
r30203 r30243 631 631 632 632 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))); 635 635 636 636 ResourceRequest request(baseKURL); … … 1369 1369 // onLoad handlers, of any redirects that happened. An example of where 1370 1370 // this is needed is Radar 3213556. 1371 url = childItem->originalURL String().deprecatedString();1371 url = childItem->originalURL(); 1372 1372 // These behaviors implied by these loadTypes should apply to the child frames 1373 1373 childLoadType = loadType; … … 2428 2428 String mimeType = mimeTypeIn; 2429 2429 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)); 2431 2431 2432 2432 if (mimeType.isEmpty()) -
trunk/WebKit/win/WebResource.cpp
r28639 r30243 104 104 { 105 105 m_data = data; 106 m_url = KURL(String(url) .deprecatedString());106 m_url = KURL(String(url)); 107 107 m_mimeType = String(mimeType); 108 108 m_textEncodingName = String(textEncodingName); -
trunk/WebKit/win/WebURLResponse.cpp
r28639 r30243 36 36 #pragma warning( push, 0 ) 37 37 #include <WebCore/BString.h> 38 #include <WebCore/DeprecatedString.h>39 38 #include <WebCore/KURL.h> 40 39 #include <WebCore/ResourceHandle.h> … … 223 222 WebURLResponse* instance = new WebURLResponse(); 224 223 // 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()); 226 225 instance->AddRef(); 227 226 return instance; … … 291 290 /* [in] */ BSTR textEncodingName) 292 291 { 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()); 294 293 return S_OK; 295 294 } -
trunk/WebKit/win/WebView.cpp
r30180 r30243 2434 2434 /* [retval][out] */ BSTR* userAgent) 2435 2435 { 2436 DeprecatedString urlStr((DeprecatedChar*)url, SysStringLen(url));2436 String urlStr(url, SysStringLen(url)); 2437 2437 String userAgentString = this->userAgentForKURL(KURL(urlStr)); 2438 2438 *userAgent = SysAllocStringLen(userAgentString.characters(), userAgentString.length()); … … 3558 3558 { 3559 3559 String temp(url, SysStringLen(url)); 3560 m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp .deprecatedString()), "");3560 m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp), ""); 3561 3561 return S_OK; 3562 3562 } … … 3870 3870 SysFreeString(str); 3871 3871 } else { 3872 settings->setUserStyleSheetLocation(KURL( DeprecatedString("")));3872 settings->setUserStyleSheetLocation(KURL()); 3873 3873 } 3874 3874 -
trunk/WebKit/wx/ChangeLog
r30204 r30243 1 2008-02-14 Darin Adler <darin@apple.com> 2 3 * WebView.cpp: Removed use of DeprecatedString to keep this compiling. 4 1 5 2008-02-11 Kevin Ollivier <kevino@theolliviers.com> 2 6 -
trunk/WebKit/wx/WebView.cpp
r30204 r30243 26 26 #include "config.h" 27 27 #include "CString.h" 28 #include "DeprecatedString.h"29 28 #include "Document.h" 30 29 #include "Element.h"
Note:
See TracChangeset
for help on using the changeset viewer.