当前位置: 首页>>代码示例>>C++>>正文


C++ NodeImpl::id方法代码示例

本文整理汇总了C++中NodeImpl::id方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeImpl::id方法的具体用法?C++ NodeImpl::id怎么用?C++ NodeImpl::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeImpl的用法示例。


在下文中一共展示了NodeImpl::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteRow

void HTMLTableElementImpl::deleteRow( long index, int &exceptioncode )
{
    HTMLTableSectionElementImpl* section = 0L;
    NodeImpl *node = firstChild();
    bool lastRow = index == -1;
    HTMLTableSectionElementImpl* lastSection = 0L;
    bool found = false;
    for ( ; node ; node = node->nextSibling() )
    {
        if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) )
        {
            section = static_cast<HTMLTableSectionElementImpl *>(node);
            lastSection = section;
            int rows = section->numRows();
            if ( !lastRow )
            {
                if ( rows > index ) {
                    found = true;
                    break;
                } else
                    index -= rows;
            }
        }
        section = 0L;
    }
    if ( !found && foot )
        section = static_cast<HTMLTableSectionElementImpl *>(foot);

    if ( lastRow )
        lastSection->deleteRow( -1, exceptioncode );
    else if ( section && index >= 0 && index < section->numRows() )
        section->deleteRow( index, exceptioncode );
    else
        exceptioncode = DOMException::INDEX_SIZE_ERR;
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:35,代码来源:html_tableimpl.cpp

示例2: setTBody

HTMLElementImpl *HTMLTableElementImpl::insertRow( long index, int &exceptioncode )
{
    // The DOM requires that we create a tbody if the table is empty
    // (cf DOM2TS HTMLTableElement31 test)
    // (note: this is different from "if the table has no sections", since we can have
    // <TABLE><TR>)
    if(!firstBody && !head && !foot && !hasChildNodes())
        setTBody( new HTMLTableSectionElementImpl(docPtr(), ID_TBODY, true /* implicit */) );

    //kdDebug(6030) << k_funcinfo << index << endl;
    // IE treats index=-1 as default value meaning 'append after last'
    // This isn't in the DOM. So, not implemented yet.
    HTMLTableSectionElementImpl* section = 0L;
    HTMLTableSectionElementImpl* lastSection = 0L;
    NodeImpl *node = firstChild();
    bool append = (index == -1);
    bool found = false;
    for ( ; node && (index>=0 || append) ; node = node->nextSibling() )
    {
	// there could be 2 tfoot elements in the table. Only the first one is the "foot", that's why we have the more
	// complicated if statement below.
        if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) )
        {
            section = static_cast<HTMLTableSectionElementImpl *>(node);
            lastSection = section;
            //kdDebug(6030) << k_funcinfo << "section id=" << node->id() << " rows:" << section->numRows() << endl;
            if ( !append )
            {
                int rows = section->numRows();
                if ( rows > index ) {
		    found = true;
                    break;
                } else
                    index -= rows;
                //kdDebug(6030) << "       index is now " << index << endl;
            }
        }
    }
    if ( !found && foot )
        section = static_cast<HTMLTableSectionElementImpl *>(foot);

    // Index == 0 means "insert before first row in current section"
    // or "append after last row" (if there's no current section anymore)
    if ( !section && ( index == 0 || append ) )
    {
        section = lastSection;
        index = section ? section->numRows() : 0;
    }
    if ( section && (index >= 0 || append) ) {
        //kdDebug(6030) << "Inserting row into section " << section << " at index " << index << endl;
        return section->insertRow( index, exceptioncode );
    } else {
        // No more sections => index is too big
        exceptioncode = DOMException::INDEX_SIZE_ERR;
        return 0L;
    }
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:57,代码来源:html_tableimpl.cpp

示例3:

