Changeset 34432 in webkit
- Timestamp:
- Jun 7, 2008 3:51:37 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 100 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r34426 r34432 1 2008-06-07 Darin Adler <darin@apple.com> 2 3 Reviewed by Mitz. 4 5 - work on https://bugs.webkit.org/show_bug.cgi?id=17257 6 start ref counts at 1 instead of 0 for speed 7 8 * bindings/js/JSCanvasRenderingContext2DCustom.cpp: 9 (WebCore::toHTMLCanvasStyle): 10 * bindings/js/JSDOMWindowBase.cpp: 11 (WebCore::JSDOMWindowBase::findOrCreateJSEventListener): 12 (WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener): 13 * bindings/js/JSNodeFilterCondition.h: 14 (WebCore::JSNodeFilterCondition::create): 15 * bindings/js/JSNodeFilterCustom.cpp: 16 (WebCore::toNodeFilter): 17 * bindings/js/JSSVGLazyEventListener.h: 18 (WebCore::JSSVGLazyEventListener::create): 19 * bindings/js/JSSVGMatrixCustom.cpp: 20 (WebCore::JSSVGMatrix::multiply): 21 (WebCore::JSSVGMatrix::inverse): 22 (WebCore::JSSVGMatrix::translate): 23 (WebCore::JSSVGMatrix::scale): 24 (WebCore::JSSVGMatrix::scaleNonUniform): 25 (WebCore::JSSVGMatrix::rotate): 26 (WebCore::JSSVGMatrix::rotateFromVector): 27 (WebCore::JSSVGMatrix::flipX): 28 (WebCore::JSSVGMatrix::flipY): 29 (WebCore::JSSVGMatrix::skewX): 30 (WebCore::JSSVGMatrix::skewY): 31 * bindings/js/JSSVGPODTypeWrapper.h: 32 (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::create): 33 (WebCore::JSSVGPODTypeWrapperCreatorReadWrite::JSSVGPODTypeWrapperCreatorReadWrite): 34 (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::create): 35 (WebCore::JSSVGPODTypeWrapperCreatorReadOnly::JSSVGPODTypeWrapperCreatorReadOnly): 36 (WebCore::JSSVGPODTypeWrapperCreatorForList::create): 37 (WebCore::JSSVGPODTypeWrapperCreatorForList::JSSVGPODTypeWrapperCreatorForList): 38 (WebCore::JSSVGPODTypeWrapperCache::lookupOrCreateWrapper): 39 (WebCore::JSSVGPODTypeWrapperCache::forgetWrapper): 40 * bindings/js/JSSVGPointListCustom.cpp: 41 (WebCore::commonExit): 42 (WebCore::commonExitReadOnly): 43 (WebCore::JSSVGPointList::initialize): 44 (WebCore::JSSVGPointList::getItem): 45 (WebCore::JSSVGPointList::insertItemBefore): 46 (WebCore::JSSVGPointList::replaceItem): 47 (WebCore::JSSVGPointList::removeItem): 48 (WebCore::JSSVGPointList::appendItem): 49 * bindings/js/JSSVGTransformListCustom.cpp: 50 (WebCore::JSSVGTransformList::initialize): 51 (WebCore::JSSVGTransformList::getItem): 52 (WebCore::JSSVGTransformList::insertItemBefore): 53 (WebCore::JSSVGTransformList::replaceItem): 54 (WebCore::JSSVGTransformList::removeItem): 55 (WebCore::JSSVGTransformList::appendItem): 56 * bindings/js/kjs_binding.cpp: 57 (WebCore::setDOMException): 58 * bindings/js/kjs_events.h: 59 (WebCore::JSUnprotectedEventListener::create): 60 (WebCore::JSEventListener::create): 61 (WebCore::JSLazyEventListener::create): 62 * bindings/js/kjs_proxy.cpp: 63 (WebCore::KJSProxy::createHTMLEventHandler): 64 (WebCore::KJSProxy::createSVGEventHandler): 65 * bindings/objc/DOM.mm: 66 (WebCore::ObjCNodeFilterCondition::create): 67 (WebCore::ObjCNodeFilterCondition::ObjCNodeFilterCondition): 68 (WebCore::ObjCNodeFilterCondition::acceptNode): 69 (-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]): 70 (-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]): 71 * bindings/scripts/CodeGeneratorJS.pm: 72 * css/CSSComputedStyleDeclaration.cpp: 73 (WebCore::valueForNinePieceImage): 74 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): 75 * css/CSSFontFace.h: 76 (WebCore::CSSFontFace::create): 77 (WebCore::CSSFontFace::CSSFontFace): 78 * css/CSSFontSelector.cpp: 79 (WebCore::CSSFontSelector::addFontFaceRule): 80 * css/CSSParser.cpp: 81 (WebCore::CSSParser::parseDashboardRegions): 82 (WebCore::CSSParser::parseCounterContent): 83 (WebCore::CSSParser::parseShape): 84 (WebCore::BorderImageParseContext::commitBorderImage): 85 * css/CSSSegmentedFontFace.cpp: 86 (WebCore::CSSSegmentedFontFace::CSSSegmentedFontFace): 87 * css/CSSSegmentedFontFace.h: 88 (WebCore::CSSSegmentedFontFace::create): 89 * css/Counter.h: 90 (WebCore::Counter::create): 91 (WebCore::Counter::Counter): 92 * css/DashboardRegion.h: 93 (WebCore::DashboardRegion::create): 94 (WebCore::DashboardRegion::DashboardRegion): 95 * css/Rect.h: 96 (WebCore::Rect::create): 97 (WebCore::Rect::Rect): 98 * dom/ChildNodeList.h: 99 (WebCore::ChildNodeList::create): 100 * dom/ClassNodeList.h: 101 (WebCore::ClassNodeList::create): 102 * dom/Clipboard.h: 103 * dom/DOMCoreException.h: 104 (WebCore::DOMCoreException::create): 105 * dom/DOMImplementation.cpp: 106 (WebCore::DOMImplementation::instance): 107 * dom/DOMImplementation.h: 108 (WebCore::DOMImplementation::DOMImplementation): 109 * dom/Document.cpp: 110 (WebCore::Document::addWindowEventListener): 111 (WebCore::Document::removeWindowEventListener): 112 (WebCore::Document::setDecoder): 113 (WebCore::Document::images): 114 (WebCore::Document::applets): 115 (WebCore::Document::embeds): 116 (WebCore::Document::plugins): 117 (WebCore::Document::objects): 118 (WebCore::Document::scripts): 119 (WebCore::Document::links): 120 (WebCore::Document::forms): 121 (WebCore::Document::anchors): 122 (WebCore::Document::all): 123 (WebCore::Document::windowNamedItems): 124 (WebCore::Document::documentNamedItems): 125 * dom/Document.h: 126 * dom/DynamicNodeList.h: 127 * dom/EventException.h: 128 (WebCore::EventException::create): 129 (WebCore::EventException::EventException): 130 * dom/EventListener.h: 131 * dom/EventTarget.cpp: 132 (WebCore::EventTarget::addEventListener): 133 (WebCore::EventTarget::removeEventListener): 134 * dom/ExceptionBase.cpp: 135 (WebCore::ExceptionBase::ExceptionBase): 136 * dom/ExceptionBase.h: 137 * dom/NameNodeList.h: 138 (WebCore::NameNodeList::create): 139 * dom/Node.cpp: 140 (WebCore::Node::childNodes): 141 (WebCore::Node::getElementsByTagNameNS): 142 (WebCore::Node::getElementsByName): 143 (WebCore::Node::getElementsByClassName): 144 (WebCore::Node::querySelectorAll): 145 * dom/NodeFilterCondition.h: 146 * dom/NodeList.h: 147 * dom/RangeException.h: 148 (WebCore::RangeException::create): 149 (WebCore::RangeException::RangeException): 150 * dom/RegisteredEventListener.h: 151 (WebCore::RegisteredEventListener::create): 152 * dom/SelectorNodeList.cpp: 153 (WebCore::createSelectorNodeList): 154 * dom/SelectorNodeList.h: 155 * dom/StaticNodeList.cpp: 156 (WebCore::StaticNodeList::StaticNodeList): 157 * dom/StaticNodeList.h: 158 (WebCore::StaticNodeList::adopt): 159 * dom/TagNodeList.h: 160 (WebCore::TagNodeList::create): 161 * history/HistoryItem.cpp: 162 (WebCore::defaultNotifyHistoryItemChanged): 163 (WebCore::HistoryItem::HistoryItem): 164 (WebCore::HistoryItem::copy): 165 * history/HistoryItem.h: 166 (WebCore::HistoryItem::create): 167 * html/CanvasGradient.h: 168 * html/CanvasPattern.cpp: 169 (WebCore::CanvasPattern::CanvasPattern): 170 * html/CanvasPattern.h: 171 (WebCore::CanvasPattern::create): 172 * html/CanvasRenderingContext2D.cpp: 173 (WebCore::CanvasRenderingContext2D::State::State): 174 (WebCore::CanvasRenderingContext2D::setStrokeColor): 175 (WebCore::CanvasRenderingContext2D::setFillColor): 176 (WebCore::CanvasRenderingContext2D::createPattern): 177 * html/CanvasStyle.cpp: 178 (WebCore::CanvasStyle::CanvasStyle): 179 * html/CanvasStyle.h: 180 (WebCore::CanvasStyle::create): 181 * html/HTMLCollection.cpp: 182 (WebCore::HTMLCollection::HTMLCollection): 183 (WebCore::HTMLCollection::create): 184 * html/HTMLCollection.h: 185 * html/HTMLElement.cpp: 186 (WebCore::HTMLElement::children): 187 * html/HTMLFormCollection.cpp: 188 (WebCore::HTMLFormCollection::create): 189 * html/HTMLFormCollection.h: 190 * html/HTMLFormElement.cpp: 191 (WebCore::HTMLFormElement::elements): 192 * html/HTMLMapElement.cpp: 193 (WebCore::HTMLMapElement::areas): 194 * html/HTMLMediaElement.cpp: 195 (WebCore::HTMLMediaElement::load): 196 (WebCore::HTMLMediaElement::mediaPlayerNetworkStateChanged): 197 (WebCore::HTMLMediaElement::willSaveToCache): 198 * html/HTMLNameCollection.h: 199 (WebCore::HTMLNameCollection::create): 200 * html/HTMLOptionsCollection.cpp: 201 (WebCore::HTMLOptionsCollection::create): 202 * html/HTMLOptionsCollection.h: 203 * html/HTMLSelectElement.cpp: 204 (WebCore::HTMLSelectElement::options): 205 * html/HTMLTableElement.cpp: 206 (WebCore::HTMLTableElement::rows): 207 (WebCore::HTMLTableElement::tBodies): 208 * html/HTMLTableRowElement.cpp: 209 (WebCore::HTMLTableRowElement::cells): 210 * html/HTMLTableRowsCollection.cpp: 211 (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): 212 (WebCore::HTMLTableRowsCollection::create): 213 * html/HTMLTableRowsCollection.h: 214 * html/HTMLTableSectionElement.cpp: 215 (WebCore::HTMLTableSectionElement::rows): 216 * html/MediaError.h: 217 (WebCore::MediaError::create): 218 (WebCore::MediaError::MediaError): 219 * loader/CachedCSSStyleSheet.cpp: 220 (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet): 221 * loader/CachedFont.cpp: 222 (WebCore::CachedFont::ensureSVGFontData): 223 * loader/CachedXSLStyleSheet.cpp: 224 (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet): 225 * loader/FrameLoader.cpp: 226 (WebCore::FrameLoader::write): 227 (WebCore::FrameLoader::createHistoryItem): 228 * loader/ImageDocument.cpp: 229 (WebCore::ImageEventListener::create): 230 (WebCore::ImageEventListener::ImageEventListener): 231 (WebCore::ImageDocument::createDocumentStructure): 232 * loader/TextResourceDecoder.h: 233 (WebCore::TextResourceDecoder::create): 234 * page/Page.cpp: 235 (WebCore::Page::userStyleSheet): 236 * svg/SVGException.h: 237 (WebCore::SVGException::create): 238 (WebCore::SVGException::SVGException): 239 * svg/animation/SVGSMILElement.cpp: 240 (WebCore::ConditionEventListener::create): 241 (WebCore::ConditionEventListener::ConditionEventListener): 242 (WebCore::SVGSMILElement::connectConditions): 243 * xml/XMLHttpRequest.cpp: 244 (WebCore::XMLHttpRequest::didReceiveData): 245 * xml/XMLHttpRequestException.h: 246 (WebCore::XMLHttpRequestException::create): 247 (WebCore::XMLHttpRequestException::XMLHttpRequestException): 248 * xml/XPathException.h: 249 (WebCore::XPathException::create): 250 (WebCore::XPathException::XPathException): 251 * xml/XPathResult.cpp: 252 (WebCore::InvalidatingEventListener::create): 253 (WebCore::InvalidatingEventListener::InvalidatingEventListener): 254 (WebCore::XPathResult::XPathResult): 255 * xml/XSLTProcessor.cpp: 256 (WebCore::XSLTProcessor::createDocumentFromSource): 257 1 258 2008-06-07 Christian Dywan <christian@twotoasts.de> 2 259 -
trunk/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
r33038 r34432 53 53 { 54 54 if (value->isString()) 55 return new CanvasStyle(value->toString(exec));55 return CanvasStyle::create(value->toString(exec)); 56 56 if (!value->isObject()) 57 57 return 0; 58 58 JSObject* object = static_cast<JSObject*>(value); 59 59 if (object->inherits(&JSCanvasGradient::s_info)) 60 return new CanvasStyle(static_cast<JSCanvasGradient*>(object)->impl());60 return CanvasStyle::create(static_cast<JSCanvasGradient*>(object)->impl()); 61 61 if (object->inherits(&JSCanvasPattern::s_info)) 62 return new CanvasStyle(static_cast<JSCanvasPattern*>(object)->impl());62 return CanvasStyle::create(static_cast<JSCanvasPattern*>(object)->impl()); 63 63 return 0; 64 64 } -
trunk/WebCore/bindings/js/JSDOMApplicationCacheCustom.cpp
r33979 r34432 74 74 if (!frame) 75 75 return jsUndefined(); 76 JSUnprotectedEventListener*listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);76 RefPtr<JSUnprotectedEventListener> listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true); 77 77 if (!listener) 78 78 return jsUndefined(); 79 impl()->addEventListener(args[0]->toString(exec), listener , args[2]->toBoolean(exec));79 impl()->addEventListener(args[0]->toString(exec), listener.release(), args[2]->toBoolean(exec)); 80 80 return jsUndefined(); 81 81 } … … 86 86 if (!frame) 87 87 return jsUndefined(); 88 JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->find OrCreateJSUnprotectedEventListener(args[1], true);88 JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findJSUnprotectedEventListener(args[1], true); 89 89 if (!listener) 90 90 return jsUndefined(); -
trunk/WebCore/bindings/js/JSDOMWindowBase.cpp
r34355 r34432 818 818 } 819 819 820 JSEventListener*JSDOMWindowBase::findOrCreateJSEventListener(JSValue* val, bool html)820 PassRefPtr<JSEventListener> JSDOMWindowBase::findOrCreateJSEventListener(JSValue* val, bool html) 821 821 { 822 822 JSEventListener* listener = findJSEventListener(val, html); … … 829 829 830 830 // Note that the JSEventListener constructor adds it to our jsEventListeners list 831 return new JSEventListener(object, static_cast<JSDOMWindow*>(this), html);831 return JSEventListener::create(object, static_cast<JSDOMWindow*>(this), html).get(); 832 832 } 833 833 … … 841 841 } 842 842 843 JSUnprotectedEventListener*JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(JSValue* val, bool html)843 PassRefPtr<JSUnprotectedEventListener> JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(JSValue* val, bool html) 844 844 { 845 845 JSUnprotectedEventListener* listener = findJSUnprotectedEventListener(val, html); … … 851 851 852 852 // The JSUnprotectedEventListener constructor adds it to our jsUnprotectedEventListeners map. 853 return new JSUnprotectedEventListener(object, static_cast<JSDOMWindow*>(this), html);853 return JSUnprotectedEventListener::create(object, static_cast<JSDOMWindow*>(this), html).get(); 854 854 } 855 855 … … 1099 1099 return jsUndefined(); 1100 1100 1101 if ( JSEventListener*listener = window->findOrCreateJSEventListener(args[1])) {1101 if (RefPtr<JSEventListener> listener = window->findOrCreateJSEventListener(args[1])) { 1102 1102 if (Document* doc = frame->document()) 1103 doc->addWindowEventListener(AtomicString(args[0]->toString(exec)), listener , args[2]->toBoolean(exec));1103 doc->addWindowEventListener(AtomicString(args[0]->toString(exec)), listener.release(), args[2]->toBoolean(exec)); 1104 1104 } 1105 1105 -
trunk/WebCore/bindings/js/JSDOMWindowBase.h
r34355 r34432 77 77 78 78 // Finds or creates a wrapper of a JS EventListener. JS EventListener object is GC-protected. 79 JSEventListener*findOrCreateJSEventListener(KJS::JSValue*, bool html = false);79 PassRefPtr<JSEventListener> findOrCreateJSEventListener(KJS::JSValue*, bool html = false); 80 80 81 81 // Finds a wrapper of a GC-unprotected JS EventListener, returns 0 if no existing one. … … 83 83 84 84 // Finds or creates a wrapper of a JS EventListener. JS EventListener object is *NOT* GC-protected. 85 JSUnprotectedEventListener*findOrCreateJSUnprotectedEventListener(KJS::JSValue*, bool html = false);85 PassRefPtr<JSUnprotectedEventListener> findOrCreateJSUnprotectedEventListener(KJS::JSValue*, bool html = false); 86 86 87 87 void clear(); -
trunk/WebCore/bindings/js/JSEventTargetBase.cpp
r33038 r34432 107 107 return jsUndefined(); 108 108 109 if ( JSEventListener*listener = toJSDOMWindow(frame)->findOrCreateJSEventListener(args[1]))110 eventTarget->addEventListener(args[0]->toString(exec), listener , args[2]->toBoolean(exec));109 if (RefPtr<JSEventListener> listener = toJSDOMWindow(frame)->findOrCreateJSEventListener(args[1])) 110 eventTarget->addEventListener(args[0]->toString(exec), listener.release(), args[2]->toBoolean(exec)); 111 111 112 112 return jsUndefined(); -
trunk/WebCore/bindings/js/JSNodeFilterCondition.h
r30089 r34432 22 22 23 23 #include "NodeFilterCondition.h" 24 #include <wtf/PassRefPtr.h> 24 25 25 26 namespace KJS { … … 33 34 class JSNodeFilterCondition : public NodeFilterCondition { 34 35 public: 35 JSNodeFilterCondition(KJS::JSObject* filter); 36 static PassRefPtr<JSNodeFilterCondition> create(KJS::JSObject* filter) 37 { 38 return adoptRef(new JSNodeFilterCondition(filter)); 39 } 40 36 41 virtual short acceptNode(Node*, KJS::JSValue*& exception) const; 37 42 virtual void mark(); 38 43 39 protected: 44 private: 45 JSNodeFilterCondition(KJS::JSObject* filter); 40 46 KJS::JSObject* m_filter; 41 47 }; -
trunk/WebCore/bindings/js/JSNodeFilterCustom.cpp
r33038 r34432 61 61 KJS::JSObject* o = static_cast<KJS::JSObject*>(val); 62 62 if (o->implementsCall()) 63 return new NodeFilter( new JSNodeFilterCondition(o));63 return new NodeFilter(JSNodeFilterCondition::create(o)); 64 64 65 65 return 0; -
trunk/WebCore/bindings/js/JSSVGLazyEventListener.h
r32584 r34432 1 1 /* 2 Copyright (C) 2006 Apple Computer, Inc. 3 4 This file is part of the WebKit project 2 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 5 3 6 4 This library is free software; you can redistribute it and/or … … 22 20 #ifndef JSSVGLazyEventListener_h 23 21 #define JSSVGLazyEventListener_h 24 #if ENABLE(SVG)25 22 26 23 #include "kjs_events.h" 24 25 #if ENABLE(SVG) 27 26 28 27 namespace WebCore { … … 30 29 class JSSVGLazyEventListener : public JSLazyEventListener { 31 30 public: 32 JSSVGLazyEventListener(const String& functionName, const String& code, JSDOMWindow*, Node*, int lineNumber = 0); 31 static PassRefPtr<JSSVGLazyEventListener> create(const String& functionName, const String& code, JSDOMWindow* window, Node* node, int lineNumber) 32 { 33 return adoptRef(new JSSVGLazyEventListener(functionName, code, window, node, lineNumber)); 34 } 33 35 34 36 private: 37 JSSVGLazyEventListener(const String& functionName, const String& code, JSDOMWindow*, Node*, int lineNumber); 38 35 39 virtual KJS::JSValue* eventParameterName() const; 36 40 }; … … 39 43 40 44 #endif // ENABLE(SVG) 45 41 46 #endif // JSSVGLazyEventListener_h -
trunk/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
r33979 r34432 212 212 if (!frame) 213 213 return jsUndefined(); 214 JSUnprotectedEventListener*listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true);214 RefPtr<JSUnprotectedEventListener> listener = toJSDOMWindow(frame)->findOrCreateJSUnprotectedEventListener(args[1], true); 215 215 if (!listener) 216 216 return jsUndefined(); 217 impl()->addEventListener(args[0]->toString(exec), listener , args[2]->toBoolean(exec));217 impl()->addEventListener(args[0]->toString(exec), listener.release(), args[2]->toBoolean(exec)); 218 218 return jsUndefined(); 219 219 } … … 227 227 if (!frame) 228 228 return jsUndefined(); 229 JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->find OrCreateJSUnprotectedEventListener(args[1], true);229 JSUnprotectedEventListener* listener = toJSDOMWindow(frame)->findJSUnprotectedEventListener(args[1], true); 230 230 if (!listener) 231 231 return jsUndefined(); -
trunk/WebCore/bindings/js/kjs_binding.cpp
r34355 r34432 279 279 switch (description.type) { 280 280 case DOMExceptionType: 281 errorObject = toJS(exec, new DOMCoreException(description));281 errorObject = toJS(exec, DOMCoreException::create(description)); 282 282 break; 283 283 case RangeExceptionType: 284 errorObject = toJS(exec, new RangeException(description));284 errorObject = toJS(exec, RangeException::create(description)); 285 285 break; 286 286 case EventExceptionType: 287 errorObject = toJS(exec, new EventException(description));287 errorObject = toJS(exec, EventException::create(description)); 288 288 break; 289 289 case XMLHttpRequestExceptionType: 290 errorObject = toJS(exec, new XMLHttpRequestException(description));290 errorObject = toJS(exec, XMLHttpRequestException::create(description)); 291 291 break; 292 292 #if ENABLE(SVG) 293 293 case SVGExceptionType: 294 errorObject = toJS(exec, new SVGException(description), 0);294 errorObject = toJS(exec, SVGException::create(description).get(), 0); 295 295 break; 296 296 #endif 297 297 #if ENABLE(XPATH) 298 298 case XPathExceptionType: 299 errorObject = toJS(exec, new XPathException(description));299 errorObject = toJS(exec, XPathException::create(description)); 300 300 break; 301 301 #endif -
trunk/WebCore/bindings/js/kjs_events.cpp
r34334 r34432 41 41 using namespace EventNames; 42 42 43 JSAbstractEventListener::JSAbstractEventListener(bool html) 44 : m_html(html) 45 { 46 } 47 48 void JSAbstractEventListener::handleEvent(Event* ele, bool isWindowEvent) 49 { 50 Event* event = ele; 51 43 void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent) 44 { 52 45 JSObject* listener = listenerObj(); 53 46 if (!listener) … … 114 107 if (!retval->isUndefinedOrNull() && event->storesResultAsString()) 115 108 event->storeResult(retval->toString(exec)); 116 if (m_ html) {109 if (m_isHTML) { 117 110 bool retvalbool; 118 111 if (retval->getBoolean(retvalbool) && !retvalbool) … … 128 121 bool JSAbstractEventListener::isHTMLEventListener() const 129 122 { 130 return m_ html;123 return m_isHTML; 131 124 } 132 125 133 126 // ------------------------------------------------------------------------- 134 127 135 JSUnprotectedEventListener::JSUnprotectedEventListener(JSObject* listener, JSDOMWindow* window, bool html)136 : JSAbstractEventListener( html)128 JSUnprotectedEventListener::JSUnprotectedEventListener(JSObject* listener, JSDOMWindow* window, bool isHTML) 129 : JSAbstractEventListener(isHTML) 137 130 , m_listener(listener) 138 131 , m_window(window) 139 132 { 140 133 if (m_listener) { 141 JSDOMWindow::UnprotectedListenersMap& listeners = html134 JSDOMWindow::UnprotectedListenersMap& listeners = isHTML 142 135 ? window->jsUnprotectedHTMLEventListeners() : window->jsUnprotectedEventListeners(); 143 136 listeners.set(m_listener, this); … … 195 188 // ------------------------------------------------------------------------- 196 189 197 JSEventListener::JSEventListener(JSObject* listener, JSDOMWindow* window, bool html)198 : JSAbstractEventListener( html)190 JSEventListener::JSEventListener(JSObject* listener, JSDOMWindow* window, bool isHTML) 191 : JSAbstractEventListener(isHTML) 199 192 , m_listener(listener) 200 193 , m_window(window) 201 194 { 202 195 if (m_listener) { 203 JSDOMWindow::ListenersMap& listeners = html196 JSDOMWindow::ListenersMap& listeners = isHTML 204 197 ? m_window->jsHTMLEventListeners() : m_window->jsEventListeners(); 205 198 listeners.set(m_listener, this); -
trunk/WebCore/bindings/js/kjs_events.h
r34273 r34432 33 33 class JSAbstractEventListener : public EventListener { 34 34 public: 35 JSAbstractEventListener(bool html = false);36 37 35 virtual void handleEvent(Event*, bool isWindowEvent); 38 36 virtual bool isHTMLEventListener() const; … … 40 38 virtual JSDOMWindow* window() const = 0; 41 39 40 protected: 41 JSAbstractEventListener(bool isHTML) 42 : m_isHTML(isHTML) 43 { 44 } 45 42 46 private: 43 bool m_ html;47 bool m_isHTML; 44 48 }; 45 49 46 50 class JSUnprotectedEventListener : public JSAbstractEventListener { 47 51 public: 48 JSUnprotectedEventListener(KJS::JSObject* listener, JSDOMWindow*, bool html = false); 52 static PassRefPtr<JSUnprotectedEventListener> create(KJS::JSObject* listener, JSDOMWindow* window, bool isHTML) 53 { 54 return adoptRef(new JSUnprotectedEventListener(listener, window, isHTML)); 55 } 49 56 virtual ~JSUnprotectedEventListener(); 50 57 … … 55 62 56 63 private: 64 JSUnprotectedEventListener(KJS::JSObject* listener, JSDOMWindow*, bool isHTML); 65 57 66 KJS::JSObject* m_listener; 58 67 JSDOMWindow* m_window; … … 61 70 class JSEventListener : public JSAbstractEventListener { 62 71 public: 63 JSEventListener(KJS::JSObject* listener, JSDOMWindow*, bool html = false); 72 static PassRefPtr<JSEventListener> create(KJS::JSObject* listener, JSDOMWindow* window, bool isHTML) 73 { 74 return adoptRef(new JSEventListener(listener, window, isHTML)); 75 } 64 76 virtual ~JSEventListener(); 65 77 … … 69 81 70 82 protected: 83 JSEventListener(KJS::JSObject* listener, JSDOMWindow*, bool isHTML); 84 71 85 mutable KJS::ProtectedPtr<KJS::JSObject> m_listener; 72 86 … … 77 91 class JSLazyEventListener : public JSEventListener { 78 92 public: 93 static PassRefPtr<JSLazyEventListener> create(const String& functionName, const String& code, JSDOMWindow* window, Node* node, int lineNumber) 94 { 95 return adoptRef(new JSLazyEventListener(functionName, code, window, node, lineNumber)); 96 } 97 virtual KJS::JSObject* listenerObj() const; 98 99 protected: 79 100 JSLazyEventListener(const String& functionName, const String& code, JSDOMWindow*, Node*, int lineNumber); 80 virtual KJS::JSObject* listenerObj() const;81 101 82 102 private: -
trunk/WebCore/bindings/js/kjs_proxy.cpp
r34279 r34432 124 124 } 125 125 126 EventListener*KJSProxy::createHTMLEventHandler(const String& functionName, const String& code, Node* node)126 PassRefPtr<EventListener> KJSProxy::createHTMLEventHandler(const String& functionName, const String& code, Node* node) 127 127 { 128 128 initScriptIfNeeded(); 129 129 JSLock lock; 130 return new JSLazyEventListener(functionName, code, m_windowShell->window(), node, m_handlerLineno);130 return JSLazyEventListener::create(functionName, code, m_windowShell->window(), node, m_handlerLineno); 131 131 } 132 132 133 133 #if ENABLE(SVG) 134 EventListener*KJSProxy::createSVGEventHandler(const String& functionName, const String& code, Node* node)134 PassRefPtr<EventListener> KJSProxy::createSVGEventHandler(const String& functionName, const String& code, Node* node) 135 135 { 136 136 initScriptIfNeeded(); 137 137 JSLock lock; 138 return new JSSVGLazyEventListener(functionName, code, m_windowShell->window(), node, m_handlerLineno);138 return JSSVGLazyEventListener::create(functionName, code, m_windowShell->window(), node, m_handlerLineno); 139 139 } 140 140 #endif -
trunk/WebCore/bindings/js/kjs_proxy.h
r34271 r34432 61 61 KJS::JSValue* evaluate(const String& filename, int baseLine, const String& code); 62 62 void clear(); 63 EventListener*createHTMLEventHandler(const String& functionName, const String& code, Node*);63 PassRefPtr<EventListener> createHTMLEventHandler(const String& functionName, const String& code, Node*); 64 64 #if ENABLE(SVG) 65 EventListener*createSVGEventHandler(const String& functionName, const String& code, Node*);65 PassRefPtr<EventListener> createSVGEventHandler(const String& functionName, const String& code, Node*); 66 66 #endif 67 67 void finishedWithEvent(Event*); -
trunk/WebCore/bindings/objc/DOM.mm
r34138 r34432 693 693 class ObjCNodeFilterCondition : public NodeFilterCondition { 694 694 public: 695 ObjCNodeFilterCondition(id <DOMNodeFilter>); 696 virtual ~ObjCNodeFilterCondition(); 695 static PassRefPtr<ObjCNodeFilterCondition> create(id <DOMNodeFilter> filter) 696 { 697 return adoptRef(new ObjCNodeFilterCondition(filter)); 698 } 699 697 700 virtual short acceptNode(Node*, JSValue*& exception) const; 698 701 699 702 private: 700 ObjCNodeFilterCondition(const ObjCNodeFilterCondition&); 701 ObjCNodeFilterCondition &operator=(const ObjCNodeFilterCondition&); 702 703 id <DOMNodeFilter> m_filter; 703 ObjCNodeFilterCondition(id <DOMNodeFilter> filter) 704 : m_filter(filter) 705 { 706 } 707 708 RetainPtr<id <DOMNodeFilter> > m_filter; 704 709 }; 705 706 ObjCNodeFilterCondition::ObjCNodeFilterCondition(id <DOMNodeFilter> filter)707 : m_filter(filter)708 {709 ASSERT(m_filter);710 HardRetain(m_filter);711 }712 713 ObjCNodeFilterCondition::~ObjCNodeFilterCondition()714 {715 HardRelease(m_filter);716 }717 710 718 711 short ObjCNodeFilterCondition::acceptNode(Node* node, JSValue*&) const … … 720 713 if (!node) 721 714 return NodeFilter::FILTER_REJECT; 722 return [m_filter acceptNode:[DOMNode _wrapNode:node]];715 return [m_filter.get() acceptNode:[DOMNode _wrapNode:node]]; 723 716 } 724 717 … … 735 728 RefPtr<NodeFilter> cppFilter; 736 729 if (filter) 737 cppFilter = new NodeFilter( new ObjCNodeFilterCondition(filter));730 cppFilter = new NodeFilter(ObjCNodeFilterCondition::create(filter)); 738 731 ExceptionCode ec = 0; 739 732 RefPtr<NodeIterator> impl = [self _document]->createNodeIterator([root _node], whatToShow, cppFilter.release(), expandEntityReferences, ec); … … 746 739 RefPtr<NodeFilter> cppFilter; 747 740 if (filter) 748 cppFilter = new NodeFilter( new ObjCNodeFilterCondition(filter));741 cppFilter = new NodeFilter(ObjCNodeFilterCondition::create(filter)); 749 742 ExceptionCode ec = 0; 750 743 RefPtr<TreeWalker> impl = [self _document]->createTreeWalker([root _node], whatToShow, cppFilter.release(), expandEntityReferences, ec); … … 782 775 } 783 776 784 ObjCEventListener *ObjCEventListener::create(id <DOMEventListener> listener)777 ObjCEventListener* ObjCEventListener::create(id <DOMEventListener> listener) 785 778 { 786 779 ObjCEventListener* wrapper = find(listener); 787 if (!wrapper) 780 if (wrapper) 781 wrapper->ref(); 782 else 788 783 wrapper = new ObjCEventListener(listener); 789 wrapper->ref();790 784 return wrapper; 791 785 } -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r33572 r34432 303 303 left = new CSSPrimitiveValue(image.m_slices.left.value(), CSSPrimitiveValue::CSS_NUMBER); 304 304 305 RefPtr<Rect> rect = new Rect();305 RefPtr<Rect> rect = Rect::create(); 306 306 rect->setTop(top); 307 307 rect->setRight(right); … … 949 949 DashboardRegion* previousRegion = 0; 950 950 for (unsigned i = 0; i < count; i++) { 951 RefPtr<DashboardRegion> region = new DashboardRegion;951 RefPtr<DashboardRegion> region = DashboardRegion::create(); 952 952 StyleDashboardRegion styleRegion = regions[i]; 953 953 … … 1002 1002 { 1003 1003 if (style->hasClip()) { 1004 Re ct* rect = new Rect();1004 RefPtr<Rect> rect = Rect::create(); 1005 1005 rect->setTop(new CSSPrimitiveValue(style->clip().top.value(), CSSPrimitiveValue::CSS_PX)); 1006 1006 rect->setRight(new CSSPrimitiveValue(style->clip().right.value(), CSSPrimitiveValue::CSS_PX)); 1007 1007 rect->setBottom(new CSSPrimitiveValue(style->clip().bottom.value(), CSSPrimitiveValue::CSS_PX)); 1008 1008 rect->setLeft(new CSSPrimitiveValue(style->clip().left.value(), CSSPrimitiveValue::CSS_PX)); 1009 return new CSSPrimitiveValue(rect );1009 return new CSSPrimitiveValue(rect.release()); 1010 1010 } 1011 1011 return 0; -
trunk/WebCore/css/CSSFontFace.h
r30122 r34432 27 27 #define CSSFontFace_h 28 28 29 #include <wtf/PassRefPtr.h> 29 30 #include <wtf/RefCounted.h> 30 31 #include <wtf/Vector.h> … … 39 40 class CSSFontFace : public RefCounted<CSSFontFace> { 40 41 public: 41 CSSFontFace() 42 : RefCounted<CSSFontFace>(0) 43 , m_segmentedFontFace(0) 44 { 45 } 46 47 virtual ~CSSFontFace(); 42 static PassRefPtr<CSSFontFace> create() { return adoptRef(new CSSFontFace); } 43 ~CSSFontFace(); 48 44 49 45 void setSegmentedFontFace(CSSSegmentedFontFace* segmentedFontFace) { m_segmentedFontFace = segmentedFontFace; } 50 46 51 47 bool isLoaded() const; 52 virtualbool isValid() const;48 bool isValid() const; 53 49 54 v irtual void addSource(CSSFontFaceSource*);50 void addSource(CSSFontFaceSource*); 55 51 56 52 void fontLoaded(CSSFontFaceSource*); 57 53 58 virtualSimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic);54 SimpleFontData* getFontData(const FontDescription&, bool syntheticBold, bool syntheticItalic); 59 55 60 56 private: 57 CSSFontFace() 58 : m_segmentedFontFace(0) 59 { 60 } 61 61 62 CSSSegmentedFontFace* m_segmentedFontFace; 62 63 Vector<CSSFontFaceSource*> m_sources; -
trunk/WebCore/css/CSSFontSelector.cpp
r31653 r34432 155 155 156 156 // Each item in the src property's list is a single CSSFontFaceSource. Put them all into a CSSFontFace. 157 CSSFontFace* fontFace = 0;157 RefPtr<CSSFontFace> fontFace; 158 158 159 159 int i; … … 202 202 203 203 if (!fontFace) 204 fontFace = new CSSFontFace();204 fontFace = CSSFontFace::create(); 205 205 206 206 if (source) { … … 218 218 ASSERT(fontFace); 219 219 220 if (fontFace && !fontFace->isValid()) { 221 delete fontFace; 222 return; 223 } 220 if (fontFace && !fontFace->isValid()) 221 return; 224 222 225 223 // Hash under every single family name. … … 268 266 CSSSegmentedFontFace* segmentedFontFace = m_fonts.get(hash).get(); 269 267 if (!segmentedFontFace) { 270 segmentedFontFace = new CSSSegmentedFontFace(this); 271 m_fonts.set(hash, segmentedFontFace); 268 RefPtr<CSSSegmentedFontFace> newFace = CSSSegmentedFontFace::create(this); 269 segmentedFontFace = newFace.get(); 270 m_fonts.set(hash, newFace.release()); 272 271 } 273 272 if (rangeList) { … … 275 274 // any character not overlaid by explicit @font-face rules for the family. 276 275 if (!segmentedFontFace->numRanges() && FontCache::fontExists(fontDescription, familyName)) { 277 CSSFontFace* implicitFontFace = new CSSFontFace();276 RefPtr<CSSFontFace> implicitFontFace = CSSFontFace::create(); 278 277 implicitFontFace->addSource(new CSSFontFaceSource(familyName)); 279 278 ASSERT(implicitFontFace->isValid()); 280 segmentedFontFace->overlayRange(0, 0x7FFFFFFF, implicitFontFace );279 segmentedFontFace->overlayRange(0, 0x7FFFFFFF, implicitFontFace.release()); 281 280 } 282 281 … … 287 286 } 288 287 } else 289 segmentedFontFace->overlayRange(0, 0x7FFFFFFF, fontFace );288 segmentedFontFace->overlayRange(0, 0x7FFFFFFF, fontFace.release()); 290 289 } 291 290 } -
trunk/WebCore/css/CSSParser.cpp
r34423 r34432 2384 2384 } 2385 2385 2386 RefPtr<DashboardRegion> firstRegion = new DashboardRegion;2386 RefPtr<DashboardRegion> firstRegion = DashboardRegion::create(); 2387 2387 DashboardRegion* region = 0; 2388 2388 … … 2391 2391 region = firstRegion.get(); 2392 2392 } else { 2393 RefPtr<DashboardRegion> nextRegion = new DashboardRegion();2393 RefPtr<DashboardRegion> nextRegion = DashboardRegion::create(); 2394 2394 region->m_next = nextRegion; 2395 2395 region = nextRegion.get(); … … 2546 2546 } 2547 2547 2548 return new CSSPrimitiveValue( new Counter(identifier.release(), listStyle.release(), separator.release()));2548 return new CSSPrimitiveValue(Counter::create(identifier.release(), listStyle.release(), separator.release())); 2549 2549 } 2550 2550 … … 2559 2559 if (args->size() != 4 && args->size() != 7) 2560 2560 return false; 2561 Re ct *rect = new Rect();2561 RefPtr<Rect> rect = Rect::create(); 2562 2562 bool valid = true; 2563 2563 int i = 0; … … 2590 2590 } 2591 2591 if (valid) { 2592 addProperty(propId, new CSSPrimitiveValue(rect ), important);2592 addProperty(propId, new CSSPrimitiveValue(rect.release()), important); 2593 2593 m_valueList->next(); 2594 2594 return true; 2595 2595 } 2596 delete rect;2597 2596 return false; 2598 2597 } … … 3316 3315 3317 3316 // Now build a rect value to hold all four of our primitive values. 3318 RefPtr<Rect> rect = new Rect;3317 RefPtr<Rect> rect = Rect::create(); 3319 3318 rect->setTop(m_top); 3320 3319 rect->setRight(m_right); -
trunk/WebCore/css/CSSSegmentedFontFace.cpp
r30392 r34432 36 36 37 37 CSSSegmentedFontFace::CSSSegmentedFontFace(CSSFontSelector* fontSelector) 38 : RefCounted<CSSSegmentedFontFace>(0) 39 , m_fontSelector(fontSelector) 38 : m_fontSelector(fontSelector) 40 39 { 41 40 } -
trunk/WebCore/css/CSSSegmentedFontFace.h
r29663 r34432 61 61 class CSSSegmentedFontFace : public RefCounted<CSSSegmentedFontFace> { 62 62 public: 63 CSSSegmentedFontFace(CSSFontSelector*);63 static PassRefPtr<CSSSegmentedFontFace> create(CSSFontSelector* selector) { return adoptRef(new CSSSegmentedFontFace(selector)); } 64 64 ~CSSSegmentedFontFace(); 65 65 … … 76 76 77 77 private: 78 CSSSegmentedFontFace(CSSFontSelector*); 79 78 80 void pruneTable(); 79 81 -
trunk/WebCore/css/Counter.h
r30122 r34432 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 6 4 * 7 5 * This library is free software; you can redistribute it and/or … … 26 24 #include "CSSPrimitiveValue.h" 27 25 #include "PlatformString.h" 28 #include <wtf/RefCounted.h>29 #include <wtf/PassRefPtr.h>30 26 31 27 namespace WebCore { … … 33 29 class Counter : public RefCounted<Counter> { 34 30 public: 35 Counter(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, PassRefPtr<CSSPrimitiveValue> separator) 36 : RefCounted<Counter>(0) 37 , m_identifier(identifier) 38 , m_listStyle(listStyle) 39 , m_separator(separator) 31 static PassRefPtr<Counter> create(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, PassRefPtr<CSSPrimitiveValue> separator) 40 32 { 33 return adoptRef(new Counter(identifier, listStyle, separator)); 41 34 } 42 35 … … 51 44 void setSeparator(PassRefPtr<CSSPrimitiveValue> separator) { m_separator = separator; } 52 45 53 protected: 54 RefPtr<CSSPrimitiveValue> m_identifier; // String 55 RefPtr<CSSPrimitiveValue> m_listStyle; // int 56 RefPtr<CSSPrimitiveValue> m_separator; // String 46 private: 47 Counter(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, PassRefPtr<CSSPrimitiveValue> separator) 48 : m_identifier(identifier) 49 , m_listStyle(listStyle) 50 , m_separator(separator) 51 { 52 } 53 54 RefPtr<CSSPrimitiveValue> m_identifier; // string 55 RefPtr<CSSPrimitiveValue> m_listStyle; // int 56 RefPtr<CSSPrimitiveValue> m_separator; // string 57 57 }; 58 58 -
trunk/WebCore/css/DashboardRegion.h
r32700 r34432 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 5 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. … … 24 22 #define DashboardRegion_h 25 23 26 #include <wtf/Platform.h>24 #include "Rect.h" 27 25 28 26 #if ENABLE(DASHBOARD_SUPPORT) 29 #include "Rect.h"30 27 31 28 namespace WebCore { … … 33 30 class DashboardRegion : public Rect { 34 31 public: 35 DashboardRegion() : m_isCircle(0), m_isRectangle(0) {}32 static PassRefPtr<DashboardRegion> create() { return adoptRef(new DashboardRegion); } 36 33 37 34 RefPtr<DashboardRegion> m_next; … … 40 37 bool m_isCircle : 1; 41 38 bool m_isRectangle : 1; 39 40 private: 41 DashboardRegion() : m_isCircle(false), m_isRectangle(false) { } 42 42 }; 43 43 44 44 } // namespace 45 45 46 #endif 46 47 -
trunk/WebCore/css/Rect.h
r30122 r34432 1 1 /* 2 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 23 23 24 24 #include "CSSPrimitiveValue.h" 25 #include <wtf/RefCounted.h>26 #include <wtf/PassRefPtr.h>27 25 #include <wtf/RefPtr.h> 28 26 … … 31 29 class Rect : public RefCounted<Rect> { 32 30 public: 33 Rect() : RefCounted<Rect>(0) { } 34 virtual ~Rect() { } 31 static RefPtr<Rect> create() { return adoptRef(new Rect); } 35 32 36 33 CSSPrimitiveValue* top() const { return m_top.get(); } … … 44 41 void setLeft(PassRefPtr<CSSPrimitiveValue> left) { m_left = left; } 45 42 43 protected: 44 Rect() { } 45 46 46 private: 47 47 RefPtr<CSSPrimitiveValue> m_top; -
trunk/WebCore/dom/ChildNodeList.h
r31144 r34432 26 26 27 27 #include "DynamicNodeList.h" 28 #include <wtf/PassRefPtr.h> 28 29 29 30 namespace WebCore { … … 31 32 class ChildNodeList : public DynamicNodeList { 32 33 public: 33 ChildNodeList(PassRefPtr<Node> rootNode, DynamicNodeList::Caches*); 34 static PassRefPtr<ChildNodeList> create(PassRefPtr<Node> rootNode, Caches* caches) 35 { 36 return adoptRef(new ChildNodeList(rootNode, caches)); 37 } 34 38 35 39 virtual unsigned length() const; … … 37 41 38 42 protected: 43 ChildNodeList(PassRefPtr<Node> rootNode, Caches*); 44 39 45 virtual bool nodeMatches(Node*) const; 40 46 }; -
trunk/WebCore/dom/ClassNodeList.h
r31435 r34432 38 38 class ClassNodeList : public DynamicNodeList { 39 39 public: 40 ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames, DynamicNodeList::Caches*); 40 static PassRefPtr<ClassNodeList> create(PassRefPtr<Node> rootNode, const String& classNames, Caches* caches) 41 { 42 return adoptRef(new ClassNodeList(rootNode, classNames, caches)); 43 } 41 44 42 45 private: 46 ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames, Caches*); 47 43 48 virtual bool nodeMatches(Node*) const; 44 49 -
trunk/WebCore/dom/Clipboard.h
r27776 r34432 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 5 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 6 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 7 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 27 25 #define Clipboard_h 28 26 29 #include <wtf/HashSet.h>30 #include "AtomicString.h"31 27 #include "ClipboardAccessPolicy.h" 32 28 #include "DragActions.h" … … 34 30 #include "IntPoint.h" 35 31 #include "Node.h" 36 #include <wtf/RefCounted.h>37 32 38 33 namespace WebCore { 39 40 class CachedImage;41 class Element;42 class Frame;43 class Image;44 class KURL;45 class Range;46 class String;47 34 48 35 // State available during IE's events for drag and drop and copy/paste 49 36 class Clipboard : public RefCounted<Clipboard> { 50 37 public: 51 Clipboard(ClipboardAccessPolicy policy, bool isForDragging);52 38 virtual ~Clipboard() { } 53 39 … … 74 60 virtual void setDragImageElement(Node*, const IntPoint&) = 0; 75 61 76 //Provides the DOM specified 77 virtual DragImageRef createDragImage(IntPoint& dragLoc) const = 0; 62 virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0; 78 63 virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0; 79 64 virtual void writeURL(const KURL&, const String&, Frame*) = 0; … … 92 77 93 78 protected: 79 Clipboard(ClipboardAccessPolicy, bool isForDragging); 80 94 81 ClipboardAccessPolicy policy() const { return m_policy; } 95 82 bool dragStarted() const { return m_dragStarted; } -
trunk/WebCore/dom/DOMCoreException.h
r29663 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 class DOMCoreException : public ExceptionBase { 37 37 public: 38 static PassRefPtr<DOMCoreException> create(const ExceptionCodeDescription& description) 39 { 40 return adoptRef(new DOMCoreException(description)); 41 } 42 43 private: 38 44 DOMCoreException(const ExceptionCodeDescription& description) 39 45 : ExceptionBase(description) -
trunk/WebCore/dom/DOMImplementation.cpp
r34379 r34432 276 276 DOMImplementation* DOMImplementation::instance() 277 277 { 278 static RefPtr<DOMImplementation> i= new DOMImplementation;279 return i.get();278 static DOMImplementation* staticInstance = new DOMImplementation; 279 return staticInstance; 280 280 } 281 281 -
trunk/WebCore/dom/DOMImplementation.h
r30122 r34432 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 5 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 7 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 43 41 class DOMImplementation : public RefCounted<DOMImplementation> { 44 42 public: 45 DOMImplementation() : RefCounted<DOMImplementation>(0) { } 46 virtual ~DOMImplementation(); 43 ~DOMImplementation(); 47 44 48 45 // DOM methods & attributes for DOMImplementation … … 70 67 static bool isXMLMIMEType(const String& MIMEType); 71 68 static bool isTextMIMEType(const String& MIMEType); 69 70 private: 71 DOMImplementation() { } 72 72 }; 73 73 -
trunk/WebCore/dom/Document.cpp
r34370 r34432 2626 2626 } 2627 2627 2628 EventListener *Document::getHTMLWindowEventListener(const AtomicString &eventType)2628 EventListener *Document::getHTMLWindowEventListener(const AtomicString& eventType) 2629 2629 { 2630 2630 RegisteredEventListenerList::iterator it = m_windowEventListeners.begin(); 2631 for (; it != m_windowEventListeners.end(); ++it)2632 if ( 2631 for (; it != m_windowEventListeners.end(); ++it) { 2632 if ((*it)->eventType() == eventType && (*it)->listener()->isHTMLEventListener()) 2633 2633 return (*it)->listener(); 2634 } 2634 2635 return 0; 2635 2636 } 2636 2637 2637 void Document::removeHTMLWindowEventListener(const AtomicString &eventType)2638 void Document::removeHTMLWindowEventListener(const AtomicString& eventType) 2638 2639 { 2639 2640 RegisteredEventListenerList::iterator it = m_windowEventListeners.begin(); 2640 for (; it != m_windowEventListeners.end(); ++it) 2641 if ( 2642 if (eventType == ((AtomicString)unloadEvent))2641 for (; it != m_windowEventListeners.end(); ++it) { 2642 if ((*it)->eventType() == eventType && (*it)->listener()->isHTMLEventListener()) { 2643 if (eventType == unloadEvent) 2643 2644 removePendingFrameUnloadEventCount(); 2644 else if (eventType == ((AtomicString)beforeunloadEvent))2645 else if (eventType == beforeunloadEvent) 2645 2646 removePendingFrameBeforeUnloadEventCount(); 2646 2647 m_windowEventListeners.remove(it); 2647 2648 return; 2648 2649 } 2650 } 2649 2651 } 2650 2652 2651 2653 void Document::addWindowEventListener(const AtomicString &eventType, PassRefPtr<EventListener> listener, bool useCapture) 2652 2654 { 2653 if (eventType == ((AtomicString)unloadEvent))2655 if (eventType == unloadEvent) 2654 2656 addPendingFrameUnloadEventCount(); 2655 else if (eventType == ((AtomicString)beforeunloadEvent))2657 else if (eventType == beforeunloadEvent) 2656 2658 addPendingFrameBeforeUnloadEventCount(); 2657 2659 // Remove existing identical listener set with identical arguments. 2658 2660 // The DOM 2 spec says that "duplicate instances are discarded" in this case. 2659 2661 removeWindowEventListener(eventType, listener.get(), useCapture); 2660 m_windowEventListeners.append(new RegisteredEventListener(eventType, listener, useCapture)); 2661 } 2662 2663 void Document::removeWindowEventListener(const AtomicString &eventType, EventListener *listener, bool useCapture) 2664 { 2665 RegisteredEventListener rl(eventType, listener, useCapture); 2662 m_windowEventListeners.append(RegisteredEventListener::create(eventType, listener, useCapture)); 2663 } 2664 2665 void Document::removeWindowEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) 2666 { 2666 2667 RegisteredEventListenerList::iterator it = m_windowEventListeners.begin(); 2667 for (; it != m_windowEventListeners.end(); ++it) 2668 if (*(*it) == rl) { 2669 if (eventType == ((AtomicString)unloadEvent)) 2668 for (; it != m_windowEventListeners.end(); ++it) { 2669 RegisteredEventListener& r = **it; 2670 if (r.eventType() == eventType && r.listener() == listener && r.useCapture() == useCapture) { 2671 if (eventType == unloadEvent) 2670 2672 removePendingFrameUnloadEventCount(); 2671 else if (eventType == ((AtomicString)beforeunloadEvent))2673 else if (eventType == beforeunloadEvent) 2672 2674 removePendingFrameBeforeUnloadEventCount(); 2673 2675 m_windowEventListeners.remove(it); 2674 2676 return; 2675 2677 } 2678 } 2676 2679 } 2677 2680 … … 2987 2990 } 2988 2991 2989 void Document::setDecoder( TextResourceDecoder *decoder)2992 void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder) 2990 2993 { 2991 2994 m_decoder = decoder; … … 3642 3645 PassRefPtr<HTMLCollection> Document::images() 3643 3646 { 3644 return new HTMLCollection(this, HTMLCollection::DocImages);3647 return HTMLCollection::create(this, HTMLCollection::DocImages); 3645 3648 } 3646 3649 3647 3650 PassRefPtr<HTMLCollection> Document::applets() 3648 3651 { 3649 return new HTMLCollection(this, HTMLCollection::DocApplets);3652 return HTMLCollection::create(this, HTMLCollection::DocApplets); 3650 3653 } 3651 3654 3652 3655 PassRefPtr<HTMLCollection> Document::embeds() 3653 3656 { 3654 return new HTMLCollection(this, HTMLCollection::DocEmbeds);3657 return HTMLCollection::create(this, HTMLCollection::DocEmbeds); 3655 3658 } 3656 3659 … … 3658 3661 { 3659 3662 // This is an alias for embeds() required for the JS DOM bindings. 3660 return new HTMLCollection(this, HTMLCollection::DocEmbeds);3663 return HTMLCollection::create(this, HTMLCollection::DocEmbeds); 3661 3664 } 3662 3665 3663 3666 PassRefPtr<HTMLCollection> Document::objects() 3664 3667 { 3665 return new HTMLCollection(this, HTMLCollection::DocObjects);3668 return HTMLCollection::create(this, HTMLCollection::DocObjects); 3666 3669 } 3667 3670 3668 3671 PassRefPtr<HTMLCollection> Document::scripts() 3669 3672 { 3670 return new HTMLCollection(this, HTMLCollection::DocScripts);3673 return HTMLCollection::create(this, HTMLCollection::DocScripts); 3671 3674 } 3672 3675 3673 3676 PassRefPtr<HTMLCollection> Document::links() 3674 3677 { 3675 return new HTMLCollection(this, HTMLCollection::DocLinks);3678 return HTMLCollection::create(this, HTMLCollection::DocLinks); 3676 3679 } 3677 3680 3678 3681 PassRefPtr<HTMLCollection> Document::forms() 3679 3682 { 3680 return new HTMLCollection(this, HTMLCollection::DocForms);3683 return HTMLCollection::create(this, HTMLCollection::DocForms); 3681 3684 } 3682 3685 3683 3686 PassRefPtr<HTMLCollection> Document::anchors() 3684 3687 { 3685 return new HTMLCollection(this, HTMLCollection::DocAnchors);3688 return HTMLCollection::create(this, HTMLCollection::DocAnchors); 3686 3689 } 3687 3690 3688 3691 PassRefPtr<HTMLCollection> Document::all() 3689 3692 { 3690 return new HTMLCollection(this, HTMLCollection::DocAll);3693 return HTMLCollection::create(this, HTMLCollection::DocAll); 3691 3694 } 3692 3695 3693 3696 PassRefPtr<HTMLCollection> Document::windowNamedItems(const String &name) 3694 3697 { 3695 return new HTMLNameCollection(this, HTMLCollection::WindowNamedItems, name);3698 return HTMLNameCollection::create(this, HTMLCollection::WindowNamedItems, name); 3696 3699 } 3697 3700 3698 3701 PassRefPtr<HTMLCollection> Document::documentNamedItems(const String &name) 3699 3702 { 3700 return new HTMLNameCollection(this, HTMLCollection::DocumentNamedItems, name);3703 return HTMLNameCollection::create(this, HTMLCollection::DocumentNamedItems, name); 3701 3704 } 3702 3705 -
trunk/WebCore/dom/Document.h
r34315 r34432 885 885 bool shouldCreateRenderers(); 886 886 887 void setDecoder( TextResourceDecoder*);887 void setDecoder(PassRefPtr<TextResourceDecoder>); 888 888 TextResourceDecoder* decoder() const { return m_decoder.get(); } 889 889 -
trunk/WebCore/dom/DynamicNodeList.h
r31144 r34432 49 49 }; 50 50 51 DynamicNodeList(PassRefPtr<Node> rootNode);52 DynamicNodeList(PassRefPtr<Node> rootNode, Caches*);53 51 virtual ~DynamicNodeList(); 54 52 … … 64 62 65 63 protected: 64 DynamicNodeList(PassRefPtr<Node> rootNode); 65 DynamicNodeList(PassRefPtr<Node> rootNode, Caches*); 66 66 67 virtual bool nodeMatches(Node*) const = 0; 67 68 -
trunk/WebCore/dom/EventException.h
r29663 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 class EventException : public ExceptionBase { 37 37 public: 38 EventException(const ExceptionCodeDescription& description) 39 : ExceptionBase(description) 38 static PassRefPtr<EventException> create(const ExceptionCodeDescription& description) 40 39 { 40 return adoptRef(new EventException(description)); 41 41 } 42 42 … … 47 47 UNSPECIFIED_EVENT_TYPE_ERR = EventExceptionOffset 48 48 }; 49 50 private: 51 EventException(const ExceptionCodeDescription& description) 52 : ExceptionBase(description) 53 { 54 } 49 55 }; 50 56 -
trunk/WebCore/dom/EventListener.h
r30122 r34432 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 30 30 class EventListener : public RefCounted<EventListener> { 31 31 public: 32 EventListener() : RefCounted<EventListener>(0) { }33 32 virtual ~EventListener() { } 34 33 virtual void handleEvent(Event*, bool isWindowEvent = false) = 0; -
trunk/WebCore/dom/EventTarget.cpp
r32006 r34432 126 126 referenceNode->document()->registerDisconnectedNodeWithEventListeners(referenceNode); 127 127 128 referenceNode->m_regdListeners->append( new RegisteredEventListener(eventType, listener.get(), useCapture));128 referenceNode->m_regdListeners->append(RegisteredEventListener::create(eventType, listener, useCapture)); 129 129 } 130 130 … … 135 135 return; 136 136 137 RegisteredEventListener rl(eventType, listener, useCapture);138 139 137 RegisteredEventListenerList::Iterator end = referenceNode->m_regdListeners->end(); 140 138 for (RegisteredEventListenerList::Iterator it = referenceNode->m_regdListeners->begin(); it != end; ++it) { 141 if (*(*it).get() == rl) { 139 RegisteredEventListener& r = **it; 140 if (r.eventType() == eventType && r.listener() == listener && r.useCapture() == useCapture) { 142 141 (*it)->setRemoved(true); 143 142 it = referenceNode->m_regdListeners->remove(it); -
trunk/WebCore/dom/EventTargetNode.cpp
r33006 r34432 396 396 removeHTMLEventListener(eventType); 397 397 if (listener) 398 addEventListener(eventType, listener .get(), false);398 addEventListener(eventType, listener, false); 399 399 } 400 400 -
trunk/WebCore/dom/ExceptionBase.cpp
r30122 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 34 34 ExceptionBase::ExceptionBase(const ExceptionCodeDescription& description) 35 : RefCounted<ExceptionBase>(0) 35 : m_code(description.code) 36 , m_name(description.name) 36 37 { 37 m_code = description.code; 38 if (description.name) { 39 m_name = description.name; 38 if (description.name) 40 39 m_message = String::format("%s: %s Exception %d", description.name, description.typeName, description.code); 41 }else40 else 42 41 m_message = String::format("%s Exception %d", description.typeName, description.code); 43 42 } -
trunk/WebCore/dom/ExceptionBase.h
r29663 r34432 38 38 class ExceptionBase : public RefCounted<ExceptionBase> { 39 39 public: 40 ExceptionBase(const ExceptionCodeDescription&);41 42 40 unsigned short code() const { return m_code; } 43 41 String name() const { return m_name; } … … 45 43 46 44 String toString() const; 45 46 protected: 47 ExceptionBase(const ExceptionCodeDescription&); 47 48 48 49 private: -
trunk/WebCore/dom/NameNodeList.h
r31144 r34432 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004, 2007 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2007m 2008 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 25 25 #define NameNodeList_h 26 26 27 #include "AtomicString.h" 27 28 #include "DynamicNodeList.h" 28 #include "AtomicString.h"29 29 30 30 namespace WebCore { … … 35 35 class NameNodeList : public DynamicNodeList { 36 36 public: 37 NameNodeList(PassRefPtr<Node> rootNode, const String& name, DynamicNodeList::Caches*); 37 static PassRefPtr<NameNodeList> create(PassRefPtr<Node> rootNode, const String& name, Caches* caches) 38 { 39 return adoptRef(new NameNodeList(rootNode, name, caches)); 40 } 38 41 39 42 private: 43 NameNodeList(PassRefPtr<Node> rootNode, const String& name, Caches*); 44 40 45 virtual bool nodeMatches(Node*) const; 41 46 -
trunk/WebCore/dom/Node.cpp
r34344 r34432 211 211 } 212 212 213 return new ChildNodeList(this, &m_nodeLists->m_childNodeListCaches);213 return ChildNodeList::create(this, &m_nodeLists->m_childNodeListCaches); 214 214 } 215 215 … … 1203 1203 if (document()->isHTMLDocument()) 1204 1204 name = localName.lower(); 1205 return new TagNodeList(this, namespaceURI.isEmpty() ? nullAtom : AtomicString(namespaceURI), name);1205 return TagNodeList::create(this, namespaceURI.isEmpty() ? nullAtom : AtomicString(namespaceURI), name); 1206 1206 } 1207 1207 … … 1217 1217 result.first->second = new DynamicNodeList::Caches; 1218 1218 1219 return new NameNodeList(this, elementName, result.first->second);1219 return NameNodeList::create(this, elementName, result.first->second); 1220 1220 } 1221 1221 … … 1231 1231 result.first->second = new DynamicNodeList::Caches; 1232 1232 1233 return new ClassNodeList(this, classNames, result.first->second);1233 return ClassNodeList::create(this, classNames, result.first->second); 1234 1234 } 1235 1235 … … 1279 1279 } 1280 1280 1281 SelectorNodeList* resultList = new SelectorNodeList(this, static_cast<CSSStyleRule*>(rule.get())->selector()); 1282 1283 return resultList; 1281 return createSelectorNodeList(this, static_cast<CSSStyleRule*>(rule.get())->selector()); 1284 1282 } 1285 1283 -
trunk/WebCore/dom/NodeFilterCondition.h
r30122 r34432 38 38 class NodeFilterCondition : public RefCounted<NodeFilterCondition> { 39 39 public: 40 NodeFilterCondition() : RefCounted<NodeFilterCondition>(0) { }41 40 virtual ~NodeFilterCondition() { } 42 virtual short acceptNode(Node*, KJS::JSValue*& exception) const ;41 virtual short acceptNode(Node*, KJS::JSValue*& exception) const = 0; 43 42 virtual void mark() { } 44 43 }; -
trunk/WebCore/dom/NodeList.h
r30122 r34432 34 34 class NodeList : public RefCounted<NodeList> { 35 35 public: 36 NodeList() : RefCounted<NodeList>(0) { }37 36 virtual ~NodeList() { } 38 37 -
trunk/WebCore/dom/RangeException.h
r29663 r34432 34 34 class RangeException : public ExceptionBase { 35 35 public: 36 RangeException(const ExceptionCodeDescription& description) 37 : ExceptionBase(description) 36 static PassRefPtr<RangeException> create(const ExceptionCodeDescription& description) 38 37 { 38 return adoptRef(new RangeException(description)); 39 39 } 40 40 … … 46 46 INVALID_NODE_TYPE_ERR 47 47 }; 48 49 private: 50 RangeException(const ExceptionCodeDescription& description) 51 : ExceptionBase(description) 52 { 53 } 48 54 }; 49 55 -
trunk/WebCore/dom/RegisteredEventListener.cpp
r30122 r34432 1 /** 2 * This file is part of the DOM implementation for KDE. 3 * 1 /* 4 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 5 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 6 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 7 * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 31 29 32 30 RegisteredEventListener::RegisteredEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) 33 : RefCounted<RegisteredEventListener>(0) 34 , m_eventType(eventType) 31 : m_eventType(eventType) 35 32 , m_listener(listener) 36 33 , m_useCapture(useCapture) -
trunk/WebCore/dom/RegisteredEventListener.h
r27776 r34432 1 1 /* 2 * This file is part of the DOM implementation for KDE.3 *4 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 5 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 6 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 7 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 8 6 * 9 7 * This library is free software; you can redistribute it and/or … … 28 26 29 27 #include "AtomicString.h" 30 #include <wtf/RefCounted.h>31 28 32 29 namespace WebCore { … … 36 33 class RegisteredEventListener : public RefCounted<RegisteredEventListener> { 37 34 public: 38 RegisteredEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); 35 static PassRefPtr<RegisteredEventListener> create(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) 36 { 37 return adoptRef(new RegisteredEventListener(eventType, listener, useCapture)); 38 } 39 39 40 40 const AtomicString& eventType() const { return m_eventType; } … … 46 46 47 47 private: 48 RegisteredEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); 49 48 50 AtomicString m_eventType; 49 51 RefPtr<EventListener> m_listener; -
trunk/WebCore/dom/SelectorNodeList.cpp
r33939 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 #include "Document.h" 35 35 #include "Element.h" 36 #include "Node.h"37 36 38 37 namespace WebCore { 39 38 40 SelectorNodeList::SelectorNodeList(PassRefPtr<Node> rootNode, CSSSelector* querySelector)39 PassRefPtr<StaticNodeList> createSelectorNodeList(PassRefPtr<Node> rootNode, CSSSelector* querySelector) 41 40 { 41 Vector<RefPtr<Node> > nodes; 42 42 Document* document = rootNode->document(); 43 43 CSSStyleSelector::SelectorChecker selectorChecker(document, !document->inCompatMode()); … … 47 47 for (CSSSelector* selector = querySelector; selector; selector = selector->next()) { 48 48 if (selectorChecker.checkSelector(selector, element)) { 49 m_nodes.append(n);49 nodes.append(n); 50 50 break; 51 51 } … … 53 53 } 54 54 } 55 return StaticNodeList::adopt(nodes); 55 56 } 56 57 -
trunk/WebCore/dom/SelectorNodeList.h
r29663 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 32 32 #include "StaticNodeList.h" 33 #include <wtf/Forward.h>34 33 35 34 namespace WebCore { 36 35 37 class Node;38 36 class CSSSelector; 39 37 40 class SelectorNodeList : public StaticNodeList { 41 public: 42 SelectorNodeList(PassRefPtr<Node> rootNode, CSSSelector*); 43 }; 38 PassRefPtr<StaticNodeList> createSelectorNodeList(PassRefPtr<Node> rootNode, CSSSelector*); 44 39 45 40 } // namespace WebCore -
trunk/WebCore/dom/StaticNodeList.cpp
r29663 r34432 30 30 #include "StaticNodeList.h" 31 31 32 #include "AtomicString.h"33 #include "Node.h"34 32 #include "Element.h" 35 33 -
trunk/WebCore/dom/StaticNodeList.h
r29663 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 32 32 #include "NodeList.h" 33 #include <wtf/PassRefPtr.h> 33 34 #include <wtf/RefPtr.h> 34 35 #include <wtf/Vector.h> … … 40 41 class StaticNodeList : public NodeList { 41 42 public: 42 // Derived classes should build up the Vector in their constructor. 43 StaticNodeList() { } 44 virtual ~StaticNodeList() { } 43 // Adopts the contents of the nodes vector. 44 static PassRefPtr<StaticNodeList> adopt(Vector<RefPtr<Node> >& nodes) 45 { 46 return adoptRef(new StaticNodeList(nodes)); 47 } 45 48 46 49 virtual unsigned length() const; … … 48 51 virtual Node* itemWithName(const AtomicString&) const; 49 52 50 protected: 53 private: 54 StaticNodeList(Vector<RefPtr<Node> >& nodes) 55 { 56 m_nodes.swap(nodes); 57 } 51 58 Vector<RefPtr<Node> > m_nodes; 52 59 }; -
trunk/WebCore/dom/TagNodeList.h
r28988 r34432 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 6 * Copyright (C) 2007 Trolltech ASA 7 7 * … … 33 33 class TagNodeList : public DynamicNodeList { 34 34 public: 35 static PassRefPtr<TagNodeList> create(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) 36 { 37 return adoptRef(new TagNodeList(rootNode, namespaceURI, localName)); 38 } 39 40 private: 35 41 TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName); 36 42 37 private:38 43 virtual bool nodeMatches(Node*) const; 39 44 -
trunk/WebCore/history/HistoryItem.cpp
r31606 r34432 39 39 namespace WebCore { 40 40 41 static void defaultNotifyHistoryItemChanged() {} 41 static void defaultNotifyHistoryItemChanged() 42 { 43 } 44 42 45 void (*notifyHistoryItemChanged)() = defaultNotifyHistoryItemChanged; 43 46 44 47 HistoryItem::HistoryItem() 45 : RefCounted<HistoryItem>(0) 46 , m_lastVisitedTime(0) 48 : m_lastVisitedTime(0) 47 49 , m_isInPageCache(false) 48 50 , m_isTargetItem(false) … … 52 54 53 55 HistoryItem::HistoryItem(const String& urlString, const String& title, double time) 54 : RefCounted<HistoryItem>(0) 55 , m_urlString(urlString) 56 : m_urlString(urlString) 56 57 , m_originalURLString(urlString) 57 58 , m_title(title) … … 65 66 66 67 HistoryItem::HistoryItem(const String& urlString, const String& title, const String& alternateTitle, double time) 67 : RefCounted<HistoryItem>(0) 68 , m_urlString(urlString) 68 : m_urlString(urlString) 69 69 , m_originalURLString(urlString) 70 70 , m_title(title) … … 78 78 } 79 79 80 HistoryItem::HistoryItem(const KURL& url, const String& title)81 : RefCounted<HistoryItem>(0)82 , m_urlString(url.string())83 , m_originalURLString(url.string())84 , m_title(title)85 , m_lastVisitedTime(0)86 , m_isInPageCache(false)87 , m_isTargetItem(false)88 , m_visitCount(0)89 {90 iconDatabase()->retainIconForPageURL(m_urlString);91 }92 93 80 HistoryItem::HistoryItem(const KURL& url, const String& target, const String& parent, const String& title) 94 : RefCounted<HistoryItem>(0) 95 , m_urlString(url.string()) 81 : m_urlString(url.string()) 96 82 , m_originalURLString(url.string()) 97 83 , m_target(target) … … 112 98 } 113 99 114 HistoryItem::HistoryItem(const HistoryItem& item)115 : RefCounted<HistoryItem>( 0)100 inline HistoryItem::HistoryItem(const HistoryItem& item) 101 : RefCounted<HistoryItem>(1) 116 102 , m_urlString(item.m_urlString) 117 103 , m_originalURLString(item.m_originalURLString) … … 140 126 PassRefPtr<HistoryItem> HistoryItem::copy() const 141 127 { 142 return new HistoryItem(*this);128 return adoptRef(new HistoryItem(*this)); 143 129 } 144 130 -
trunk/WebCore/history/HistoryItem.h
r30243 r34432 59 59 60 60 public: 61 HistoryItem(); 62 HistoryItem(const String& urlString, const String& title, double lastVisited); 63 HistoryItem(const String& urlString, const String& title, const String& alternateTitle, double lastVisited); 64 HistoryItem(const KURL& url, const String& title); 65 HistoryItem(const KURL& url, const String& target, const String& parent, const String& title); 61 static PassRefPtr<HistoryItem> create() { return adoptRef(new HistoryItem); } 62 static PassRefPtr<HistoryItem> create(const String& urlString, const String& title, double lastVisited) 63 { 64 return adoptRef(new HistoryItem(urlString, title, lastVisited)); 65 } 66 static PassRefPtr<HistoryItem> create(const String& urlString, const String& title, const String& alternateTitle, double lastVisited) 67 { 68 return adoptRef(new HistoryItem(urlString, title, alternateTitle, lastVisited)); 69 } 70 static PassRefPtr<HistoryItem> create(const KURL& url, const String& target, const String& parent, const String& title) 71 { 72 return adoptRef(new HistoryItem(url, target, parent, title)); 73 } 66 74 67 75 ~HistoryItem(); … … 147 155 148 156 private: 157 HistoryItem(); 158 HistoryItem(const String& urlString, const String& title, double lastVisited); 159 HistoryItem(const String& urlString, const String& title, const String& alternateTitle, double lastVisited); 160 HistoryItem(const KURL& url, const String& target, const String& parent, const String& title); 161 149 162 HistoryItem(const HistoryItem&); 150 163 -
trunk/WebCore/html/CanvasGradient.h
r34366 r34432 28 28 #define CanvasGradient_h 29 29 30 #include "FloatPoint.h"31 30 #include "Gradient.h" 32 31 #include <wtf/PassRefPtr.h> 33 32 #include <wtf/RefCounted.h> 34 #include <wtf/Vector.h>35 33 36 34 namespace WebCore { -
trunk/WebCore/html/CanvasPattern.cpp
r31834 r34432 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 67 67 68 68 CanvasPattern::CanvasPattern(CGImageRef image, bool repeatX, bool repeatY, bool originClean) 69 : RefCounted<CanvasPattern>(0) 70 , m_platformImage(image) 69 : m_platformImage(image) 71 70 , m_cachedImage(0) 72 71 , m_repeatX(repeatX) … … 79 78 80 79 CanvasPattern::CanvasPattern(cairo_surface_t* surface, bool repeatX, bool repeatY, bool originClean) 81 : RefCounted<CanvasPattern>(0) 82 , m_platformImage(cairo_surface_reference(surface)) 80 : m_platformImage(cairo_surface_reference(surface)) 83 81 , m_cachedImage(0) 84 82 , m_repeatX(repeatX) … … 91 89 92 90 CanvasPattern::CanvasPattern(CachedImage* cachedImage, bool repeatX, bool repeatY, bool originClean) 93 : RefCounted<CanvasPattern>(0) 94 #if PLATFORM(CG) || PLATFORM(CAIRO) 95 , m_platformImage(0) 96 #endif 97 , m_cachedImage(cachedImage) 91 : m_cachedImage(cachedImage) 98 92 , m_repeatX(repeatX) 99 93 , m_repeatY(repeatY) 100 94 , m_originClean(originClean) 101 95 { 96 #if PLATFORM(CAIRO) 97 m_platformImage = 0; 98 #endif 102 99 if (cachedImage) 103 100 cachedImage->addClient(this); -
trunk/WebCore/html/CanvasPattern.h
r30869 r34432 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "CachedResourceClient.h" 30 #include <wtf/PassRefPtr.h> 30 31 #include <wtf/RefCounted.h> 31 32 … … 49 50 50 51 #if PLATFORM(CG) 51 CanvasPattern(CGImageRef, bool repeatX, bool repeatY, bool originClean); 52 static PassRefPtr<CanvasPattern> create(CGImageRef image, bool repeatX, bool repeatY, bool originClean) 53 { 54 return adoptRef(new CanvasPattern(image, repeatX, repeatY, originClean)); 55 } 52 56 #elif PLATFORM(CAIRO) 53 CanvasPattern(cairo_surface_t*, bool repeatX, bool repeatY, bool originClean); 57 static PassRefPtr<CanvasPattern> create(cairo_surface_t* surface, bool repeatX, bool repeatY, bool originClean) 58 { 59 return adoptRef(new CanvasPattern(surface, repeatX, repeatY, originClean)); 60 } 54 61 #endif 55 CanvasPattern(CachedImage*, bool repeatX, bool repeatY, bool originClean); 56 ~CanvasPattern(); 62 static PassRefPtr<CanvasPattern> create(CachedImage* image, bool repeatX, bool repeatY, bool originClean) 63 { 64 return adoptRef(new CanvasPattern(image, repeatX, repeatY, originClean)); 65 } 66 virtual ~CanvasPattern(); 57 67 58 68 #if PLATFORM(CG) … … 73 83 private: 74 84 #if PLATFORM(CG) 85 CanvasPattern(CGImageRef, bool repeatX, bool repeatY, bool originClean); 86 #elif PLATFORM(CAIRO) 87 CanvasPattern(cairo_surface_t*, bool repeatX, bool repeatY, bool originClean); 88 #endif 89 CanvasPattern(CachedImage*, bool repeatX, bool repeatY, bool originClean); 90 91 #if PLATFORM(CG) 75 92 const RetainPtr<CGImageRef> m_platformImage; 76 93 #elif PLATFORM(CAIRO) -
trunk/WebCore/html/CanvasRenderingContext2D.cpp
r34366 r34432 82 82 83 83 CanvasRenderingContext2D::State::State() 84 : m_strokeStyle( new CanvasStyle("black"))85 , m_fillStyle( new CanvasStyle("black"))84 : m_strokeStyle(CanvasStyle::create("black")) 85 , m_fillStyle(CanvasStyle::create("black")) 86 86 , m_lineWidth(1) 87 87 , m_lineCap(ButtCap) … … 368 368 void CanvasRenderingContext2D::setStrokeColor(const String& color) 369 369 { 370 setStrokeStyle( new CanvasStyle(color));370 setStrokeStyle(CanvasStyle::create(color)); 371 371 } 372 372 373 373 void CanvasRenderingContext2D::setStrokeColor(float grayLevel) 374 374 { 375 setStrokeStyle( new CanvasStyle(grayLevel, 1));375 setStrokeStyle(CanvasStyle::create(grayLevel, 1)); 376 376 } 377 377 378 378 void CanvasRenderingContext2D::setStrokeColor(const String& color, float alpha) 379 379 { 380 setStrokeStyle( new CanvasStyle(color, alpha));380 setStrokeStyle(CanvasStyle::create(color, alpha)); 381 381 } 382 382 383 383 void CanvasRenderingContext2D::setStrokeColor(float grayLevel, float alpha) 384 384 { 385 setStrokeStyle( new CanvasStyle(grayLevel, alpha));385 setStrokeStyle(CanvasStyle::create(grayLevel, alpha)); 386 386 } 387 387 388 388 void CanvasRenderingContext2D::setStrokeColor(float r, float g, float b, float a) 389 389 { 390 setStrokeStyle( new CanvasStyle(r, g, b, a));390 setStrokeStyle(CanvasStyle::create(r, g, b, a)); 391 391 } 392 392 393 393 void CanvasRenderingContext2D::setStrokeColor(float c, float m, float y, float k, float a) 394 394 { 395 setStrokeStyle( new CanvasStyle(c, m, y, k, a));395 setStrokeStyle(CanvasStyle::create(c, m, y, k, a)); 396 396 } 397 397 398 398 void CanvasRenderingContext2D::setFillColor(const String& color) 399 399 { 400 setFillStyle( new CanvasStyle(color));400 setFillStyle(CanvasStyle::create(color)); 401 401 } 402 402 403 403 void CanvasRenderingContext2D::setFillColor(float grayLevel) 404 404 { 405 setFillStyle( new CanvasStyle(grayLevel, 1));405 setFillStyle(CanvasStyle::create(grayLevel, 1)); 406 406 } 407 407 408 408 void CanvasRenderingContext2D::setFillColor(const String& color, float alpha) 409 409 { 410 setFillStyle( new CanvasStyle(color, 1));410 setFillStyle(CanvasStyle::create(color, 1)); 411 411 } 412 412 413 413 void CanvasRenderingContext2D::setFillColor(float grayLevel, float alpha) 414 414 { 415 setFillStyle( new CanvasStyle(grayLevel, alpha));415 setFillStyle(CanvasStyle::create(grayLevel, alpha)); 416 416 } 417 417 418 418 void CanvasRenderingContext2D::setFillColor(float r, float g, float b, float a) 419 419 { 420 setFillStyle( new CanvasStyle(r, g, b, a));420 setFillStyle(CanvasStyle::create(r, g, b, a)); 421 421 } 422 422 423 423 void CanvasRenderingContext2D::setFillColor(float c, float m, float y, float k, float a) 424 424 { 425 setFillStyle( new CanvasStyle(c, m, y, k, a));425 setFillStyle(CanvasStyle::create(c, m, y, k, a)); 426 426 } 427 427 … … 1120 1120 originClean = m_canvas->document()->securityOrigin()->canAccess(origin.get()); 1121 1121 } 1122 return new CanvasPattern(image->cachedImage(), repeatX, repeatY, originClean);1122 return CanvasPattern::create(image->cachedImage(), repeatX, repeatY, originClean); 1123 1123 } 1124 1124 … … 1133 1133 // FIXME: Do this through platform-independent GraphicsContext API. 1134 1134 #if PLATFORM(CG) 1135 CGImageRefimage = canvas->createPlatformImage();1135 RetainPtr<CGImageRef> image = canvas->createPlatformImage(); 1136 1136 if (!image) 1137 1137 return 0; 1138 PassRefPtr<CanvasPattern> pattern = new CanvasPattern(image, repeatX, repeatY, canvas->originClean()); 1139 CGImageRelease(image); 1140 return pattern; 1138 return CanvasPattern::create(image.get(), repeatX, repeatY, canvas->originClean()); 1141 1139 #elif PLATFORM(CAIRO) 1142 1140 cairo_surface_t* surface = canvas->createPlatformImage(); 1143 1141 if (!surface) 1144 1142 return 0; 1145 PassRefPtr<CanvasPattern> pattern = new CanvasPattern(surface, repeatX, repeatY, canvas->originClean());1143 RefPtr<CanvasPattern> pattern = CanvasPattern::create(surface, repeatX, repeatY, canvas->originClean()); 1146 1144 cairo_surface_destroy(surface); 1147 return pattern ;1145 return pattern.release(); 1148 1146 #else 1149 1147 notImplemented(); -
trunk/WebCore/html/CanvasStyle.cpp
r30122 r34432 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Trolltech ASA 4 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> … … 48 48 49 49 CanvasStyle::CanvasStyle(const String& color) 50 : RefCounted<CanvasStyle>(0) 51 , m_type(ColorString) 50 : m_type(ColorString) 52 51 , m_color(color) 53 52 { … … 55 54 56 55 CanvasStyle::CanvasStyle(float grayLevel) 57 : RefCounted<CanvasStyle>(0) 58 , m_type(GrayLevel) 56 : m_type(GrayLevel) 59 57 , m_alpha(1) 60 58 , m_grayLevel(grayLevel) … … 63 61 64 62 CanvasStyle::CanvasStyle(const String& color, float alpha) 65 : RefCounted<CanvasStyle>(0) 66 , m_type(ColorStringWithAlpha), m_color(color), m_alpha(alpha) 63 : m_type(ColorStringWithAlpha), m_color(color), m_alpha(alpha) 67 64 { 68 65 } 69 66 70 67 CanvasStyle::CanvasStyle(float grayLevel, float alpha) 71 : RefCounted<CanvasStyle>(0) 72 , m_type(GrayLevel), m_alpha(alpha), m_grayLevel(grayLevel) 68 : m_type(GrayLevel), m_alpha(alpha), m_grayLevel(grayLevel) 73 69 { 74 70 } 75 71 76 72 CanvasStyle::CanvasStyle(float r, float g, float b, float a) 77 : RefCounted<CanvasStyle>(0) 78 , m_type(RGBA), m_alpha(a), m_red(r), m_green(g), m_blue(b) 73 : m_type(RGBA), m_alpha(a), m_red(r), m_green(g), m_blue(b) 79 74 { 80 75 } 81 76 82 77 CanvasStyle::CanvasStyle(float c, float m, float y, float k, float a) 83 : RefCounted<CanvasStyle>(0) 84 , m_type(CMYKA), m_alpha(a), m_cyan(c), m_magenta(m), m_yellow(y), m_black(k) 78 : m_type(CMYKA), m_alpha(a), m_cyan(c), m_magenta(m), m_yellow(y), m_black(k) 85 79 { 86 80 } 87 81 88 82 CanvasStyle::CanvasStyle(PassRefPtr<CanvasGradient> gradient) 89 : RefCounted<CanvasStyle>(0) 90 , m_type(gradient ? Gradient : ColorString), m_gradient(gradient) 83 : m_type(gradient ? Gradient : ColorString), m_gradient(gradient) 91 84 { 92 85 } 93 86 94 87 CanvasStyle::CanvasStyle(PassRefPtr<CanvasPattern> pattern) 95 : RefCounted<CanvasStyle>(0) 96 , m_type(pattern ? ImagePattern : ColorString), m_pattern(pattern) 88 : m_type(pattern ? ImagePattern : ColorString), m_pattern(pattern) 97 89 { 98 90 } -
trunk/WebCore/html/CanvasStyle.h
r31607 r34432 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 class CanvasStyle : public RefCounted<CanvasStyle> { 38 38 public: 39 CanvasStyle(const String& color);40 CanvasStyle(float grayLevel);41 CanvasStyle(const String& color, float alpha);42 CanvasStyle(float grayLevel, float alpha);43 CanvasStyle(float r, float g, float b, float a);44 CanvasStyle(float c, float m, float y, float k, float a);45 CanvasStyle(PassRefPtr<CanvasGradient>);46 CanvasStyle(PassRefPtr<CanvasPattern>);39 static PassRefPtr<CanvasStyle> create(const String& color) { return adoptRef(new CanvasStyle(color)); } 40 static PassRefPtr<CanvasStyle> create(float grayLevel) { return adoptRef(new CanvasStyle(grayLevel)); } 41 static PassRefPtr<CanvasStyle> create(const String& color, float alpha) { return adoptRef(new CanvasStyle(color, alpha)); } 42 static PassRefPtr<CanvasStyle> create(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); } 43 static PassRefPtr<CanvasStyle> create(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); } 44 static PassRefPtr<CanvasStyle> create(float c, float m, float y, float k, float a) { return adoptRef(new CanvasStyle(c, m, y, k, a)); } 45 static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasGradient> gradient) { return adoptRef(new CanvasStyle(gradient)); } 46 static PassRefPtr<CanvasStyle> create(PassRefPtr<CanvasPattern> pattern) { return adoptRef(new CanvasStyle(pattern)); } 47 47 48 48 String color() const { return m_color; } … … 57 57 58 58 private: 59 CanvasStyle(const String& color); 60 CanvasStyle(float grayLevel); 61 CanvasStyle(const String& color, float alpha); 62 CanvasStyle(float grayLevel, float alpha); 63 CanvasStyle(float r, float g, float b, float a); 64 CanvasStyle(float c, float m, float y, float k, float a); 65 CanvasStyle(PassRefPtr<CanvasGradient>); 66 CanvasStyle(PassRefPtr<CanvasPattern>); 67 59 68 enum Type { ColorString, ColorStringWithAlpha, GrayLevel, RGBA, CMYKA, Gradient, ImagePattern }; 60 69 -
trunk/WebCore/html/HTMLCollection.cpp
r30443 r34432 37 37 38 38 HTMLCollection::HTMLCollection(PassRefPtr<Node> base, Type type) 39 : RefCounted<HTMLCollection>(0) 40 , m_idsDone(false) 39 : m_idsDone(false) 41 40 , m_base(base) 42 41 , m_type(type) … … 47 46 48 47 HTMLCollection::HTMLCollection(PassRefPtr<Node> base, Type type, CollectionInfo* info) 49 : RefCounted<HTMLCollection>(0) 50 , m_idsDone(false) 48 : m_idsDone(false) 51 49 , m_base(base) 52 50 , m_type(type) … … 54 52 , m_ownsInfo(false) 55 53 { 54 } 55 56 PassRefPtr<HTMLCollection> HTMLCollection::create(PassRefPtr<Node> base, Type type) 57 { 58 return adoptRef(new HTMLCollection(base, type)); 56 59 } 57 60 -
trunk/WebCore/html/HTMLCollection.h
r29101 r34432 77 77 static const unsigned NumNamedDocumentCachedTypes = DocumentNamedItems - WindowNamedItems + 1; 78 78 79 HTMLCollection(PassRefPtr<Node> base, Type);79 static PassRefPtr<HTMLCollection> create(PassRefPtr<Node> base, Type); 80 80 virtual ~HTMLCollection(); 81 81 … … 140 140 141 141 private: 142 HTMLCollection(PassRefPtr<Node> base, Type); 143 142 144 virtual Element* itemAfter(Element*) const; 143 145 virtual unsigned calcLength() const; -
trunk/WebCore/html/HTMLElement.cpp
r33577 r34432 704 704 PassRefPtr<HTMLCollection> HTMLElement::children() 705 705 { 706 return new HTMLCollection(this, HTMLCollection::NodeChildren);706 return HTMLCollection::create(this, HTMLCollection::NodeChildren); 707 707 } 708 708 -
trunk/WebCore/html/HTMLFormCollection.cpp
r30443 r34432 46 46 : HTMLCollection(form.get(), Other, formCollectionInfo(form.get())) 47 47 { 48 } 49 50 PassRefPtr<HTMLFormCollection> HTMLFormCollection::create(PassRefPtr<HTMLFormElement> form) 51 { 52 return adoptRef(new HTMLFormCollection(form)); 48 53 } 49 54 -
trunk/WebCore/html/HTMLFormCollection.h
r28327 r34432 2 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 36 36 class HTMLFormCollection : public HTMLCollection { 37 37 public: 38 HTMLFormCollection(PassRefPtr<HTMLFormElement>); 39 ~HTMLFormCollection(); 38 static PassRefPtr<HTMLFormCollection> create(PassRefPtr<HTMLFormElement>); 39 40 virtual ~HTMLFormCollection(); 40 41 41 42 virtual Node* item(unsigned index) const; … … 46 47 47 48 private: 49 HTMLFormCollection(PassRefPtr<HTMLFormElement>); 50 48 51 virtual void updateNameCache() const; 49 52 virtual unsigned calcLength() const; -
trunk/WebCore/html/HTMLFormElement.cpp
r32666 r34432 619 619 PassRefPtr<HTMLCollection> HTMLFormElement::elements() 620 620 { 621 return new HTMLFormCollection(this);621 return HTMLFormCollection::create(this); 622 622 } 623 623 -
trunk/WebCore/html/HTMLMapElement.cpp
r30431 r34432 96 96 PassRefPtr<HTMLCollection> HTMLMapElement::areas() 97 97 { 98 return new HTMLCollection(this, HTMLCollection::MapAreas);98 return HTMLCollection::create(this, HTMLCollection::MapAreas); 99 99 } 100 100 -
trunk/WebCore/html/HTMLMediaElement.cpp
r34369 r34432 278 278 if (m_begun) { 279 279 m_begun = false; 280 m_error = new MediaError(MediaError::MEDIA_ERR_ABORTED);280 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); 281 281 initAndDispatchProgressEvent(abortEvent); 282 282 if (m_loadNestingLevel < m_terminateLoadBelowNestingLevel) … … 364 364 //m_player = 0; 365 365 // FIXME better error handling 366 m_error = new MediaError(MediaError::MEDIA_ERR_NETWORK);366 m_error = MediaError::create(MediaError::MEDIA_ERR_NETWORK); 367 367 m_begun = false; 368 368 m_progressEventTimer.stop(); … … 1003 1003 m_progressEventTimer.stop(); 1004 1004 1005 m_error = new MediaError(MediaError::MEDIA_ERR_ABORTED);1005 m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED); 1006 1006 m_begun = false; 1007 1007 initAndDispatchProgressEvent(abortEvent); -
trunk/WebCore/html/HTMLNameCollection.h
r28327 r34432 33 33 class HTMLNameCollection : public HTMLCollection { 34 34 public: 35 HTMLNameCollection(PassRefPtr<Document>, Type, const String& name); 35 static PassRefPtr<HTMLNameCollection> create(PassRefPtr<Document> document, Type type, const String& name) 36 { 37 return adoptRef(new HTMLNameCollection(document, type, name)); 38 } 36 39 37 40 private: 41 HTMLNameCollection(PassRefPtr<Document>, Type, const String& name); 42 38 43 virtual Element* itemAfter(Element*) const; 39 44 -
trunk/WebCore/html/HTMLOptionsCollection.cpp
r28584 r34432 33 33 : HTMLCollection(select.get(), SelectOptions, select->collectionInfo()) 34 34 { 35 } 36 37 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(PassRefPtr<HTMLSelectElement> select) 38 { 39 return adoptRef(new HTMLOptionsCollection(select)); 35 40 } 36 41 -
trunk/WebCore/html/HTMLOptionsCollection.h
r28584 r34432 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2000 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 36 36 class HTMLOptionsCollection : public HTMLCollection { 37 37 public: 38 HTMLOptionsCollection(PassRefPtr<HTMLSelectElement>);38 static PassRefPtr<HTMLOptionsCollection> create(PassRefPtr<HTMLSelectElement>); 39 39 40 40 void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&); … … 46 46 47 47 void setLength(unsigned, ExceptionCode&); 48 49 private: 50 HTMLOptionsCollection(PassRefPtr<HTMLSelectElement>); 48 51 }; 49 52 -
trunk/WebCore/html/HTMLSelectElement.cpp
r34405 r34432 493 493 PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options() 494 494 { 495 return new HTMLOptionsCollection(this);495 return HTMLOptionsCollection::create(this); 496 496 } 497 497 -
trunk/WebCore/html/HTMLTableElement.cpp
r31357 r34432 659 659 PassRefPtr<HTMLCollection> HTMLTableElement::rows() 660 660 { 661 return new HTMLTableRowsCollection(this);661 return HTMLTableRowsCollection::create(this); 662 662 } 663 663 664 664 PassRefPtr<HTMLCollection> HTMLTableElement::tBodies() 665 665 { 666 return new HTMLCollection(this, HTMLCollection::TableTBodies);666 return HTMLCollection::create(this, HTMLCollection::TableTBodies); 667 667 } 668 668 -
trunk/WebCore/html/HTMLTableRowElement.cpp
r28327 r34432 168 168 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells() 169 169 { 170 return new HTMLCollection(this, HTMLCollection::TRCells);170 return HTMLCollection::create(this, HTMLCollection::TRCells); 171 171 } 172 172 -
trunk/WebCore/html/HTMLTableRowsCollection.cpp
r29101 r34432 150 150 151 151 HTMLTableRowsCollection::HTMLTableRowsCollection(PassRefPtr<HTMLTableElement> table) 152 : HTMLCollection(table, Other )152 : HTMLCollection(table, Other, 0) 153 153 { 154 } 155 156 PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(PassRefPtr<HTMLTableElement> table) 157 { 158 return adoptRef(new HTMLTableRowsCollection(table)); 154 159 } 155 160 -
trunk/WebCore/html/HTMLTableRowsCollection.h
r29101 r34432 39 39 class HTMLTableRowsCollection : public HTMLCollection { 40 40 public: 41 HTMLTableRowsCollection(PassRefPtr<HTMLTableElement>);41 static PassRefPtr<HTMLTableRowsCollection> create(PassRefPtr<HTMLTableElement>); 42 42 43 43 static HTMLTableRowElement* rowAfter(HTMLTableElement*, HTMLTableRowElement*); … … 45 45 46 46 private: 47 HTMLTableRowsCollection(PassRefPtr<HTMLTableElement>); 48 47 49 virtual Element* itemAfter(Element*) const; 48 50 }; -
trunk/WebCore/html/HTMLTableSectionElement.cpp
r29647 r34432 170 170 PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows() 171 171 { 172 return new HTMLCollection(this, HTMLCollection::TSectionRows);172 return HTMLCollection::create(this, HTMLCollection::TSectionRows); 173 173 } 174 174 -
trunk/WebCore/html/MediaError.h
r30122 r34432 37 37 enum Code { MEDIA_ERR_ABORTED = 1, MEDIA_ERR_NETWORK, MEDIA_ERR_DECODE }; 38 38 39 MediaError(Code code) : RefCounted<MediaError>(0), m_code(code) {}39 static PassRefPtr<MediaError> create(Code code) { return adoptRef(new MediaError(code)); } 40 40 41 41 Code code() const { return m_code; } 42 42 43 43 private: 44 MediaError(Code code) : m_code(code) { } 45 44 46 Code m_code; 45 47 }; -
trunk/WebCore/loader/CachedCSSStyleSheet.cpp
r31834 r34432 39 39 CachedCSSStyleSheet::CachedCSSStyleSheet(const String& url, const String& charset) 40 40 : CachedResource(url, CSSStyleSheet) 41 , m_decoder( new TextResourceDecoder("text/css", charset))41 , m_decoder(TextResourceDecoder::create("text/css", charset)) 42 42 { 43 43 // Prefer text/css but accept any type (dell.com serves a stylesheet -
trunk/WebCore/loader/CachedFont.cpp
r31834 r34432 136 136 m_externalSVGDocument->open(); 137 137 138 TextResourceDecoder decoder("application/xml");139 m_externalSVGDocument->write(decoder .decode(m_data->data(), m_data->size()));140 if (decoder .sawError()) {138 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml"); 139 m_externalSVGDocument->write(decoder->decode(m_data->data(), m_data->size())); 140 if (decoder->sawError()) { 141 141 m_externalSVGDocument.clear(); 142 142 return 0; -
trunk/WebCore/loader/CachedXSLStyleSheet.cpp
r31834 r34432 43 43 CachedXSLStyleSheet::CachedXSLStyleSheet(const String &url) 44 44 : CachedResource(url, XSLStyleSheet) 45 , m_decoder( new TextResourceDecoder("text/xsl"))45 , m_decoder(TextResourceDecoder::create("text/xsl")) 46 46 { 47 47 // It's XML we want. -
trunk/WebCore/loader/FrameLoader.cpp
r34273 r34432 997 997 if (!m_decoder) { 998 998 Settings* settings = m_frame->settings(); 999 m_decoder = new TextResourceDecoder(m_responseMIMEType, settings ? settings->defaultTextEncodingName() : String());999 m_decoder = TextResourceDecoder::create(m_responseMIMEType, settings ? settings->defaultTextEncodingName() : String()); 1000 1000 if (m_encoding.isEmpty()) { 1001 1001 Frame* parentFrame = m_frame->tree()->parent(); … … 3975 3975 originalURL = blankURL(); 3976 3976 3977 RefPtr<HistoryItem> item = new HistoryItem(url, m_frame->tree()->name(), m_frame->tree()->parent() ? m_frame->tree()->parent()->tree()->name() : "", docLoader ? docLoader->title() : "");3977 RefPtr<HistoryItem> item = HistoryItem::create(url, m_frame->tree()->name(), m_frame->tree()->parent() ? m_frame->tree()->parent()->tree()->name() : "", docLoader ? docLoader->title() : ""); 3978 3978 item->setOriginalURLString(originalURL.string()); 3979 3979 -
trunk/WebCore/loader/ImageDocument.cpp
r31155 r34432 53 53 class ImageEventListener : public EventListener { 54 54 public: 55 ImageEventListener(ImageDocument* doc) : m_doc(doc) {}55 static PassRefPtr<ImageEventListener> create(ImageDocument* document) { return adoptRef(new ImageEventListener(document)); } 56 56 virtual void handleEvent(Event*, bool isWindowEvent); 57 57 58 58 private: 59 ImageEventListener(ImageDocument* document) : m_doc(document) { } 59 60 ImageDocument* m_doc; 60 61 }; … … 174 175 if (shouldShrinkToFit()) { 175 176 // Add event listeners 176 RefPtr<EventListener> listener = new ImageEventListener(this);177 RefPtr<EventListener> listener = ImageEventListener::create(this); 177 178 addWindowEventListener("resize", listener, false); 178 179 imageElement->addEventListener("click", listener.release(), false); -
trunk/WebCore/loader/TextResourceDecoder.cpp
r34202 r34432 321 321 322 322 TextResourceDecoder::TextResourceDecoder(const String& mimeType, const TextEncoding& specifiedDefaultEncoding) 323 : RefCounted<TextResourceDecoder>(0) 324 , m_contentType(determineContentType(mimeType)) 323 : m_contentType(determineContentType(mimeType)) 325 324 , m_decoder(defaultEncoding(m_contentType, specifiedDefaultEncoding)) 326 325 , m_source(DefaultEncoding) -
trunk/WebCore/loader/TextResourceDecoder.h
r31316 r34432 1 1 /* 2 This file is part of the KDE libraries3 4 2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) 5 3 Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 Copyright (C) 2006 Apple Computer, Inc.4 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 7 5 8 6 This library is free software; you can redistribute it and/or … … 26 24 #define TextResourceDecoder_h 27 25 28 #include "PlatformString.h"29 #include <wtf/RefCounted.h>30 26 #include "TextDecoder.h" 31 #include <wtf/Vector.h>32 27 33 28 namespace WebCore { … … 45 40 }; 46 41 47 TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncoding = TextEncoding()); 42 static PassRefPtr<TextResourceDecoder> create(const String& mimeType, const TextEncoding& defaultEncoding = TextEncoding()) 43 { 44 return adoptRef(new TextResourceDecoder(mimeType, defaultEncoding)); 45 } 48 46 ~TextResourceDecoder(); 49 47 … … 57 55 58 56 private: 57 TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncoding); 58 59 59 enum ContentType { PlainText, HTML, XML, CSS }; // PlainText is equivalent to directly using TextDecoder. 60 60 static ContentType determineContentType(const String& mimeType); -
trunk/WebCore/loader/appcache/DOMApplicationCache.h
r32006 r34432 79 79 using RefCounted<DOMApplicationCache>::deref; 80 80 81 void setOnCheckingListener( EventListener*eventListener) { m_onCheckingListener = eventListener; }81 void setOnCheckingListener(PassRefPtr<EventListener> eventListener) { m_onCheckingListener = eventListener; } 82 82 EventListener* onCheckingListener() const { return m_onCheckingListener.get(); } 83 83 84 void setOnErrorListener( EventListener*eventListener) { m_onErrorListener = eventListener; }84 void setOnErrorListener(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; } 85 85 EventListener* onErrorListener() const { return m_onErrorListener.get(); } 86 86 87 void setOnNoUpdateListener( EventListener*eventListener) { m_onNoUpdateListener = eventListener; }87 void setOnNoUpdateListener(PassRefPtr<EventListener> eventListener) { m_onNoUpdateListener = eventListener; } 88 88 EventListener* onNoUpdateListener() const { return m_onNoUpdateListener.get(); } 89 89 90 void setOnDownloadingListener( EventListener*eventListener) { m_onDownloadingListener = eventListener; }90 void setOnDownloadingListener(PassRefPtr<EventListener> eventListener) { m_onDownloadingListener = eventListener; } 91 91 EventListener* onDownloadingListener() const { return m_onDownloadingListener.get(); } 92 92 93 void setOnProgressListener( EventListener*eventListener) { m_onProgressListener = eventListener; }93 void setOnProgressListener(PassRefPtr<EventListener> eventListener) { m_onProgressListener = eventListener; } 94 94 EventListener* onProgressListener() const { return m_onProgressListener.get(); } 95 95 96 void setOnUpdateReadyListener( EventListener*eventListener) { m_onUpdateReadyListener = eventListener; }96 void setOnUpdateReadyListener(PassRefPtr<EventListener> eventListener) { m_onUpdateReadyListener = eventListener; } 97 97 EventListener* onUpdateReadyListener() const { return m_onUpdateReadyListener.get(); } 98 98 99 void setOnCachedListener( EventListener*eventListener) { m_onCachedListener = eventListener; }99 void setOnCachedListener(PassRefPtr<EventListener> eventListener) { m_onCachedListener = eventListener; } 100 100 EventListener* onCachedListener() const { return m_onCachedListener.get(); } 101 101 … … 112 112 113 113 private: 114 DOMApplicationCache(Frame* frame);115 void callListener(const AtomicString& eventType, EventListener* listener);114 DOMApplicationCache(Frame*); 115 void callListener(const AtomicString& eventType, EventListener*); 116 116 117 117 virtual void refEventTarget() { ref(); } -
trunk/WebCore/page/Page.cpp
r33585 r34432 436 436 return m_userStyleSheet; 437 437 438 m_userStyleSheet = TextResourceDecoder ("text/css").decode(data->data(), data->size());438 m_userStyleSheet = TextResourceDecoder::create("text/css")->decode(data->data(), data->size()); 439 439 440 440 return m_userStyleSheet; -
trunk/WebCore/svg/SVGException.h
r29663 r34432 1 1 /* 2 2 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 * Copyright (C) 2006 Apple Computer, Inc.3 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 23 23 #define SVGException_h 24 24 25 #include "ExceptionBase.h" 26 25 27 #if ENABLE(SVG) 26 27 #include "ExceptionBase.h"28 28 29 29 namespace WebCore { … … 31 31 class SVGException : public ExceptionBase { 32 32 public: 33 SVGException(const ExceptionCodeDescription& description) 34 : ExceptionBase(description) 33 static PassRefPtr<SVGException> create(const ExceptionCodeDescription& description) 35 34 { 35 return adoptRef(new SVGException(description)); 36 36 } 37 37 … … 44 44 SVG_MATRIX_NOT_INVERTABLE = SVGExceptionOffset + 2 45 45 }; 46 47 private: 48 SVGException(const ExceptionCodeDescription& description) 49 : ExceptionBase(description) 50 { 51 } 46 52 }; 47 53 -
trunk/WebCore/svg/animation/SVGSMILElement.cpp
r32498 r34432 54 54 class ConditionEventListener : public EventListener { 55 55 public: 56 static PassRefPtr<ConditionEventListener> create(SVGSMILElement* animation, Element* eventBase, SVGSMILElement::Condition* condition) 57 { 58 return adoptRef(new ConditionEventListener(animation, eventBase, condition)); 59 } 60 61 void unregister() 62 { 63 // If this has only one ref then the event base is dead already and we don't need to remove ourself. 64 if (!hasOneRef()) 65 m_eventBase->removeEventListener(m_condition->m_name, this, false); 66 } 67 68 virtual void handleEvent(Event* event, bool isWindowEvent) 69 { 70 m_animation->handleConditionEvent(event, m_condition); 71 } 72 73 private: 56 74 ConditionEventListener(SVGSMILElement* animation, Element* eventBase, SVGSMILElement::Condition* condition) 57 75 : m_animation(animation) … … 62 80 } 63 81 64 void unregister()65 {66 // If this has only one ref then the event base is dead already and we don't need to remove ourself.67 if (!hasOneRef())68 m_eventBase->removeEventListener(m_condition->m_name, this, false);69 }70 71 virtual void handleEvent(Event* event, bool isWindowEvent)72 {73 m_animation->handleConditionEvent(event, m_condition);74 }75 private:76 82 SVGSMILElement* m_animation; 77 83 SVGSMILElement::Condition* m_condition; … … 378 384 continue; 379 385 ASSERT(!condition.m_eventListener); 380 condition.m_eventListener = new ConditionEventListener(this, eventBase, &condition);386 condition.m_eventListener = ConditionEventListener::create(this, eventBase, &condition); 381 387 } else if (condition.m_type == Condition::Syncbase) { 382 388 ASSERT(!condition.m_baseID.isEmpty()); -
trunk/WebCore/xml/XMLHttpRequest.cpp
r34041 r34432 206 206 } 207 207 208 void XMLHttpRequest::setOnReadyStateChangeListener( EventListener*eventListener)208 void XMLHttpRequest::setOnReadyStateChangeListener(PassRefPtr<EventListener> eventListener) 209 209 { 210 210 m_onReadyStateChangeListener = eventListener; … … 221 221 } 222 222 223 void XMLHttpRequest::setOnLoadListener( EventListener*eventListener)223 void XMLHttpRequest::setOnLoadListener(PassRefPtr<EventListener> eventListener) 224 224 { 225 225 m_onLoadListener = eventListener; 226 226 } 227 227 228 void XMLHttpRequest::setOnProgressListener( EventListener*eventListener)228 void XMLHttpRequest::setOnProgressListener(PassRefPtr<EventListener> eventListener) 229 229 { 230 230 m_onProgressListener = eventListener; … … 934 934 if (!m_decoder) { 935 935 if (!m_responseEncoding.isEmpty()) 936 m_decoder = new TextResourceDecoder("text/plain", m_responseEncoding);936 m_decoder = TextResourceDecoder::create("text/plain", m_responseEncoding); 937 937 // allow TextResourceDecoder to look inside the m_response if it's XML or HTML 938 938 else if (responseIsXML()) 939 m_decoder = new TextResourceDecoder("application/xml");939 m_decoder = TextResourceDecoder::create("application/xml"); 940 940 else if (responseMIMEType() == "text/html") 941 m_decoder = new TextResourceDecoder("text/html", "UTF-8");941 m_decoder = TextResourceDecoder::create("text/html", "UTF-8"); 942 942 else 943 m_decoder = new TextResourceDecoder("text/plain", "UTF-8");943 m_decoder = TextResourceDecoder::create("text/plain", "UTF-8"); 944 944 } 945 945 if (len == 0) -
trunk/WebCore/xml/XMLHttpRequest.h
r34041 r34432 66 66 Document* responseXML() const; 67 67 68 void setOnReadyStateChangeListener( EventListener*);68 void setOnReadyStateChangeListener(PassRefPtr<EventListener>); 69 69 EventListener* onReadyStateChangeListener() const; 70 void setOnLoadListener( EventListener*);70 void setOnLoadListener(PassRefPtr<EventListener>); 71 71 EventListener* onLoadListener() const; 72 void setOnProgressListener( EventListener*);72 void setOnProgressListener(PassRefPtr<EventListener>); 73 73 EventListener* onProgressListener() const; 74 74 -
trunk/WebCore/xml/XMLHttpRequestException.h
r33559 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 class XMLHttpRequestException : public ExceptionBase { 37 37 public: 38 XMLHttpRequestException(const ExceptionCodeDescription& description) 39 : ExceptionBase(description) 38 static PassRefPtr<XMLHttpRequestException> create(const ExceptionCodeDescription& description) 40 39 { 40 return adoptRef(new XMLHttpRequestException(description)); 41 41 } 42 42 … … 48 48 ABORT_ERR 49 49 }; 50 51 private: 52 XMLHttpRequestException(const ExceptionCodeDescription& description) 53 : ExceptionBase(description) 54 { 55 } 50 56 }; 51 57 -
trunk/WebCore/xml/XPathException.h
r29663 r34432 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #define XPathException_h 31 31 32 #include "ExceptionBase.h" 33 32 34 #if ENABLE(XPATH) 33 34 #include "ExceptionBase.h"35 35 36 36 namespace WebCore { … … 38 38 class XPathException : public ExceptionBase { 39 39 public: 40 XPathException(const ExceptionCodeDescription& description) 41 : ExceptionBase(description) 40 static PassRefPtr<XPathException> create(const ExceptionCodeDescription& description) 42 41 { 42 return adoptRef(new XPathException(description)); 43 43 } 44 44 … … 50 50 TYPE_ERR 51 51 }; 52 53 private: 54 XPathException(const ExceptionCodeDescription& description) 55 : ExceptionBase(description) 56 { 57 } 52 58 }; 53 59 -
trunk/WebCore/xml/XPathResult.cpp
r30419 r34432 43 43 class InvalidatingEventListener : public EventListener { 44 44 public: 45 static PassRefPtr<InvalidatingEventListener> create(XPathResult* result) { return adoptRef(new InvalidatingEventListener(result)); } 46 virtual void handleEvent(Event*, bool) { m_result->invalidateIteratorState(); } 47 48 private: 45 49 InvalidatingEventListener(XPathResult* result) : m_result(result) { } 46 virtual void handleEvent(Event*, bool) { m_result->invalidateIteratorState(); }47 private:48 50 XPathResult* m_result; 49 51 }; … … 53 55 , m_eventTarget(eventTarget) 54 56 { 55 m_eventListener = new InvalidatingEventListener(this);57 m_eventListener = InvalidatingEventListener::create(this); 56 58 m_eventTarget->addEventListener(EventNames::DOMSubtreeModifiedEvent, m_eventListener, false); 57 59 switch (m_value.type()) { -
trunk/WebCore/xml/XSLTProcessor.cpp
r34187 r34432 270 270 result->open(); 271 271 272 RefPtr<TextResourceDecoder> decoder = new TextResourceDecoder(sourceMIMEType);272 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(sourceMIMEType); 273 273 decoder->setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : TextEncoding(sourceEncoding), TextResourceDecoder::EncodingFromXMLHeader); 274 result->setDecoder(decoder. get());274 result->setDecoder(decoder.release()); 275 275 276 276 result->write(documentSource); -
trunk/WebKit/mac/ChangeLog
r34351 r34432 1 2008-06-07 Darin Adler <darin@apple.com> 2 3 Reviewed by Mitz. 4 5 - work on https://bugs.webkit.org/show_bug.cgi?id=17257 6 start ref counts at 1 instead of 0 for speed 7 8 * History/WebHistoryItem.mm: 9 (-[WebHistoryItem init]): 10 (-[WebHistoryItem initWithURLString:title:lastVisitedTimeInterval:]): 11 (-[WebHistoryItem initWithURL:target:parent:title:]): 12 (-[WebHistoryItem initWithURLString:title:displayTitle:lastVisitedTimeInterval:]): 13 * WebView/WebView.mm: 14 (+[WebView _decodeData:]): 15 1 16 2008-06-03 Oliver Hunt <oliver@apple.com> 2 17 -
trunk/WebKit/mac/History/WebHistoryItem.mm
r31260 r34432 92 92 - (id)init 93 93 { 94 return [self initWithWebCoreHistoryItem: (new HistoryItem)];94 return [self initWithWebCoreHistoryItem:HistoryItem::create()]; 95 95 } 96 96 … … 98 98 { 99 99 WebCoreThreadViolationCheck(); 100 return [self initWithWebCoreHistoryItem: (new HistoryItem(URLString, title, time))];100 return [self initWithWebCoreHistoryItem:HistoryItem::create(URLString, title, time)]; 101 101 } 102 102 … … 277 277 - (id)initWithURL:(NSURL *)URL target:(NSString *)target parent:(NSString *)parent title:(NSString *)title 278 278 { 279 return [self initWithWebCoreHistoryItem: (new HistoryItem(URL, target, parent, title))];279 return [self initWithWebCoreHistoryItem:HistoryItem::create(URL, target, parent, title)]; 280 280 } 281 281 282 282 - (id)initWithURLString:(NSString *)URLString title:(NSString *)title displayTitle:(NSString *)displayTitle lastVisitedTimeInterval:(NSTimeInterval)time 283 283 { 284 return [self initWithWebCoreHistoryItem: (new HistoryItem(URLString, title, displayTitle, time))];284 return [self initWithWebCoreHistoryItem:HistoryItem::create(URLString, title, displayTitle, time)]; 285 285 } 286 286 -
trunk/WebKit/mac/WebView/WebView.mm
r34189 r34432 1193 1193 { 1194 1194 HTMLNames::init(); // this method is used for importing bookmarks at startup, so HTMLNames are likely to be uninitialized yet 1195 RefPtr<TextResourceDecoder> decoder = new TextResourceDecoder("text/html"); // bookmark files are HTML1195 RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/html"); // bookmark files are HTML 1196 1196 String result = decoder->decode(static_cast<const char*>([data bytes]), [data length]); 1197 1197 result += decoder->flush(); -
trunk/WebKit/win/ChangeLog
r34346 r34432 1 2008-06-07 Darin Adler <darin@apple.com> 2 3 Reviewed by Mitz. 4 5 - work on https://bugs.webkit.org/show_bug.cgi?id=17257 6 start ref counts at 1 instead of 0 for speed 7 8 * WebHistoryItem.cpp: 9 (WebHistoryItem::createInstance): 10 (WebHistoryItem::initFromDictionaryRepresentation): 11 (WebHistoryItem::initWithURLString): 12 1 13 2008-05-30 Steve Falkenburg <sfalken@apple.com> 2 14 -
trunk/WebKit/win/WebHistoryItem.cpp
r31212 r34432 69 69 WebHistoryItem* WebHistoryItem::createInstance() 70 70 { 71 WebHistoryItem* instance = new WebHistoryItem( new HistoryItem);71 WebHistoryItem* instance = new WebHistoryItem(HistoryItem::create()); 72 72 instance->AddRef(); 73 73 return instance; … … 127 127 128 128 historyItemWrappers().remove(m_historyItem.get()); 129 m_historyItem = new HistoryItem(urlStringRef, titleRef, lastVisitedTime);129 m_historyItem = HistoryItem::create(urlStringRef, titleRef, lastVisitedTime); 130 130 historyItemWrappers().set(m_historyItem.get(), this); 131 131 … … 361 361 { 362 362 historyItemWrappers().remove(m_historyItem.get()); 363 m_historyItem = new HistoryItem(String(urlString, SysStringLen(urlString)), String(title, SysStringLen(title)), MarshallingHelpers::DATEToCFAbsoluteTime(lastVisited));363 m_historyItem = HistoryItem::create(String(urlString, SysStringLen(urlString)), String(title, SysStringLen(title)), MarshallingHelpers::DATEToCFAbsoluteTime(lastVisited)); 364 364 historyItemWrappers().set(m_historyItem.get(), this); 365 365
Note: See TracChangeset
for help on using the changeset viewer.