Changeset 65917 in webkit


Ignore:
Timestamp:
Aug 24, 2010 11:33:27 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-08-24 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Partial deployment of adoptPtr to WebCore/html
https://bugs.webkit.org/show_bug.cgi?id=44507

Deploy adoptPtr to some more places in WebCore/html. The big chunk
that I haven't done yet is createRenderer, but that's going to be a big
patch unto itself.

  • html/HTMLFormCollection.cpp: (WebCore::HTMLFormCollection::formCollectionInfo):
  • html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::addElementAlias):
  • html/HTMLInputElement.cpp: (WebCore::createTypeMap): (WebCore::HTMLInputElement::setInputType): (WebCore::HTMLInputElement::parseMappedAttribute): (WebCore::HTMLInputElement::attach): (WebCore::HTMLInputElement::preDispatchEventHandler):
  • html/HTMLObjectElement.cpp: (WebCore::HTMLObjectElement::parseMappedAttribute): (WebCore::HTMLObjectElement::attach):
  • html/HTMLToken.h: (WebCore::HTMLToken::beginDOCTYPE):
  • html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::attach): (WebCore::HTMLVideoElement::parseMappedAttribute):
  • html/ValidityState.h: (WebCore::ValidityState::create):
Location:
trunk/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65916 r65917  
     12010-08-24  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Partial deployment of adoptPtr to WebCore/html
     6        https://bugs.webkit.org/show_bug.cgi?id=44507
     7
     8        Deploy adoptPtr to some more places in WebCore/html.  The big chunk
     9        that I haven't done yet is createRenderer, but that's going to be a big
     10        patch unto itself.
     11
     12        * html/HTMLFormCollection.cpp:
     13        (WebCore::HTMLFormCollection::formCollectionInfo):
     14        * html/HTMLFormElement.cpp:
     15        (WebCore::HTMLFormElement::addElementAlias):
     16        * html/HTMLInputElement.cpp:
     17        (WebCore::createTypeMap):
     18        (WebCore::HTMLInputElement::setInputType):
     19        (WebCore::HTMLInputElement::parseMappedAttribute):
     20        (WebCore::HTMLInputElement::attach):
     21        (WebCore::HTMLInputElement::preDispatchEventHandler):
     22        * html/HTMLObjectElement.cpp:
     23        (WebCore::HTMLObjectElement::parseMappedAttribute):
     24        (WebCore::HTMLObjectElement::attach):
     25        * html/HTMLToken.h:
     26        (WebCore::HTMLToken::beginDOCTYPE):
     27        * html/HTMLVideoElement.cpp:
     28        (WebCore::HTMLVideoElement::attach):
     29        (WebCore::HTMLVideoElement::parseMappedAttribute):
     30        * html/ValidityState.h:
     31        (WebCore::ValidityState::create):
     32
    1332010-08-24  Adam Barth  <abarth@webkit.org>
    234
  • trunk/WebCore/html/HTMLFormCollection.cpp

    r61094 r65917  
    4040{
    4141    if (!form->m_collectionCache)
    42         form->m_collectionCache.set(new CollectionCache);
     42        form->m_collectionCache = adoptPtr(new CollectionCache);
    4343    return form->m_collectionCache.get();
    4444}
  • trunk/WebCore/html/HTMLFormElement.cpp

    r64110 r65917  
    530530        return;
    531531    if (!m_elementAliases)
    532         m_elementAliases.set(new AliasMap);
     532        m_elementAliases = adoptPtr(new AliasMap);
    533533    m_elementAliases->set(alias.impl(), element);
    534534}
  • trunk/WebCore/html/HTMLInputElement.cpp

    r65077 r65917  
    744744
    745745typedef HashMap<String, HTMLInputElement::InputType, CaseFoldingHash> InputTypeMap;
    746 static const InputTypeMap* createTypeMap()
    747 {
    748     InputTypeMap* map = new InputTypeMap;
     746static PassOwnPtr<InputTypeMap> createTypeMap()
     747{
     748    OwnPtr<InputTypeMap> map = adoptPtr(new InputTypeMap);
    749749    map->add("button", HTMLInputElement::BUTTON);
    750750    map->add("checkbox", HTMLInputElement::CHECKBOX);
     
    771771    map->add("week", HTMLInputElement::WEEK);
    772772    // No need to register "text" because it is the default type.
    773     return map;
     773    return map.release();
    774774}
    775775
    776776void HTMLInputElement::setInputType(const String& t)
    777777{
    778     static const InputTypeMap* typeMap = createTypeMap();
     778    static const InputTypeMap* typeMap = createTypeMap().leakPtr();
    779779    InputType newType = t.isNull() ? TEXT : typeMap->get(t);
    780780
     
    10831083        if (renderer() && inputType() == IMAGE) {
    10841084            if (!m_imageLoader)
    1085                 m_imageLoader.set(new HTMLImageLoader(this));
     1085                m_imageLoader = adoptPtr(new HTMLImageLoader(this));
    10861086            m_imageLoader->updateFromElementIgnoringPreviousError();
    10871087        }
     
    12061206    if (inputType() == IMAGE) {
    12071207        if (!m_imageLoader)
    1208             m_imageLoader.set(new HTMLImageLoader(this));
     1208            m_imageLoader = adoptPtr(new HTMLImageLoader(this));
    12091209        m_imageLoader->updateFromElement();
    12101210        if (renderer() && m_imageLoader->haveFiredBeforeLoadEvent()) {
     
    20492049            && evt->type() == eventNames().clickEvent && static_cast<MouseEvent*>(evt)->button() == LeftButton) {
    20502050       
    2051         EventHandlingState* state = new EventHandlingState(indeterminate(), checked());
     2051        OwnPtr<EventHandlingState> state = adoptPtr(new EventHandlingState(indeterminate(), checked()));
    20522052
    20532053        if (inputType() == CHECKBOX) {
     
    20712071            setChecked(true, true);
    20722072        }
    2073         result = state;
     2073        result = state.leakPtr(); // FIXME: Check whether this actually ends up leaking.
    20742074    }
    20752075    return result;
  • trunk/WebCore/html/HTMLObjectElement.cpp

    r65468 r65917  
    8787        if (renderer() && isImageType()) {
    8888          if (!m_imageLoader)
    89               m_imageLoader.set(new HTMLImageLoader(this));
     89              m_imageLoader = adoptPtr(new HTMLImageLoader(this));
    9090          m_imageLoader->updateFromElementIgnoringPreviousError();
    9191        }
     
    153153    if (isImage && renderer() && !m_useFallbackContent) {
    154154        if (!m_imageLoader)
    155             m_imageLoader.set(new HTMLImageLoader(this));
     155            m_imageLoader = adoptPtr(new HTMLImageLoader(this));
    156156        m_imageLoader->updateFromElement();
    157157    }
  • trunk/WebCore/html/HTMLToken.h

    r65132 r65917  
    129129        ASSERT(m_type == Uninitialized);
    130130        m_type = DOCTYPE;
    131         m_doctypeData.set(new DoctypeData());
     131        m_doctypeData = adoptPtr(new DoctypeData());
    132132    }
    133133
  • trunk/WebCore/html/HTMLVideoElement.cpp

    r64997 r65917  
    7777    if (shouldDisplayPosterImage()) {
    7878        if (!m_imageLoader)
    79             m_imageLoader.set(new HTMLImageLoader(this));
     79            m_imageLoader = adoptPtr(new HTMLImageLoader(this));
    8080        m_imageLoader->updateFromElement();
    8181        if (renderer()) {
     
    106106        if (shouldDisplayPosterImage()) {
    107107            if (!m_imageLoader)
    108                 m_imageLoader.set(new HTMLImageLoader(this));
     108                m_imageLoader = adoptPtr(new HTMLImageLoader(this));
    109109            m_imageLoader->updateFromElementIgnoringPreviousError();
    110110        } else {
  • trunk/WebCore/html/ValidityState.h

    r64805 r65917  
    3434    static PassOwnPtr<ValidityState> create(HTMLFormControlElement* control)
    3535    {
    36         return new ValidityState(control);
     36        return adoptPtr(new ValidityState(control));
    3737    }
    3838
Note: See TracChangeset for help on using the changeset viewer.