LinkStyle & LinkStyle::operator = (const Node &other)
{
    if(node) node->deref();
    node = 0;
    // ### add processing instructions
    NodeImpl *n = other.handle();

    // ### check link is really linking a style sheet
    if( n && n->isElementNode() &&
	(n->id() == ID_STYLE || n->id() == ID_LINK) ) {
    node = n;
    if(node) node->ref();
    }
    return *this;
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:15,代码来源:css_stylesheet.cpp

示例4: rowIndex

long HTMLTableRowElementImpl::rowIndex() const
{
    int rIndex = 0;

    NodeImpl *table = parentNode();
    if ( !table )
	return -1;
    table = table->parentNode();
    if ( !table || table->id() != ID_TABLE )
	return -1;

    HTMLTableSectionElementImpl *head = static_cast<HTMLTableElementImpl *>(table)->tHead();
    HTMLTableSectionElementImpl *foot = static_cast<HTMLTableElementImpl *>(table)->tFoot();

    if ( head ) {
        const NodeImpl *row = head->firstChild();
        while ( row ) {
            if ( row == this )
                return rIndex;
            rIndex++;
            row = row->nextSibling();
        }
    }

    NodeImpl *node = table->firstChild();
    while ( node ) {
        if ( node != foot && node != head && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) ) {
	    HTMLTableSectionElementImpl* section = static_cast<HTMLTableSectionElementImpl *>(node);
	    const NodeImpl *row = section->firstChild();
	    while ( row ) {
		if ( row == this )
		    return rIndex;
		rIndex++;
		row = row->nextSibling();
	    }
	}
	node = node->nextSibling();
    }
    const NodeImpl *row = foot->firstChild();
    while ( row ) {
	if ( row == this )
	    return rIndex;
	rIndex++;
	row = row->nextSibling();
    }
    // should never happen
    return -1;
}
开发者ID:,项目名称:,代码行数:48,代码来源:

示例5: layout

void RenderApplet::layout()
{
    //kdDebug(6100) << "RenderApplet::layout" << endl;

    KHTMLAssert( needsLayout() );
    KHTMLAssert( minMaxKnown() );

    calcWidth();
    calcHeight();

    KJavaAppletWidget *tmp = static_cast<KJavaAppletWidget*>(m_widget);
    if ( tmp ) {
        NodeImpl *child = element()->firstChild();

        while(child) {

            if(child->id() == ID_PARAM) {
                HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
                if(tmp->applet())
                    tmp->applet()->setParameter( p->name(), p->value());
            }
            child = child->nextSibling();
        }
        //kdDebug(6100) << "setting applet widget to size: " << m_width << ", " << m_height << endl;
        m_widget->resize(m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
                         m_height-borderTop()-borderBottom()-paddingTop()-paddingBottom());
        tmp->showApplet();
    }

    setNeedsLayout(false);
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例6: documentElement

HTMLElementImpl *HTMLDocumentImpl::body()
{
    NodeImpl *de = documentElement();
    if (!de)
        return 0;

    // try to prefer a FRAMESET element over BODY
    NodeImpl* body = 0;
    for (NodeImpl* i = de->firstChild(); i; i = i->nextSibling()) {
        if (i->id() == ID_FRAMESET)
            return static_cast<HTMLElementImpl*>(i);

        if (i->id() == ID_BODY)
            body = i;
    }
    return static_cast<HTMLElementImpl *>(body);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:17,代码来源:html_documentimpl.cpp

示例7: addCSSProperty

NodeImpl *HTMLLayerElementImpl::addChild(NodeImpl *child)
{
    NodeImpl *retval = HTMLDivElementImpl::addChild(child);
    // When someone adds standard layers, we make sure not to interfere
    if (retval && retval->id() == ID_DIV) {
        if (!transparent)
            addCSSProperty(CSS_PROP_POSITION, CSS_VAL_STATIC);
        transparent = true;
    }
    return retval;
}
开发者ID:vasi,项目名称:kdelibs,代码行数:11,代码来源:html_blockimpl.cpp

示例8: findRowSection

bool HTMLTableElementImpl::findRowSection(long index,
                        HTMLTableSectionElementImpl*& outSection,
                        long&                         outIndex) const
{
    HTMLTableSectionElementImpl* foot = tFoot();
    HTMLTableSectionElementImpl* head = tHead();

    HTMLTableSectionElementImpl* section = 0L;
    HTMLTableSectionElementImpl* lastSection = 0L;

    if ( head )
        section = processSection( head, lastSection, index );

    if ( !section ) {
        for ( NodeImpl *node = firstChild(); node; node = node->nextSibling() ) {
            if ( ( node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY ) &&
                   node != foot && node != head ) {
                section = processSection( static_cast<HTMLTableSectionElementImpl *>(node),
                        lastSection, index );
                if ( section )
                    break;
            }
        }
    }

    if ( !section && foot )
        section = processSection( foot, lastSection, index );

    outIndex = index;
    if ( section ) {
        outSection = section;
        return true;
    } else {
        outSection = lastSection;
        return false;
    }
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例9: slotPartLoadingErrorNotify

void RenderPartObject::slotPartLoadingErrorNotify()
{
#if APPLE_CHANGES
    // FIXME: What are we going to do for this case?
#else
    // First we need to find out the servicetype - again - this code is too duplicated !
    HTMLEmbedElementImpl *embed = 0;
    QString serviceType;
    if( element()->id()==ID_OBJECT ) {

        // check for embed child object
        HTMLObjectElementImpl *o = static_cast<HTMLObjectElementImpl *>(element());
        serviceType = o->serviceType;
        NodeImpl *child = o->firstChild();
        while ( child ) {
            if ( child->id() == ID_EMBED )
                embed = static_cast<HTMLEmbedElementImpl *>( child );

            child = child->nextSibling();
        }

    } else if( element()->id()==ID_EMBED ) {
        embed = static_cast<HTMLEmbedElementImpl *>(element());
    }
    if ( embed )
	serviceType = embed->serviceType;

    KHTMLPart *part = static_cast<KHTMLView *>(m_view)->part();
    KParts::BrowserExtension *ext = part->browserExtension();
    if( embed && !embed->pluginPage.isEmpty() && ext ) {
        // Prepare the mimetype to show in the question (comment if available, name as fallback)
        QString mimeName = serviceType;
        KMimeType::Ptr mime = KMimeType::mimeType(serviceType);
        if ( mime->name() != KMimeType::defaultMimeType() )
            mimeName = mime->comment();
        // Prepare the URL to show in the question (host only if http, to make it short)
        KURL pluginPageURL( embed->pluginPage );
        QString shortURL = pluginPageURL.protocol() == "http" ? pluginPageURL.host() : pluginPageURL.prettyURL();
        int res = KMessageBox::questionYesNo( m_view,
            i18n("No plugin found for '%1'.\nDo you want to download one from %2?").arg(mimeName).arg(shortURL),
	    i18n("Missing plugin"), QString::null, QString::null, QString("plugin-")+serviceType);
	if ( res == KMessageBox::Yes )
	{
          // Display vendor download page
          ext->createNewWindow( pluginPageURL );
	}
    }
#endif // APPLE_CHANGES
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:49,代码来源:render_frames.cpp

示例10: partLoadingErrorNotify

bool RenderPartObject::partLoadingErrorNotify( khtml::ChildFrame *childFrame, const KURL& url, const QString& serviceType )
{
    KHTMLPart *part = static_cast<KHTMLView *>(m_view)->part();
    //kdDebug() << "RenderPartObject::partLoadingErrorNotify serviceType=" << serviceType << endl;
    // Check if we just tried with e.g. nsplugin
    // and fallback to the activexhandler if there is a classid
    // and a codebase, where we may download the ocx if it's missing
    if( (serviceType != "application/x-activex-handler") && (element()->id()==ID_OBJECT) ) {

        // check for embed child object
        HTMLObjectElementImpl *o = static_cast<HTMLObjectElementImpl *>(element());
        HTMLEmbedElementImpl *embed = 0;
        NodeImpl *child = o->firstChild();
        while ( child ) {
            if ( child->id() == ID_EMBED )
                embed = static_cast<HTMLEmbedElementImpl *>( child );

            child = child->nextSibling();
        }
        if( embed && !o->classId.isEmpty() &&
            !( static_cast<ElementImpl *>(o)->getAttribute(ATTR_CODEBASE).string() ).isEmpty() )
        {
            KParts::URLArgs args;
            args.serviceType = "application/x-activex-handler";
            if (part->requestObject( childFrame, url, args ))
                return true; // success
        }
    }
    // Dissociate ourselves from the current event loop (to prevent crashes
    // due to the message box staying up)
    QTimer::singleShot( 0, this, SLOT( slotPartLoadingErrorNotify() ) );
    Tokenizer *tokenizer = static_cast<DOM::DocumentImpl *>(part->document().handle())->tokenizer();
    if (tokenizer) tokenizer->setOnHold( true );
    slotPartLoadingErrorNotify();
    if (tokenizer) tokenizer->setOnHold( false );
    return false;
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:37,代码来源:render_frames.cpp

示例11: close

void HTMLDocumentImpl::close()
{
    bool doload = !parsing() && m_tokenizer;

    DocumentImpl::close();

    if(doload)
    {

        if(title().isEmpty()) // ensure setTitle is called at least once
            setTitle(DOMString());

        // auto fill: walk the tree and try to fill in login credentials
        if(view() && m_doAutoFill)
        {
            for(NodeImpl *n = this; n; n = n->traverseNextNode())
                if(n->id() == ID_FORM)
                    static_cast< HTMLFormElementImpl * >(n)->doAutoFill();
            m_doAutoFill = false;
        }

        // According to dom the load event must not bubble
        // but other browsers execute in a frameset document
        // the first(IE)/last(Moz/Konq) registered onload on a <frame> and the
        // first(IE)/last(Moz/Konq) registered onload on a <frameset>.

        // kdDebug() << "dispatching LOAD_EVENT on document " << getDocument() << " " << (view()?view()->part()->name():0) << endl;

        // Make sure to flush any pending image events now, as we want them out before the document's load event
        dispatchImageLoadEventsNow();
        getDocument()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false);

        // don't update rendering if we're going to redirect anyway
        if(view() && (view()->part()->d->m_redirectURL.isNull() || view()->part()->d->m_delayRedirect > 1))
            updateRendering();
    }
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例12: createWidgetIfNecessary

void RenderApplet::createWidgetIfNecessary()
{
    if (!m_widget) {
        if (static_cast<HTMLAppletElementImpl*>(element())->allParamsAvailable()) {
            // FIXME: Java applets can't be resized (this is a bug in Apple's Java implementation).  In order to work around
            // this problem, we will simply use fixed widths/heights from the style system when we can, since the widget might
            // not have an accurate m_width/m_height.
            int width = style()->width().isFixed() ? style()->width().value :
                        m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
            int height = style()->height().isFixed() ? style()->height().value :
                         m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
            NodeImpl *child = element()->firstChild();
            while (child) {
                if (child->id() == ID_PARAM) {
                    HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
                    m_args.insert(p->name(), p->value());
                }
                child = child->nextSibling();
            }

            setQWidget(new KJavaAppletWidget(QSize(width, height), m_context, m_args));
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:24,代码来源:render_applet.cpp

示例13: parseToken

void KHTMLParser::parseToken(Token *t)
{
    if (t->id > 2*ID_CLOSE_TAG)
    {
        kdDebug( 6035 ) << "Unknown tag!! tagID = " << t->id << endl;
        return;
    }
    if(discard_until) {
        if(t->id == discard_until)
            discard_until = 0;

        // do not skip </iframe>
        if ( discard_until || current->id() + ID_CLOSE_TAG != t->id )
            return;
    }

#ifdef PARSER_DEBUG
    kdDebug( 6035 ) << "\n\n==> parser: processing token " << getTagName(t->id).string() << "(" << t->id << ")"
                    << " current = " << getTagName(current->id()).string() << "(" << current->id() << ")" << endl;
    kdDebug(6035) << " inBody=" << inBody << " haveFrameSet=" << haveFrameSet << endl;
#endif

    // holy shit. apparently some sites use </br> instead of <br>
    // be compatible with IE and NS
    if(t->id == ID_BR+ID_CLOSE_TAG && document->document()->inCompatMode())
        t->id -= ID_CLOSE_TAG;

    if(t->id > ID_CLOSE_TAG)
    {
        processCloseTag(t);
        return;
    }

    // ignore spaces, if we're not inside a paragraph or other inline code
    if( t->id == ID_TEXT && t->text ) {
        if(inBody && !skipMode() && current->id() != ID_STYLE
                && current->id() != ID_TITLE && current->id() != ID_SCRIPT &&
                !t->text->containsOnlyWhitespace())
            haveContent = true;
#ifdef PARSER_DEBUG
        kdDebug(6035) << "length="<< t->text->l << " text='" << QConstString(t->text->s, t->text->l).string() << "'" << endl;
#endif
    }

    NodeImpl *n = getElement(t);
    // just to be sure, and to catch currently unimplemented stuff
    if(!n)
        return;

    // set attributes
    if(n->isElementNode())
    {
        ElementImpl *e = static_cast<ElementImpl *>(n);
        e->setAttributeMap(t->attrs);

        // take care of optional close tags
        if(endTag[e->id()] == DOM::OPTIONAL)
            popBlock(t->id);
    }

    // if this tag is forbidden inside the current context, pop
    // blocks until we are allowed to add it...
    while(forbiddenTag[t->id]) {
#ifdef PARSER_DEBUG
        kdDebug( 6035 ) << "t->id: " << t->id << " is forbidden :-( " << endl;
#endif
        popOneBlock();
    }

    if (!insertNode(n, t->flat))
    {
        // we couldn't insert the node...

        if(n->isElementNode())
        {
            ElementImpl *e = static_cast<ElementImpl *>(n);
            e->setAttributeMap(0);
        }

#ifdef PARSER_DEBUG
        kdDebug( 6035 ) << "insertNode failed current=" << current->id() << ", new=" << n->id() << "!" << endl;
#endif
        if (map == n)
        {
#ifdef PARSER_DEBUG
            kdDebug( 6035 ) << "  --> resetting map!" << endl;
#endif
            map = 0;
        }
        if (form == n)
        {
#ifdef PARSER_DEBUG
            kdDebug( 6035 ) << "   --> resetting form!" << endl;
#endif
            form = 0;
        }
        delete n;
    }
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:99,代码来源:htmlparser.cpp

示例14: if

HTMLElementImpl *HTMLTableElementImpl::insertRow( long index, int &exceptioncode )
{
    // The DOM requires that we create a tbody if the table is empty
    // (cf DOM2TS HTMLTableElement31 test)
    // (note: this is different from "if the table has no sections", since we can have
    // <TABLE><TR>)
    if(!firstBody && !head && !foot && !hasChildNodes())
        setTBody( new HTMLTableSectionElementImpl(docPtr(), ID_TBODY, true /* implicit */) );

    //kdDebug(6030) << k_funcinfo << index << endl;
    // IE treats index=-1 as default value meaning 'append after last'
    // This isn't in the DOM. So, not implemented yet.
    HTMLTableSectionElementImpl* section = 0L;
    HTMLTableSectionElementImpl* lastSection = 0L;
    NodeImpl *node = firstChild();
    bool append = index == -1;
    for ( ; node && (index>=0 || append) ; node = node->nextSibling() )
    {
        if ( node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY )
        {
            section = static_cast<HTMLTableSectionElementImpl *>(node);
            lastSection = section;
            //kdDebug(6030) << k_funcinfo << "section id=" << node->id() << " rows:" << section->numRows() << endl;
            if ( !append )
            {
                int rows = section->numRows();
                if ( rows > index )
                    break;
                else
                    index -= rows;
                //kdDebug(6030) << "       index is now " << index << endl;
            }
        }
        // Note: we now can have both TR and sections (THEAD/TBODY/TFOOT) as children of a TABLE
        else if ( node->id() == ID_TR )
        {
            section = 0L;
            //kdDebug(6030) << k_funcinfo << "row" << endl;
            if (!append && !index)
            {
                // Insert row right here, before "node"
                HTMLTableRowElementImpl* row = new HTMLTableRowElementImpl(docPtr());
                insertBefore(row, node, exceptioncode );
                return row;
            }
            if ( !append )
                index--;
            //kdDebug(6030) << "       index is now " << index << endl;
        }
        section = 0L;
    }
    // Index == 0 means "insert before first row in current section"
    // or "append after last row" (if there's no current section anymore)
    if ( !section && ( index == 0 || append ) )
    {
        section = lastSection;
        index = section ? section->numRows() : 0;
    }
    if ( section && ( index >= 0 || append ) ) {
        //kdDebug(6030) << "Inserting row into section " << section << " at index " << index << endl;
        return section->insertRow( index, exceptioncode );
    } else {
        // No more sections => index is too big
        exceptioncode = DOMException::INDEX_SIZE_ERR;
        return 0L;
    }
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:67,代码来源:html_tableimpl.cpp

示例15: insertNode

bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
{
    int id = n->id();

    // let's be stupid and just try to insert it.
    // this should work if the document is wellformed
#ifdef PARSER_DEBUG
    NodeImpl *tmp = current;
#endif
    NodeImpl *newNode = current->addChild(n);
    if ( newNode ) {
#ifdef PARSER_DEBUG
        kdDebug( 6035 ) << "added " << n->nodeName().string() << " to " << tmp->nodeName().string() << ", new current=" << newNode->nodeName().string() << endl;
#endif

	// have to do this here (and not when creating the node, as we don't know before where we add the LI element to.
	if ( id == ID_LI && n->isElementNode() ) {
	    int cid = current->id();
	    if ( cid != ID_UL && cid != ID_OL )
	    static_cast<HTMLElementImpl*>(n)->addCSSProperty(CSS_PROP_LIST_STYLE_POSITION, CSS_VAL_INSIDE);
	}

	// don't push elements without end tag on the stack
        if(tagPriority[id] != 0 && !flat) {
#if SPEED_DEBUG < 2
            if(!n->attached() && HTMLWidget )
                n->attach();
#endif
	    if(n->isInline()) m_inline = true;
            pushBlock(id, tagPriority[id]);
            current = newNode;
        } else {
#if SPEED_DEBUG < 2
            if(!n->attached() && HTMLWidget)
                n->attach();
            if (n->maintainsState()) {
                document->document()->registerMaintainsState(n);
                QString state(document->document()->nextState());
                if (!state.isNull()) n->restoreState(state);
            }
            if(n->renderer())
                n->renderer()->close();
#endif
	    if(n->isInline()) m_inline = true;
        }

#if SPEED_DEBUG < 1
        if(tagPriority[id] == 0 && n->renderer())
            n->renderer()->calcMinMaxWidth();
#endif
        return true;
    } else {
#ifdef PARSER_DEBUG
        kdDebug( 6035 ) << "ADDING NODE FAILED!!!! current = " << current->nodeName().string() << ", new = " << n->nodeName().string() << endl;
#endif
        // error handling...
        HTMLElementImpl *e;
        bool handled = false;

	// never create anonymous objects just to hold a space.
	if ( id == ID_TEXT &&
	     static_cast<TextImpl *>(n)->string()->l == 1 &&
	     static_cast<TextImpl *>(n)->string()->s[0] == " " )
	    return false;

        // switch according to the element to insert
        switch(id)
        {
        case ID_COMMENT:
            break;
        case ID_HEAD:
            // ### alllow not having <HTML> in at all, as per HTML spec
            if (!current->isDocumentNode() && current->id() != ID_HTML )
                return false;
            break;
        case ID_META:
        case ID_LINK:
        case ID_ISINDEX:
        case ID_BASE:
            if( !head )
                createHead();
            if( head ) {
                if ( head->addChild(n) ) {
#if SPEED_DEBUG < 2
                    if(!n->attached() && HTMLWidget)
                        n->attach();
#endif
		}

                return true;
            }

            break;
        case ID_HTML:
            if (!current->isDocumentNode() ) {
		if ( doc()->firstChild()->id() == ID_HTML) {
		    // we have another <HTML> element.... apply attributes to existing one
		    // make sure we don't overwrite already existing attributes
		    NamedAttrMapImpl *map = static_cast<ElementImpl*>(n)->attributes(true);
		    NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->firstChild())->attributes(false);
//.........这里部分代码省略.........
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:101,代码来源:htmlparser.cpp


注:本文中的NodeImpl::id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。