Commit 642f5008 authored by darin@apple.com's avatar darin@apple.com

WebCore:

2008-06-07  Darin Adler  <darin@apple.com>

        Reviewed by Mitz.

        - work on https://bugs.webkit.org/show_bug.cgi?id=17257
          start ref counts at 1 instead of 0 for speed

        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
        (WebCore::toHTMLCanvasStyle):
        * bindings/js/JSDOMWindowBase.cpp:
        (WebCore::JSDOMWindowBase::findOrCreateJSEventListener):
        (WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener):
        * bindings/js/JSNodeFilterCondition.h:
        (WebCore::JSNodeFilterCondition::create):
        * bindings/js/JSNodeFilterCustom.cpp:
        (WebCore::toNodeFilter):
        * bindings/js/JSSVGLazyEventListener.h:
        (WebCore::JSSVGLazyEventListener::create):
        * bindings/js/JSSVGMatrixCustom.cpp:
        (WebCore::JSSVGMatrix::multiply):
        (WebCore::JSSVGMatrix::inverse):
        (WebCore::JSSVGMatrix::translate):
        (WebCore::JSSVGMatrix::scale):
        (WebCore::JSSVGMatrix::scaleNonUniform):
        (WebCore::JSSVGMatrix::rotate):
        (WebCore::JSSVGMatrix::rotateFromVector):
        (WebCore::JSSVGMatrix::flipX):
        (WebCore::JSSVGMatrix::flipY):
        (WebCore::JSSVGMatrix::skewX):
        (WebCore::JSSVGMatrix::skewY):
        * bindings/js/JSSVGPODTypeWrapper.h:
        (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::create):
        (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::JSSVGPODTypeWrapperCreatorReadWrite):
        (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::create):
        (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::JSSVGPODTypeWrapperCreatorReadOnly):
        (WebCore::JSSVGPODTypeWrapperCreatorForList::create):
        (WebCore::JSSVGPODTypeWrapperCreatorForList::JSSVGPODTypeWrapperCreatorForList):
        (WebCore::JSSVGPODTypeWrapperCache::lookupOrCreateWrapper):
        (WebCore::JSSVGPODTypeWrapperCache::forgetWrapper):
        * bindings/js/JSSVGPointListCustom.cpp:
        (WebCore::commonExit):
        (WebCore::commonExitReadOnly):
        (WebCore::JSSVGPointList::initialize):
        (WebCore::JSSVGPointList::getItem):
        (WebCore::JSSVGPointList::insertItemBefore):
        (WebCore::JSSVGPointList::replaceItem):
        (WebCore::JSSVGPointList::removeItem):
        (WebCore::JSSVGPointList::appendItem):
        * bindings/js/JSSVGTransformListCustom.cpp:
        (WebCore::JSSVGTransformList::initialize):
        (WebCore::JSSVGTransformList::getItem):
        (WebCore::JSSVGTransformList::insertItemBefore):
        (WebCore::JSSVGTransformList::replaceItem):
        (WebCore::JSSVGTransformList::removeItem):
        (WebCore::JSSVGTransformList::appendItem):
        * bindings/js/kjs_binding.cpp:
        (WebCore::setDOMException):
        * bindings/js/kjs_events.h:
        (WebCore::JSUnprotectedEventListener::create):
        (WebCore::JSEventListener::create):
        (WebCore::JSLazyEventListener::create):
        * bindings/js/kjs_proxy.cpp:
        (WebCore::KJSProxy::createHTMLEventHandler):
        (WebCore::KJSProxy::createSVGEventHandler):
        * bindings/objc/DOM.mm:
        (WebCore::ObjCNodeFilterCondition::create):
        (WebCore::ObjCNodeFilterCondition::ObjCNodeFilterCondition):
        (WebCore::ObjCNodeFilterCondition::acceptNode):
        (-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]):
        (-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]):
        * bindings/scripts/CodeGeneratorJS.pm:
        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::valueForNinePieceImage):
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
        * css/CSSFontFace.h:
        (WebCore::CSSFontFace::create):
        (WebCore::CSSFontFace::CSSFontFace):
        * css/CSSFontSelector.cpp:
        (WebCore::CSSFontSelector::addFontFaceRule):
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseDashboardRegions):
        (WebCore::CSSParser::parseCounterContent):
        (WebCore::CSSParser::parseShape):
        (WebCore::BorderImageParseContext::commitBorderImage):
        * css/CSSSegmentedFontFace.cpp:
        (WebCore::CSSSegmentedFontFace::CSSSegmentedFontFace):
        * css/CSSSegmentedFontFace.h:
        (WebCore::CSSSegmentedFontFace::create):
        * css/Counter.h:
        (WebCore::Counter::create):
        (WebCore::Counter::Counter):
        * css/DashboardRegion.h:
        (WebCore::DashboardRegion::create):
        (WebCore::DashboardRegion::DashboardRegion):
        * css/Rect.h:
        (WebCore::Rect::create):
        (WebCore::Rect::Rect):
        * dom/ChildNodeList.h:
        (WebCore::ChildNodeList::create):
        * dom/ClassNodeList.h:
        (WebCore::ClassNodeList::create):
        * dom/Clipboard.h:
        * dom/DOMCoreException.h:
        (WebCore::DOMCoreException::create):
        * dom/DOMImplementation.cpp:
        (WebCore::DOMImplementation::instance):
        * dom/DOMImplementation.h:
        (WebCore::DOMImplementation::DOMImplementation):
        * dom/Document.cpp:
        (WebCore::Document::addWindowEventListener):
        (WebCore::Document::removeWindowEventListener):
        (WebCore::Document::setDecoder):
        (WebCore::Document::images):
        (WebCore::Document::applets):
        (WebCore::Document::embeds):
        (WebCore::Document::plugins):
        (WebCore::Document::objects):
        (WebCore::Document::scripts):
        (WebCore::Document::links):
        (WebCore::Document::forms):
        (WebCore::Document::anchors):
        (WebCore::Document::all):
        (WebCore::Document::windowNamedItems):
        (WebCore::Document::documentNamedItems):
        * dom/Document.h:
        * dom/DynamicNodeList.h:
        * dom/EventException.h:
        (WebCore::EventException::create):
        (WebCore::EventException::EventException):
        * dom/EventListener.h:
        * dom/EventTarget.cpp:
        (WebCore::EventTarget::addEventListener):
        (WebCore::EventTarget::removeEventListener):
        * dom/ExceptionBase.cpp:
        (WebCore::ExceptionBase::ExceptionBase):
        * dom/ExceptionBase.h:
        * dom/NameNodeList.h:
        (WebCore::NameNodeList::create):
        * dom/Node.cpp:
        (WebCore::Node::childNodes):
        (WebCore::Node::getElementsByTagNameNS):
        (WebCore::Node::getElementsByName):
        (WebCore::Node::getElementsByClassName):
        (WebCore::Node::querySelectorAll):
        * dom/NodeFilterCondition.h:
        * dom/NodeList.h:
        * dom/RangeException.h:
        (WebCore::RangeException::create):
        (WebCore::RangeException::RangeException):
        * dom/RegisteredEventListener.h:
        (WebCore::RegisteredEventListener::create):
        * dom/SelectorNodeList.cpp:
        (WebCore::createSelectorNodeList):
        * dom/SelectorNodeList.h:
        * dom/StaticNodeList.cpp:
        (WebCore::StaticNodeList::StaticNodeList):
        * dom/StaticNodeList.h:
        (WebCore::StaticNodeList::adopt):
        * dom/TagNodeList.h:
        (WebCore::TagNodeList::create):
        * history/HistoryItem.cpp:
        (WebCore::defaultNotifyHistoryItemChanged):
        (WebCore::HistoryItem::HistoryItem):
        (WebCore::HistoryItem::copy):
        * history/HistoryItem.h:
        (WebCore::HistoryItem::create):
        * html/CanvasGradient.h:
        * html/CanvasPattern.cpp:
        (WebCore::CanvasPattern::CanvasPattern):
        * html/CanvasPattern.h:
        (WebCore::CanvasPattern::create):
        * html/CanvasRenderingContext2D.cpp:
        (WebCore::CanvasRenderingContext2D::State::State):
        (WebCore::CanvasRenderingContext2D::setStrokeColor):
        (WebCore::CanvasRenderingContext2D::setFillColor):
        (WebCore::CanvasRenderingContext2D::createPattern):
        * html/CanvasStyle.cpp:
        (WebCore::CanvasStyle::CanvasStyle):
        * html/CanvasStyle.h:
        (WebCore::CanvasStyle::create):
        * html/HTMLCollection.cpp:
        (WebCore::HTMLCollection::HTMLCollection):
        (WebCore::HTMLCollection::create):
        * html/HTMLCollection.h:
        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::children):
        * html/HTMLFormCollection.cpp:
        (WebCore::HTMLFormCollection::create):
        * html/HTMLFormCollection.h:
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::elements):
        * html/HTMLMapElement.cpp:
        (WebCore::HTMLMapElement::areas):
        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::load):
        (WebCore::HTMLMediaElement::mediaPlayerNetworkStateChanged):
        (WebCore::HTMLMediaElement::willSaveToCache):
        * html/HTMLNameCollection.h:
        (WebCore::HTMLNameCollection::create):
        * html/HTMLOptionsCollection.cpp:
        (WebCore::HTMLOptionsCollection::create):
        * html/HTMLOptionsCollection.h:
        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::options):
        * html/HTMLTableElement.cpp:
        (WebCore::HTMLTableElement::rows):
        (WebCore::HTMLTableElement::tBodies):
        * html/HTMLTableRowElement.cpp:
        (WebCore::HTMLTableRowElement::cells):
        * html/HTMLTableRowsCollection.cpp:
        (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection):
        (WebCore::HTMLTableRowsCollection::create):
        * html/HTMLTableRowsCollection.h:
        * html/HTMLTableSectionElement.cpp:
        (WebCore::HTMLTableSectionElement::rows):
        * html/MediaError.h:
        (WebCore::MediaError::create):
        (WebCore::MediaError::MediaError):
        * loader/CachedCSSStyleSheet.cpp:
        (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
        * loader/CachedFont.cpp:
        (WebCore::CachedFont::ensureSVGFontData):
        * loader/CachedXSLStyleSheet.cpp:
        (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::write):
        (WebCore::FrameLoader::createHistoryItem):
        * loader/ImageDocument.cpp:
        (WebCore::ImageEventListener::create):
        (WebCore::ImageEventListener::ImageEventListener):
        (WebCore::ImageDocument::createDocumentStructure):
        * loader/TextResourceDecoder.h:
        (WebCore::TextResourceDecoder::create):
        * page/Page.cpp:
        (WebCore::Page::userStyleSheet):
        * svg/SVGException.h:
        (WebCore::SVGException::create):
        (WebCore::SVGException::SVGException):
        * svg/animation/SVGSMILElement.cpp:
        (WebCore::ConditionEventListener::create):
        (WebCore::ConditionEventListener::ConditionEventListener):
        (WebCore::SVGSMILElement::connectConditions):
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::didReceiveData):
        * xml/XMLHttpRequestException.h:
        (WebCore::XMLHttpRequestException::create):
        (WebCore::XMLHttpRequestException::XMLHttpRequestException):
        * xml/XPathException.h:
        (WebCore::XPathException::create):
        (WebCore::XPathException::XPathException):
        * xml/XPathResult.cpp:
        (WebCore::InvalidatingEventListener::create):
        (WebCore::InvalidatingEventListener::InvalidatingEventListener):
        (WebCore::XPathResult::XPathResult):
        * xml/XSLTProcessor.cpp:
        (WebCore::XSLTProcessor::createDocumentFromSource):

