Reviewed by Eric Seidel.
Based on work by Marvin Decker <marv.decker@gmail.com>
- fix http://bugs.webkit.org/show_bug.cgi?id=16538
KURL should use String instead of DeprecatedString
- fix http://bugs.webkit.org/show_bug.cgi?id=16485
DocLoader::checkForReload will crash if the URL isNull
and a similar problem in IconDatabase
- fix http://bugs.webkit.org/show_bug.cgi?id=16487
KURL doesn't preserve isNull when constructed with a DeprecatedString
- changed completeURL and various DOM getters to return KURL, to avoid
conversion back and forth from KURL to String
- changed the conversion of KURL to NSURL or NSString to be automatic,
to ease the use of KURL in Objective C DOM bindings, and eliminated
the getNSURL function
- because I had to visit the DOM bindings anyway, eliminated almost all
the use of the KJS namespace for things in WebCore
- fixed HTMLOptionElement constructor to check for undefined rather
than size of the arguments array
- eliminated some other unnecessary uses of DeprecatedString
- changed String::split to take a Vector parameter instead of returning
a Vector, for better performance
- added a couple of missing calls to do layout in SVG image handling;
I was able to reproduce these only because I had broken URLs for a
while -- not sure how to reproduce them now but the changes are
clearly needed
Performance testing shows this to be at least a 1% speedup.
Added a new function protocolIs to efficiently compare protocols
without case errors and a blankURL function so we don't have to
code "about:blank" in multiple places in the code and don't have to
construct a frash KURL each time. Moved decode_string and encode_string
out of KURL and gave them clearer names.
Made KURL constructors explicit to highlight potentially-expensive
operations and the poor semantics of KURL's constructor that takes
a String.
* WebCore.base.exp: Updated.
* bindings/js/JSAttrCustom.cpp:
(WebCore::JSAttr::setValue): Use protocolIs.
* bindings/js/JSAudioConstructor.h: KJS namespace change.
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJS): Ditto.
* bindings/js/JSCSSValueCustom.cpp:
(WebCore::toJS): Ditto.
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::location): Ditto.
(WebCore::JSDocument::setLocation): Updated for KURL change.
(WebCore::toJS): KJS namespace change.
* bindings/js/JSElementCustom.cpp:
(WebCore::allowSettingSrcToJavascriptURL): Use protocolIs.
(WebCore::JSElement::setAttribute): KJS namespace change.
(WebCore::JSElement::setAttributeNode): Ditto.
(WebCore::JSElement::setAttributeNS): Ditto.
(WebCore::JSElement::setAttributeNodeNS): Ditto.
* bindings/js/JSHTMLFrameElementCustom.cpp:
(WebCore::allowSettingJavascriptURL): Use protocolIs.
(WebCore::JSHTMLFrameElement::setSrc): KJS namespace change.
(WebCore::JSHTMLFrameElement::setLocation): Ditto.
* bindings/js/JSHTMLIFrameElementCustom.cpp:
(WebCore::JSHTMLIFrameElement::setSrc): Use protocolIs.
* bindings/js/JSHTMLOptionElementConstructor.cpp:
(WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor):
(WebCore::JSHTMLOptionElementConstructor::construct): Cleaned up the
structure a bit and changed checking to check for undefined rather than
number of arguments.
* bindings/js/JSHTMLOptionElementConstructor.h: KJS namespace change.
* bindings/js/JSLocation.cpp:
(WebCore::JSLocation::put): Eliminated some DeprecatedString use,
and use protocolIs.
(WebCore::jsLocationProtoFuncReplace): Ditto.
(WebCore::jsLocationProtoFuncReload): Ditto.
(WebCore::jsLocationProtoFuncAssign): Ditto.
* bindings/js/JSLocation.h: KJS namespace change.
* bindings/js/JSNamedNodeMapCustom.cpp:
(WebCore::JSNamedNodeMap::canGetItemsForName): Ditto.
(WebCore::JSNamedNodeMap::nameGetter): Ditto.
* bindings/js/JSNamedNodesCollection.cpp:
(WebCore::JSNamedNodesCollection::JSNamedNodesCollection): Ditto.
* bindings/js/JSNamedNodesCollection.h: Ditto.
* bindings/js/JSXMLHttpRequest.cpp:
(WebCore::jsXMLHttpRequestPrototypeFunctionOpen): Removed
DeprecatedString use.
(WebCore::jsXMLHttpRequestPrototypeFunctionSend): Ditto.
* bindings/js/JSXMLHttpRequest.h: Moved this class into the WebCore
namespace.
* bindings/js/JSXSLTProcessor.cpp: Namespace change.
* bindings/js/JSXSLTProcessor.h: Ditto.
* bindings/js/kjs_binding.cpp: Updated for namespace change.
(WebCore::jsStringOrNull): Added an overload for KURL to allow DOM
classes to return KURL even if the DOM expects a string.
(WebCore::jsStringOrUndefined): Ditto.
(WebCore::jsStringOrFalse): Ditto.
* bindings/js/kjs_binding.h: Moved everything into the WebCore
namespace.
* bindings/js/kjs_css.h: Namespace change.
* bindings/js/kjs_events.cpp: Removed an include.
* bindings/js/kjs_events.h: Namespace change.
* bindings/js/kjs_html.h: Namespace change.
* bindings/js/kjs_navigator.cpp: Moved everything into the
WebCore namespace.
* bindings/js/kjs_navigator.h: Ditto.
* bindings/js/kjs_window.cpp:
(KJS::parseModalDialogFeatures): Updated for String::split change.
(KJS::createWindow): Use protocolIs and removed some DeprecatedString.
(KJS::Window::put): Ditto.
(KJS::Window::allowsAccessFrom): Ditto.
(KJS::windowProtoFuncOpen): Ditto.
* bindings/objc/DOM.mm:
(-[DOMElement _getURLAttribute:]): Removed getNSURL call.
* bindings/objc/DOMHTML.mm:
(-[DOMHTMLDocument _createDocumentFragmentWithMarkupString:baseURLString:]): Ditto.
* bindings/scripts/CodeGeneratorCOM.pm: Updated includes so conversions from
KURL will work.
* bindings/scripts/CodeGeneratorJS.pm: Updated for namespace changes, and also
updated includes so conversions from KURL will work.
* bindings/scripts/CodeGeneratorObjC.pm: Updated includes so conversions from
KURL will work.
* bridge/mac/WebCoreAXObject.mm:
(-[WebCoreAXObject accessibilityAttributeValue:]): Removed getNSURL call.
Also streamlined the logic.
(AXAttributedStringAppendText): Ditto.
* bridge/mac/WebCoreScriptDebugger.mm:
(toNSString): Tweaked.
(toNSURL): Removed getNSURL call.
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::image): Removed DeprecatedString use.
* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::insertedIntoParent): Ditto.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue): Ditto.
(WebCore::CSSParser::parseContent): Ditto.
(WebCore::CSSParser::parseBackgroundImage): Ditto.
(WebCore::CSSParser::parseFontFaceSrc): Ditto.
(WebCore::CSSParser::parseBorderImage): Ditto.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::setEncodedURL): Ditto.
(WebCore::checkPseudoState): Ditto.
* css/CSSStyleSelector.h: Ditto.
* css/MediaList.cpp:
(WebCore::MediaList::setMediaText): Updated for String::split change.
* css/StyleBase.cpp:
(WebCore::StyleBase::baseURL): Return KURL.
* css/StyleBase.h: DItto.
* dom/Document.cpp:
(WebCore::Document::~Document): Updated for namespace change.
(WebCore::Document::documentURI): Return KURL.
(WebCore::Document::setDocumentURI): Removed DeprecatedString use.
(WebCore::Document::baseURI): Return KURL.
(WebCore::Document::open): Updated to use blankURL.
(WebCore::Document::setURL): Take KURL.
(WebCore::Document::shouldBeAllowedToLoadLocalResources): Updated for
change to use KURL
(WebCore::Document::setBaseURL): Take KURL.
(WebCore::Document::elementSheet): Updated for KURL change.
(WebCore::Document::mappedElementSheet): Ditto.
(WebCore::Document::processHttpEquiv): Ditto.
(WebCore::Document::recalcStyleSelector): Removed use of
DeprecatedString -- also noticed some dead code here!
(WebCore::Document::setCookie): Ditto.
(WebCore::Document::completeURL): Return KURL.
* dom/Document.h: Use KURL instead of String in a few places.
* dom/DocumentType.cpp:
(WebCore::DocumentType::baseURI): Return KURL.
* dom/DocumentType.h: Ditto.
* dom/Element.cpp:
(WebCore::Element::baseURI): Return KURL.
* dom/Element.h: Ditto.
* dom/Node.cpp:
(WebCore::Node::setDocument): Namespace change.
(WebCore::Node::baseURI): Return KURL.
* dom/Node.h: Ditto.
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::checkStyleSheet): Updated for KURL change.
* dom/StyleElement.cpp:
(WebCore::StyleElement::process): Changed to use Vector<UChar> instead of
String for better performance.
(WebCore::StyleElement::createSheet): Removed use of DeprecateString.
* dom/XMLTokenizer.cpp:
(WebCore::XMLTokenizer::endElementNs): Updated for KURL change.
(WebCore::XMLTokenizer::end): Ditto.
(WebCore::xmlDocPtrForString): Removed use of DeprecateString.
* dom/XMLTokenizer.h: Ditto.
* editing/markup.cpp: Moved appendString to PlatformString.h.
(WebCore::appendQuotedURLAttributeValue): Use protocolIs.
(WebCore::completeURLs): Removed DeprecatedString use.
(WebCore::createFragmentFromMarkup): Use blankURL.
(WebCore::fillContainerFromString): Removed DeprecatedString use.
(WebCore::createFragmentFromText): Ditto.
* history/HistoryItem.cpp:
(WebCore::HistoryItem::url): Removed DeprecatedString use.
(WebCore::HistoryItem::originalURL): Ditto.
* history/HistoryItem.h: Removed include.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::defaultEventHandler): Removed use of
DeprecatedString.
(WebCore::HTMLAnchorElement::href): Return KURL.
(WebCore::HTMLAnchorElement::hash): Removed DeprecatedString use.
(WebCore::HTMLAnchorElement::host): Ditto.
(WebCore::HTMLAnchorElement::hostname): Ditto.
(WebCore::HTMLAnchorElement::pathname): Ditto.
(WebCore::HTMLAnchorElement::port): Ditto.
(WebCore::HTMLAnchorElement::protocol): Ditto.
(WebCore::HTMLAnchorElement::search): Ditto.
(WebCore::HTMLAnchorElement::toString): Ditto.
* html/HTMLAnchorElement.h: Ditto.
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::createRenderer): Updated for KURL change.
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::href): Return KURL.
* html/HTMLAreaElement.h: Ditto.
* html/HTMLBaseElement.cpp:
(WebCore::HTMLBaseElement::removedFromDocument): Updated for KURL change.
(WebCore::HTMLBaseElement::process): Removed DeprecatedString use.
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::parseMappedAttribute): Updated for KURL change.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::parseMappedAttribute): Removed use of
DeprecatedString.
* html/HTMLEmbedElement.h: Removed DeprecatedString use.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::formWouldHaveSecureSubmission): Use protocolIs.
(WebCore::encodeCString): Updated for change to String::split.
(WebCore::HTMLFormElement::dataEncoding): Ditto.
(WebCore::HTMLFormElement::formData): Removed DeprecatedString use.
(WebCore::HTMLFormElement::isMailtoForm): Use protocolIs.
(WebCore::HTMLFormElement::submit): Updated for KURL change.
(WebCore::HTMLFormElement::reset): Ditto.
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::isURLAllowed): Updated for KURL change
and use equalIgnoringRef instead of doing a setRef to get the same effect.
(WebCore::HTMLFrameElementBase::openURL): Use blankURL.
(WebCore::HTMLFrameElementBase::location): Return KURL.
(WebCore::HTMLFrameElementBase::src): Return KURL.
* html/HTMLFrameElementBase.h: Ditto.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseMappedAttribute): Updated for KURL change.
(WebCore::HTMLImageElement::longDesc): Return KURL.
(WebCore::HTMLImageElement::lowsrc): Return KURL.
(WebCore::HTMLImageElement::src): Return KURL.
* html/HTMLImageElement.h: Ditto. Also removed imageMap() function.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::src): Return KURL.
* html/HTMLInputElement.h: Ditto.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::parseMappedAttribute): Updated for KURL change.
(WebCore::HTMLLinkElement::tokenizeRelAttribute): Updated for String::split change.
(WebCore::HTMLLinkElement::href): Return KURL.
* html/HTMLLinkElement.h: Ditto.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::src): Return KURL.
(WebCore::HTMLMediaElement::pickMedia): Updated for KURL change.
* html/HTMLMediaElement.h: Ditto.
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::isImageType): Use protocolIs.
(WebCore::HTMLObjectElement::data): Return KURL.
* html/HTMLObjectElement.h: Ditto.
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::groupLabelText): Removed DeprecatedString use.
* html/HTMLParser.cpp:
(WebCore::HTMLParser::reportErrorToConsole): Updated for KURL change.
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::insertedIntoDocument): Ditto.
(WebCore::HTMLScriptElement::text): Changed to use Vector<UChar> instead of
String for better performance.
(WebCore::HTMLScriptElement::src): Return KURL.
* html/HTMLScriptElement.h: Ditto.
* html/HTMLSourceElement.cpp:
(WebCore::HTMLSourceElement::src): Return KURL.
* html/HTMLSourceElement.h: Ditto.
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::parseMappedAttribute): Updated for KURL change.
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::parseMappedAttribute): Updated for KURL change.
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setValue): Removed DeprecatedString use.
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::scriptExecution): Ditto.
(WebCore::HTMLTokenizer::notifyFinished): Use protocolIs.
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::poster): Return KURL.
* html/HTMLVideoElement.h: Ditto.
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addText): Updated for String::split change.
* loader/DocLoader.cpp:
(WebCore::DocLoader::checkForReload): Add an explicit check for an empty URL
here to avoid problems using its string as a hash table key later.
(WebCore::DocLoader::requestResource): Removed DeprecatedString use.
* loader/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryTokenizer::createTDForFilename): Updated for KURL change.
(WebCore::FTPDirectoryTokenizer::parseAndAppendOneLine): Removed use of
DeprecatedString.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::requestFrame): Use protocolIs.
(WebCore::FrameLoader::loadSubframe): Use blankURL.
(WebCore::FrameLoader::submitForm): Use protocolIs and removed use of
DeprecatedString.
(WebCore::FrameLoader::iconURL): Return KURL. Use protcolIs.
(WebCore::FrameLoader::didOpenURL): Use protocolIs.
(WebCore::FrameLoader::didExplicitOpen): Use blankURL.
(WebCore::FrameLoader::executeIfJavaScriptURL): Use protocolIs.
Update for name change to decodeURLEscapeSequences.
(WebCore::FrameLoader::receivedFirstData): Updated for KURL changes.
(WebCore::FrameLoader::begin): Removed DeprecatedString use.
Renamed baseurl to baseURL. Updated to use KURL more.
(WebCore::FrameLoader::gotoAnchor): Removed use of encodedHtmlRef
function, which is no different from ref.
(WebCore::FrameLoader::completeURL): Updated for KURL change.
(WebCore::FrameLoader::scheduleLocationChange): Ditto.
(WebCore::FrameLoader::canCachePage): Use protocolIs.
(WebCore::FrameLoader::updatePolicyBaseURL): Update for KURL change.
(WebCore::FrameLoader::setPolicyBaseURL): Take KURL.
(WebCore::FrameLoader::startRedirectionTimer): Removed use of
DeprecatedString.
(WebCore::FrameLoader::load): Use protocolIs.
(WebCore::FrameLoader::shouldHideReferrer): Use protocolIs.
(WebCore::FrameLoader::shouldAllowNavigation): Updated for KURL change.
(WebCore::FrameLoader::commitProvisionalLoad): Use blankURL.
(WebCore::FrameLoader::open): Use protcolIs.
(WebCore::FrameLoader::createHistoryItem): Use blankURL.
(WebCore::FrameLoader::createJavaAppletWidget): Updated for KURL change.
(WebCore::FrameLoader::switchOutLowBandwidthDisplayIfReady): Removed
DeprecatedString use.
* loader/FrameLoader.h: Ditto.
* loader/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure): Updated for KURL change.
* loader/PluginDocument.cpp:
(WebCore::PluginTokenizer::createDocumentStructure): Ditto.
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::iconForPageURL): Added a check for an empty URL
before trying to use it as a hash table key.
* loader/icon/IconLoader.h: Tweaked includes.
* loader/loader.cpp:
(WebCore::Loader::servePendingRequests): Use protcolIs. Also removed some
code to set up a local variable that is never used (and a DeprecatedString
on to boot!).
* loader/mac/LoaderNSURLExtras.m:
(suggestedFilenameWithMIMEType): Removed unnecessary typecast.
* page/ContextMenuController.cpp: Removed include.
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks):
Use protocolIs.
* page/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge URLWithAttributeString:]): Removed getNSURL call.
(-[WebCoreFrameBridge baseURL]): Ditto.
* platform/KURL.cpp:
(WebCore::isSchemeFirstChar): Fixed bug in handling of values >= 0x80.
(WebCore::isSchemeChar): Ditto.
(WebCore::isPathSegmentEndChar): Ditto.
(WebCore::hexDigitValue): Changed parameter type to UChar.
(WebCore::copyASCII): Added.
(WebCore::findFirstOf): Added.
(WebCore::KURL::protocolIs): Added.
(WebCore::KURL::KURL): Tightened logic up quite a bit. Changed parameter
types from DeprecatedString to String.
(WebCore::KURL::init): Changed parameter type to String. Preserved the
passed-in string even if the base is invalid. Cleaned up logic to determine
if the originalString should be pased in to the parse function. Simplified
by calling the new parse overload that takes String in many cases.
(WebCore::KURL::lastPathComponent): Return String.
(WebCore::KURL::protocol): Ditto.
(WebCore::KURL::host): Ditto.
(WebCore::KURL::port): Changed logic to use early return for clarity.
(WebCore::KURL::pass): Return String.
(WebCore::KURL::user): Ditto.
(WebCore::KURL::ref): Ditto.
(WebCore::assertProtocolIsGood): Added.
(WebCore::KURL::protocolIs): Added.
(WebCore::KURL::query): Return String.
(WebCore::KURL::path): Ditto.
(WebCore::KURL::setProtocol): Take String.
(WebCore::KURL::setHost): Ditto.
(WebCore::KURL::setPort): Use String.
(WebCore::KURL::setHostAndPort): Take String.
(WebCore::KURL::setUser): Ditto.
(WebCore::KURL::setPass): Ditto.
(WebCore::KURL::setRef): Ditto.
(WebCore::KURL::setQuery): Ditto.
(WebCore::KURL::setPath): Ditto.
(WebCore::KURL::prettyURL): Return String. Use Vector<UChar> to build it.
(WebCore::decodeURLEscapeSequences): Renamed from KURL::decode_string.
Return String. Use Vector<UChar> to build it.
(WebCore::KURL::isLocalFile): Use protocolIs.
(WebCore::KURL::parse): Added an overload that takes a String to replace
the use of DeprecatedString::ascii at various call sites. Updated for
name change (urlString -> m_string).
(WebCore::equalIgnoringRef): Wrote a new implementation that doesn't
do any allocation.
(WebCore::encodeWithURLEscapeSequences): Renamed from KURL::encode_string.
Return String.
(WebCore::appendEncodedHostname): Added. Replaces encodeHostname and
avoids the need to allocate a string.
(WebCore::findHostnamesInMailToURL): Update to use findFirstOf instead of
regular expressions.
(WebCore::findHostnameInHierarchicalURL): Ditto.
(WebCore::encodeHostnames): Use protocolIs and the other helpers above.
(WebCore::encodeRelativeString): Changed to put result into a CharBuffer.
(WebCore::substituteBackslashes): Updated to use String.
(WebCore::KURL::copyToBuffer): Added.
(WebCore::protocolIs): Added.
(WebCore::blankURL): Added.
(WebCore::KURL::print): Updated.
* platform/KURL.h: Added a number of comments. Reorganized the header a bit.
Made the string constructors explicit. Changed to use String instead of
DeprecatedString. Removed encodedHTMLRef. Renamed and added a few functions.
* platform/cf/KURLCFNet.cpp:
(WebCore::KURL::KURL): Streamlined the logic a bit.
(WebCore::KURL::createCFURL): Changed to use copyToBuffer.
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivate::createQTMovie): Removed getNSURL call.
Use protocolIs.
* platform/mac/ClipboardMac.mm:
(WebCore::ClipboardMac::declareAndWriteDragImage): Removed getNSURL call.
* platform/mac/CookieJar.mm:
(WebCore::cookies): Removed getNSURL call.
(WebCore::setCookies): Removed getNSURL call.
* platform/mac/KURLMac.mm:
(WebCore::KURL::KURL): Streamlined the logic a bit.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::writeURL): Removed getNSURL call.
(WebCore::Pasteboard::writeImage): Ditto.
* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString): Ditto.
* platform/network/HTTPParsers.cpp:
(WebCore::filenameFromHTTPContentDisposition): Updated for String::split.
* platform/network/ResourceHandle.cpp:
(WebCore::ResourceHandle::portAllowed): Use protocolIs.
* platform/network/cf/ResourceErrorCF.cpp:
(WebCore::ResourceError::operator CFErrorRef): Removed deprecatedString call.
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::headerCallback): Ditto.
(WebCore::parseDataUrl): Use String instead of DeprecatedString.
(WebCore::ResourceHandleManager::startJob): Updated for KURL changes.
* platform/network/mac/ResourceErrorMac.mm:
(WebCore::ResourceError::operator NSError*): Removed getNSURL call.
* platform/network/mac/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest): Removed DeprecatedString use.
* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::doUpdatePlatformRequest): Removed getNSURL call.
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::nsURLResponse): Removed getNSURL call.
* platform/qt/ClipboardQt.cpp:
(WebCore::ClipboardQt::writeURL): Removed deprecatedString call.
* platform/text/CString.h:
(WebCore::CStringBuffer::length): Fixed size_t/unsigned mismatch to make it
possible to compile this on Windows with higher warning level
* platform/text/PlatformString.h: Updated split to modify a result parameter
rather than returning a Vector. Added charactersAreAllASCII and an append
function that appends a String to a Vector<UChar>.
* platform/text/String.cpp:
(WebCore::String::split): Updated.
* platform/win/BString.cpp:
(WebCore::BString::BString): Added conversion from KURL.
* platform/win/BString.h: Ditto.
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::markupToCF_HTML): Removed use of deprecatedString.
* platform/win/ClipboardWin.cpp:
(WebCore::filesystemPathFromUrlOrTitle): Ditto.
(WebCore::createGlobalHDropContent): Ditto.
(WebCore::ClipboardWin::setData): Ditto.
(WebCore::ClipboardWin::writeRange): Ditto.
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeSelection): Ditto.
* plugins/PluginStream.cpp:
(WebCore::PluginStream::startStream): Ditto.
(WebCore::PluginStream::destroyStream): Ditto.
* plugins/win/PluginViewWin.cpp:
(WebCore::scriptStringIfJavaScriptURL): Ditto.
(WebCore::PluginView::performRequest): Ditto.
(WebCore::PluginView::PluginView): Ditto.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::absoluteImageURL): Removed DeprecatedString use.
(WebCore::HitTestResult::absoluteLinkURL): Ditto.
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::layOutAxis): Fixed comment wording.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced): Removed use of DeperecatedString,
(WebCore::RenderImage::imageMap): Changed to call useMap instead of imageMap;
both do the same thing, and the first is standard DOM.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::addPDFURLRect): Rewrote and streamlined to remove
DeprecatedString use.
* rendering/RenderObject.h: Changed addPDFURLRect to take const IntRect&.
* rendering/RenderPartObject.cpp:
(WebCore::isURLAllowed): Updated for KURL change and use equalIgnoringRef
instead of doing a setRef to get the same effect.
(WebCore::RenderPartObject::updateWidget): Updated for KURL change.
* rendering/RenderText.cpp:
(WebCore::charactersAreAllASCII): Moved the guts to PlatformString.h.
* rendering/SVGRenderSupport.cpp:
(WebCore::renderSubtreeToImage): Added missing call to do layout. I ran
into this while doing some layout tests while URL processing was broken.
* rendering/SVGRenderTreeAsText.h: Removed include.
* svg/SVGImageLoader.cpp:
(WebCore::SVGImageLoader::updateFromElement): Removed DeprecatedString use.
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw): Added missing call to do layout. I ran
into this while doing some layout tests while URL processing was broken.
(WebCore::SVGImage::dataChanged): Use a null URL rather than an arbitrary
string for the document.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::getResponseXML): Removed DeprecatedString use.
(WebCore::XMLHttpRequest::urlMatchesDocumentDomain): Ditto.
(WebCore::XMLHttpRequest::open): Ditto.
(WebCore::XMLHttpRequest::send): Namespace change.
(WebCore::XMLHttpRequest::dropProtection): Ditto.
* xml/XMLHttpRequest.h: Removed DeprecatedString use.
* xml/XSLImportRule.cpp:
(WebCore::XSLImportRule::loadSheet): Removed DeprecatedString use.
* xml/XSLStyleSheet.cpp:
(WebCore::XSLStyleSheet::loadChildSheets): Ditto.
(WebCore::XSLStyleSheet::loadChildSheet): Ditto.
* xml/XSLStyleSheet.h: Ditto.
* xml/XSLTProcessor.cpp:
(WebCore::docLoaderFunc): Ditto.
(WebCore::xsltStylesheetPointer): Ditto.
(WebCore::xmlDocPtrFromNode): Ditto.
WebKit/gtk:
* webkit/webkitwebframe.cpp: Removed DeprecatedString use to try to keep it building.
* webkit/webkitwebview.cpp: Ditto.
WebKit/mac:
Reviewed by Eric Seidel.
- updated for WebCore KURL changes
* History/WebHistoryItem.mm:
(-[WebHistoryItem URL]): Removed getNSURL call.
* Misc/WebElementDictionary.mm:
(-[WebElementDictionary _absoluteImageURL]): Ditto.
(-[WebElementDictionary _absoluteLinkURL]): Ditto.
* Misc/WebNSAttributedStringExtras.mm:
(fileWrapperForElement): Ditto.
(+[NSAttributedString _web_attributedStringFromRange:]): Ditto.
* Misc/WebNSURLExtras.mm:
(-[NSString _webkit_stringByReplacingValidPercentEscapes]): Updated
for function name change.
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::downloadURL): Removed getNSURL call.
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::createDragImageForLink): Ditto.
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchWillPerformClientRedirect): Ditto.
(WebFrameLoaderClient::startDownload): Ditto.
(WebFrameLoaderClient::updateGlobalHistoryForStandardLoad): Ditto.
(WebFrameLoaderClient::updateGlobalHistoryForReload): Ditto.
(WebFrameLoaderClient::cancelledError): Ditto.
(WebFrameLoaderClient::blockedError): Ditto.
(WebFrameLoaderClient::cannotShowURLError): Ditto.
(WebFrameLoaderClient::interruptForPolicyChangeError): Ditto.
(WebFrameLoaderClient::cannotShowMIMETypeError): Ditto.
(WebFrameLoaderClient::fileDoesNotExistError): Ditto.
(WebFrameLoaderClient::willUseArchive): Ditto.
(WebFrameLoaderClient::setTitle): Ditto.
(WebFrameLoaderClient::actionDictionary): Ditto.
(WebFrameLoaderClient::createFrame): Ditto.
(WebFrameLoaderClient::objectContentType): Ditto.
(WebFrameLoaderClient::createPlugin): Ditto.
(WebFrameLoaderClient::createJavaAppletWidget): Ditto.
* WebView/WebDataSource.mm:
(-[WebDataSource _URL]): Ditto.
(-[WebDataSource _initWithDocumentLoader:]): Ditto.
(-[WebDataSource unreachableURL]): Ditto.
* WebView/WebHTMLView.mm:
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): Ditto.
WebKit/win:
- updated for WebCore KURL changes
* MarshallingHelpers.cpp:
(MarshallingHelpers::BSTRToKURL): Removed deprecatedString call.
(MarshallingHelpers::KURLToBSTR): Tweaked for efficiency.
* WebContextMenuClient.cpp:
(WebContextMenuClient::searchWithGoogle): Updated for KURL changes.
* WebDataSource.cpp:
(WebDataSource::unreachableURL): Ditto.
* WebDownload.cpp:
(WebDownload::init): Ditto.
(WebDownload::initWithRequest): Ditto.
* WebFrame.cpp:
(WebFrame::loadData): Ditto.
(WebFrame::loadURLIntoChild): Ditto.
(WebFrame::objectContentType): Ditto.
* WebResource.cpp:
(WebResource::initWithData): Ditto.
* WebURLResponse.cpp:
(WebURLResponse::createInstance): Ditto.
(WebURLResponse::initWithURL): Ditto.
* WebView.cpp:
(WebView::userAgentForURL): Ditto.
(WebView::copyURL): Ditto.
(WebView::notifyPreferencesChanged): Ditto.
WebKit/wx:
* WebView.cpp: Removed use of DeprecatedString to keep this compiling.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30243
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-02-14 Darin Adler <darin@apple.com>
+
+ Reviewed by Eric Seidel.
+
+ Based on work by Marvin Decker <marv.decker@gmail.com>
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16538
+ KURL should use String instead of DeprecatedString
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16485
+ DocLoader::checkForReload will crash if the URL isNull
+ and a similar problem in IconDatabase
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=16487
+ KURL doesn't preserve isNull when constructed with a DeprecatedString
+
+ - changed completeURL and various DOM getters to return KURL, to avoid
+ conversion back and forth from KURL to String
+
+ - changed the conversion of KURL to NSURL or NSString to be automatic,
+ to ease the use of KURL in Objective C DOM bindings, and eliminated
+ the getNSURL function
+
+ - because I had to visit the DOM bindings anyway, eliminated almost all
+ the use of the KJS namespace for things in WebCore
+
+ - fixed HTMLOptionElement constructor to check for undefined rather
+ than size of the arguments array
+
+ - eliminated some other unnecessary uses of DeprecatedString
+
+ - changed String::split to take a Vector parameter instead of returning
+ a Vector, for better performance
+
+ - added a couple of missing calls to do layout in SVG image handling;
+ I was able to reproduce these only because I had broken URLs for a
+ while -- not sure how to reproduce them now but the changes are
+ clearly needed
+
+ Performance testing shows this to be at least a 1% speedup.
+
+ Added a new function protocolIs to efficiently compare protocols
+ without case errors and a blankURL function so we don't have to
+ code "about:blank" in multiple places in the code and don't have to
+ construct a frash KURL each time. Moved decode_string and encode_string
+ out of KURL and gave them clearer names.
+
+ Made KURL constructors explicit to highlight potentially-expensive
+ operations and the poor semantics of KURL's constructor that takes
+ a String.
+
+ * WebCore.base.exp: Updated.
+
+ * bindings/js/JSAttrCustom.cpp:
+ (WebCore::JSAttr::setValue): Use protocolIs.
+ * bindings/js/JSAudioConstructor.h: KJS namespace change.
+ * bindings/js/JSCSSRuleCustom.cpp:
+ (WebCore::toJS): Ditto.
+ * bindings/js/JSCSSValueCustom.cpp:
+ (WebCore::toJS): Ditto.
+ * bindings/js/JSDocumentCustom.cpp:
+ (WebCore::JSDocument::location): Ditto.
+ (WebCore::JSDocument::setLocation): Updated for KURL change.
+ (WebCore::toJS): KJS namespace change.
+ * bindings/js/JSElementCustom.cpp:
+ (WebCore::allowSettingSrcToJavascriptURL): Use protocolIs.
+ (WebCore::JSElement::setAttribute): KJS namespace change.
+ (WebCore::JSElement::setAttributeNode): Ditto.
+ (WebCore::JSElement::setAttributeNS): Ditto.
+ (WebCore::JSElement::setAttributeNodeNS): Ditto.
+ * bindings/js/JSHTMLFrameElementCustom.cpp:
+ (WebCore::allowSettingJavascriptURL): Use protocolIs.
+ (WebCore::JSHTMLFrameElement::setSrc): KJS namespace change.
+ (WebCore::JSHTMLFrameElement::setLocation): Ditto.
+ * bindings/js/JSHTMLIFrameElementCustom.cpp:
+ (WebCore::JSHTMLIFrameElement::setSrc): Use protocolIs.
+ * bindings/js/JSHTMLOptionElementConstructor.cpp:
+ (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor):
+ (WebCore::JSHTMLOptionElementConstructor::construct): Cleaned up the
+ structure a bit and changed checking to check for undefined rather than
+ number of arguments.
+ * bindings/js/JSHTMLOptionElementConstructor.h: KJS namespace change.
+ * bindings/js/JSLocation.cpp:
+ (WebCore::JSLocation::put): Eliminated some DeprecatedString use,
+ and use protocolIs.
+ (WebCore::jsLocationProtoFuncReplace): Ditto.
+ (WebCore::jsLocationProtoFuncReload): Ditto.
+ (WebCore::jsLocationProtoFuncAssign): Ditto.
+ * bindings/js/JSLocation.h: KJS namespace change.
+ * bindings/js/JSNamedNodeMapCustom.cpp:
+ (WebCore::JSNamedNodeMap::canGetItemsForName): Ditto.
+ (WebCore::JSNamedNodeMap::nameGetter): Ditto.
+ * bindings/js/JSNamedNodesCollection.cpp:
+ (WebCore::JSNamedNodesCollection::JSNamedNodesCollection): Ditto.
+ * bindings/js/JSNamedNodesCollection.h: Ditto.
+ * bindings/js/JSXMLHttpRequest.cpp:
+ (WebCore::jsXMLHttpRequestPrototypeFunctionOpen): Removed
+ DeprecatedString use.
+ (WebCore::jsXMLHttpRequestPrototypeFunctionSend): Ditto.
+ * bindings/js/JSXMLHttpRequest.h: Moved this class into the WebCore
+ namespace.
+ * bindings/js/JSXSLTProcessor.cpp: Namespace change.
+ * bindings/js/JSXSLTProcessor.h: Ditto.
+
+ * bindings/js/kjs_binding.cpp: Updated for namespace change.
+ (WebCore::jsStringOrNull): Added an overload for KURL to allow DOM
+ classes to return KURL even if the DOM expects a string.
+ (WebCore::jsStringOrUndefined): Ditto.
+ (WebCore::jsStringOrFalse): Ditto.
+ * bindings/js/kjs_binding.h: Moved everything into the WebCore
+ namespace.
+
+ * bindings/js/kjs_css.h: Namespace change.
+ * bindings/js/kjs_events.cpp: Removed an include.
+ * bindings/js/kjs_events.h: Namespace change.
+ * bindings/js/kjs_html.h: Namespace change.
+
+ * bindings/js/kjs_navigator.cpp: Moved everything into the
+ WebCore namespace.
+ * bindings/js/kjs_navigator.h: Ditto.
+
+ * bindings/js/kjs_window.cpp:
+ (KJS::parseModalDialogFeatures): Updated for String::split change.
+ (KJS::createWindow): Use protocolIs and removed some DeprecatedString.
+ (KJS::Window::put): Ditto.
+ (KJS::Window::allowsAccessFrom): Ditto.
+ (KJS::windowProtoFuncOpen): Ditto.
+
+ * bindings/objc/DOM.mm:
+ (-[DOMElement _getURLAttribute:]): Removed getNSURL call.
+ * bindings/objc/DOMHTML.mm:
+ (-[DOMHTMLDocument _createDocumentFragmentWithMarkupString:baseURLString:]): Ditto.
+
+ * bindings/scripts/CodeGeneratorCOM.pm: Updated includes so conversions from
+ KURL will work.
+ * bindings/scripts/CodeGeneratorJS.pm: Updated for namespace changes, and also
+ updated includes so conversions from KURL will work.
+ * bindings/scripts/CodeGeneratorObjC.pm: Updated includes so conversions from
+ KURL will work.
+
+ * bridge/mac/WebCoreAXObject.mm:
+ (-[WebCoreAXObject accessibilityAttributeValue:]): Removed getNSURL call.
+ Also streamlined the logic.
+ (AXAttributedStringAppendText): Ditto.
+
+ * bridge/mac/WebCoreScriptDebugger.mm:
+ (toNSString): Tweaked.
+ (toNSURL): Removed getNSURL call.
+
+ * css/CSSImageValue.cpp:
+ (WebCore::CSSImageValue::image): Removed DeprecatedString use.
+ * css/CSSImportRule.cpp:
+ (WebCore::CSSImportRule::insertedIntoParent): Ditto.
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue): Ditto.
+ (WebCore::CSSParser::parseContent): Ditto.
+ (WebCore::CSSParser::parseBackgroundImage): Ditto.
+ (WebCore::CSSParser::parseFontFaceSrc): Ditto.
+ (WebCore::CSSParser::parseBorderImage): Ditto.
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::setEncodedURL): Ditto.
+ (WebCore::checkPseudoState): Ditto.
+ * css/CSSStyleSelector.h: Ditto.
+
+ * css/MediaList.cpp:
+ (WebCore::MediaList::setMediaText): Updated for String::split change.
+
+ * css/StyleBase.cpp:
+ (WebCore::StyleBase::baseURL): Return KURL.
+ * css/StyleBase.h: DItto.
+
+ * dom/Document.cpp:
+ (WebCore::Document::~Document): Updated for namespace change.
+ (WebCore::Document::documentURI): Return KURL.
+ (WebCore::Document::setDocumentURI): Removed DeprecatedString use.
+ (WebCore::Document::baseURI): Return KURL.
+ (WebCore::Document::open): Updated to use blankURL.
+ (WebCore::Document::setURL): Take KURL.
+ (WebCore::Document::shouldBeAllowedToLoadLocalResources): Updated for
+ change to use KURL
+ (WebCore::Document::setBaseURL): Take KURL.
+ (WebCore::Document::elementSheet): Updated for KURL change.
+ (WebCore::Document::mappedElementSheet): Ditto.
+ (WebCore::Document::processHttpEquiv): Ditto.
+ (WebCore::Document::recalcStyleSelector): Removed use of
+ DeprecatedString -- also noticed some dead code here!
+ (WebCore::Document::setCookie): Ditto.
+ (WebCore::Document::completeURL): Return KURL.
+ * dom/Document.h: Use KURL instead of String in a few places.
+
+ * dom/DocumentType.cpp:
+ (WebCore::DocumentType::baseURI): Return KURL.
+ * dom/DocumentType.h: Ditto.
+
+ * dom/Element.cpp:
+ (WebCore::Element::baseURI): Return KURL.
+ * dom/Element.h: Ditto.
+
+ * dom/Node.cpp:
+ (WebCore::Node::setDocument): Namespace change.
+ (WebCore::Node::baseURI): Return KURL.
+ * dom/Node.h: Ditto.
+
+ * dom/ProcessingInstruction.cpp:
+ (WebCore::ProcessingInstruction::checkStyleSheet): Updated for KURL change.
+ * dom/StyleElement.cpp:
+ (WebCore::StyleElement::process): Changed to use Vector<UChar> instead of
+ String for better performance.
+ (WebCore::StyleElement::createSheet): Removed use of DeprecateString.
+ * dom/XMLTokenizer.cpp:
+ (WebCore::XMLTokenizer::endElementNs): Updated for KURL change.
+ (WebCore::XMLTokenizer::end): Ditto.
+ (WebCore::xmlDocPtrForString): Removed use of DeprecateString.
+ * dom/XMLTokenizer.h: Ditto.
+
+ * editing/markup.cpp: Moved appendString to PlatformString.h.
+ (WebCore::appendQuotedURLAttributeValue): Use protocolIs.
+ (WebCore::completeURLs): Removed DeprecatedString use.
+ (WebCore::createFragmentFromMarkup): Use blankURL.
+ (WebCore::fillContainerFromString): Removed DeprecatedString use.
+ (WebCore::createFragmentFromText): Ditto.
+
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::url): Removed DeprecatedString use.
+ (WebCore::HistoryItem::originalURL): Ditto.
+ * history/HistoryItem.h: Removed include.
+
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::defaultEventHandler): Removed use of
+ DeprecatedString.
+ (WebCore::HTMLAnchorElement::href): Return KURL.
+ (WebCore::HTMLAnchorElement::hash): Removed DeprecatedString use.
+ (WebCore::HTMLAnchorElement::host): Ditto.
+ (WebCore::HTMLAnchorElement::hostname): Ditto.
+ (WebCore::HTMLAnchorElement::pathname): Ditto.
+ (WebCore::HTMLAnchorElement::port): Ditto.
+ (WebCore::HTMLAnchorElement::protocol): Ditto.
+ (WebCore::HTMLAnchorElement::search): Ditto.
+ (WebCore::HTMLAnchorElement::toString): Ditto.
+ * html/HTMLAnchorElement.h: Ditto.
+ * html/HTMLAppletElement.cpp:
+ (WebCore::HTMLAppletElement::createRenderer): Updated for KURL change.
+ * html/HTMLAreaElement.cpp:
+ (WebCore::HTMLAreaElement::href): Return KURL.
+ * html/HTMLAreaElement.h: Ditto.
+ * html/HTMLBaseElement.cpp:
+ (WebCore::HTMLBaseElement::removedFromDocument): Updated for KURL change.
+ (WebCore::HTMLBaseElement::process): Removed DeprecatedString use.
+ * html/HTMLBodyElement.cpp:
+ (WebCore::HTMLBodyElement::parseMappedAttribute): Updated for KURL change.
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::parseMappedAttribute): Removed use of
+ DeprecatedString.
+ * html/HTMLEmbedElement.h: Removed DeprecatedString use.
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::formWouldHaveSecureSubmission): Use protocolIs.
+ (WebCore::encodeCString): Updated for change to String::split.
+ (WebCore::HTMLFormElement::dataEncoding): Ditto.
+ (WebCore::HTMLFormElement::formData): Removed DeprecatedString use.
+ (WebCore::HTMLFormElement::isMailtoForm): Use protocolIs.
+ (WebCore::HTMLFormElement::submit): Updated for KURL change.
+ (WebCore::HTMLFormElement::reset): Ditto.
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::isURLAllowed): Updated for KURL change
+ and use equalIgnoringRef instead of doing a setRef to get the same effect.
+ (WebCore::HTMLFrameElementBase::openURL): Use blankURL.
+ (WebCore::HTMLFrameElementBase::location): Return KURL.
+ (WebCore::HTMLFrameElementBase::src): Return KURL.
+ * html/HTMLFrameElementBase.h: Ditto.
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::parseMappedAttribute): Updated for KURL change.
+ (WebCore::HTMLImageElement::longDesc): Return KURL.
+ (WebCore::HTMLImageElement::lowsrc): Return KURL.
+ (WebCore::HTMLImageElement::src): Return KURL.
+ * html/HTMLImageElement.h: Ditto. Also removed imageMap() function.
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::src): Return KURL.
+ * html/HTMLInputElement.h: Ditto.
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::parseMappedAttribute): Updated for KURL change.
+ (WebCore::HTMLLinkElement::tokenizeRelAttribute): Updated for String::split change.
+ (WebCore::HTMLLinkElement::href): Return KURL.
+ * html/HTMLLinkElement.h: Ditto.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::src): Return KURL.
+ (WebCore::HTMLMediaElement::pickMedia): Updated for KURL change.
+ * html/HTMLMediaElement.h: Ditto.
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::isImageType): Use protocolIs.
+ (WebCore::HTMLObjectElement::data): Return KURL.
+ * html/HTMLObjectElement.h: Ditto.
+ * html/HTMLOptGroupElement.cpp:
+ (WebCore::HTMLOptGroupElement::groupLabelText): Removed DeprecatedString use.
+ * html/HTMLParser.cpp:
+ (WebCore::HTMLParser::reportErrorToConsole): Updated for KURL change.
+ * html/HTMLScriptElement.cpp:
+ (WebCore::HTMLScriptElement::insertedIntoDocument): Ditto.
+ (WebCore::HTMLScriptElement::text): Changed to use Vector<UChar> instead of
+ String for better performance.
+ (WebCore::HTMLScriptElement::src): Return KURL.
+ * html/HTMLScriptElement.h: Ditto.
+ * html/HTMLSourceElement.cpp:
+ (WebCore::HTMLSourceElement::src): Return KURL.
+ * html/HTMLSourceElement.h: Ditto.
+ * html/HTMLTableElement.cpp:
+ (WebCore::HTMLTableElement::parseMappedAttribute): Updated for KURL change.
+ * html/HTMLTablePartElement.cpp:
+ (WebCore::HTMLTablePartElement::parseMappedAttribute): Updated for KURL change.
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::setValue): Removed DeprecatedString use.
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::scriptExecution): Ditto.
+ (WebCore::HTMLTokenizer::notifyFinished): Use protocolIs.
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::poster): Return KURL.
+ * html/HTMLVideoElement.h: Ditto.
+ * html/HTMLViewSourceDocument.cpp:
+ (WebCore::HTMLViewSourceDocument::addText): Updated for String::split change.
+
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::checkForReload): Add an explicit check for an empty URL
+ here to avoid problems using its string as a hash table key later.
+ (WebCore::DocLoader::requestResource): Removed DeprecatedString use.
+
+ * loader/FTPDirectoryDocument.cpp:
+ (WebCore::FTPDirectoryTokenizer::createTDForFilename): Updated for KURL change.
+ (WebCore::FTPDirectoryTokenizer::parseAndAppendOneLine): Removed use of
+ DeprecatedString.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::requestFrame): Use protocolIs.
+ (WebCore::FrameLoader::loadSubframe): Use blankURL.
+ (WebCore::FrameLoader::submitForm): Use protocolIs and removed use of
+ DeprecatedString.
+ (WebCore::FrameLoader::iconURL): Return KURL. Use protcolIs.
+ (WebCore::FrameLoader::didOpenURL): Use protocolIs.
+ (WebCore::FrameLoader::didExplicitOpen): Use blankURL.
+ (WebCore::FrameLoader::executeIfJavaScriptURL): Use protocolIs.
+ Update for name change to decodeURLEscapeSequences.
+ (WebCore::FrameLoader::receivedFirstData): Updated for KURL changes.
+ (WebCore::FrameLoader::begin): Removed DeprecatedString use.
+ Renamed baseurl to baseURL. Updated to use KURL more.
+ (WebCore::FrameLoader::gotoAnchor): Removed use of encodedHtmlRef
+ function, which is no different from ref.
+ (WebCore::FrameLoader::completeURL): Updated for KURL change.
+ (WebCore::FrameLoader::scheduleLocationChange): Ditto.
+ (WebCore::FrameLoader::canCachePage): Use protocolIs.
+ (WebCore::FrameLoader::updatePolicyBaseURL): Update for KURL change.
+ (WebCore::FrameLoader::setPolicyBaseURL): Take KURL.
+ (WebCore::FrameLoader::startRedirectionTimer): Removed use of
+ DeprecatedString.
+ (WebCore::FrameLoader::load): Use protocolIs.
+ (WebCore::FrameLoader::shouldHideReferrer): Use protocolIs.
+ (WebCore::FrameLoader::shouldAllowNavigation): Updated for KURL change.
+ (WebCore::FrameLoader::commitProvisionalLoad): Use blankURL.
+ (WebCore::FrameLoader::open): Use protcolIs.
+ (WebCore::FrameLoader::createHistoryItem): Use blankURL.
+ (WebCore::FrameLoader::createJavaAppletWidget): Updated for KURL change.
+ (WebCore::FrameLoader::switchOutLowBandwidthDisplayIfReady): Removed
+ DeprecatedString use.
+ * loader/FrameLoader.h: Ditto.
+
+ * loader/ImageDocument.cpp:
+ (WebCore::ImageDocument::createDocumentStructure): Updated for KURL change.
+ * loader/PluginDocument.cpp:
+ (WebCore::PluginTokenizer::createDocumentStructure): Ditto.
+
+ * loader/icon/IconDatabase.cpp:
+ (WebCore::IconDatabase::iconForPageURL): Added a check for an empty URL
+ before trying to use it as a hash table key.
+
+ * loader/icon/IconLoader.h: Tweaked includes.
+
+ * loader/loader.cpp:
+ (WebCore::Loader::servePendingRequests): Use protcolIs. Also removed some
+ code to set up a local variable that is never used (and a DeprecatedString
+ on to boot!).
+
+ * loader/mac/LoaderNSURLExtras.m:
+ (suggestedFilenameWithMIMEType): Removed unnecessary typecast.
+
+ * page/ContextMenuController.cpp: Removed include.
+
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::needsKeyboardEventDisambiguationQuirks):
+ Use protocolIs.
+
+ * page/mac/WebCoreFrameBridge.mm:
+ (-[WebCoreFrameBridge URLWithAttributeString:]): Removed getNSURL call.
+ (-[WebCoreFrameBridge baseURL]): Ditto.
+
+ * platform/KURL.cpp:
+ (WebCore::isSchemeFirstChar): Fixed bug in handling of values >= 0x80.
+ (WebCore::isSchemeChar): Ditto.
+ (WebCore::isPathSegmentEndChar): Ditto.
+ (WebCore::hexDigitValue): Changed parameter type to UChar.
+ (WebCore::copyASCII): Added.
+ (WebCore::findFirstOf): Added.
+ (WebCore::KURL::protocolIs): Added.
+ (WebCore::KURL::KURL): Tightened logic up quite a bit. Changed parameter
+ types from DeprecatedString to String.
+ (WebCore::KURL::init): Changed parameter type to String. Preserved the
+ passed-in string even if the base is invalid. Cleaned up logic to determine
+ if the originalString should be pased in to the parse function. Simplified
+ by calling the new parse overload that takes String in many cases.
+ (WebCore::KURL::lastPathComponent): Return String.
+ (WebCore::KURL::protocol): Ditto.
+ (WebCore::KURL::host): Ditto.
+ (WebCore::KURL::port): Changed logic to use early return for clarity.
+ (WebCore::KURL::pass): Return String.
+ (WebCore::KURL::user): Ditto.
+ (WebCore::KURL::ref): Ditto.
+ (WebCore::assertProtocolIsGood): Added.
+ (WebCore::KURL::protocolIs): Added.
+ (WebCore::KURL::query): Return String.
+ (WebCore::KURL::path): Ditto.
+ (WebCore::KURL::setProtocol): Take String.
+ (WebCore::KURL::setHost): Ditto.
+ (WebCore::KURL::setPort): Use String.
+ (WebCore::KURL::setHostAndPort): Take String.
+ (WebCore::KURL::setUser): Ditto.
+ (WebCore::KURL::setPass): Ditto.
+ (WebCore::KURL::setRef): Ditto.
+ (WebCore::KURL::setQuery): Ditto.
+ (WebCore::KURL::setPath): Ditto.
+ (WebCore::KURL::prettyURL): Return String. Use Vector<UChar> to build it.
+ (WebCore::decodeURLEscapeSequences): Renamed from KURL::decode_string.
+ Return String. Use Vector<UChar> to build it.
+ (WebCore::KURL::isLocalFile): Use protocolIs.
+ (WebCore::KURL::parse): Added an overload that takes a String to replace
+ the use of DeprecatedString::ascii at various call sites. Updated for
+ name change (urlString -> m_string).
+ (WebCore::equalIgnoringRef): Wrote a new implementation that doesn't
+ do any allocation.
+ (WebCore::encodeWithURLEscapeSequences): Renamed from KURL::encode_string.
+ Return String.
+ (WebCore::appendEncodedHostname): Added. Replaces encodeHostname and
+ avoids the need to allocate a string.
+ (WebCore::findHostnamesInMailToURL): Update to use findFirstOf instead of
+ regular expressions.
+ (WebCore::findHostnameInHierarchicalURL): Ditto.
+ (WebCore::encodeHostnames): Use protocolIs and the other helpers above.
+ (WebCore::encodeRelativeString): Changed to put result into a CharBuffer.
+ (WebCore::substituteBackslashes): Updated to use String.
+ (WebCore::KURL::copyToBuffer): Added.
+ (WebCore::protocolIs): Added.
+ (WebCore::blankURL): Added.
+ (WebCore::KURL::print): Updated.
+ * platform/KURL.h: Added a number of comments. Reorganized the header a bit.
+ Made the string constructors explicit. Changed to use String instead of
+ DeprecatedString. Removed encodedHTMLRef. Renamed and added a few functions.
+
+ * platform/cf/KURLCFNet.cpp:
+ (WebCore::KURL::KURL): Streamlined the logic a bit.
+ (WebCore::KURL::createCFURL): Changed to use copyToBuffer.
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivate::createQTMovie): Removed getNSURL call.
+ Use protocolIs.
+ * platform/mac/ClipboardMac.mm:
+ (WebCore::ClipboardMac::declareAndWriteDragImage): Removed getNSURL call.
+ * platform/mac/CookieJar.mm:
+ (WebCore::cookies): Removed getNSURL call.
+ (WebCore::setCookies): Removed getNSURL call.
+ * platform/mac/KURLMac.mm:
+ (WebCore::KURL::KURL): Streamlined the logic a bit.
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::writeURL): Removed getNSURL call.
+ (WebCore::Pasteboard::writeImage): Ditto.
+ * platform/mac/SSLKeyGeneratorMac.mm:
+ (WebCore::signedPublicKeyAndChallengeString): Ditto.
+
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::filenameFromHTTPContentDisposition): Updated for String::split.
+ * platform/network/ResourceHandle.cpp:
+ (WebCore::ResourceHandle::portAllowed): Use protocolIs.
+
+ * platform/network/cf/ResourceErrorCF.cpp:
+ (WebCore::ResourceError::operator CFErrorRef): Removed deprecatedString call.
+ * platform/network/curl/ResourceHandleManager.cpp:
+ (WebCore::headerCallback): Ditto.
+ (WebCore::parseDataUrl): Use String instead of DeprecatedString.
+ (WebCore::ResourceHandleManager::startJob): Updated for KURL changes.
+ * platform/network/mac/ResourceErrorMac.mm:
+ (WebCore::ResourceError::operator NSError*): Removed getNSURL call.
+ * platform/network/mac/ResourceRequest.h:
+ (WebCore::ResourceRequest::ResourceRequest): Removed DeprecatedString use.
+ * platform/network/mac/ResourceRequestMac.mm:
+ (WebCore::ResourceRequest::doUpdatePlatformRequest): Removed getNSURL call.
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::nsURLResponse): Removed getNSURL call.
+
+ * platform/qt/ClipboardQt.cpp:
+ (WebCore::ClipboardQt::writeURL): Removed deprecatedString call.
+
+ * platform/text/CString.h:
+ (WebCore::CStringBuffer::length): Fixed size_t/unsigned mismatch to make it
+ possible to compile this on Windows with higher warning level
+
+ * platform/text/PlatformString.h: Updated split to modify a result parameter
+ rather than returning a Vector. Added charactersAreAllASCII and an append
+ function that appends a String to a Vector<UChar>.
+ * platform/text/String.cpp:
+ (WebCore::String::split): Updated.
+
+ * platform/win/BString.cpp:
+ (WebCore::BString::BString): Added conversion from KURL.
+ * platform/win/BString.h: Ditto.
+
+ * platform/win/ClipboardUtilitiesWin.cpp:
+ (WebCore::markupToCF_HTML): Removed use of deprecatedString.
+ * platform/win/ClipboardWin.cpp:
+ (WebCore::filesystemPathFromUrlOrTitle): Ditto.
+ (WebCore::createGlobalHDropContent): Ditto.
+ (WebCore::ClipboardWin::setData): Ditto.
+ (WebCore::ClipboardWin::writeRange): Ditto.
+ * platform/win/PasteboardWin.cpp:
+ (WebCore::Pasteboard::writeSelection): Ditto.
+ * plugins/PluginStream.cpp:
+ (WebCore::PluginStream::startStream): Ditto.
+ (WebCore::PluginStream::destroyStream): Ditto.
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::scriptStringIfJavaScriptURL): Ditto.
+ (WebCore::PluginView::performRequest): Ditto.
+ (WebCore::PluginView::PluginView): Ditto.
+
+ * rendering/HitTestResult.cpp:
+ (WebCore::HitTestResult::absoluteImageURL): Removed DeprecatedString use.
+ (WebCore::HitTestResult::absoluteLinkURL): Ditto.
+
+ * rendering/RenderFrameSet.cpp:
+ (WebCore::RenderFrameSet::layOutAxis): Fixed comment wording.
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintReplaced): Removed use of DeperecatedString,
+ (WebCore::RenderImage::imageMap): Changed to call useMap instead of imageMap;
+ both do the same thing, and the first is standard DOM.
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::addPDFURLRect): Rewrote and streamlined to remove
+ DeprecatedString use.
+ * rendering/RenderObject.h: Changed addPDFURLRect to take const IntRect&.
+
+ * rendering/RenderPartObject.cpp:
+ (WebCore::isURLAllowed): Updated for KURL change and use equalIgnoringRef
+ instead of doing a setRef to get the same effect.
+ (WebCore::RenderPartObject::updateWidget): Updated for KURL change.
+
+ * rendering/RenderText.cpp:
+ (WebCore::charactersAreAllASCII): Moved the guts to PlatformString.h.
+
+ * rendering/SVGRenderSupport.cpp:
+ (WebCore::renderSubtreeToImage): Added missing call to do layout. I ran
+ into this while doing some layout tests while URL processing was broken.
+
+ * rendering/SVGRenderTreeAsText.h: Removed include.
+
+ * svg/SVGImageLoader.cpp:
+ (WebCore::SVGImageLoader::updateFromElement): Removed DeprecatedString use.
+
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::draw): Added missing call to do layout. I ran
+ into this while doing some layout tests while URL processing was broken.
+ (WebCore::SVGImage::dataChanged): Use a null URL rather than an arbitrary
+ string for the document.
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::getResponseXML): Removed DeprecatedString use.
+ (WebCore::XMLHttpRequest::urlMatchesDocumentDomain): Ditto.
+ (WebCore::XMLHttpRequest::open): Ditto.
+ (WebCore::XMLHttpRequest::send): Namespace change.
+ (WebCore::XMLHttpRequest::dropProtection): Ditto.
+ * xml/XMLHttpRequest.h: Removed DeprecatedString use.
+
+ * xml/XSLImportRule.cpp:
+ (WebCore::XSLImportRule::loadSheet): Removed DeprecatedString use.
+ * xml/XSLStyleSheet.cpp:
+ (WebCore::XSLStyleSheet::loadChildSheets): Ditto.
+ (WebCore::XSLStyleSheet::loadChildSheet): Ditto.
+ * xml/XSLStyleSheet.h: Ditto.
+ * xml/XSLTProcessor.cpp:
+ (WebCore::docLoaderFunc): Ditto.
+ (WebCore::xsltStylesheetPointer): Ditto.
+ (WebCore::xmlDocPtrFromNode): Ditto.
+
2008-02-14 Ada Chan <adachan@apple.com>
<rdar://problem/5744728> Fix leaks of RegularExpression objects in Frame.cpp.
__ZN7WebCore21findEventWithKeyStateEPNS_5EventE
__ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
__ZN7WebCore21reportThreadViolationEPKc
+__ZN7WebCore24decodeURLEscapeSequencesERKNS_6StringE
__ZN7WebCore24notifyHistoryItemChangedE
__ZN7WebCore26CSSMutableStyleDeclarationC1Ev
__ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEPNS_32NetscapePlugInStreamLoaderClientE
__ZN7WebCore4FontC1Ev
__ZN7WebCore4FontD1Ev
__ZN7WebCore4FontaSERKS0_
-__ZN7WebCore4KURL13decode_stringERKNS_16DeprecatedStringE
__ZN7WebCore4KURLC1EP5NSURL
-__ZN7WebCore4KURLC1ERKNS_16DeprecatedStringE
+__ZN7WebCore4KURLC1ERKNS_6StringE
__ZN7WebCore4KURLC1Ev
__ZN7WebCore4Node17stopIgnoringLeaksEv
__ZN7WebCore4Node18startIgnoringLeaksEv
__ZN7WebCore6WidgetC1Ev
__ZN7WebCore7IntSizeC1ERK7_NSSize
__ZN7WebCore7nsColorERKNS_5ColorE
-__ZN7WebCore8Document11completeURLERKNS_16DeprecatedStringE
+__ZN7WebCore8Document11completeURLERKNS_6StringE
__ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
__ZN7WebCore8Document4bodyEv
__ZN7WebCore9TimerBaseD2Ev
__ZN7WebCore9pageCacheEv
__ZN7WebCoreeqERKNS_19ResourceRequestBaseES2_
-__ZN7WebCoreeqERKNS_4KURLES2_
__ZNK7WebCore11CachedImage5imageEv
__ZNK7WebCore11ContextMenu19platformDescriptionEv
__ZNK7WebCore11FrameLoader10isCompleteEv
__ZNK7WebCore4KURL17lastPathComponentEv
__ZNK7WebCore4KURL4hostEv
__ZNK7WebCore4KURL4pathEv
-__ZNK7WebCore4KURL8getNSURLEv
+__ZNK7WebCore4KURLcvP5NSURLEv
__ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
__ZNK7WebCore5Frame10isFrameSetEv
__ZNK7WebCore5Frame12eventHandlerEv
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "config.h"
#include "JSAttr.h"
-#include "Attr.h"
-#include "Document.h"
-#include "ExceptionCode.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
-#include "PlatformString.h"
-#include "kjs_binding.h"
-#include "kjs_dom.h"
+
+using namespace KJS;
namespace WebCore {
using namespace HTMLNames;
-void JSAttr::setValue(KJS::ExecState* exec, KJS::JSValue* value)
+void JSAttr::setValue(ExecState* exec, JSValue* value)
{
Attr* imp = static_cast<Attr*>(impl());
String attrValue = valueToStringWithNullCheck(exec, value);
Element* ownerElement = imp->ownerElement();
- if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag)) && equalIgnoringCase(imp->name(), "src") && attrValue.startsWith("javascript:", false)) {
- HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(ownerElement);
- if (!checkNodeSecurity(exec, frame->contentDocument()))
- return;
+ if (ownerElement && (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag))) {
+ if (equalIgnoringCase(imp->name(), "src") && protocolIs(attrValue, "javascript")) {
+ if (!checkNodeSecurity(exec, static_cast<HTMLFrameElementBase*>(ownerElement)->contentDocument()))
+ return;
+ }
}
ExceptionCode ec = 0;
imp->setValue(attrValue, ec);
- KJS::setDOMException(exec, ec);
+ setDOMException(exec, ec);
}
} // namespace WebCore
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
- class JSAudioConstructor : public KJS::DOMObject {
+ class JSAudioConstructor : public DOMObject {
public:
JSAudioConstructor(KJS::ExecState*, Document*);
virtual bool implementsConstruct() const;
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "CSSImportRule.h"
#include "CSSMediaRule.h"
#include "CSSPageRule.h"
-#include "CSSRule.h"
#include "CSSStyleRule.h"
#include "JSCSSCharsetRule.h"
#include "JSCSSFontFaceRule.h"
#include "JSCSSMediaRule.h"
#include "JSCSSPageRule.h"
#include "JSCSSStyleRule.h"
-#include "kjs_binding.h"
+
+using namespace KJS;
namespace WebCore {
-KJS::JSValue* toJS(KJS::ExecState* exec, CSSRule* rule)
+JSValue* toJS(ExecState* exec, CSSRule* rule)
{
if (!rule)
- return KJS::jsNull();
+ return jsNull();
- KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(rule);
+ DOMObject* ret = ScriptInterpreter::getDOMObject(rule);
if (ret)
return ret;
break;
}
- KJS::ScriptInterpreter::putDOMObject(rule, ret);
+ ScriptInterpreter::putDOMObject(rule, ret);
return ret;
}
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "JSCSSValue.h"
#include "CSSPrimitiveValue.h"
-#include "CSSValue.h"
#include "CSSValueList.h"
#include "JSCSSPrimitiveValue.h"
#include "JSCSSValueList.h"
-#include "kjs_binding.h"
#if ENABLE(SVG)
#include "JSSVGColor.h"
#include "SVGPaint.h"
#endif
+using namespace KJS;
+
namespace WebCore {
-KJS::JSValue* toJS(KJS::ExecState* exec, CSSValue* value)
+JSValue* toJS(ExecState* exec, CSSValue* value)
{
if (!value)
- return KJS::jsNull();
+ return jsNull();
- KJS::DOMObject* ret = KJS::ScriptInterpreter::getDOMObject(value);
+ DOMObject* ret = ScriptInterpreter::getDOMObject(value);
if (ret)
return ret;
else
ret = new JSCSSValue(JSCSSValuePrototype::self(exec), value);
- KJS::ScriptInterpreter::putDOMObject(value, ret);
+ ScriptInterpreter::putDOMObject(value, ret);
return ret;
}
#include "JSDocument.h"
#include "DOMWindow.h"
-#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
#include "JSDOMWindow.h"
#include "JSHTMLDocument.h"
#include "JSLocation.h"
-#include "kjs_binding.h"
#include "kjs_proxy.h"
#if ENABLE(SVG)
#include "SVGDocument.h"
#endif
-namespace WebCore {
-
using namespace KJS;
+namespace WebCore {
+
void JSDocument::mark()
{
JSEventTargetNode::mark();
if (!frame)
return jsNull();
- KJS::Window* win = KJS::Window::retrieveWindow(frame);
+ Window* win = Window::retrieveWindow(frame);
ASSERT(win);
return win->location();
}
// not the target frame.
Frame* activeFrame = static_cast<JSDOMWindow*>(exec->dynamicGlobalObject())->impl()->frame();
if (activeFrame)
- str = activeFrame->document()->completeURL(str);
+ str = activeFrame->document()->completeURL(str).string();
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), false, userGesture);
// Make sure the document is kept around by the window object, and works right with the
// back/forward cache.
if (doc->frame())
- KJS::Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
+ Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly);
else {
size_t nodeCount = 0;
for (Node* n = doc; n; n = n->traverseNextNode())
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "config.h"
#include "JSElement.h"
-#include "Attr.h"
-#include "Document.h"
-#include "Element.h"
#include "ExceptionCode.h"
#include "HTMLFrameElementBase.h"
#include "HTMLNames.h"
-#include "PlatformString.h"
-#include "kjs_binding.h"
-#include "kjs_dom.h"
+
+using namespace KJS;
namespace WebCore {
using namespace HTMLNames;
-static inline bool allowSettingSrcToJavascriptURL(KJS::ExecState* exec, Element* element, String name, String value)
+static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value)
{
- if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && value.startsWith("javascript:", false)) {
+ if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIs(value, "javascript")) {
HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(element);
if (!checkNodeSecurity(exec, frame->contentDocument()))
return false;
return true;
}
-KJS::JSValue* JSElement::setAttribute(KJS::ExecState* exec, const KJS::List& args)
+JSValue* JSElement::setAttribute(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
String name = args[0]->toString(exec);
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, name, value))
- return KJS::jsUndefined();
+ return jsUndefined();
imp->setAttribute(name, value, ec);
- KJS::setDOMException(exec, ec);
- return KJS::jsUndefined();
+ setDOMException(exec, ec);
+ return jsUndefined();
}
-KJS::JSValue* JSElement::setAttributeNode(KJS::ExecState* exec, const KJS::List& args)
+JSValue* JSElement::setAttributeNode(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
bool newAttrOk;
Attr* newAttr = toAttr(args[0], newAttrOk);
if (!newAttrOk) {
setDOMException(exec, TYPE_MISMATCH_ERR);
- return KJS::jsUndefined();
+ return jsUndefined();
}
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
- return KJS::jsUndefined();
+ return jsUndefined();
- KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
- KJS::setDOMException(exec, ec);
+ JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
+ setDOMException(exec, ec);
return result;
}
-KJS::JSValue* JSElement::setAttributeNS(KJS::ExecState* exec, const KJS::List& args)
+JSValue* JSElement::setAttributeNS(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
String namespaceURI = valueToStringWithNullCheck(exec, args[0]);
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, qualifiedName, value))
- return KJS::jsUndefined();
+ return jsUndefined();
imp->setAttributeNS(namespaceURI, qualifiedName, value, ec);
- KJS::setDOMException(exec, ec);
- return KJS::jsUndefined();
+ setDOMException(exec, ec);
+ return jsUndefined();
}
-KJS::JSValue* JSElement::setAttributeNodeNS(KJS::ExecState* exec, const KJS::List& args)
+JSValue* JSElement::setAttributeNodeNS(ExecState* exec, const List& args)
{
ExceptionCode ec = 0;
bool newAttrOk;
Attr* newAttr = toAttr(args[0], newAttrOk);
if (!newAttrOk) {
- KJS::setDOMException(exec, TYPE_MISMATCH_ERR);
- return KJS::jsUndefined();
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
}
Element* imp = impl();
if (!allowSettingSrcToJavascriptURL(exec, imp, newAttr->name(), newAttr->value()))
- return KJS::jsUndefined();
+ return jsUndefined();
- KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
- KJS::setDOMException(exec, ec);
+ JSValue* result = toJS(exec, WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
+ setDOMException(exec, ec);
return result;
}
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "config.h"
#include "JSHTMLFrameElement.h"
-#include "Document.h"
#include "HTMLFrameElement.h"
-#include "PlatformString.h"
-#include "kjs_binding.h"
-#include "kjs_dom.h"
+
+using namespace KJS;
namespace WebCore {
-static inline bool allowSettingJavascriptURL(KJS::ExecState* exec, HTMLFrameElement* imp, String value)
+static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* imp, const String& value)
{
- if (value.startsWith("javascript:", false)) {
+ if (protocolIs(value, "javascript")) {
if (!checkNodeSecurity(exec, imp->contentDocument()))
return false;
}
return true;
}
-void JSHTMLFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
+void JSHTMLFrameElement::setSrc(ExecState* exec, JSValue* value)
{
HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl());
- String srcValue = KJS::valueToStringWithNullCheck(exec, value);
+ String srcValue = valueToStringWithNullCheck(exec, value);
if (!allowSettingJavascriptURL(exec, imp, srcValue))
return;
return;
}
-void JSHTMLFrameElement::setLocation(KJS::ExecState* exec, KJS::JSValue* value)
+void JSHTMLFrameElement::setLocation(ExecState* exec, JSValue* value)
{
HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl());
- String locationValue = KJS::valueToStringWithNullCheck(exec, value);
+ String locationValue = valueToStringWithNullCheck(exec, value);
if (!allowSettingJavascriptURL(exec, imp, locationValue))
return;
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "config.h"
#include "JSHTMLIFrameElement.h"
-#include "Document.h"
#include "HTMLIFrameElement.h"
-#include "PlatformString.h"
-#include "kjs_binding.h"
-#include "kjs_dom.h"
+
+using namespace KJS;
namespace WebCore {
-void JSHTMLIFrameElement::setSrc(KJS::ExecState* exec, KJS::JSValue* value)
+void JSHTMLIFrameElement::setSrc(ExecState* exec, JSValue* value)
{
HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
- String srcValue = KJS::valueToStringWithNullCheck(exec, value);
- if (srcValue.startsWith("javascript:", false)) {
+
+ String srcValue = valueToStringWithNullCheck(exec, value);
+
+ if (protocolIs(srcValue, "javascript")) {
if (!checkNodeSecurity(exec, imp->contentDocument()))
return;
}
imp->setSrc(srcValue);
- return;
}
} // namespace WebCore
/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#include "JSHTMLOptionElement.h"
#include "Text.h"
-namespace WebCore {
-
using namespace KJS;
-JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* d)
- : KJS::DOMObject(exec->lexicalGlobalObject()->objectPrototype())
- , m_doc(d)
+namespace WebCore {
+
+JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document)
+ : DOMObject(exec->lexicalGlobalObject()->objectPrototype())
+ , m_document(document)
{
putDirect(exec->propertyNames().length, jsNumber(4), ReadOnly|DontDelete|DontEnum);
}
JSObject* JSHTMLOptionElementConstructor::construct(ExecState* exec, const List& args)
{
- int exception = 0;
- RefPtr<Element> el(m_doc->createElement("option", exception));
- HTMLOptionElement* opt = 0;
- if (el) {
- opt = static_cast<HTMLOptionElement*>(el.get());
- int sz = args.size();
- RefPtr<Text> text = m_doc->createTextNode("");
- opt->appendChild(text, exception);
- if (exception == 0 && sz > 0)
- text->setData(args[0]->toString(exec), exception);
- if (exception == 0 && sz > 1)
- opt->setValue(args[1]->toString(exec));
- if (exception == 0 && sz > 2)
- opt->setDefaultSelected(args[2]->toBoolean(exec));
- if (exception == 0 && sz > 3)
- opt->setSelected(args[3]->toBoolean(exec));
+ ExceptionCode ec = 0;
+
+ RefPtr<HTMLOptionElement> element = static_pointer_cast<HTMLOptionElement>(m_document->createElement("option", ec));
+ if (element) {
+ RefPtr<Text> text = m_document->createTextNode("");
+ if (!args[0]->isUndefined())
+ text->setData(args[0]->toString(exec), ec);
+ if (ec == 0)
+ element->appendChild(text.release(), ec);
+ if (ec == 0 && !args[1]->isUndefined())
+ element->setValue(args[1]->toString(exec));
+ if (ec == 0)
+ element->setDefaultSelected(args[2]->toBoolean(exec));
+ if (ec == 0)
+ element->setSelected(args[3]->toBoolean(exec));
}
- setDOMException(exec, exception);
- return static_cast<JSObject*>(toJS(exec, opt));
+ setDOMException(exec, ec);
+ if (ec || !element)
+ return 0;
+
+ return static_cast<JSObject*>(toJS(exec, element.release()));
}
} // namespace WebCore
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace WebCore {
- class JSHTMLOptionElementConstructor : public KJS::DOMObject {
+ class JSHTMLOptionElementConstructor : public DOMObject {
public:
JSHTMLOptionElementConstructor(KJS::ExecState*, Document*);
virtual bool implementsConstruct() const;
- virtual KJS::JSObject *construct(KJS::ExecState*, const KJS::List& args);
+ virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List& args);
private:
- RefPtr<Document> m_doc;
+ RefPtr<Document> m_document;
};
}
#include "DOMWindow.h"
#include "Frame.h"
#include "FrameLoader.h"
-#include "PlatformString.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
if (!m_frame)
return;
- DeprecatedString str = value->toString(exec);
+ String str = value->toString(exec);
KURL url = m_frame->loader()->url();
bool sameDomainAccess = allowsAccessFromFrame(exec, m_frame);
switch (entry->value.intValue) {
case Href: {
+ // FIXME: Why isn't this security check needed for the other properties, like Host, below?
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
if (!frame)
return;
url = frame->loader()->completeURL(str);
break;
}
- case Hash: {
+ case Hash:
if (str.startsWith("#"))
- str = str.mid(1);
+ str = str.substring(1);
if (url.ref() == str)
return;
url.setRef(str);
break;
- }
- case Host: {
+ case Host:
url.setHostAndPort(str);
break;
- }
case Hostname:
url.setHost(str);
break;
case Pathname:
url.setPath(str);
break;
- case Port:
- url.setPort(str.toUInt());
+ case Port: {
+ // FIXME: Could make this a little less ugly if String provided a toUnsignedShort function.
+ int port = str.toInt();
+ if (port < 0 || port > 0xFFFF)
+ port = 0;
+ url.setPort(port);
break;
+ }
case Protocol:
url.setProtocol(str);
break;
}
Frame* activeFrame = Window::retrieveActive(exec)->impl()->frame();
- if (!url.deprecatedString().startsWith("javascript:", false) || sameDomainAccess) {
+ if (!url.protocolIs("javascript") || sameDomainAccess) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
m_frame->loader()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), false, userGesture);
}
if (activeFrame) {
if (!activeFrame->loader()->shouldAllowNavigation(frame))
return jsUndefined();
- DeprecatedString str = args[0]->toString(exec);
+ String str = args[0]->toString(exec);
const Window* window = Window::retrieveWindow(frame);
- if (!str.startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {
+ if (!protocolIs(str, "javascript") || (window && window->allowsAccessFrom(exec))) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
frame->loader()->scheduleLocationChange(activeFrame->loader()->completeURL(str).string(), activeFrame->loader()->outgoingReferrer(), true, userGesture);
}
if (!window->allowsAccessFrom(exec))
return jsUndefined();
- if (!frame->loader()->url().deprecatedString().startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {
+ if (!frame->loader()->url().protocolIs("javascript") || (window && window->allowsAccessFrom(exec))) {
bool userGesture = Window::retrieveActive(exec)->impl()->frame()->scriptProxy()->processingUserGesture();
frame->loader()->scheduleRefresh(userGesture);
}
return jsUndefined();
const Window* window = Window::retrieveWindow(frame);
String dstUrl = activeFrame->loader()->completeURL(args[0]->toString(exec)).string();
- if (!dstUrl.startsWith("javascript:", false) || (window && window->allowsAccessFrom(exec))) {
+ if (!protocolIs(dstUrl, "javascript") || (window && window->allowsAccessFrom(exec))) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
// We want a new history item if this JS was called via a user gesture
frame->loader()->scheduleLocationChange(dstUrl, activeFrame->loader()->outgoingReferrer(), false, userGesture);
class Frame;
- class JSLocation : public KJS::DOMObject {
- typedef KJS::DOMObject Base;
+ class JSLocation : public DOMObject {
+ typedef DOMObject Base;
friend class KJS::Window;
public:
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "JSNamedNodeMap.h"
#include "NamedNodeMap.h"
-#include "PlatformString.h"
#include "kjs_binding.h"
#include "kjs_dom.h"
+using namespace KJS;
+
namespace WebCore {
-bool JSNamedNodeMap::canGetItemsForName(KJS::ExecState*, NamedNodeMap* impl, const KJS::Identifier& propertyName)
+bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, const Identifier& propertyName)
{
return impl->getNamedItem(propertyName);
}
-KJS::JSValue* JSNamedNodeMap::nameGetter(KJS::ExecState* exec, KJS::JSObject* originalObject, const KJS::Identifier& propertyName, const KJS::PropertySlot& slot)
+JSValue* JSNamedNodeMap::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(slot.slotBase());
- return KJS::toJS(exec, thisObj->impl()->getNamedItem(propertyName));
+ return toJS(exec, thisObj->impl()->getNamedItem(propertyName));
}
} // namespace WebCore
// for constructs like document.forms.<name>[1],
// so it shouldn't be a problem that it's storing all the nodes (with the same name). (David)
JSNamedNodesCollection::JSNamedNodesCollection(KJS::JSObject* prototype, const Vector<RefPtr<Node> >& nodes)
- : KJS::DOMObject(prototype)
+ : DOMObject(prototype)
, m_nodes(nodes)
{
}
// Internal class, used for the collection return by e.g. document.forms.myinput
// when multiple nodes have the same name.
- class JSNamedNodesCollection : public KJS::DOMObject {
+ class JSNamedNodesCollection : public DOMObject {
public:
JSNamedNodesCollection(KJS::JSObject* prototype, const Vector<RefPtr<Node> >&);
#include "kjs_events.h"
#include "kjs_window.h"
-#include "JSXMLHttpRequest.lut.h"
-
-namespace KJS {
-
+using namespace KJS;
using namespace WebCore;
-////////////////////// JSXMLHttpRequest Object ////////////////////////
+#include "JSXMLHttpRequest.lut.h"
+
+namespace WebCore {
/* Source for JSXMLHttpRequestPrototypeTable.
@begin JSXMLHttpRequestPrototypeTable 7
return header;
}
-
JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&JSXMLHttpRequest::info))
Frame* frame = Window::retrieveActive(exec)->impl()->frame();
if (!frame)
return jsUndefined();
- KURL url = frame->loader()->completeURL(DeprecatedString(args[1]->toString(exec)));
+ KURL url = frame->loader()->completeURL(args[1]->toString(exec));
bool async = true;
if (args.size() >= 3)
String body;
if (args.size() >= 1) {
- if (args[0]->toObject(exec)->inherits(&JSDocument::info)) {
- Document* doc = static_cast<Document*>(static_cast<JSDocument*>(args[0]->toObject(exec))->impl());
- body = doc->toString().deprecatedString();
- } else {
+ if (args[0]->toObject(exec)->inherits(&JSDocument::info))
+ body = static_cast<Document*>(static_cast<JSDocument*>(args[0]->toObject(exec))->impl())->toString();
+ else {
// converting certain values (like null) to object can set an exception
if (exec->hadException())
exec->clearException();
-// -*- c-basic-offset: 2 -*-
/*
- * This file is part of the KDE libraries
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
*
* This library is free software; you can redistribute it and/or
class XMLHttpRequest;
class Document;
-}
-
-namespace KJS {
-
class JSXMLHttpRequestConstructorImp : public DOMObject {
public:
- JSXMLHttpRequestConstructorImp(ExecState*, WebCore::Document*);
+ JSXMLHttpRequestConstructorImp(KJS::ExecState*, Document*);
virtual bool implementsConstruct() const;
- virtual JSObject* construct(ExecState*, const List&);
+ virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
private:
- RefPtr<WebCore::Document> doc;
+ RefPtr<Document> doc;
};
class JSXMLHttpRequest : public DOMObject {
public:
- JSXMLHttpRequest(JSObject* prototype, WebCore::Document*);
+ JSXMLHttpRequest(KJS::JSObject* prototype, Document*);
~JSXMLHttpRequest();
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status,
StatusText, Abort, GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader, OverrideMIMEType,
AddEventListener, RemoveEventListener, DispatchEvent };
- virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
- JSValue* getValueProperty(ExecState*, int token) const;
- virtual void put(ExecState*, const Identifier& propertyName, JSValue* value, int attr = None);
- void putValueProperty(ExecState*, int token, JSValue* value, int /*attr*/);
- virtual bool toBoolean(ExecState*) const { return true; }
+ virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
+ KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;
+ virtual void put(KJS::ExecState*, const KJS::Identifier& propertyName, KJS::JSValue*, int attr);
+ void putValueProperty(KJS::ExecState*, int token, KJS::JSValue*, int attr);
+ virtual bool toBoolean(KJS::ExecState*) const { return true; }
virtual void mark();
- WebCore::XMLHttpRequest* impl() const { return m_impl.get(); }
+ XMLHttpRequest* impl() const { return m_impl.get(); }
private:
- RefPtr<WebCore::XMLHttpRequest> m_impl;
+ RefPtr<XMLHttpRequest> m_impl;
};
-JSValue* jsXMLHttpRequestPrototypeFunctionAbort(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionOpen(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionSend(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionSetRequestHeader(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionOverrideMIMEType(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(ExecState*, JSObject*, const List&);
-JSValue* jsXMLHttpRequestPrototypeFunctionDispatchEvent(ExecState*, JSObject*, const List&);
-
-} // namespace KJS
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionAbort(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionGetAllResponseHeaders(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionGetResponseHeader(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionOpen(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionSend(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionSetRequestHeader(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionOverrideMIMEType(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionAddEventListener(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionRemoveEventListener(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXMLHttpRequestPrototypeFunctionDispatchEvent(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+
+} // namespace WebCore
#endif // JSXMLHttpRequest_h
/*
- * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "JSXSLTProcessor.h"
#include "XSLTProcessor.h"
-#include "JSXSLTProcessor.lut.h"
#include "kjs_dom.h"
#include "JSDocument.h"
#include "Document.h"
#include "DocumentFragment.h"
+using namespace KJS;
using namespace WebCore;
-namespace KJS {
+#include "JSXSLTProcessor.lut.h"
+
+namespace WebCore {
const ClassInfo JSXSLTProcessor::info = { "XSLTProcessor", 0, 0 };
JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState* exec, JSObject* thisObj, const List& args)
{
- if (!thisObj->inherits(&KJS::JSXSLTProcessor::info))
+ if (!thisObj->inherits(&JSXSLTProcessor::info))
return throwError(exec, TypeError);
XSLTProcessor& processor = *static_cast<JSXSLTProcessor*>(thisObj)->impl();
return jsUndefined();
}
-XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState *exec)
+XSLTProcessorConstructorImp::XSLTProcessorConstructorImp(ExecState* exec)
: DOMObject(exec->lexicalGlobalObject()->objectPrototype())
{
putDirect(exec->propertyNames().prototype, XSLTProcessorPrototype::self(exec), None);
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "kjs_binding.h"
namespace WebCore {
- class XSLTProcessor;
-}
+
+class XSLTProcessor;
// Eventually we should implement XSLTException:
// http://lxr.mozilla.org/seamonkey/source/content/xsl/public/nsIXSLTException.idl
// http://bugs.webkit.org/show_bug.cgi?id=5446
-namespace KJS {
-
class JSXSLTProcessor : public DOMObject {
public:
- JSXSLTProcessor(JSObject* prototype);
+ JSXSLTProcessor(KJS::JSObject* prototype);
~JSXSLTProcessor();
- virtual const ClassInfo *classInfo() const { return &info; }
- static const ClassInfo info;
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
+
+ XSLTProcessor* impl() const { return m_impl.get(); }
- WebCore::XSLTProcessor *impl() const { return m_impl.get(); }
private:
- RefPtr<WebCore::XSLTProcessor> m_impl;
+ RefPtr<XSLTProcessor> m_impl;
};
class XSLTProcessorConstructorImp : public DOMObject {
public:
- XSLTProcessorConstructorImp(ExecState*);
+ XSLTProcessorConstructorImp(KJS::ExecState*);
virtual bool implementsConstruct() const;
- virtual JSObject* construct(ExecState*, const List&);
+ virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List&);
};
-JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(ExecState*, JSObject*, const List&);
-JSValue* jsXSLTProcessorPrototypeFunctionReset(ExecState*, JSObject*, const List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionImportStylesheet(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionTransformToFragment(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionTransformToDocument(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionSetParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionGetParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionRemoveParameter(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionClearParameters(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
+KJS::JSValue* jsXSLTProcessorPrototypeFunctionReset(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
-} // namespace KJS
+} // namespace WebCore
#endif // ENABLE(XSLT)
#include "JSNode.h"
#include "JSRangeException.h"
#include "JSXMLHttpRequestException.h"
+#include "KURL.h"
#include "RangeException.h"
#include "XMLHttpRequestException.h"
#include "kjs_window.h"
#endif
using namespace KJS;
-using namespace WebCore;
-using namespace HTMLNames;
-// FIXME: Move all this stuff into the WebCore namespace.
+namespace WebCore {
-namespace KJS {
+using namespace HTMLNames;
typedef HashMap<void*, DOMObject*> DOMObjectMap;
typedef HashMap<WebCore::Node*, JSNode*> NodeMap;
return jsString(s);
}
+JSValue* jsStringOrNull(const KURL& url)
+{
+ if (url.isNull())
+ return jsNull();
+ return jsString(url.string());
+}
+
+JSValue* jsStringOrUndefined(const KURL& url)
+{
+ if (url.isNull())
+ return jsUndefined();
+ return jsString(url.string());
+}
+
+JSValue* jsStringOrFalse(const KURL& url)
+{
+ if (url.isNull())
+ return jsBoolean(false);
+ return jsString(url.string());
+}
+
String valueToStringWithNullCheck(ExecState* exec, JSValue* val)
{
if (val->isNull())
exec->setException(errorObject);
}
-} // namespace KJS
-
-namespace WebCore {
-
bool allowsAccessFromFrame(ExecState* exec, Frame* frame)
{
if (!frame)
#endif
namespace WebCore {
+
class AtomicString;
class Document;
class Event;
class Frame;
+ class KURL;
class Node;
class String;
class JSNode;
#if ENABLE(SVG)
class SVGElement;
#endif
-}
-
-namespace KJS {
- /**
- * Base class for all objects in this binding EXCEPT Window
- */
- class DOMObject : public JSObject {
+ // Base class for all objects in this binding except Window.
+ class DOMObject : public KJS::JSObject {
protected:
- explicit DOMObject(JSValue* prototype) // FIXME: this should take a JSObject once JSLocation has a real prototype
+ explicit DOMObject(KJS::JSValue* prototype) // FIXME: this should take a JSObject once JSLocation has a real prototype
: JSObject(prototype)
{
// DOMObject destruction is not thread-safe because DOMObjects wrap
// unsafe WebCore DOM data structures.
- Collector::collectOnMainThreadOnly(this);
+ KJS::Collector::collectOnMainThreadOnly(this);
}
#ifndef NDEBUG
DOMObject();
};
- class ScriptInterpreter : public Interpreter {
+ class ScriptInterpreter : public KJS::Interpreter {
public:
static DOMObject* getDOMObject(void* objectHandle);
static void putDOMObject(void* objectHandle, DOMObject*);
static void forgetDOMObject(void* objectHandle);
- static WebCore::JSNode* getDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
- static void putDOMNodeForDocument(WebCore::Document*, WebCore::Node*, WebCore::JSNode* nodeWrapper);
- static void forgetDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
- static void forgetAllDOMNodesForDocument(WebCore::Document*);
- static void updateDOMNodeDocument(WebCore::Node*, WebCore::Document* oldDoc, WebCore::Document* newDoc);
- static void markDOMNodesForDocument(WebCore::Document*);
+ static JSNode* getDOMNodeForDocument(Document*, Node*);
+ static void putDOMNodeForDocument(Document*, Node*, JSNode* nodeWrapper);
+ static void forgetDOMNodeForDocument(Document*, Node*);
+ static void forgetAllDOMNodesForDocument(Document*);
+ static void updateDOMNodeDocument(Node*, Document* oldDoc, Document* newDoc);
+ static void markDOMNodesForDocument(Document*);
};
- /**
- * Retrieve from cache, or create, a JS object around a DOM object
- */
- template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline JSValue* cacheDOMObject(ExecState* exec, DOMObj* domObj)
+ // Retrieve from cache, or create, a JS wrapper for a DOM object.
+ template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline KJS::JSValue* cacheDOMObject(KJS::ExecState* exec, DOMObj* domObj)
{
if (!domObj)
- return jsNull();
+ return KJS::jsNull();
if (DOMObject* ret = ScriptInterpreter::getDOMObject(domObj))
return ret;
DOMObject* ret = new JSDOMObj(JSDOMObjPrototype::self(exec), domObj);
}
#if ENABLE(SVG)
- /**
- * Retrieve from cache, or create, a JS object around a SVG DOM object
- */
- template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline JSValue* cacheSVGDOMObject(ExecState* exec, DOMObj* domObj, WebCore::SVGElement* context)
+ // Retrieve from cache, or create, a JS wrapper for an SVG DOM object.
+ template<class DOMObj, class JSDOMObj, class JSDOMObjPrototype> inline KJS::JSValue* cacheSVGDOMObject(KJS::ExecState* exec, DOMObj* domObj, SVGElement* context)
{
if (!domObj)
- return jsNull();
+ return KJS::jsNull();
if (DOMObject* ret = ScriptInterpreter::getDOMObject(domObj))
return ret;
DOMObject* ret = new JSDOMObj(JSDOMObjPrototype::self(exec), domObj, context);
#endif
// Convert a DOM implementation exception code into a JavaScript exception in the execution state.
- void setDOMException(ExecState*, WebCore::ExceptionCode);
+ void setDOMException(KJS::ExecState*, ExceptionCode);
// Helper class to call setDOMException on exit without adding lots of separate calls to that function.
class DOMExceptionTranslator : Noncopyable {
public:
- explicit DOMExceptionTranslator(ExecState* exec) : m_exec(exec), m_code(0) { }
+ explicit DOMExceptionTranslator(KJS::ExecState* exec) : m_exec(exec), m_code(0) { }
~DOMExceptionTranslator() { setDOMException(m_exec, m_code); }
- operator WebCore::ExceptionCode&() { return m_code; }
+ operator ExceptionCode&() { return m_code; }
private:
- ExecState* m_exec;
- WebCore::ExceptionCode m_code;
+ KJS::ExecState* m_exec;
+ ExceptionCode m_code;
};
- JSValue* jsStringOrNull(const WebCore::String&); // null if the string is null
- JSValue* jsStringOrUndefined(const WebCore::String&); // undefined if the string is null
- JSValue* jsStringOrFalse(const WebCore::String&); // boolean false if the string is null
+ KJS::JSValue* jsStringOrNull(const String&); // null if the string is null
+ KJS::JSValue* jsStringOrNull(const KURL&); // null if the URL is null
- // see JavaScriptCore for explanation should be used for UString that is already owned
- // by another object, so that collecting the JSString wrapper is unlikely to save memory.
- JSValue* jsOwnedStringOrNull(const KJS::UString&);
+ KJS::JSValue* jsStringOrUndefined(const String&); // undefined if the string is null
+ KJS::JSValue* jsStringOrUndefined(const KURL&); // undefined if the URL is null
- WebCore::String valueToStringWithNullCheck(ExecState*, JSValue*); // null String if the value is null
- WebCore::String valueToStringWithUndefinedOrNullCheck(ExecState*, JSValue*); // null String if the value is null or undefined
+ KJS::JSValue* jsStringOrFalse(const String&); // boolean false if the string is null
+ KJS::JSValue* jsStringOrFalse(const KURL&); // boolean false if the URL is null
- template <typename T> inline JSValue* toJS(ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
+ // See JavaScriptCore for explanation: Should be used for any UString that is already owned by another
+ // object, to let the engine know that collecting the JSString wrapper is unlikely to save memory.
+ KJS::JSValue* jsOwnedStringOrNull(const KJS::UString&);
-} // namespace KJS
+ String valueToStringWithNullCheck(KJS::ExecState*, KJS::JSValue*); // null String if the value is null
+ String valueToStringWithUndefinedOrNullCheck(KJS::ExecState*, KJS::JSValue*); // null String if the value is null or undefined
-namespace WebCore {
+ template <typename T> inline KJS::JSValue* toJS(KJS::ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
// Helpers for Window, History, and Location classes to implement cross-domain policy.
// Besides the cross-domain check, they need non-caching versions of staticFunctionGetter for
bool allowsAccessFromFrame(KJS::ExecState*, Frame*);
bool allowsAccessFromFrame(KJS::ExecState*, Frame*, String& message);
void printErrorMessageForFrame(Frame*, const String& message);
-
KJS::JSValue* nonCachingStaticFunctionGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier& propertyName, const KJS::PropertySlot&);
KJS::JSValue* objectToStringFunctionGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier& propertyName, const KJS::PropertySlot&);
namespace WebCore {
- class JSRGBColor : public KJS::DOMObject {
+ class JSRGBColor : public DOMObject {
public:
JSRGBColor(KJS::JSObject* prototype, unsigned color);
~JSRGBColor();
#include "HTMLNames.h"
#include "JSEvent.h"
#include "JSEventTargetNode.h"
-#include "KURL.h"
#include "Page.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
KJS::JSValue* getNodeEventListener(Node*, const AtomicString& eventType);
- class JSClipboard : public KJS::DOMObject {
+ class JSClipboard : public DOMObject {
public:
JSClipboard(KJS::JSObject* prototype, Clipboard*);
virtual ~JSClipboard();
class HTMLElement;
class JSHTMLElement;
- class ImageConstructorImp : public KJS::DOMObject {
+ class ImageConstructorImp : public DOMObject {
public:
ImageConstructorImp(KJS::ExecState*, Document*);
-// -*- c-basic-offset: 2 -*-
/*
* Copyright (C) 2000 Harri Porten (porten@kde.org)
* Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
* Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#define WEBCORE_NAVIGATOR_VENDOR_SUB ""
#endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
+using namespace KJS;
using namespace WebCore;
-namespace KJS {
+namespace WebCore {
class PluginBase : public DOMObject {
public:
- PluginBase(ExecState *exec);
+ PluginBase(ExecState*);
virtual ~PluginBase();
static void refresh(bool reload);
protected:
static void cachePluginDataIfNecessary();
- static Vector<PluginInfo*> *plugins;
- static Vector<MimeClassInfo*> *mimes;
+ static Vector<PluginInfo*>* plugins;
+ static Vector<MimeClassInfo*>* mimes;
private:
static int m_plugInCacheRefCount;
class Plugins : public PluginBase {
public:
- Plugins(ExecState *exec) : PluginBase(exec) {};
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
+ Plugins(ExecState* exec) : PluginBase(exec) { }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Length };
private:
- static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
- static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
+ static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
+ static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
};
JSValue* pluginsFunctionRefresh(ExecState*, JSObject*, const List&);
class MimeTypes : public PluginBase {
public:
- MimeTypes(ExecState *exec) : PluginBase(exec) { };
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
+ MimeTypes(ExecState* exec) : PluginBase(exec) { };
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Length };
private:
- static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
- static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
+ static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
+ static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
};
class Plugin : public PluginBase {
public:
- Plugin(ExecState *exec, PluginInfo *info) : PluginBase(exec), m_info(info) { }
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
+ Plugin(ExecState* exec, PluginInfo* info) : PluginBase(exec), m_info(info) { }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Name, Filename, Description, Length };
private:
- static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
- static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
+ static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
+ static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
- PluginInfo *m_info;
+ PluginInfo* m_info;
};
class MimeType : public PluginBase {
public:
- MimeType( ExecState *exec, MimeClassInfo *info ) : PluginBase(exec), m_info(info) { }
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
+ MimeType(ExecState* exec, MimeClassInfo* info) : PluginBase(exec), m_info(info) { }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Type, Suffixes, Description, EnabledPlugin };
private:
- MimeClassInfo *m_info;
+ MimeClassInfo* m_info;
};
-} // namespace
+}
#include "kjs_navigator.lut.h"
-namespace KJS {
+namespace WebCore {
const ClassInfo Plugins::info = { "PluginArray", 0, &PluginsTable };
const ClassInfo MimeTypes::info = { "MimeTypeArray", 0, &MimeTypesTable };
const ClassInfo Plugin::info = { "Plugin", 0, &PluginTable };
const ClassInfo MimeType::info = { "MimeType", 0, &MimeTypeTable };
-Vector<PluginInfo*> *KJS::PluginBase::plugins = 0;
-Vector<MimeClassInfo*> *KJS::PluginBase::mimes = 0;
-int KJS::PluginBase::m_plugInCacheRefCount = 0;
+Vector<PluginInfo*>* PluginBase::plugins = 0;
+Vector<MimeClassInfo*>* PluginBase::mimes = 0;
+int PluginBase::m_plugInCacheRefCount = 0;
const ClassInfo Navigator::info = { "Navigator", 0, &NavigatorTable };
/*
{
}
-bool Navigator::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
+bool Navigator::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticPropertySlot<Navigator, JSObject>(exec, &NavigatorTable, this, propertyName, slot);
}
@end
*/
-JSValue *Plugins::getValueProperty(ExecState *exec, int token) const
+JSValue* Plugins::getValueProperty(ExecState* exec, int token) const
{
ASSERT(token == Length);
return jsNumber(plugins->size());
}
-JSValue *Plugins::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
+JSValue* Plugins::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
return new Plugin(exec, plugins->at(slot.index()));
}
-JSValue *Plugins::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
+JSValue* Plugins::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
AtomicString atomicPropertyName = propertyName;
Vector<PluginInfo*>::iterator end = plugins->end();
for (Vector<PluginInfo*>::iterator itr = plugins->begin(); itr != end; itr++) {
- PluginInfo *pl = *itr;
+ PluginInfo* pl = *itr;
if (pl->name == atomicPropertyName)
return new Plugin(exec, pl);
}
return jsUndefined();
}
-bool Plugins::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
+bool Plugins::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
const HashEntry* entry = Lookup::findEntry(&PluginsTable, propertyName);
if (entry) {
@end
*/
-JSValue *MimeTypes::getValueProperty(ExecState *exec, int token) const
+JSValue* MimeTypes::getValueProperty(ExecState* exec, int token) const
{
ASSERT(token == Length);
return jsNumber(mimes->size());
}
-JSValue *MimeTypes::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
+JSValue* MimeTypes::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
return new MimeType(exec, mimes->at(slot.index()));
}
-JSValue *MimeTypes::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
+JSValue* MimeTypes::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
AtomicString atomicPropertyName = propertyName;
Vector<MimeClassInfo*>::iterator end = mimes->end();
for (Vector<MimeClassInfo*>::iterator itr = mimes->begin(); itr != end; itr++) {
- MimeClassInfo *m = (*itr);
+ MimeClassInfo* m = (*itr);
if (m->type == atomicPropertyName)
return new MimeType(exec, m);
}
return jsUndefined();
}
-bool MimeTypes::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
+bool MimeTypes::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
const HashEntry* entry = Lookup::findEntry(&MimeTypesTable, propertyName);
if (entry) {
@end
*/
-JSValue *Plugin::getValueProperty(ExecState *exec, int token) const
+JSValue* Plugin::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case Name:
}
}
-JSValue *Plugin::indexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
+JSValue* Plugin::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
- Plugin *thisObj = static_cast<Plugin *>(slot.slotBase());
+ Plugin* thisObj = static_cast<Plugin*>(slot.slotBase());
return new MimeType(exec, thisObj->m_info->mimes.at(slot.index()));
}
-JSValue *Plugin::nameGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
+JSValue* Plugin::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
- Plugin *thisObj = static_cast<Plugin *>(slot.slotBase());
+ Plugin* thisObj = static_cast<Plugin*>(slot.slotBase());
AtomicString atomicPropertyName = propertyName;
Vector<MimeClassInfo*>::iterator end = thisObj->m_info->mimes.end();
for (Vector<MimeClassInfo*>::iterator itr = thisObj->m_info->mimes.begin(); itr != end; itr++) {
- MimeClassInfo *m = (*itr);
+ MimeClassInfo* m = (*itr);
if (m->type == atomicPropertyName)
return new MimeType(exec, m);
}
}
-bool Plugin::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
+bool Plugin::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
const HashEntry* entry = Lookup::findEntry(&PluginTable, propertyName);
if (entry) {
@end
*/
-JSValue *MimeType::getValueProperty(ExecState *exec, int token) const
+JSValue* MimeType::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case Type:
}
}
-bool MimeType::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
+bool MimeType::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<MimeType, PluginBase>(exec, &MimeTypeTable, this, propertyName, slot);
}
JSValue* navigatorProtoFuncJavaEnabled(ExecState* exec, JSObject* thisObj, const List&)
{
- if (!thisObj->inherits(&KJS::Navigator::info))
- return throwError(exec, TypeError);
- Navigator *nav = static_cast<Navigator *>(thisObj);
- // javaEnabled()
- Settings* settings = nav->frame() ? nav->frame()->settings() : 0;
- return jsBoolean(settings && settings->isJavaEnabled());
+ if (!thisObj->inherits(&Navigator::info))
+ return throwError(exec, TypeError);
+ Navigator* nav = static_cast<Navigator*>(thisObj);
+ Settings* settings = nav->frame() ? nav->frame()->settings() : 0;
+ return jsBoolean(settings && settings->isJavaEnabled());
}
} // namespace
-// -*- c-basic-offset: 2 -*-
/*
- * This file is part of the KDE libraries
* Copyright (C) 2000 Harri Porten (porten@kde.org)
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include "kjs_binding.h"
namespace WebCore {
+
class Frame;
-}
-
-namespace KJS {
-
- class Navigator : public DOMObject {
- public:
- Navigator(JSObject* prototype, WebCore::Frame*);
-
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *exec, int token) const;
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
- _Plugins, _MimeTypes, Product, ProductSub, Vendor, VendorSub, CookieEnabled };
- WebCore::Frame *frame() const { return m_frame; }
- private:
- WebCore::Frame *m_frame;
- };
-
- // Functions
- JSValue* navigatorProtoFuncJavaEnabled(ExecState*, JSObject*, const List&);
+
+ class Navigator : public DOMObject {
+ public:
+ Navigator(KJS::JSObject* prototype, Frame*);
+
+ virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
+ KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;
+ virtual const KJS::ClassInfo* classInfo() const { return &info; }
+ static const KJS::ClassInfo info;
+
+ enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
+ _Plugins, _MimeTypes, Product, ProductSub, Vendor, VendorSub, CookieEnabled };
+
+ Frame* frame() const { return m_frame; }
+
+ private:
+ Frame* m_frame;
+ };
+
+ KJS::JSValue* navigatorProtoFuncJavaEnabled(KJS::ExecState*, KJS::JSObject*, const KJS::List&);
} // namespace
{
HashMap<String, String> map;
- Vector<String> features = featuresArg.split(';');
+ Vector<String> features;
+ featuresArg.split(';', features);
Vector<String>::const_iterator end = features.end();
for (Vector<String>::const_iterator it = features.begin(); it != end; ++it) {
String s = *it;
if (dialogArgs)
newWindow->putDirect("dialogArguments", dialogArgs);
- if (!url.startsWith("javascript:", false) || newWindow->allowsAccessFrom(exec)) {
- String completedURL = url.isEmpty() ? url : activeFrame->document()->completeURL(url);
+ if (!protocolIs(url, "javascript") || newWindow->allowsAccessFrom(exec)) {
+ KURL completedURL = url.isEmpty() ? KURL("") : activeFrame->document()->completeURL(url);
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
if (created) {
- newFrame->loader()->changeLocation(KURL(completedURL.deprecatedString()), activeFrame->loader()->outgoingReferrer(), false, userGesture);
+ newFrame->loader()->changeLocation(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
if (Document* oldDoc = openerFrame->document())
newFrame->document()->setBaseURL(oldDoc->baseURL());
} else if (!url.isEmpty())
- newFrame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
+ newFrame->loader()->scheduleLocationChange(completedURL.string(), activeFrame->loader()->outgoingReferrer(), false, userGesture);
}
return newFrame;
if (!p->loader()->shouldAllowNavigation(impl()->frame()))
return;
String dstUrl = p->loader()->completeURL(value->toString(exec)).string();
- if (!dstUrl.startsWith("javascript:", false) || allowsAccessFrom(exec)) {
+ if (!protocolIs(dstUrl, "javascript") || allowsAccessFrom(exec)) {
bool userGesture = p->scriptProxy()->processingUserGesture();
// We want a new history item if this JS was called via a user gesture
impl()->frame()->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), false, userGesture);
// FIXME: this error message should contain more specifics of why the same origin check has failed.
message = String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains, protocols and ports must match.\n",
- targetDocument->url().utf8().data(), originDocument->url().utf8().data());
+ targetDocument->url().string().utf8().data(), originDocument->url().string().utf8().data());
return false;
}
String completedURL;
if (!urlString.isEmpty())
- completedURL = activeFrame->document()->completeURL(urlString);
+ completedURL = activeFrame->document()->completeURL(urlString).string();
const Window* targetedWindow = Window::retrieveWindow(frame);
- if (!completedURL.isEmpty() && (!completedURL.startsWith("javascript:", false) || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
+ if (!completedURL.isEmpty() && (!protocolIs(completedURL, "javascript") || (targetedWindow && targetedWindow->allowsAccessFrom(exec)))) {
bool userGesture = activeFrame->scriptProxy()->processingUserGesture();
frame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture);
}
ASSERT(name);
WebCore::Element* element = [self _element];
ASSERT(element);
- return WebCore::KURL(element->document()->completeURL(parseURL(element->getAttribute(name)).deprecatedString())).getNSURL();
+ return element->document()->completeURL(parseURL(element->getAttribute(name)));
}
// FIXME: this should be implemented in the implementation
#import "HTMLDocument.h"
#import "HTMLInputElement.h"
#import "HTMLObjectElement.h"
-#import "KURL.h"
#import "Range.h"
#import "RenderTextControl.h"
#import "markup.h"
- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString
{
- NSURL *baseURL = WebCore::KURL([self _document]->completeURL(WebCore::parseURL(baseURLString)).deprecatedString()).getNSURL();
+ NSURL *baseURL = [self _document]->completeURL(WebCore::parseURL(baseURLString));
return [self createDocumentFragmentWithMarkupString:markupString baseURL:baseURL];
}
return if $codeGenerator->IsNonPointerType($type);
if ($codeGenerator->IsStringType($type)) {
- $CPPImplementationWebCoreIncludes{"PlatformString.h"} = 1;
- $CPPImplementationWebCoreIncludes{"BString.h"} = 1;
$CPPImplementationWebCoreIncludes{"AtomicString.h"} = 1;
+ $CPPImplementationWebCoreIncludes{"BString.h"} = 1;
+ $CPPImplementationWebCoreIncludes{"KURL.h"} = 1;
return;
}
my $dataNode = shift;
return $dataNode->extendedAttributes->{"LegacyParent"} if $dataNode->extendedAttributes->{"LegacyParent"};
- return "KJS::DOMObject" if @{$dataNode->parents} eq 0;
+ return "DOMObject" if @{$dataNode->parents} eq 0;
return "JS" . $codeGenerator->StripModule($dataNode->parents(0));
}
push(@implContent, "{\n");
push(@implContent, " ${className}* thisObj = static_cast<$className*>(slot.slotBase());\n");
if (IndexGetterReturnsStrings($implClassName)) {
- $implIncludes{"PlatformString.h"} = 1;
+ $implIncludes{"KURL.h"} = 1;
push(@implContent, " return jsStringOrNull(thisObj->impl()->item(slot.index()));\n");
} else {
push(@implContent, " return toJS(exec, static_cast<$implClassName*>(thisObj->impl())->item(slot.index()));\n");
push(@implContent, "{\n");
if ($podType) {
- push(@implContent, " return KJS::cacheSVGDOMObject<JSSVGPODTypeWrapper<$podType>, $className, ${className}Prototype>(exec, obj, context);\n");
+ push(@implContent, " return cacheSVGDOMObject<JSSVGPODTypeWrapper<$podType>, $className, ${className}Prototype>(exec, obj, context);\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, " return KJS::cacheSVGDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj, context);\n");
+ push(@implContent, " return cacheSVGDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj, context);\n");
} else {
- push(@implContent, " return KJS::cacheDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj);\n");
+ push(@implContent, " return cacheDOMObject<$implClassName, $className, ${className}Prototype>(exec, obj);\n");
}
push(@implContent, "}\n");
}
return "jsNumber($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType" or $type eq "DOMTimeStamp";
if ($codeGenerator->IsStringType($type)) {
- $implIncludes{"PlatformString.h"} = 1;
+ $implIncludes{"KURL.h"} = 1;
my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"};
if (defined $conv) {
return "jsStringOrNull($value)" if $conv eq "Null";
# Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
-# Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
return if $codeGenerator->IsNonPointerType($type) or IsNativeObjCType($type);
if ($codeGenerator->IsStringType($type)) {
- $implIncludes{"PlatformString.h"} = 1;
+ $implIncludes{"KURL.h"} = 1;
return;
}
/*
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
if ([attributeName isEqualToString: NSAccessibilityURLAttribute]) {
if ([self isAnchor]) {
- HTMLAnchorElement* anchor = [self anchorElement];
- if (anchor) {
- DeprecatedString s = anchor->getAttribute(hrefAttr).deprecatedString();
- if (!s.isNull()) {
- s = anchor->document()->completeURL(s);
- return KURL(s).getNSURL();
- }
+ if (HTMLAnchorElement* anchor = [self anchorElement]) {
+ NSURL *href = anchor->href();
+ return href;
}
- }
- else if (m_renderer->isImage() && m_renderer->element() && m_renderer->element()->hasTagName(imgTag)) {
- DeprecatedString src = static_cast<HTMLImageElement*>(m_renderer->element())->src().deprecatedString();
- if (!src.isNull())
- return KURL(src).getNSURL();
+ } else if (m_renderer->isImage() && m_renderer->element() && m_renderer->element()->hasTagName(imgTag)) {
+ NSURL *src = static_cast<HTMLImageElement*>(m_renderer->element())->src();
+ return src;
}
return nil;
}
// add new attributes and remove irrelevant inherited ones
// NOTE: color attributes are handled specially because -[NSMutableAttributedString addAttribute: value: range:] does not merge
// identical colors. Workaround is to not replace an existing color attribute if it matches what we are adding. This also means
- // we can not just pre-remove all inherited attributes on the appended string, so we have to remove the irrelevant ones individually.
+ // we cannot just pre-remove all inherited attributes on the appended string, so we have to remove the irrelevant ones individually.
// remove inherited attachment from prior AXAttributedStringAppendReplaced
[attrString removeAttribute:NSAccessibilityAttachmentTextAttribute range:attrStringRange];
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@end
// convert UString to NSString
-static NSString *toNSString(const UString &s)
+static NSString *toNSString(const UString& s)
{
- if (s.isEmpty()) return nil;
- return [NSString stringWithCharacters:(const unichar *)s.data() length:s.size()];
+ if (s.isEmpty())
+ return nil;
+ return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(s.data()) length:s.size()];
}
// convert UString to NSURL
-static NSURL *toNSURL(const UString &s)
+static NSURL *toNSURL(const UString& s)
{
- if (s.isEmpty()) return nil;
- return KURL(DeprecatedString(s)).getNSURL();
+ if (s.isEmpty())
+ return nil;
+ return KURL(s);
}
// C++ interface to KJS debugger callbacks
};
-
-
// WebCoreScriptDebugger
//
// This is the main (behind-the-scenes) debugger class in WebCore.
- (WebCoreScriptDebugger *)initWithDelegate:(id<WebScriptDebugger>)delegate
{
if ((self = [super init])) {
- _delegate = delegate;
+ _delegate = delegate;
_globalObj = [_delegate globalObject];
_debugger = new WebCoreScriptDebuggerImp(self, [_globalObj _rootObject]->globalObject());
}
@end
-
-
@implementation WebCoreScriptDebugger (WebCoreScriptDebuggerInternal)
- (WebCoreScriptCallFrame *)_enterFrame:(ExecState *)state;
@end
-
-
// WebCoreScriptCallFrame
//
// One of these is created to represent each stack frame. Additionally, there is a "global"
@end
-
-
@implementation WebCoreScriptCallFrame
- (void)dealloc
return _caller;
}
-
// Returns an array of scope objects (most local first).
// The properties of each scope object are the variables for that scope.
// Note that the last entry in the array will _always_ be the global object (windowScriptObject),
return result;
}
-
// Returns the name of the function for this frame, if available.
// Returns nil for anonymous functions and for the global frame.
- (NSString *)functionName
{
if (_state->scopeNode()) {
- FunctionImp *func = _state->function();
+ FunctionImp* func = _state->function();
if (func) {
Identifier fn = func->functionName();
return toNSString(fn.ustring());
return nil;
}
-
// Returns the pending exception for this frame (nil if none).
- (id)exception
return [self _convertValueToObjcValue:_state->exception()];
}
-
// Evaluate some JavaScript code in the context of this frame.
// The code is evaluated as if by "eval", and the result is returned.
// If there is an (uncaught) exception, it is returned as though _it_ were the result.
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
if (loader)
m_image = loader->requestImage(url);
- else
+ else {
// FIXME: Should find a way to make these images sit in their own memory partition, since they are user agent images.
- m_image = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(url.deprecatedString()), 0, 0));
+ m_image = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(url), 0, 0));
+ }
if (m_image)
m_image->ref(this);
#include "CSSStyleSheet.h"
#include "DocLoader.h"
#include "Document.h"
-#include "KURL.h"
#include "MediaList.h"
namespace WebCore {
CSSStyleSheet* parentSheet = parentStyleSheet();
if (!parentSheet->href().isNull())
// use parent styleheet's URL as the base URL
- absHref = KURL(parentSheet->href().deprecatedString(), m_strHref.deprecatedString()).string();
+ absHref = KURL(KURL(parentSheet->href()), m_strHref).string();
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
#include "FloatConversion.h"
#include "FontFamilyValue.h"
#include "FontValue.h"
-#include "KURL.h"
#include "MediaList.h"
#include "MediaQueryExp.h"
#include "Pair.h"
hotspot = IntPoint(coords[0], coords[1]);
if (strict || coords.size() == 0) {
if (!uri.isEmpty()) {
- list->append(new CSSCursorImageValue(
- KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
- hotspot, styleElement));
+ list->append(new CSSCursorImageValue(KURL(styleElement->baseURL(), uri).string(),
+ hotspot, styleElement));
}
}
if ((strict && !value) || (value && !(value->unit == Value::Operator && value->iValue == ',')))
// ### allow string in non strict mode?
String uri = parseURL(domString(value->string));
if (!uri.isEmpty()) {
- parsedValue = new CSSImageValue(
- KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
- styleElement);
+ parsedValue = new CSSImageValue(KURL(styleElement->baseURL(), uri).string(), styleElement);
valueList->next();
}
}
while ((val = valueList->current())) {
if (val->unit == CSSPrimitiveValue::CSS_URI) {
String value = parseURL(domString(val->string));
- parsedValue = new CSSPrimitiveValue(
- KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).string(),
- CSSPrimitiveValue::CSS_URI);
+ parsedValue = new CSSPrimitiveValue(KURL(styleElement->baseURL(), value).string(),
+ CSSPrimitiveValue::CSS_URI);
}
if (!parsedValue)
break;
if (val->unit == CSSPrimitiveValue::CSS_URI) {
// url
String value = parseURL(domString(val->string));
- parsedValue = new CSSImageValue(
- KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).string(), styleElement);
+ parsedValue = new CSSImageValue(KURL(styleElement->baseURL(), value).string(), styleElement);
} else if (val->unit == Value::Function) {
// attr(X) | counter(X [,Y]) | counters(X, Y, [,Z])
ValueList *args = val->function->args;
if (valueList->current()->unit == CSSPrimitiveValue::CSS_URI) {
String uri = parseURL(domString(valueList->current()->string));
if (!uri.isEmpty())
- value = new CSSImageValue(KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
- styleElement);
+ value = new CSSImageValue(KURL(styleElement->baseURL(), uri).string(), styleElement);
return true;
}
return false;
RefPtr<CSSFontFaceSrcValue> parsedValue;
if (val->unit == CSSPrimitiveValue::CSS_URI && !expectComma) {
String value = parseURL(domString(val->string));
- parsedValue = new CSSFontFaceSrcValue(KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).string(), false);
+ parsedValue = new CSSFontFaceSrcValue(KURL(styleElement->baseURL(), value).string(), false);
uriValue = parsedValue;
allowFormat = true;
expectComma = true;
if (uri.isEmpty())
return false;
- context.commitImage(new CSSImageValue(KURL(styleElement->baseURL().deprecatedString(), uri.deprecatedString()).string(),
- styleElement));
+ context.commitImage(new CSSImageValue(KURL(styleElement->baseURL(), uri).string(), styleElement));
while ((val = valueList->next())) {
if (context.allowNumber() && validUnit(val, FInteger|FNonNeg|FPercent, true)) {
context.commitNumber(val);
#define yyconst const
typedef int yy_state_type;
typedef unsigned YY_CHAR;
-// this line makes sure we treat all Unicode chars correctly.
+// The following line makes sure we treat non-Latin-1 Unicode characters correctly.
#define YY_SC_TO_UI(c) (c > 0xff ? 0xff : c)
#define YY_DO_BEFORE_ACTION \
yytext = yy_bp; \
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
#define yyterminate() yyTok = END_TOKEN; return yyTok
#define YY_FATAL_ERROR(a)
-// The line below is needed to build the tokenizer with conditon stack.
+// The following line is needed to build the tokenizer with a condition stack.
// The macro is used in the tokenizer grammar with lines containing
// BEGIN(mediaqueries) and BEGIN(initial). yy_start acts as index to
// tokenizer transition table, and 'mediaqueries' and 'initial' are
// offset multipliers that specify which transitions are active
-// in the tokenizer during in each condition (tokenizer state)
+// in the tokenizer during in each condition (tokenizer state).
#define BEGIN yy_start = 1 + 2 *
#include "tokenizer.cpp"
CSSStyleSheet *CSSStyleSelector::m_svgSheet = 0;
#endif
-static CSSStyleSelector::Encodedurl *currentEncodedURL = 0;
+static CSSStyleSelector::EncodedURL* currentEncodedURL = 0;
static PseudoState pseudoState;
static const MediaQueryEvaluator& screenEval()
{
KURL u = url;
- u.setQuery(DeprecatedString::null);
- u.setRef(DeprecatedString::null);
- m_encodedURL.file = u.deprecatedString();
- int pos = m_encodedURL.file.findRev('/');
+ u.setQuery(String());
+ u.setRef(String());
+ m_encodedURL.file = u.string();
+ int pos = m_encodedURL.file.reverseFind('/');
m_encodedURL.path = m_encodedURL.file;
if (pos > 0) {
m_encodedURL.path.truncate(pos);
- m_encodedURL.path += '/';
+ m_encodedURL.path.append('/');
}
- u.setPath(DeprecatedString::null);
- m_encodedURL.host = u.deprecatedString();
+ u.setPath(String());
+ m_encodedURL.prefix = u.string();
}
CSSStyleSelector::~CSSStyleSelector()
DeprecatedConstString cu(reinterpret_cast<const DeprecatedChar*>(characters), length);
DeprecatedString u = cu.string();
if (length && characters[0] == '/')
- u.prepend(currentEncodedURL->host);
+ u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->prefix.characters()), currentEncodedURL->prefix.length());
else if (length && characters[0] == '#')
- u.prepend(currentEncodedURL->file);
+ u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->file.characters()), currentEncodedURL->file.length());
else
- u.prepend(currentEncodedURL->path);
+ u.prepend(reinterpret_cast<const DeprecatedChar*>(currentEncodedURL->path.characters()), currentEncodedURL->path.length());
cleanpath(u);
pseudoState = historyContains(reinterpret_cast<const UChar*>(u.unicode()), u.length())
? PseudoVisited : PseudoLink;
/*
- * This file is part of the CSS implementation for KDE.
- *
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
bool strictParsing;
- struct Encodedurl {
- DeprecatedString host; //also contains protocol
- DeprecatedString path;
- DeprecatedString file;
+ struct EncodedURL {
+ String prefix; // protocol, host, etc.
+ String path;
+ String file;
} m_encodedURL;
void setEncodedURL(const KURL& url);
MediaList tempMediaList;
CSSParser p(true);
- Vector<String> list = value.split(',');
+ Vector<String> list;
+ value.split(',', list);
Vector<String>::const_iterator end = list.end();
for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) {
String medium = (*it).stripWhiteSpace();
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
* 1999 Waldo Bastian (bastian@kde.org)
* 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch)
* 2001-2003 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2002, 2006 Apple Computer, Inc.
+ * Copyright (C) 2002, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
return static_cast<StyleSheet*>(b);
}
-String StyleBase::baseURL()
+KURL StyleBase::baseURL() const
{
- // try to find the style sheet. If found look for its url.
- // If it has none, look for the parentsheet, or the parentNode and
- // try to find out about their url
-
- StyleSheet* sheet = stylesheet();
+ // Try to find the style sheet. If found look for its URL.
+ // If it has none, get the URL from the parent sheet or the parent node.
+ StyleSheet* sheet = const_cast<StyleBase*>(this)->stylesheet();
if (!sheet)
- return String();
-
+ return KURL();
if (!sheet->href().isNull())
- return sheet->href();
-
- // find parent
+ return KURL(sheet->href());
if (sheet->parent())
return sheet->parent()->baseURL();
-
if (!sheet->ownerNode())
- return String();
-
+ return KURL();
return sheet->ownerNode()->document()->baseURL();
}
/*
- * This file is part of the CSS implementation for KDE.
- *
* Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
* Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
* Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
class String;
class StyleSheet;
+ class KURL;
// a style class which has a parent (almost all have)
class StyleBase : public RefCounted<StyleBase> {
void setParent(StyleBase* parent) { m_parent = parent; }
// returns the url of the style sheet this object belongs to
- String baseURL();
+ KURL baseURL() const;
virtual bool isStyleSheet() const { return false; }
virtual bool isCSSStyleSheet() const { return false; }
XMLHttpRequest::detachRequests(this);
{
KJS::JSLock lock;
- KJS::ScriptInterpreter::forgetAllDOMNodesForDocument(this);
+ ScriptInterpreter::forgetAllDOMNodesForDocument(this);
}
if (m_docChanged && changedDocuments)
m_xmlStandalone = standalone;
}
-String Document::documentURI() const
+KURL Document::documentURI() const
{
return m_baseURL;
}
-void Document::setDocumentURI(const String &uri)
+void Document::setDocumentURI(const String& uri)
{
- m_baseURL = uri.deprecatedString();
+ m_baseURL = KURL(uri);
}
-String Document::baseURI() const
+KURL Document::baseURI() const
{
- return documentURI();
+ return m_baseURL;
}
Element* Document::elementFromPoint(int x, int y) const
{
// This is work that we should probably do in clear(), but we can't have it
// happen when implicitOpen() is called unless we reorganize Frame code.
- if (Document *parent = parentDocument()) {
- if (m_url.isEmpty() || m_url == "about:blank")
+ if (Document* parent = parentDocument()) {
+ if (m_url.isEmpty() || m_url == blankURL())
setURL(parent->baseURL());
- if (m_baseURL.isEmpty() || m_baseURL == "about:blank")
+ if (m_baseURL.isEmpty() || m_baseURL == blankURL())
setBaseURL(parent->baseURL());
}
m_windowEventListeners.clear();
}
-void Document::setURL(const DeprecatedString& url)
+void Document::setURL(const KURL& url)
{
if (url == m_url)
return;
m_url = url;
if (m_styleSelector)
- m_styleSelector->setEncodedURL(m_url);
+ m_styleSelector->setEncodedURL(url);
m_isAllowedToLoadLocalResources = shouldBeAllowedToLoadLocalResources();
}
bool Document::shouldBeAllowedToLoadLocalResources() const
{
- if (FrameLoader::shouldTreatURLAsLocal(m_url))
+ if (FrameLoader::shouldTreatURLAsLocal(m_url.string()))
return true;
Frame* frame = this->frame();
if (!documentLoader)
return false;
- if (m_url == "about:blank" && frame->loader()->opener() && frame->loader()->opener()->document()->isAllowedToLoadLocalResources())
+ if (m_url == blankURL() && frame->loader()->opener() && frame->loader()->opener()->document()->isAllowedToLoadLocalResources())
return true;
return documentLoader->substituteData().isValid();
}
-void Document::setBaseURL(const DeprecatedString& baseURL)
+void Document::setBaseURL(const KURL& baseURL)
{
- m_baseURL = baseURL;
+ m_baseURL = baseURL;
if (m_elemSheet)
- m_elemSheet->setHref(m_baseURL);
+ m_elemSheet->setHref(baseURL.string());
}
void Document::setCSSStyleSheet(const String &url, const String& charset, const CachedCSSStyleSheet* sheet)
CSSStyleSheet* Document::elementSheet()
{
if (!m_elemSheet)
- m_elemSheet = new CSSStyleSheet(this, baseURL());
+ m_elemSheet = new CSSStyleSheet(this, baseURL().string());
return m_elemSheet.get();
}
CSSStyleSheet* Document::mappedElementSheet()
{
if (!m_mappedElementSheet)
- m_mappedElementSheet = new CSSStyleSheet(this, baseURL());
+ m_mappedElementSheet = new CSSStyleSheet(this, baseURL().string());
return m_mappedElementSheet.get();
}
if (url.isEmpty())
url = frame->loader()->url().string();
else
- url = completeURL(url);
+ url = completeURL(url).string();
frame->loader()->scheduleHTTPRedirection(delay, url);
}
} else if (equalIgnoringCase(equiv, "set-cookie")) {
if (title != m_preferredStylesheetSet)
sheet = 0;
-
-#if ENABLE(SVG)
- if (!n->isHTMLElement())
- title = title.deprecatedString().replace('&', "&&");
-#endif
}
}
void Document::setCookie(const String& value)
{
- setCookies(this, url(), policyBaseURL().deprecatedString(), value);
+ setCookies(this, url(), policyBaseURL(), value);
}
String Document::referrer() const
return m_decoder->encoding().backslashAsCurrencySymbol();
}
-DeprecatedString Document::completeURL(const DeprecatedString& url)
-{
- // FIXME: This treats null URLs the same as empty URLs, unlike the String function below.
-
- // If both the URL and base URL are empty, like they are for documents
- // created using DOMImplementation::createDocument, just return the passed in URL.
- // (We do this because url() returns "about:blank" for empty URLs.
- if (m_url.isEmpty() && m_baseURL.isEmpty())
- return url;
- if (!m_decoder)
- return KURL(baseURL(), url).deprecatedString();
- return KURL(baseURL(), url, m_decoder->encoding()).deprecatedString();
-}
-
-String Document::completeURL(const String& url)
+KURL Document::completeURL(const String& url)
{
- // FIXME: This always returns null when passed a null URL, unlike the DeprecatedString function above.
- // Code relies on this behavior, namely the href property of <a> and the data property of <object>.
+ // Always return a null URL when passed a null string.
+ // FIXME: Should we change the KURL constructor to have this behavior?
if (url.isNull())
- return url;
- return completeURL(url.deprecatedString());
+ return KURL();
+ KURL base = m_baseURL;
+ if (base.isEmpty())
+ base = m_url;
+ if (!m_decoder)
+ return KURL(base, url);
+ return KURL(base, url, m_decoder->encoding());
}
bool Document::inPageCache()
#include "DocumentMarker.h"
#include "HTMLCollection.h"
#include "HTMLFormElement.h"
+#include "KURL.h"
#include "StringHash.h"
#include "Timer.h"
#include <wtf/HashCountedSet.h>
void setXMLVersion(const String&, ExceptionCode&);
void setXMLStandalone(bool, ExceptionCode&);
- String documentURI() const;
+ KURL documentURI() const;
void setDocumentURI(const String&);
- virtual String baseURI() const;
+ virtual KURL baseURI() const;
PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionCode&);
bool wellFormed() const { return m_wellFormed; }
- DeprecatedString url() const { return m_url.isEmpty() ? "about:blank" : m_url; }
- void setURL(const DeprecatedString& url);
+ const KURL& url() const { return m_url.isEmpty() ? blankURL() : m_url; }
+ void setURL(const KURL&);
- DeprecatedString baseURL() const { return m_baseURL.isEmpty() ? url() : m_baseURL; }
- void setBaseURL(const DeprecatedString& baseURL);
+ const KURL& baseURL() const { return m_baseURL.isEmpty() ? url() : m_baseURL; }
+ void setBaseURL(const KURL&);
- String baseTarget() const { return m_baseTarget; }
+ const String& baseTarget() const { return m_baseTarget; }
void setBaseTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
- DeprecatedString completeURL(const DeprecatedString &);
- String completeURL(const String&);
+ KURL completeURL(const String&);
// from cachedObjectClient
virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*);
String lastModified() const;
- String policyBaseURL() const { return m_policyBaseURL; }
- void setPolicyBaseURL(const String& s) { m_policyBaseURL = s; }
+ const KURL& policyBaseURL() const { return m_policyBaseURL; }
+ void setPolicyBaseURL(const KURL& url) { m_policyBaseURL = url; }
// The following implements the rule from HTML 4 for what valid names are.
// To get this right for all the XML cases, we probably have to improve this or move it
DocLoader* m_docLoader;
Tokenizer* m_tokenizer;
bool m_wellFormed;
- DeprecatedString m_url;
- DeprecatedString m_baseURL;
+ KURL m_url;
+ KURL m_baseURL;
String m_baseTarget;
RefPtr<DocumentType> m_docType;
typedef HashMap<AtomicStringImpl*, HTMLMapElement*> ImageMapsByName;
ImageMapsByName m_imageMapsByName;
- String m_policyBaseURL;
+ KURL m_policyBaseURL;
HashSet<Node*> m_disconnectedNodesWithEventListeners;
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace WebCore {
-DocumentType::DocumentType(DOMImplementation *i, Document *doc, const String &n, const String &p, const String &s)
- : Node(doc), m_implementation(i), m_name(n), m_publicId(p), m_systemId(s)
+DocumentType::DocumentType(DOMImplementation* i, Document* document, const String& n, const String& p, const String& s)
+ : Node(document)
+ , m_implementation(i)
+ , m_name(n)
+ , m_publicId(p)
+ , m_systemId(s)
{
}
-DocumentType::DocumentType(Document *doc, const String &n, const String &p, const String &s)
- : Node(doc), m_name(n), m_publicId(p), m_systemId(s)
+DocumentType::DocumentType(Document* document, const String& n, const String& p, const String& s)
+ : Node(document)
+ , m_name(n)
+ , m_publicId(p)
+ , m_systemId(s)
{
}
-DocumentType::DocumentType(Document *doc, const DocumentType &t)
- : Node(doc), m_implementation(t.m_implementation)
- , m_name(t.m_name), m_publicId(t.m_publicId), m_systemId(t.m_systemId), m_subset(t.m_subset)
+DocumentType::DocumentType(Document* document, const DocumentType &t)
+ : Node(document)
+ , m_implementation(t.m_implementation)
+ , m_name(t.m_name)
+ , m_publicId(t.m_publicId)
+ , m_systemId(t.m_systemId)
+ , m_subset(t.m_subset)
{
}
return result;
}
-String DocumentType::baseURI() const
+KURL DocumentType::baseURI() const
{
- return String();
+ return KURL();
}
String DocumentType::nodeName() const
PassRefPtr<Node> DocumentType::cloneNode(bool /*deep*/)
{
- // The DOM Level 2 specification says cloning DocumentType nodes is "implementation dependent" so for now we do not support it.
+ // The DOM Level 2 specification says cloning DocumentType nodes is "implementation dependent".
+ // For now, we do not support it.
return 0;
}
String systemId() const { return m_systemId; }
String internalSubset() const { return m_subset; }
- virtual String baseURI() const;
+ virtual KURL baseURI() const;
// Other methods (not part of DOM)
DOMImplementation *implementation() const { return m_implementation.get(); }
* (C) 2001 Peter Kelly (pmk@post.com)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* (C) 2007 David Smith (catfish.man@gmail.com)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* (C) 2007 Eric Seidel (eric@webkit.org)
*
* This library is free software; you can redistribute it and/or
#include "FrameView.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
-#include "KURL.h"
#include "NamedAttrMap.h"
#include "NodeList.h"
#include "Page.h"
m_tagName.setPrefix(_prefix);
}
-String Element::baseURI() const
+KURL Element::baseURI() const
{
- KURL xmlbase(getAttribute(baseAttr).deprecatedString());
-
- if (!xmlbase.protocol().isEmpty())
- return xmlbase.string();
+ KURL base(getAttribute(baseAttr));
+ if (!base.protocol().isEmpty())
+ return base;
Node* parent = parentNode();
- if (parent)
- return KURL(parent->baseURI().deprecatedString(), xmlbase.deprecatedString()).string();
+ if (!parent)
+ return base;
+
+ KURL parentBase = parent->baseURI();
+ if (parentBase.isNull())
+ return base;
- return xmlbase.string();
+ return KURL(parentBase, base.string());
}
Node* Element::insertAdjacentElement(const String& where, Node* newChild, int& exception)
virtual void setPrefix(const AtomicString &_prefix, ExceptionCode&);
virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
- virtual String baseURI() const;
+ virtual KURL baseURI() const;
// DOM methods overridden from parent classes
virtual NodeType nodeType() const;
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007 Trolltech ASA
*
* This library is free software; you can redistribute it and/or
#include "Frame.h"
#include "HTMLNames.h"
#include "HTMLNames.h"
-#include "KURL.h"
#include "Logging.h"
#include "NameNodeList.h"
#include "NamedAttrMap.h"
{
KJS::JSLock lock;
- KJS::ScriptInterpreter::updateDOMNodeDocument(this, m_document.get(), doc);
+ ScriptInterpreter::updateDOMNodeDocument(this, m_document.get(), doc);
}
m_document = doc;
return false;
}
-NamedAttrMap *Node::attributes() const
+NamedAttrMap* Node::attributes() const
{
return 0;
}
-String Node::baseURI() const
+KURL Node::baseURI() const
{
- Node* parent = parentNode();
- if (parent)
- return parent->baseURI();
-
- return String();
+ return parentNode() ? parentNode()->baseURI() : KURL();
}
bool Node::isEqualNode(Node *other) const
class EventListener;
class IntRect;
class KeyboardEvent;
+class KURL;
class NamedAttrMap;
class NodeList;
class PlatformKeyboardEvent;
virtual bool hasAttributes() const;
virtual NamedAttrMap* attributes() const;
- virtual String baseURI() const;
+ virtual KURL baseURI() const;
// These should all actually return a node, but this is only important for language bindings,
// which will already know and hold a ref on the right node to return. Returning bool allows
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 2000 Peter Kelly (pmk@post.com)
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "ProcessingInstruction.h"
m_cachedSheet->deref(this);
#if ENABLE(XSLT)
if (m_isXSL)
- m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href));
+ m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href).string());
else
#endif
{
if (charset.isEmpty())
charset = document()->frame()->loader()->encoding();
- m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href), charset);
+ m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href).string(), charset);
}
if (m_cachedSheet)
m_cachedSheet->ref(this);
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 2006, 2007 Rob Buis
+ * Copyright (C) 2008 Apple, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "StyleElement.h"
if (!e || !e->inDocument())
return;
- String text = "";
+ Vector<UChar> text;
for (Node* c = e->firstChild(); c; c = c->nextSibling())
if (c->nodeType() == Node::TEXT_NODE || c->nodeType() == Node::CDATA_SECTION_NODE || c->nodeType() == Node::COMMENT_NODE)
- text += c->nodeValue();
+ append(text, c->nodeValue());
- createSheet(e, text);
+ createSheet(e, String::adopt(text));
}
void StyleElement::createSheet(Element* e, const String& text)
m_sheet = 0;
}
- String typeValue = e->isHTMLElement() ? type().deprecatedString().lower() : type();
- if (typeValue.isEmpty() || typeValue == "text/css") { // Type must be empty or CSS
+ // If type is empty or CSS, this is a CSS style sheet.
+ const AtomicString& type = this->type();
+ if (type.isEmpty() || (e->isHTMLElement() ? equalIgnoringCase(type, "text/css") : (type == "text/css"))) {
RefPtr<MediaList> mediaList = new MediaList((CSSStyleSheet*)0, media(), e->isHTMLElement());
MediaQueryEvaluator screenEval("screen", true);
MediaQueryEvaluator printEval("print", true);
if (child->isTextNode() || child->nodeType() == Node::CDATA_SECTION_NODE)
scriptCode += static_cast<CharacterData*>(child)->data();
}
- m_view->frame()->loader()->executeScript(m_doc->url(), m_scriptStartLine - 1, scriptCode);
+ m_view->frame()->loader()->executeScript(m_doc->url().string(), m_scriptStartLine - 1, scriptCode);
}
m_requestingScript = false;
{
#if ENABLE(XSLT)
if (m_sawXSLTransform) {
- m_doc->setTransformSource(xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url()));
+ m_doc->setTransformSource(xmlDocPtrForString(m_doc->docLoader(), m_originalSourceForTransform, m_doc->url().string()));
m_doc->setParsing(false); // Make the doc think it's done, so it will apply xsl sheets.
m_doc->updateStyleSelector();
}
#if ENABLE(XSLT)
-void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const DeprecatedString& url)
+void* xmlDocPtrForString(DocLoader* docLoader, const String& source, const String& url)
{
if (source.isEmpty())
return 0;
xmlDocPtr sourceDoc = xmlReadMemory(reinterpret_cast<const char*>(source.characters()),
source.length() * sizeof(UChar),
- url.ascii(),
+ url.latin1().data(),
BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE",
XSLT_PARSE_OPTIONS);
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 2000 Peter Kelly (pmk@post.com)
- * Copyright (C) 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
* Copyright (C) 2007 Trolltech ASA
*
};
#if ENABLE(XSLT)
-void* xmlDocPtrForString(DocLoader*, const String& source, const DeprecatedString& url);
+void* xmlDocPtrForString(DocLoader*, const String& source, const String& url);
void setLoaderForLibXMLCallbacks(DocLoader*);
#endif
/*
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "HTMLElement.h"
#include "HTMLNames.h"
#include "InlineTextBox.h"
-#include "KURL.h"
#include "Logging.h"
#include "ProcessingInstruction.h"
#include "QualifiedName.h"
String m_value;
};
-static inline void appendString(Vector<UChar>& result, const String& str)
-{
- result.append(str.characters(), str.length());
-}
-
static void appendAttributeValue(Vector<UChar>& result, const String& attr)
{
const UChar* uchars = attr.characters();
switch (c) {
case '&':
result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
- appendString(result, ampEntity);
+ append(result, ampEntity);
lastCopiedFrom = i + 1;
break;
case '<':
result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
- appendString(result, ltEntity);
+ append(result, ltEntity);
lastCopiedFrom = i + 1;
break;
case '"':
result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
- appendString(result, quotEntity);
+ append(result, quotEntity);
lastCopiedFrom = i + 1;
}
}
if ((c == '&') | (c == '<')) {
result.append(uchars + lastCopiedFrom, i - lastCopiedFrom);
if (c == '&')
- appendString(result, ampEntity);
+ append(result, ampEntity);
else
- appendString(result, ltEntity);
+ append(result, ltEntity);
lastCopiedFrom = i + 1;
}
}
result.append(reinterpret_cast<const UChar*>(str.unicode()), str.length());
}
-static void appendQuotedURLAttributeValue(Vector<UChar>& result, String urlString)
+static void appendQuotedURLAttributeValue(Vector<UChar>& result, const String& urlString)
{
UChar quoteChar = '\"';
- if (urlString.stripWhiteSpace().startsWith("javascript:", false)) {
+ String strippedURLString = urlString.stripWhiteSpace();
+ if (protocolIs(strippedURLString, "javascript")) {
// minimal escaping for javascript urls
- if (urlString.contains('\"')) {
- if (urlString.contains('\''))
- urlString.replace('\"', """);
+ if (strippedURLString.contains('"')) {
+ if (strippedURLString.contains('\''))
+ strippedURLString.replace('\"', """);
else
quoteChar = '\'';
}
result.append(quoteChar);
- appendString(result, urlString);
+ append(result, strippedURLString);
result.append(quoteChar);
return;
}
- // FIXME this does not fully match other browsers. Firefox escapes spaces and other special characters.
+ // FIXME: This does not fully match other browsers. Firefox escapes spaces and other special characters.
result.append(quoteChar);
appendAttributeValue(result, urlString);
result.append(quoteChar);
namespaces.set(pre, ns.impl());
static const String xmlns("xmlns");
result.append(' ');
- appendString(result, xmlns);
+ append(result, xmlns);
if (!prefix.isEmpty()) {
result.append(':');
- appendString(result, prefix);
+ append(result, prefix);
}
result.append('=');
break;
}
case Node::COMMENT_NODE:
- appendString(result, static_cast<const Comment*>(node)->toString());
+ append(result, static_cast<const Comment*>(node)->toString());
break;
case Node::DOCUMENT_NODE: {
// FIXME: I think the comment below (and therefore this code) is wrong now
// Documents do not normally contain a docType as a child node, force it to print here instead.
const DocumentType* docType = static_cast<const Document*>(node)->doctype();
if (docType)
- appendString(result, docType->toString());
+ append(result, docType->toString());
break;
}
case Node::DOCUMENT_FRAGMENT_NODE:
break;
case Node::DOCUMENT_TYPE_NODE:
- appendString(result, static_cast<const DocumentType*>(node)->toString());
+ append(result, static_cast<const DocumentType*>(node)->toString());
break;
case Node::PROCESSING_INSTRUCTION_NODE:
- appendString(result, static_cast<const ProcessingInstruction*>(node)->toString());
+ append(result, static_cast<const ProcessingInstruction*>(node)->toString());
break;
case Node::ELEMENT_NODE: {
result.append('<');
const Element* el = static_cast<const Element*>(node);
bool convert = convertBlocksToInlines & isBlock(const_cast<Node*>(node));
- appendString(result, el->nodeNamePreservingCase());
+ append(result, el->nodeNamePreservingCase());
NamedAttrMap *attrs = el->attributes();
unsigned length = attrs->length();
if (!documentIsHTML && namespaces && shouldAddNamespaceElem(el))
result.append(' ');
if (documentIsHTML)
- appendString(result, attr->name().localName());
+ append(result, attr->name().localName());
else
- appendString(result, attr->name().toString());
+ append(result, attr->name().toString());
result.append('=');
style->setProperty(CSS_PROP_DISPLAY, CSS_VAL_INLINE, true);
if (style->length() > 0) {
static const String stylePrefix(" style=\"");
- appendString(result, stylePrefix);
+ append(result, stylePrefix);
appendAttributeValue(result, style->cssText());
result.append('\"');
}
break;
}
case Node::CDATA_SECTION_NODE:
- appendString(result, static_cast<const CDATASection*>(node)->toString());
+ append(result, static_cast<const CDATASection*>(node)->toString());
break;
case Node::ATTRIBUTE_NODE:
case Node::ENTITY_NODE:
result.append('<');
result.append('/');
- appendString(result, static_cast<const Element*>(node)->nodeNamePreservingCase());
+ append(result, static_cast<const Element*>(node)->nodeNamePreservingCase());
result.append('>');
}
{
Vector<AttributeChange> changes;
- KURL baseURLAsKURL(baseURL.deprecatedString());
+ KURL parsedBaseURL(baseURL);
Node* end = node->traverseNextSibling();
for (Node* n = node; n != end; n = n->traverseNextNode()) {
unsigned length = attrs->length();
for (unsigned i = 0; i < length; i++) {
Attribute* attr = attrs->attributeItem(i);
- if (e->isURLAttribute(attr)) {
- String completedURL = KURL(baseURLAsKURL, attr->value().deprecatedString()).string();
- changes.append(AttributeChange(e, attr->name(), completedURL));
- }
+ if (e->isURLAttribute(attr))
+ changes.append(AttributeChange(e, attr->name(), KURL(parsedBaseURL, attr->value()).string()));
}
}
}
result.reserveCapacity(length);
for (size_t i = preCount; i > 0; --i)
- appendString(result, preMarkups[i - 1]);
+ append(result, preMarkups[i - 1]);
for (size_t i = 0; i < postCount; ++i)
- appendString(result, postMarkups[i]);
+ append(result, postMarkups[i]);
return String::adopt(result);
}
if (style->length()) {
Vector<UChar> openTag;
static const String divStyle("<div style=\"");
- appendString(openTag, divStyle);
+ append(openTag, divStyle);
appendAttributeValue(openTag, style->cssText());
openTag.append('\"');
openTag.append('>');
if (style->length() > 0) {
Vector<UChar> openTag;
const String spanClassStyle = String("<span class=\"" AppleStyleSpanClass "\" style=\"");
- appendString(openTag, spanClassStyle);
+ append(openTag, spanClassStyle);
appendAttributeValue(openTag, style->cssText());
openTag.append('\"');
openTag.append('>');
RefPtr<DocumentFragment> fragment = element->createContextualFragment(markup);
- if (fragment && !baseURL.isEmpty() && baseURL != "about:blank" && baseURL != document->baseURL())
+ if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL())
completeURLs(fragment.get(), baseURL);
return fragment.release();
return String::adopt(result);
}
-static void fillContainerFromString(ContainerNode* paragraph, const DeprecatedString& string)
+static void fillContainerFromString(ContainerNode* paragraph, const String& string)
{
Document* document = paragraph->document();
ASSERT(string.find('\n') == -1);
- DeprecatedStringList tabList = DeprecatedStringList::split('\t', string, true);
- DeprecatedString tabText = "";
+ Vector<String> tabList;
+ string.split('\t', true, tabList);
+ String tabText = "";
bool first = true;
- while (!tabList.isEmpty()) {
- DeprecatedString s = tabList.first();
- tabList.pop_front();
+ size_t numEntries = tabList.size();
+ for (size_t i = 0; i < numEntries; ++i) {
+ const String& s = tabList[i];
// append the non-tab textual part
if (!s.isEmpty()) {
ASSERT(ec == 0);
tabText = "";
}
- RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, tabList.isEmpty()));
+ RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
paragraph->appendChild(textNode.release(), ec);
ASSERT(ec == 0);
}
// there is a tab after every entry, except the last entry
// (if the last character is a tab, the list gets an extra empty entry)
- if (!tabList.isEmpty())
- tabText += '\t';
+ if (i + 1 != numEntries)
+ tabText.append('\t');
else if (!tabText.isEmpty()) {
paragraph->appendChild(createTabSpanElement(document, tabText), ec);
ASSERT(ec == 0);
if (text.isEmpty())
return fragment.release();
- DeprecatedString string = text.deprecatedString();
+ String string = text;
string.replace("\r\n", "\n");
string.replace('\r', '\n');
Node* block = enclosingBlock(context->startNode());
bool useClonesOfEnclosingBlock = !block->hasTagName(bodyTag);
- DeprecatedStringList list = DeprecatedStringList::split('\n', string, true); // true gets us empty strings in the list
- while (!list.isEmpty()) {
- DeprecatedString s = list.first();
- list.pop_front();
+ Vector<String> list;
+ string.split('\n', true, list); // true gets us empty strings in the list
+ size_t numLines = list.size();
+ for (size_t i = 0; i < numLines; ++i) {
+ const String& s = list[i];
RefPtr<Element> element;
- if (s.isEmpty() && list.isEmpty()) {
+ if (s.isEmpty() && i + 1 == numLines) {
// For last line, use the "magic BR" rather than a P.
element = document->createElementNS(xhtmlNamespaceURI, "br", ec);
ASSERT(ec == 0);
KURL HistoryItem::url() const
{
- return KURL(m_urlString.deprecatedString());
+ return KURL(m_urlString);
}
KURL HistoryItem::originalURL() const
{
- return KURL(m_originalURLString.deprecatedString());
+ return KURL(m_originalURLString);
}
const String& HistoryItem::target() const
#include "CachedPage.h"
#include "FormData.h"
#include "IntPoint.h"
-#include "KURL.h"
#include "PlatformString.h"
#include <wtf/RefCounted.h>
#include "StringHash.h"
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
* (C) 2006 Graham Dennis (graham.dennis@gmail.com)
*
* This library is free software; you can redistribute it and/or
int x = e->pageX() - absx;
int y = e->pageY() - absy;
url += "?";
- url += DeprecatedString::number(x);
+ url += String::number(x);
url += ",";
- url += DeprecatedString::number(y);
+ url += String::number(y);
} else {
evt->setDefaultHandled();
HTMLElement::defaultEventHandler(evt);
setAttribute(coordsAttr, value);
}
-String HTMLAnchorElement::href() const
+KURL HTMLAnchorElement::href() const
{
return document()->completeURL(getAttribute(hrefAttr));
}
String HTMLAnchorElement::hash() const
{
- return '#' + KURL(href().deprecatedString()).ref();
+ return "#" + href().ref();
}
String HTMLAnchorElement::host() const
{
- return KURL(href().deprecatedString()).host();
+ return href().host();
}
String HTMLAnchorElement::hostname() const
{
- KURL url(href().deprecatedString());
- if (url.port()==0)
+ KURL url(href());
+ if (url.port() == 0)
return url.host();
- else
- return url.host() + ":" + String::number(url.port());
+ return url.host() + ":" + String::number(url.port());
}
String HTMLAnchorElement::pathname() const
{
- return KURL(href().deprecatedString()).path();
+ return href().path();
}
String HTMLAnchorElement::port() const
{
- return DeprecatedString::number(KURL(href().deprecatedString()).port());
+ return String::number(href().port());
}
String HTMLAnchorElement::protocol() const
{
- return KURL(href().deprecatedString()).protocol() + ":";
+ return href().protocol() + ":";
}
String HTMLAnchorElement::search() const
{
- return KURL(href().deprecatedString()).query();
+ return href().query();
}
String HTMLAnchorElement::text() const
String HTMLAnchorElement::toString() const
{
- return href();
+ return href().string();
}
bool HTMLAnchorElement::isLiveLink() const
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace WebCore {
-class String;
-
class HTMLAnchorElement : public HTMLElement {
public:
HTMLAnchorElement(Document*);
String coords() const;
void setCoords(const String&);
- String href() const;
+ KURL href() const;
void setHref(const String&);
String hreflang() const;
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. ALl rights reserved.
* Copyright (C) 2007 Trolltech ASA
*
* This library is free software; you can redistribute it and/or
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "HTMLAppletElement.h"
using namespace HTMLNames;
-HTMLAppletElement::HTMLAppletElement(Document *doc)
-: HTMLPlugInElement(appletTag, doc)
+HTMLAppletElement::HTMLAppletElement(Document* doc)
+ : HTMLPlugInElement(appletTag, doc)
{
}
#endif
}
-void HTMLAppletElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == altAttr ||
attr->name() == archiveAttr ||
} else if (attr->name() == nameAttr) {
String newNameAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeNamedItem(oldNameAttr);
doc->addNamedItem(newNameAttr);
}
} else if (attr->name() == idAttr) {
String newIdAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeDocExtraNamedItem(oldIdAttr);
doc->addDocExtraNamedItem(newIdAttr);
}
void HTMLAppletElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->addNamedItem(oldNameAttr);
doc->addDocExtraNamedItem(oldIdAttr);
}
void HTMLAppletElement::removedFromDocument()
{
if (document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeNamedItem(oldNameAttr);
doc->removeDocExtraNamedItem(oldIdAttr);
}
HTMLPlugInElement::removedFromDocument();
}
-bool HTMLAppletElement::rendererIsNeeded(RenderStyle *style)
+bool HTMLAppletElement::rendererIsNeeded(RenderStyle* style)
{
return !getAttribute(codeAttr).isNull();
}
-RenderObject *HTMLAppletElement::createRenderer(RenderArena *arena, RenderStyle *style)
+RenderObject* HTMLAppletElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
Settings* settings = document()->settings();
if (!archive.isNull())
args.set("archive", archive);
- args.set("baseURL", document()->baseURL());
+ args.set("baseURL", document()->baseURL().string());
const AtomicString& mayScript = getAttribute(mayscriptAttr);
if (!mayScript.isNull())
}
#if USE(JAVASCRIPTCORE_BINDINGS)
-KJS::Bindings::Instance *HTMLAppletElement::getInstance() const
+KJS::Bindings::Instance* HTMLAppletElement::getInstance() const
{
Settings* settings = document()->settings();
if (!settings || !settings->isJavaEnabled())
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "HTMLAreaElement.h"
#include "Document.h"
-#include "HTMLNames.h"
#include "FloatRect.h"
+#include "HTMLNames.h"
#include "HitTestResult.h"
#include "RenderObject.h"
setAttribute(coordsAttr, value);
}
-String HTMLAreaElement::href() const
+KURL HTMLAreaElement::href() const
{
return document()->completeURL(getAttribute(hrefAttr));
}
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004 Apple Computer, Inc.
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
class HTMLAreaElement : public HTMLAnchorElement {
public:
- enum Shape { Default, Poly, Rect, Circle, Unknown };
-
HTMLAreaElement(Document*);
~HTMLAreaElement();
String coords() const;
void setCoords(const String&);
- String href() const;
+ KURL href() const;
void setHref(const String&);
bool noHref() const;
virtual String target() const;
void setTarget(const String&);
-protected:
+private:
+ enum Shape { Default, Poly, Rect, Circle, Unknown };
Path getRegion(const IntSize&) const;
Path region;
Length* m_coords;
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
using namespace HTMLNames;
-HTMLBaseElement::HTMLBaseElement(Document *doc)
+HTMLBaseElement::HTMLBaseElement(Document* doc)
: HTMLElement(baseTag, doc)
{
}
{
}
-void HTMLBaseElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLBaseElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == hrefAttr) {
m_href = parseURL(attr->value());
// Since the document doesn't have a base element...
// (This will break in the case of multiple base elements, but that's not valid anyway (?))
- document()->setBaseURL(DeprecatedString::null);
- document()->setBaseTarget(DeprecatedString::null);
+ document()->setBaseURL(KURL());
+ document()->setBaseTarget(String());
}
void HTMLBaseElement::process()
return;
if (!m_href.isEmpty() && document()->frame())
- document()->setBaseURL(KURL(document()->frame()->loader()->url(), m_href.deprecatedString()).deprecatedString());
+ document()->setBaseURL(KURL(document()->frame()->loader()->url(), m_href));
if (!m_target.isEmpty())
document()->setBaseTarget(m_target);
-/**
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Simon Hausmann (hausmann@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
if (attr->name() == backgroundAttr) {
String url = parseURL(attr->value());
if (!url.isEmpty())
- addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
+ addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string());
} else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) {
addCSSLength(attr, CSS_PROP_MARGIN_RIGHT, attr->value());
addCSSLength(attr, CSS_PROP_MARGIN_LEFT, attr->value());
return getAttribute(alinkAttr);
}
-void HTMLBodyElement::setALink(const String &value)
+void HTMLBodyElement::setALink(const String& value)
{
setAttribute(alinkAttr, value);
}
return getAttribute(backgroundAttr);
}
-void HTMLBodyElement::setBackground(const String &value)
+void HTMLBodyElement::setBackground(const String& value)
{
setAttribute(backgroundAttr, value);
}
return getAttribute(bgcolorAttr);
}
-void HTMLBodyElement::setBgColor(const String &value)
+void HTMLBodyElement::setBgColor(const String& value)
{
setAttribute(bgcolorAttr, value);
}
return getAttribute(linkAttr);
}
-void HTMLBodyElement::setLink(const String &value)
+void HTMLBodyElement::setLink(const String& value)
{
setAttribute(linkAttr, value);
}
return getAttribute(textAttr);
}
-void HTMLBodyElement::setText(const String &value)
+void HTMLBodyElement::setText(const String& value)
{
setAttribute(textAttr, value);
}
return getAttribute(vlinkAttr);
}
-void HTMLBodyElement::setVLink(const String &value)
+void HTMLBodyElement::setVLink(const String& value)
{
setAttribute(vlinkAttr, value);
}
Document* doc = document();
doc->updateLayoutIgnorePendingStylesheets();
FrameView* view = doc->view();
-
return view ? view->contentsX() : 0;
}
Document* doc = document();
doc->updateLayoutIgnorePendingStylesheets();
FrameView* view = doc->view();
-
return view ? view->contentsY() : 0;
}
Document* doc = document();
doc->updateLayoutIgnorePendingStylesheets();
FrameView* view = doc->view();
-
return view ? view->contentsHeight() : 0;
}
Document* doc = document();
doc->updateLayoutIgnorePendingStylesheets();
FrameView* view = doc->view();
-
return view ? view->contentsWidth() : 0;
}
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007 Trolltech ASA
*
* This library is free software; you can redistribute it and/or
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "HTMLEmbedElement.h"
? static_cast<RenderWidget*>(n->renderer()) : 0;
}
-KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
+KJS::Bindings::Instance* HTMLEmbedElement::getInstance() const
{
Frame* frame = document()->frame();
if (!frame)
if (pos != -1)
m_serviceType = m_serviceType.left(pos);
} else if (attr->name() == codeAttr || attr->name() == srcAttr)
- url = parseURL(val).deprecatedString();
+ m_url = parseURL(val);
else if (attr->name() == pluginpageAttr || attr->name() == pluginspageAttr)
m_pluginPage = val;
else if (attr->name() == hiddenAttr) {
HTMLPlugInElement::parseMappedAttribute(attr);
}
-bool HTMLEmbedElement::rendererIsNeeded(RenderStyle *style)
+bool HTMLEmbedElement::rendererIsNeeded(RenderStyle* style)
{
- Frame *frame = document()->frame();
+ Frame* frame = document()->frame();
if (!frame)
return false;
- Node *p = parentNode();
+ Node* p = parentNode();
if (p && p->hasTagName(objectTag)) {
ASSERT(p->renderer());
return false;
return true;
}
-RenderObject *HTMLEmbedElement::createRenderer(RenderArena *arena, RenderStyle *style)
+RenderObject* HTMLEmbedElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
return new (arena) RenderPartObject(this);
}
void HTMLEmbedElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->addNamedItem(oldNameAttr);
}
void HTMLEmbedElement::removedFromDocument()
{
if (document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeNamedItem(oldNameAttr);
}
}
}
-bool HTMLEmbedElement::isURLAttribute(Attribute *attr) const
+bool HTMLEmbedElement::isURLAttribute(Attribute* attr) const
{
return attr->name() == srcAttr;
}
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
String type() const;
void setType(const String&);
- DeprecatedString url;
+ const String& url() const { return m_url; }
+ const String& serviceType() const { return m_serviceType; }
+
+private:
+ String m_url;
String m_pluginPage;
String m_serviceType;
bool m_needWidgetUpdate;
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* (C) 2006 Alexey Proskuryakov (ap@nypop.com)
*
* This library is free software; you can redistribute it and/or
imgElements[i]->m_form = 0;
}
-bool HTMLFormElement::formWouldHaveSecureSubmission(const String &url)
+bool HTMLFormElement::formWouldHaveSecureSubmission(const String& url)
{
- if (url.isNull()) {
- return false;
- }
- return document()->completeURL(url.deprecatedString()).startsWith("https:", false);
+ return document()->completeURL(url).protocolIs("https");
}
void HTMLFormElement::attach()
void HTMLFormElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->addNamedItem(oldNameAttr);
}
void HTMLFormElement::removedFromDocument()
{
if (document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeNamedItem(oldNameAttr);
}
bool submitFound = false;
for (unsigned i = 0; i < formElements.size(); ++i) {
if (formElements[i]->hasLocalName(inputTag)) {
- HTMLInputElement *element = static_cast<HTMLInputElement *>(formElements[i]);
+ HTMLInputElement* element = static_cast<HTMLInputElement*>(formElements[i]);
if (element->isSuccessfulSubmitButton() && element->renderer()) {
submitFound = true;
element->dispatchSimulatedClick(event);
// http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
// same safe characters as Netscape for compatibility
- static const char *safe = "-._*";
+ static const char* safe = "-._*";
int elen = e.length();
DeprecatedCString encoded((elen + e.contains('\n')) * 3 + 1);
int enclen = 0;
TextEncoding encoding;
String str = m_acceptcharset;
str.replace(',', ' ');
- Vector<String> charsets = str.split(' ');
+ Vector<String> charsets;
+ str.split(' ', charsets);
Vector<String>::const_iterator end = charsets.end();
for (Vector<String>::const_iterator it = charsets.begin(); it != end; ++it)
if ((encoding = TextEncoding(*it)).isValid())
hstr += "\"";
if (!static_cast<HTMLInputElement*>(current)->value().isEmpty()) {
- DeprecatedString mimeType = MIMETypeRegistry::getMIMETypeForPath(path).deprecatedString();
+ String mimeType = MIMETypeRegistry::getMIMETypeForPath(path);
if (!mimeType.isEmpty()) {
hstr += "\r\nContent-Type: ";
- hstr += mimeType.ascii();
+ hstr += mimeType.latin1().deprecatedCString();
}
}
}
bool HTMLFormElement::isMailtoForm() const
{
- return m_url.startsWith("mailto:", false);
+ return protocolIs(m_url, "mailto");
}
bool HTMLFormElement::prepareSubmit(Event* event)
void HTMLFormElement::submit(Event* event, bool activateSubmitButton)
{
- FrameView *view = document()->view();
- Frame *frame = document()->frame();
+ FrameView* view = document()->view();
+ Frame* frame = document()->frame();
if (!view || !frame)
return;
firstSuccessfulSubmitButton->setActivatedSubmit(true);
if (!m_url)
- m_url = document()->url();
+ m_url = document()->url().string();
if (m_post) {
if (m_multipart && isMailtoForm()) {
String body = data->flattenToString();
if (equalIgnoringCase(enctype(), "text/plain")) {
// Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20.
- body = KURL::decode_string(body.replace('&', "\r\n").replace('+', ' ').deprecatedString() + "\r\n");
+ body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', ' ') + "\r\n");
}
data = new FormData((String("body=") + encodeCString(body.utf8())).replace('+', "%20").latin1());
}
void HTMLFormElement::reset()
{
- Frame *frame = document()->frame();
+ Frame* frame = document()->frame();
if (m_inreset || !frame)
return;
m_inreset = false;
}
-void HTMLFormElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLFormElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == actionAttr)
m_url = parseURL(attr->value());
else if (attr->name() == nameAttr) {
String newNameAttr = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
- HTMLDocument *doc = static_cast<HTMLDocument *>(document());
+ HTMLDocument* doc = static_cast<HTMLDocument*>(document());
doc->removeNamedItem(oldNameAttr);
doc->addNamedItem(newNameAttr);
}
}
}
-unsigned HTMLFormElement::formElementIndex(HTMLGenericFormElement *e)
+unsigned HTMLFormElement::formElementIndex(HTMLGenericFormElement* e)
{
// Check for the special case where this element is the very last thing in
// the form's tree of children; we don't want to walk the entire tree in that
// that says "add this form element to the end of the array".
if (e->traverseNextNode(this)) {
unsigned i = 0;
- for (Node *node = this; node; node = node->traverseNextNode(this)) {
+ for (Node* node = this; node; node = node->traverseNextNode(this)) {
if (node == e)
return i;
if (node->isHTMLElement()
- && static_cast<HTMLElement *>(node)->isGenericFormElement()
- && static_cast<HTMLGenericFormElement *>(node)->form() == this)
+ && static_cast<HTMLElement*>(node)->isGenericFormElement()
+ && static_cast<HTMLGenericFormElement*>(node)->form() == this)
++i;
}
}
removeFromVector(formElements, e);
}
-bool HTMLFormElement::isURLAttribute(Attribute *attr) const
+bool HTMLFormElement::isURLAttribute(Attribute* attr) const
{
return attr->name() == actionAttr;
}
-void HTMLFormElement::registerImgElement(HTMLImageElement *e)
+void HTMLFormElement::registerImgElement(HTMLImageElement* e)
{
imgElements.append(e);
}
-void HTMLFormElement::removeImgElement(HTMLImageElement *e)
+void HTMLFormElement::removeImgElement(HTMLImageElement* e)
{
removeFromVector(imgElements, e);
}
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Simon Hausmann (hausmann@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "HTMLFrameElementBase.h"
if (URLString.isEmpty())
return true;
- KURL completeURL(document()->completeURL(URLString.deprecatedString()));
- completeURL.setRef(DeprecatedString::null);
+ KURL completeURL(document()->completeURL(URLString));
// Don't allow more than 200 total frames in a set. This seems
// like a reasonable upper bound, and otherwise mutually recursive
// frameset pages can quickly bring the program to its knees with
// exponential growth in the number of frames.
-
- // FIXME: This limit could be higher, but WebKit has some
+ // FIXME: This limit could be higher, but because WebKit has some
// algorithms that happen while loading which appear to be N^2 or
- // worse in the number of frames
- if (Frame* parentFrame = document()->frame())
+ // worse in the number of frames, we'll keep it at 200 for now.
+ if (Frame* parentFrame = document()->frame()) {
if (parentFrame->page()->frameCount() > 200)
return false;
+ }
// We allow one level of self-reference because some sites depend on that.
// But we don't allow more than one.
bool foundSelfReference = false;
for (Frame* frame = document()->frame(); frame; frame = frame->tree()->parent()) {
- KURL frameURL = frame->loader()->url();
- frameURL.setRef(DeprecatedString::null);
- if (frameURL == completeURL) {
+ if (equalIgnoringRef(frame->loader()->url(), completeURL)) {
if (foundSelfReference)
return false;
foundSelfReference = true;
return;
if (m_URL.isEmpty())
- m_URL = "about:blank";
+ m_URL = blankURL().string();
Frame* parentFrame = document()->frame();
if (!parentFrame)
renderPart->setWidget(frame->view());
}
-String HTMLFrameElementBase::location() const
+KURL HTMLFrameElementBase::location() const
{
return src();
}
setAttribute(scrollingAttr, value);
}
-String HTMLFrameElementBase::src() const
+KURL HTMLFrameElementBase::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
virtual void attach();
- String location() const;
+ KURL location() const;
void setLocation(const String&);
virtual bool isFocusable() const;
String scrolling() const;
void setScrolling(const String&);
- String src() const;
+ KURL src() const;
void setSrc(const String&);
int width() const;
if (attr->value().domString()[0] == '#')
usemap = attr->value();
else
- usemap = document()->completeURL(parseURL(attr->value()));
+ usemap = document()->completeURL(parseURL(attr->value())).string();
m_isLink = !attr->isNull();
} else if (attrName == ismapAttr)
ismap = true;
setAttribute(ismapAttr, isMap ? "" : 0);
}
-String HTMLImageElement::longDesc() const
+KURL HTMLImageElement::longDesc() const
{
return document()->completeURL(getAttribute(longdescAttr));
}
setAttribute(longdescAttr, value);
}
-String HTMLImageElement::lowsrc() const
+KURL HTMLImageElement::lowsrc() const
{
return document()->completeURL(getAttribute(lowsrcAttr));
}
setAttribute(lowsrcAttr, value);
}
-String HTMLImageElement::src() const
+KURL HTMLImageElement::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004 Apple Computer, Inc.
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#ifndef HTMLImageElement_h
#define HTMLImageElement_h
-#include "HTMLElement.h"
#include "GraphicsTypes.h"
+#include "HTMLElement.h"
#include "HTMLImageLoader.h"
namespace WebCore {
- class HTMLFormElement;
+
+class HTMLFormElement;
class HTMLImageElement : public HTMLElement {
friend class HTMLFormElement;
String altText() const;
- String imageMap() const { return usemap; }
-
virtual bool isURLAttribute(Attribute*) const;
CompositeOperator compositeOperator() const { return m_compositeOperator; }
bool isMap() const;
void setIsMap(bool);
- String longDesc() const;
+ KURL longDesc() const;
void setLongDesc(const String&);
- String lowsrc() const;
+ KURL lowsrc() const;
void setLowsrc(const String&);
- String src() const;
+ KURL src() const;
void setSrc(const String&);
String useMap() const;
bool complete() const;
bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); }
-protected:
+
+private:
HTMLImageLoader m_imageLoader;
String usemap;
bool ismap;
setAttribute(sizeAttr, String::number(_size));
}
-String HTMLInputElement::src() const
+KURL HTMLInputElement::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
namespace WebCore {
class HTMLImageLoader;
+class KURL;
class Selection;
class HTMLInputElement : public HTMLFormControlElementWithState {
void setSize(unsigned);
- String src() const;
+ KURL src() const;
void setSrc(const String&);
void setMaxLength(int);
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "HTMLLinkElement.h"
tokenizeRelAttribute(attr->value());
process();
} else if (attr->name() == hrefAttr) {
- m_url = document()->completeURL(parseURL(attr->value()));
+ m_url = document()->completeURL(parseURL(attr->value())).string();
process();
} else if (attr->name() == typeAttr) {
m_type = attr->value();
else {
// Tokenize the rel attribute and set bits based on specific keywords that we find.
rel.replace('\n', ' ');
- Vector<String> list = rel.split(' ');
+ Vector<String> list;
+ rel.split(' ', list);
Vector<String>::const_iterator end = list.end();
for (Vector<String>::const_iterator it = list.begin(); it != end; ++it) {
if (*it == "stylesheet")
setAttribute(charsetAttr, value);
}
-String HTMLLinkElement::href() const
+KURL HTMLLinkElement::href() const
{
return document()->completeURL(getAttribute(hrefAttr));
}
/*
- * This file is part of the DOM implementation for KDE.
- *
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2003 Apple Computer, Inc.
+ * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* Boston, MA 02110-1301, USA.
*
*/
+
#ifndef HTMLLinkElement_h
#define HTMLLinkElement_h
-#include "HTMLElement.h"
-#include "CachedResourceClient.h"
#include "CSSStyleSheet.h"
+#include "CachedResourceClient.h"
+#include "HTMLElement.h"
namespace WebCore {
class CachedCSSStyleSheet;
+class KURL;
-class HTMLLinkElement : public HTMLElement, public CachedResourceClient
-{
+class HTMLLinkElement : public HTMLElement, public CachedResourceClient {
public:
HTMLLinkElement(Document*);
~HTMLLinkElement();
String charset() const;
void setCharset(const String&);
- String href() const;
+ KURL href() const;
void setHref(const String&);
String hreflang() const;
/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
return m_error;
}
-String HTMLMediaElement::src() const
+KURL HTMLMediaElement::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
if (!MIMETypeRegistry::isSupportedMediaMIMEType(type))
continue;
}
- mediaSrc = source->src();
+ mediaSrc = source->src().string();
break;
}
}
}
if (!mediaSrc.isEmpty())
- mediaSrc = document()->completeURL(mediaSrc);
+ mediaSrc = document()->completeURL(mediaSrc).string();
return mediaSrc;
}
class MediaError;
class TimeRanges;
+class KURL;
class HTMLMediaElement : public HTMLElement, public MediaPlayerClient {
public:
PassRefPtr<MediaError> error() const;
// network state
- String src() const;
+ KURL src() const;
void setSrc(const String&);
String currentSrc() const;
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2007 Trolltech ASA
*
* This library is free software; you can redistribute it and/or
bool HTMLObjectElement::isImageType()
{
- if (m_serviceType.isEmpty() && m_url.startsWith("data:")) {
+ if (m_serviceType.isEmpty() && protocolIs(m_url, "data")) {
// Extract the MIME type from the data URL.
int index = m_url.find(';');
if (index == -1)
setAttribute(codetypeAttr, value);
}
-String HTMLObjectElement::data() const
+KURL HTMLObjectElement::data() const
{
return document()->completeURL(getAttribute(dataAttr));
}
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace WebCore {
class HTMLImageLoader;
+class KURL;
class HTMLObjectElement : public HTMLPlugInElement {
public:
String codeType() const;
void setCodeType(const String&);
- String data() const;
+ KURL data() const;
void setData(const String&);
bool declare() const;
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* (C) 2006 Alexey Proskuryakov (ap@nypop.com)
*
* This library is free software; you can redistribute it and/or
String HTMLOptGroupElement::groupLabelText() const
{
- DeprecatedString itemText = getAttribute(labelAttr).deprecatedString();
+ String itemText = getAttribute(labelAttr);
itemText.replace('\\', document()->backslashAsCurrencySymbol());
// In WinIE, leading and trailing whitespace is ignored in options and optgroups. We match this behavior.
message.replace("%tag1", tag1);
message.replace("%tag2", tag2);
- page->chrome()->addMessageToConsole(HTMLMessageSource, isWarning(errorCode) ? WarningMessageLevel: ErrorMessageLevel, message, lineNumber, document->url());
+ page->chrome()->addMessageToConsole(HTMLMessageSource,
+ isWarning(errorCode) ? WarningMessageLevel : ErrorMessageLevel,
+ message, lineNumber, document->url().string());
}
}
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "HTMLScriptElement.h"
using namespace HTMLNames;
using namespace EventNames;
-HTMLScriptElement::HTMLScriptElement(Document *doc)
+HTMLScriptElement::HTMLScriptElement(Document* doc)
: HTMLElement(scriptTag, doc)
, m_cachedScript(0)
, m_createdByParser(false)
m_cachedScript->deref(this);
}
-bool HTMLScriptElement::isURLAttribute(Attribute *attr) const
+bool HTMLScriptElement::isURLAttribute(Attribute* attr) const
{
return attr->name() == srcAttr;
}
// and the script element has been inserted in the document
// we evaluate the script.
if (!m_createdByParser && inDocument() && firstChild())
- evaluateScript(document()->url(), text());
+ evaluateScript(document()->url().string(), text());
HTMLElement::childrenChanged(changedByParser);
}
-void HTMLScriptElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLScriptElement::parseMappedAttribute(MappedAttribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == srcAttr) {
// it should be evaluated, and evaluateScript only evaluates a script once.
String scriptString = text();
if (!scriptString.isEmpty())
- evaluateScript(document()->url(), scriptString);
+ evaluateScript(document()->url().string(), scriptString);
}
void HTMLScriptElement::removedFromDocument()
void HTMLScriptElement::notifyFinished(CachedResource* o)
{
- CachedScript *cs = static_cast<CachedScript *>(o);
+ CachedScript* cs = static_cast<CachedScript*>(o);
ASSERT(cs == m_cachedScript);
String HTMLScriptElement::text() const
{
- String val = "";
+ Vector<UChar> val;
- for (Node *n = firstChild(); n; n = n->nextSibling()) {
+ for (Node* n = firstChild(); n; n = n->nextSibling()) {
if (n->isTextNode())
- val += static_cast<Text *>(n)->data();
+ append(val, static_cast<Text*>(n)->data());
}
- return val;
+ return String::adopt(val);
}
void HTMLScriptElement::setText(const String &value)
return;
}
- if (numChildren > 0) {
+ if (numChildren > 0)
removeChildren();
- }
appendChild(document()->createTextNode(value.impl()), ec);
}
return String();
}
-void HTMLScriptElement::setHtmlFor(const String &/*value*/)
+void HTMLScriptElement::setHtmlFor(const String& /*value*/)
{
// DOM Level 1 says: reserved for future use.
}
return String();
}
-void HTMLScriptElement::setEvent(const String &/*value*/)
+void HTMLScriptElement::setEvent(const String& /*value*/)
{
// DOM Level 1 says: reserved for future use.
}
setAttribute(deferAttr, defer ? "" : 0);
}
-String HTMLScriptElement::src() const
+KURL HTMLScriptElement::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
bool defer() const;
void setDefer(bool);
- String src() const;
+ KURL src() const;
void setSrc(const String&);
String type() const;
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "HTMLDocument.h"
#include "HTMLMediaElement.h"
+#include "HTMLNames.h"
using namespace std;
}
}
-String HTMLSourceElement::src() const
+KURL HTMLSourceElement::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#if ENABLE(VIDEO)
#include "HTMLElement.h"
-#include "HTMLNames.h"
#include <limits>
namespace WebCore {
-using namespace HTMLNames;
-
-class MediaError;
-
+class KURL;
+
class HTMLSourceElement : public HTMLElement {
public:
HTMLSourceElement(Document*);
virtual void insertedIntoDocument();
- String src() const;
+ KURL src() const;
String media() const;
String type() const;
void setSrc(const String&);
} else if (attr->name() == backgroundAttr) {
String url = parseURL(attr->value());
if (!url.isEmpty())
- addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
+ addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string());
} else if (attr->name() == frameAttr) {
// Cache the value of "frame" so that the table can examine it later.
m_frameAttr = false;
else if (attr->name() == backgroundAttr) {
String url = parseURL(attr->value());
if (!url.isEmpty())
- addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url));
+ addCSSImageProperty(attr, CSS_PROP_BACKGROUND_IMAGE, document()->completeURL(url).string());
} else if (attr->name() == bordercolorAttr) {
if (!attr->value().isEmpty()) {
addCSSColor(attr, CSS_PROP_BORDER_COLOR, attr->value());
{
// Code elsewhere normalizes line endings added by the user via the keyboard or pasting.
// We must normalize line endings coming from JS.
- DeprecatedString valueWithNormalizedLineEndings = value.deprecatedString();
+ String valueWithNormalizedLineEndings = value;
valueWithNormalizedLineEndings.replace("\r\n", "\n");
valueWithNormalizedLineEndings.replace("\r", "\n");
if (m_fragment || !m_doc->frame())
return state;
m_executingScript++;
- DeprecatedString url = scriptURL.isNull() ? m_doc->frame()->document()->url() : scriptURL.deprecatedString();
+ String url = scriptURL.isNull() ? m_doc->frame()->document()->url().string() : scriptURL;
SegmentedString *savedPrependingSrc = currentPrependingSrc;
SegmentedString prependingSrc;
Settings* settings = m_doc->settings();
if (settings && settings->isJavaScriptEnabled()) {
if ((a = currToken.attrs->getAttributeItem(srcAttr)))
- scriptSrc = m_doc->completeURL(parseURL(a->value()));
+ scriptSrc = m_doc->completeURL(parseURL(a->value())).string();
if ((a = currToken.attrs->getAttributeItem(charsetAttr)))
scriptSrcCharset = a->value().domString().stripWhiteSpace();
if (scriptSrcCharset.isEmpty())
jsProxy->setEventHandlerLineno(tagStartLineno);
if (dest > buffer) {
#ifdef TOKEN_DEBUG
- if(currToken.tagName.length()) {
- qDebug( "unexpected token: %s, str: *%s*", currToken.tagName.deprecatedString().latin1(),DeprecatedConstString( buffer,dest-buffer ).deprecatedString().latin1() );
+ if (currToken.tagName.length()) {
+ qDebug( "unexpected token: %s, str: *%s*", currToken.tagName.latin1().data(), DeprecatedConstString(buffer, dest-buffer).deprecatedString().latin1());
ASSERT(0);
}
#ifdef TOKEN_DEBUG
DeprecatedString name = currToken.tagName.deprecatedString();
DeprecatedString text;
- if(currToken.text)
+ if (currToken.text)
text = DeprecatedConstString(currToken.text->unicode(), currToken.text->length()).deprecatedString();
kdDebug( 6036 ) << "Token --> " << name << endl;
// file loads were serialized in lower level.
// FIXME: this should really be done for all script loads or the same effect should be achieved by other
// means, like javascript suspend/resume
- m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded() && pendingScripts.head()->url().startsWith("file:", false);
+ m_hasScriptsWaitingForStylesheets = !m_doc->haveStylesheetsLoaded() && protocolIs(pendingScripts.head()->url(), "file");
if (m_hasScriptsWaitingForStylesheets)
return;
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
m_imageLoader.clear();
}
-void HTMLVideoElement::parseMappedAttribute(MappedAttribute *attr)
+void HTMLVideoElement::parseMappedAttribute(MappedAttribute* attr)
{
const QualifiedName& attrName = attr->name();
setAttribute(heightAttr, String::number(value));
}
-String HTMLVideoElement::poster() const
+KURL HTMLVideoElement::poster() const
{
return document()->completeURL(getAttribute(posterAttr));
}
setAttribute(posterAttr, value);
}
-bool HTMLVideoElement::isURLAttribute(Attribute *attr) const
+bool HTMLVideoElement::isURLAttribute(Attribute* attr) const
{
return attr->name() == posterAttr;
}
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
int videoWidth() const;
int videoHeight() const;
- String poster() const;
+ KURL poster() const;
void setPoster(const String&);
void updatePosterImage();
/*
- * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
*/
#include "config.h"
-#include "DOMImplementation.h"
#include "HTMLViewSourceDocument.h"
+
+#include "DOMImplementation.h"
#include "HTMLTokenizer.h"
#include "HTMLHtmlElement.h"
#include "HTMLAnchorElement.h"
#include "TextDocument.h"
#include "HTMLNames.h"
-namespace WebCore
-{
+namespace WebCore {
using namespace HTMLNames;
return;
// Add in the content, splitting on newlines.
- Vector<String> lines = text.split('\n', true);
+ Vector<String> lines;
+ text.split('\n', true, lines);
unsigned size = lines.size();
for (unsigned i = 0; i < size; i++) {
String substring = lines[i];
/*
- This file is part of the KDE libraries
-
Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
- Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
void DocLoader::checkForReload(const KURL& fullURL)
{
if (m_allowStaleResources)
- return; //Don't reload resources while pasting
+ return; // Don't reload resources while pasting
+
+ if (fullURL.isEmpty())
+ return;
+
if (m_cachePolicy == CachePolicyVerify) {
if (!m_reloadedURLs.contains(fullURL.string())) {
CachedResource* existing = cache()->resourceForURL(fullURL.string());
CachedResource* DocLoader::requestResource(CachedResource::Type type, const String& url, const String* charset, bool skipCanLoadCheck, bool sendResourceLoadCallbacks)
{
- KURL fullURL = m_doc->completeURL(url.deprecatedString());
+ KURL fullURL = m_doc->completeURL(url);
if (cache()->disabled()) {
HashMap<String, CachedResource*>::iterator it = m_docResources.find(fullURL.string());
/*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "CharacterNames.h"
#include "CString.h"
-#include "Element.h"
#include "HTMLNames.h"
#include "HTMLTableElement.h"
-#include "HTMLTableSectionElement.h"
#include "HTMLTokenizer.h"
-#include "KURL.h"
#include "Loca