webkit 中的设计模式--工厂模式

来源:互联网 发布:尤易软件 编辑:程序博客网 时间:2024/04/25 22:25
PassRefPtr<HTMLElement> HTMLElementFactory::createHTMLElement(const QualifiedName& qName, Document* document, HTMLFormElement* formElement, bool createdByParser)
{
    if (!document)
        return 0;


    if (!gFunctionMap)
        createFunctionMap();
    if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl()))
        return function(qName, document, formElement, createdByParser);
    return HTMLElement::create(qName, document);
}


} // namespace WebCore
原创粉丝点击