WebKit/mac:

2008-06-07  Darin Adler  <darin@apple.com>

        Reviewed by Mitz.

        - work on https://bugs.webkit.org/show_bug.cgi?id=17257
          start ref counts at 1 instead of 0 for speed

        * History/WebHistoryItem.mm:
        (-[WebHistoryItem init]):
        (-[WebHistoryItem initWithURLString:title:lastVisitedTimeInterval:]):
        (-[WebHistoryItem initWithURL:target:parent:title:]):
        (-[WebHistoryItem initWithURLString:title:displayTitle:lastVisitedTimeInterval:]):
        * WebView/WebView.mm:
        (+[WebView _decodeData:]):

WebKit/win:

2008-06-07  Darin Adler  <darin@apple.com>

        Reviewed by Mitz.

        - work on https://bugs.webkit.org/show_bug.cgi?id=17257
          start ref counts at 1 instead of 0 for speed

        * WebHistoryItem.cpp:
        (WebHistoryItem::createInstance):
        (WebHistoryItem::initFromDictionaryRepresentation):
        (WebHistoryItem::initWithURLString):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34432 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a3a48766
2008-06-07 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- work on https://bugs.webkit.org/show_bug.cgi?id=17257
start ref counts at 1 instead of 0 for speed
* bindings/js/JSCanvasRenderingContext2DCustom.cpp:
(WebCore::toHTMLCanvasStyle):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::findOrCreateJSEventListener):
(WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener):
* bindings/js/JSNodeFilterCondition.h:
(WebCore::JSNodeFilterCondition::create):
* bindings/js/JSNodeFilterCustom.cpp:
(WebCore::toNodeFilter):
* bindings/js/JSSVGLazyEventListener.h:
(WebCore::JSSVGLazyEventListener::create):
* bindings/js/JSSVGMatrixCustom.cpp:
(WebCore::JSSVGMatrix::multiply):
(WebCore::JSSVGMatrix::inverse):
(WebCore::JSSVGMatrix::translate):
(WebCore::JSSVGMatrix::scale):
(WebCore::JSSVGMatrix::scaleNonUniform):
(WebCore::JSSVGMatrix::rotate):
(WebCore::JSSVGMatrix::rotateFromVector):
(WebCore::JSSVGMatrix::flipX):
(WebCore::JSSVGMatrix::flipY):
(WebCore::JSSVGMatrix::skewX):
(WebCore::JSSVGMatrix::skewY):
* bindings/js/JSSVGPODTypeWrapper.h:
(WebCore::JSSVGPODTypeWrapperCreatorReadWrite::create):
(WebCore::JSSVGPODTypeWrapperCreatorReadWrite::JSSVGPODTypeWrapperCreatorReadWrite):
(WebCore::JSSVGPODTypeWrapperCreatorReadOnly::create):
(WebCore::JSSVGPODTypeWrapperCreatorReadOnly::JSSVGPODTypeWrapperCreatorReadOnly):
(WebCore::JSSVGPODTypeWrapperCreatorForList::create):
(WebCore::JSSVGPODTypeWrapperCreatorForList::JSSVGPODTypeWrapperCreatorForList):
(WebCore::JSSVGPODTypeWrapperCache::lookupOrCreateWrapper):
(WebCore::JSSVGPODTypeWrapperCache::forgetWrapper):
* bindings/js/JSSVGPointListCustom.cpp:
(WebCore::commonExit):
(WebCore::commonExitReadOnly):
(WebCore::JSSVGPointList::initialize):
(WebCore::JSSVGPointList::getItem):
(WebCore::JSSVGPointList::insertItemBefore):
(WebCore::JSSVGPointList::replaceItem):
(WebCore::JSSVGPointList::removeItem):
(WebCore::JSSVGPointList::appendItem):
* bindings/js/JSSVGTransformListCustom.cpp:
(WebCore::JSSVGTransformList::initialize):
(WebCore::JSSVGTransformList::getItem):
(WebCore::JSSVGTransformList::insertItemBefore):
(WebCore::JSSVGTransformList::replaceItem):
(WebCore::JSSVGTransformList::removeItem):
(WebCore::JSSVGTransformList::appendItem):
* bindings/js/kjs_binding.cpp:
(WebCore::setDOMException):
* bindings/js/kjs_events.h:
(WebCore::JSUnprotectedEventListener::create):
(WebCore::JSEventListener::create):
(WebCore::JSLazyEventListener::create):
* bindings/js/kjs_proxy.cpp:
(WebCore::KJSProxy::createHTMLEventHandler):
(WebCore::KJSProxy::createSVGEventHandler):
* bindings/objc/DOM.mm:
(WebCore::ObjCNodeFilterCondition::create):
(WebCore::ObjCNodeFilterCondition::ObjCNodeFilterCondition):
(WebCore::ObjCNodeFilterCondition::acceptNode):
(-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]):
(-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]):
* bindings/scripts/CodeGeneratorJS.pm:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForNinePieceImage):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSFontFace.h:
(WebCore::CSSFontFace::create):
(WebCore::CSSFontFace::CSSFontFace):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseDashboardRegions):
(WebCore::CSSParser::parseCounterContent):
(WebCore::CSSParser::parseShape):
(WebCore::BorderImageParseContext::commitBorderImage):
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::CSSSegmentedFontFace):
* css/CSSSegmentedFontFace.h:
(WebCore::CSSSegmentedFontFace::create):
* css/Counter.h:
(WebCore::Counter::create):
(WebCore::Counter::Counter):
* css/DashboardRegion.h:
(WebCore::DashboardRegion::create):
(WebCore::DashboardRegion::DashboardRegion):
* css/Rect.h:
(WebCore::Rect::create):
(WebCore::Rect::Rect):
* dom/ChildNodeList.h:
(WebCore::ChildNodeList::create):
* dom/ClassNodeList.h:
(WebCore::ClassNodeList::create):
* dom/Clipboard.h:
* dom/DOMCoreException.h:
(WebCore::DOMCoreException::create):
* dom/DOMImplementation.cpp:
(WebCore::DOMImplementation::instance):
* dom/DOMImplementation.h:
(WebCore::DOMImplementation::DOMImplementation):
* dom/Document.cpp:
(WebCore::Document::addWindowEventListener):
(WebCore::Document::removeWindowEventListener):
(WebCore::Document::setDecoder):
(WebCore::Document::images):
(WebCore::Document::applets):
(WebCore::Document::embeds):
(WebCore::Document::plugins):
(WebCore::Document::objects):
(WebCore::Document::scripts):
(WebCore::Document::links):
(WebCore::Document::forms):
(WebCore::Document::anchors):
(WebCore::Document::all):
(WebCore::Document::windowNamedItems):
(WebCore::Document::documentNamedItems):
* dom/Document.h:
* dom/DynamicNodeList.h:
* dom/EventException.h:
(WebCore::EventException::create):
(WebCore::EventException::EventException):
* dom/EventListener.h:
* dom/EventTarget.cpp:
(WebCore::EventTarget::addEventListener):
(WebCore::EventTarget::removeEventListener):
* dom/ExceptionBase.cpp:
(WebCore::ExceptionBase::ExceptionBase):
* dom/ExceptionBase.h:
* dom/NameNodeList.h:
(WebCore::NameNodeList::create):
* dom/Node.cpp:
(WebCore::Node::childNodes):
(WebCore::Node::getElementsByTagNameNS):
(WebCore::Node::getElementsByName):
(WebCore::Node::getElementsByClassName):
(WebCore::Node::querySelectorAll):
* dom/NodeFilterCondition.h:
* dom/NodeList.h:
* dom/RangeException.h:
(WebCore::RangeException::create):
(WebCore::RangeException::RangeException):
* dom/RegisteredEventListener.h:
(WebCore::RegisteredEventListener::create):
* dom/SelectorNodeList.cpp:
(WebCore::createSelectorNodeList):
* dom/SelectorNodeList.h:
* dom/StaticNodeList.cpp:
(WebCore::StaticNodeList::StaticNodeList):
* dom/StaticNodeList.h:
(WebCore::StaticNodeList::adopt):
* dom/TagNodeList.h:
(WebCore::TagNodeList::create):
* history/HistoryItem.cpp:
(WebCore::defaultNotifyHistoryItemChanged):
(WebCore::HistoryItem::HistoryItem):
(WebCore::HistoryItem::copy):
* history/HistoryItem.h:
(WebCore::HistoryItem::create):
* html/CanvasGradient.h:
* html/CanvasPattern.cpp:
(WebCore::CanvasPattern::CanvasPattern):
* html/CanvasPattern.h:
(WebCore::CanvasPattern::create):
* html/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::State::State):
(WebCore::CanvasRenderingContext2D::setStrokeColor):
(WebCore::CanvasRenderingContext2D::setFillColor):
(WebCore::CanvasRenderingContext2D::createPattern):
* html/CanvasStyle.cpp:
(WebCore::CanvasStyle::CanvasStyle):
* html/CanvasStyle.h:
(WebCore::CanvasStyle::create):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::HTMLCollection):
(WebCore::HTMLCollection::create):
* html/HTMLCollection.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::children):
* html/HTMLFormCollection.cpp:
(WebCore::HTMLFormCollection::create):
* html/HTMLFormCollection.h:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::elements):
* html/HTMLMapElement.cpp:
(WebCore::HTMLMapElement::areas):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::load):
(WebCore::HTMLMediaElement::mediaPlayerNetworkStateChanged):
(WebCore::HTMLMediaElement::willSaveToCache):
* html/HTMLNameCollection.h:
(WebCore::HTMLNameCollection::create):
* html/HTMLOptionsCollection.cpp:
(WebCore::HTMLOptionsCollection::create):
* html/HTMLOptionsCollection.h:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::options):
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::rows):
(WebCore::HTMLTableElement::tBodies):
* html/HTMLTableRowElement.cpp:
(WebCore::HTMLTableRowElement::cells):
* html/HTMLTableRowsCollection.cpp:
(WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection):
(WebCore::HTMLTableRowsCollection::create):
* html/HTMLTableRowsCollection.h:
* html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::rows):
* html/MediaError.h:
(WebCore::MediaError::create):
(WebCore::MediaError::MediaError):
* loader/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
* loader/CachedFont.cpp:
(WebCore::CachedFont::ensureSVGFontData):
* loader/CachedXSLStyleSheet.cpp:
(WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::write):
(WebCore::FrameLoader::createHistoryItem):
* loader/ImageDocument.cpp:
(WebCore::ImageEventListener::create):
(WebCore::ImageEventListener::ImageEventListener):
(WebCore::ImageDocument::createDocumentStructure):
* loader/TextResourceDecoder.h:
(WebCore::TextResourceDecoder::create):
* page/Page.cpp:
(WebCore::Page::userStyleSheet):
* svg/SVGException.h:
(WebCore::SVGException::create):
(WebCore::SVGException::SVGException):
* svg/animation/SVGSMILElement.cpp:
(WebCore::ConditionEventListener::create):
(WebCore::ConditionEventListener::ConditionEventListener):
(WebCore::SVGSMILElement::connectConditions):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didReceiveData):
* xml/XMLHttpRequestException.h:
(WebCore::XMLHttpRequestException::create):
(WebCore::XMLHttpRequestException::XMLHttpRequestException):
* xml/XPathException.h:
(WebCore::XPathException::create):
(WebCore::XPathException::XPathException):
* xml/XPathResult.cpp:
(WebCore::InvalidatingEventListener::create):
(WebCore::InvalidatingEventListener::InvalidatingEventListener):
(WebCore::XPathResult::XPathResult):
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource):
2008-06-07 Christian Dywan <christian@twotoasts.de>
Reviewed by Alp Toker.
......@@ -52,14 +52,14 @@ static JSValue* toJS(ExecState* exec, CanvasStyle* style)
static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState* exec, JSValue* value)
{
if (value->isString())
return new CanvasStyle(value->toString(exec));
return CanvasStyle::create(value->toString(exec));
if (!value->isObject())
return 0;
JSObject* object = static_cast<JSObject*>(value);
if (object->inherits(&JSCanvasGradient::s_info))
return new CanvasStyle(static_cast<JSCanvasGradient*>(object)->impl());
return CanvasStyle::create(static_cast<JSCanvasGradient*>(object)->impl());
if (object->inherits(&JSCanvasPattern::s_info))
return new CanvasStyle(static_cast<JSCanvasPattern*>(object)->impl());
return CanvasStyle::create(static_cast<JSCanvasPattern*>(object)->impl());
return 0;
}
......
......@@ -73,10 +73,10 @@ JSValue* JSDOMApplicationCache::addEventListener(ExecState* exec, const List& ar
Frame* frame = impl()->frame();
if (!frame)
return jsUndefined();
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
RefPtr<JSUnprotectedEventListener> listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
if (!listener)
return jsUndefined();
impl()->addEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
impl()->addEventListener(args[0]->toString(exec), listener.release(), args[2]->toBoolean(exec));
return jsUndefined();
}
......@@ -85,7 +85,7 @@ JSValue* JSDOMApplicationCache::removeEventListener(ExecState* exec, const List&
Frame* frame = impl()->frame();
if (!frame)
return jsUndefined();
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findJSUnprotectedEventListener(args[1], true);
if (!listener)
return jsUndefined();
impl()->removeEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
......
......@@ -817,7 +817,7 @@ JSEventListener* JSDOMWindowBase::findJSEventListener(JSValue* val, bool html)
return listeners.get(object);
}
JSEventListener* JSDOMWindowBase::findOrCreateJSEventListener(JSValue* val, bool html)
PassRefPtr<JSEventListener> JSDOMWindowBase::findOrCreateJSEventListener(JSValue* val, bool html)
{
JSEventListener* listener = findJSEventListener(val, html);
if (listener)
......@@ -828,7 +828,7 @@ JSEventListener* JSDOMWindowBase::findOrCreateJSEventListener(JSValue* val, bool
JSObject* object = static_cast<JSObject*>(val);
// Note that the JSEventListener constructor adds it to our jsEventListeners list
return new JSEventListener(object, static_cast<JSDOMWindow*>(this), html);
return JSEventListener::create(object, static_cast<JSDOMWindow*>(this), html).get();
}
JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(JSValue* val, bool html)
......@@ -840,7 +840,7 @@ JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(JSVa
return listeners.get(object);
}
JSUnprotectedEventListener* JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(JSValue* val, bool html)
PassRefPtr<JSUnprotectedEventListener> JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(JSValue* val, bool html)
{
JSUnprotectedEventListener* listener = findJSUnprotectedEventListener(val, html);
if (listener)
......@@ -850,7 +850,7 @@ JSUnprotectedEventListener* JSDOMWindowBase::findOrCreateJSUnprotectedEventListe
JSObject* object = static_cast<JSObject*>(val);
// The JSUnprotectedEventListener constructor adds it to our jsUnprotectedEventListeners map.
return new JSUnprotectedEventListener(object, static_cast<JSDOMWindow*>(this), html);
return JSUnprotectedEventListener::create(object, static_cast<JSDOMWindow*>(this), html).get();
}
void JSDOMWindowBase::clearHelperObjectProperties()
......@@ -1098,9 +1098,9 @@ JSValue* windowProtoFuncAddEventListener(ExecState* exec, JSObject* thisObj, con
if (!frame)
return jsUndefined();
if (JSEventListener* listener = window->findOrCreateJSEventListener(args[1])) {
if (RefPtr<JSEventListener> listener = window->findOrCreateJSEventListener(args[1])) {
if (Document* doc = frame->document())
doc->addWindowEventListener(AtomicString(args[0]->toString(exec)), listener, args[2]->toBoolean(exec));
doc->addWindowEventListener(AtomicString(args[0]->toString(exec)), listener.release(), args[2]->toBoolean(exec));
}
return jsUndefined();
......
......@@ -76,13 +76,13 @@ namespace WebCore {
JSEventListener* findJSEventListener(KJS::JSValue*, bool html = false);
// Finds or creates a wrapper of a JS EventListener. JS EventListener object is GC-protected.
JSEventListener* findOrCreateJSEventListener(KJS::JSValue*, bool html = false);
PassRefPtr<JSEventListener> findOrCreateJSEventListener(KJS::JSValue*, bool html = false);
// Finds a wrapper of a GC-unprotected JS EventListener, returns 0 if no existing one.
JSUnprotectedEventListener* findJSUnprotectedEventListener(KJS::JSValue*, bool html = false);
// Finds or creates a wrapper of a JS EventListener. JS EventListener object is *NOT* GC-protected.
JSUnprotectedEventListener* findOrCreateJSUnprotectedEventListener(KJS::JSValue*, bool html = false);
PassRefPtr<JSUnprotectedEventListener> findOrCreateJSUnprotectedEventListener(KJS::JSValue*, bool html = false);
void clear();
......
......@@ -106,8 +106,8 @@ JSValue* jsEventTargetAddEventListener(ExecState* exec, JSObject* thisObj, const
if (!frame)
return jsUndefined();
if (JSEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSEventListener(args[1]))
eventTarget->addEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
if (RefPtr<JSEventListener> listener = toJSDOMWindow(frame)->findOrCreateJSEventListener(args[1]))
eventTarget->addEventListener(args[0]->toString(exec), listener.release(), args[2]->toBoolean(exec));
return jsUndefined();
}
......
......@@ -21,6 +21,7 @@
#define JSNodeFilterCondition_h
#include "NodeFilterCondition.h"
#include <wtf/PassRefPtr.h>
namespace KJS {
class JSObject;
......@@ -32,11 +33,16 @@ namespace WebCore {
class JSNodeFilterCondition : public NodeFilterCondition {
public:
JSNodeFilterCondition(KJS::JSObject* filter);
static PassRefPtr<JSNodeFilterCondition> create(KJS::JSObject* filter)
{
return adoptRef(new JSNodeFilterCondition(filter));
}
virtual short acceptNode(Node*, KJS::JSValue*& exception) const;
virtual void mark();
protected:
private:
JSNodeFilterCondition(KJS::JSObject* filter);
KJS::JSObject* m_filter;
};
......
......@@ -60,7 +60,7 @@ NodeFilter* toNodeFilter(KJS::JSValue* val)
KJS::JSObject* o = static_cast<KJS::JSObject*>(val);
if (o->implementsCall())
return new NodeFilter(new JSNodeFilterCondition(o));
return new NodeFilter(JSNodeFilterCondition::create(o));
return 0;
}
......
/*
Copyright (C) 2006 Apple Computer, Inc.
This file is part of the WebKit project
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
......@@ -21,21 +19,28 @@
#ifndef JSSVGLazyEventListener_h
#define JSSVGLazyEventListener_h
#if ENABLE(SVG)
#include "kjs_events.h"
#if ENABLE(SVG)
namespace WebCore {
class JSSVGLazyEventListener : public JSLazyEventListener {
public:
JSSVGLazyEventListener(const String& functionName, const String& code, JSDOMWindow*, Node*, int lineNumber = 0);
static PassRefPtr<JSSVGLazyEventListener> create(const String& functionName, const String& code, JSDOMWindow* window, Node* node, int lineNumber)
{
return adoptRef(new JSSVGLazyEventListener(functionName, code, window, node, lineNumber));
}
private:
JSSVGLazyEventListener(const String& functionName, const String& code, JSDOMWindow*, Node*, int lineNumber);
virtual KJS::JSValue* eventParameterName() const;
};
} // namespace WebCore
#endif // ENABLE(SVG)
#endif // JSSVGLazyEventListener_h
......@@ -211,10 +211,10 @@ JSValue* JSXMLHttpRequest::addEventListener(ExecState* exec, const List& args)
Frame* frame = document->frame();
if (!frame)
return jsUndefined();
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
RefPtr<JSUnprotectedEventListener> listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
if (!listener)
return jsUndefined();
impl()->addEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
impl()->addEventListener(args[0]->toString(exec), listener.release(), args[2]->toBoolean(exec));
return jsUndefined();
}
......@@ -226,7 +226,7 @@ JSValue* JSXMLHttpRequest::removeEventListener(ExecState* exec, const List& args
Frame* frame = document->frame();
if (!frame)
return jsUndefined();
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);
JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findJSUnprotectedEventListener(args[1], true);
if (!listener)
return jsUndefined();
impl()->removeEventListener(args[0]->toString(exec), listener, args[2]->toBoolean(exec));
......
......@@ -278,25 +278,25 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
JSValue* errorObject = 0;
switch (description.type) {
case DOMExceptionType:
errorObject = toJS(exec, new DOMCoreException(description));
errorObject = toJS(exec, DOMCoreException::create(description));
break;
case RangeExceptionType:
errorObject = toJS(exec, new RangeException(description));
errorObject = toJS(exec, RangeException::create(description));
break;
case EventExceptionType:
errorObject = toJS(exec, new EventException(description));
errorObject = toJS(exec, EventException::create(description));
break;
case XMLHttpRequestExceptionType:
errorObject = toJS(exec, new XMLHttpRequestException(description));
errorObject = toJS(exec, XMLHttpRequestException::create(description));
break;
#if ENABLE(SVG)
case SVGExceptionType:
errorObject = toJS(exec, new SVGException(description), 0);
errorObject = toJS(exec, SVGException::create(description).get(), 0);
break;
#endif
#if ENABLE(XPATH)
case XPathExceptionType:
errorObject = toJS(exec, new XPathException(description));
errorObject = toJS(exec, XPathException::create(description));
break;
#endif
}
......
......@@ -40,15 +40,8 @@ namespace WebCore {
using namespace EventNames;
JSAbstractEventListener::JSAbstractEventListener(bool html)
: m_html(html)
void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
{
}
void JSAbstractEventListener::handleEvent(Event* ele, bool isWindowEvent)
{
Event* event = ele;
JSObject* listener = listenerObj();
if (!listener)
return;
......@@ -113,7 +106,7 @@ void JSAbstractEventListener::handleEvent(Event* ele, bool isWindowEvent)
} else {
if (!retval->isUndefinedOrNull() && event->storesResultAsString())
event->storeResult(retval->toString(exec));
if (m_html) {
if (m_isHTML) {
bool retvalbool;
if (retval->getBoolean(retvalbool) && !retvalbool)
event->preventDefault();
......@@ -127,18 +120,18 @@ void JSAbstractEventListener::handleEvent(Event* ele, bool isWindowEvent)
bool JSAbstractEventListener::isHTMLEventListener() const
{
return m_html;
return m_isHTML;
}
// -------------------------------------------------------------------------
JSUnprotectedEventListener::JSUnprotectedEventListener(JSObject* listener, JSDOMWindow* window, bool html)
: JSAbstractEventListener(html)
JSUnprotectedEventListener::JSUnprotectedEventListener(JSObject* listener, JSDOMWindow* window, bool isHTML)
: JSAbstractEventListener(isHTML)
, m_listener(listener)
, m_window(window)
{
if (m_listener) {
JSDOMWindow::UnprotectedListenersMap& listeners = html
JSDOMWindow::UnprotectedListenersMap& listeners = isHTML
? window->jsUnprotectedHTMLEventListeners() : window->jsUnprotectedEventListeners();
listeners.set(m_listener, this);
}
......@@ -194,13 +187,13 @@ static EventListenerCounter eventListenerCounter;
// -------------------------------------------------------------------------
JSEventListener::JSEventListener(JSObject* listener, JSDOMWindow* window, bool html)
: JSAbstractEventListener(html)
JSEventListener::JSEventListener(JSObject* listener, JSDOMWindow* window, bool isHTML)
: JSAbstractEventListener(isHTML)
, m_listener(listener)
, m_window(window)
{
if (m_listener) {
JSDOMWindow::ListenersMap& listeners = html
JSDOMWindow::ListenersMap& listeners = isHTML
? m_window->jsHTMLEventListeners() : m_window->jsEventListeners();
listeners.set(m_listener, this);
}
......
......@@ -32,20 +32,27 @@ namespace WebCore {
class JSAbstractEventListener : public EventListener {
public:
JSAbstractEventListener(bool html = false);
virtual void handleEvent(Event*, bool isWindowEvent);
virtual bool isHTMLEventListener() const;
virtual KJS::JSObject* listenerObj() const = 0;
virtual JSDOMWindow* window() const = 0;
protected:
JSAbstractEventListener(bool isHTML)
: m_isHTML(isHTML)
{
}
private: