void HTMLFrameSetElementImpl::attach()
{
    assert(!m_render);
    assert(parentNode());
    assert(parentNode()->renderer());

    // inherit default settings from parent frameset
    HTMLElementImpl* node = static_cast<HTMLElementImpl*>(parentNode());
    while(node)
    {
        if(node->id() == ID_FRAMESET)
        {
            HTMLFrameSetElementImpl* frameset = static_cast<HTMLFrameSetElementImpl*>(node);
            if(!frameBorderSet)  frameborder = frameset->frameBorder();
            if(!noresize)  noresize = frameset->noResize();
            break;
        }
        node = static_cast<HTMLElementImpl*>(node->parentNode());
    }

    // ignore display: none
    m_render = new RenderFrameSet(this);
    m_render->setStyle(getDocument()->styleSelector()->styleForElement(this));
    parentNode()->renderer()->addChild(m_render, nextRenderer());

    NodeBaseImpl::attach();
}
void HTMLTableCellElementImpl::attach(KHTMLView *_view)
{
    HTMLElementImpl* p = static_cast<HTMLElementImpl*>(_parent);
    while(p && p->id() != ID_TABLE)
        p = static_cast<HTMLElementImpl*>(p->parentNode());

    if(p) {
        HTMLTableElementImpl* table = static_cast<HTMLTableElementImpl*>(p);

        if(table->m_noBorder && getAttribute(ATTR_BORDER).isNull())
            addCSSProperty(CSS_PROP_BORDER_WIDTH, "0px");
        if(!table->getAttribute(ATTR_BORDERCOLOR).isNull())
            addCSSProperty(CSS_PROP_BORDER_STYLE, "solid");
    }

    setStyle(document->styleSelector()->styleForElement(this));
    khtml::RenderObject *r = _parent->renderer();
    if(r)
    {
	m_render = khtml::RenderObject::createObject(this);
	if(m_render && m_render->style()->display() == TABLE_CELL)
	{
	    RenderTableCell *cell = static_cast<RenderTableCell *>(m_render);
	    cell->setRowSpan(rSpan);
	    cell->setColSpan(cSpan);
            cell->setNoWrap(nWrap);
	}
	if(m_render) r->addChild(m_render, _next ? _next->renderer() : 0);
    }

    NodeBaseImpl::attach(_view);
}
void HTMLTableCellElementImpl::attach()
{
    HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
    while(p && p->id() != ID_TABLE)
        p = static_cast<HTMLElementImpl*>(p->parentNode());

    if(p) {
        HTMLTableElementImpl* table = static_cast<HTMLTableElementImpl*>(p);
        if (table->m_noBorder) {
            addCSSProperty(CSS_PROP_BORDER_WIDTH, "0");
        }
        else {
            addCSSProperty(CSS_PROP_BORDER_WIDTH, "1px");
            int v = (table->m_solid || m_solid) ? CSS_VAL_SOLID : CSS_VAL_INSET;
            addCSSProperty(CSS_PROP_BORDER_TOP_STYLE, v);
            addCSSProperty(CSS_PROP_BORDER_BOTTOM_STYLE, v);
            addCSSProperty(CSS_PROP_BORDER_LEFT_STYLE, v);
            addCSSProperty(CSS_PROP_BORDER_RIGHT_STYLE, v);

            if (!m_solid)
                addCSSProperty(CSS_PROP_BORDER_COLOR, "inherit");
        }
    }

    HTMLTablePartElementImpl::attach();
}
void HTMLTableCellElementImpl::attach()
{
    HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
    while(p && p->id() != ID_TABLE)
        p = static_cast<HTMLElementImpl*>(p->parentNode());

    HTMLTablePartElementImpl::attach();
}
Exemplo n.º 5
0
void HTMLFrameElementImpl::attach()
{
    assert(!attached());
    assert(parentNode());

    name = getAttribute(ATTR_NAME);
    if(name.isNull())
        name = getAttribute(ATTR_ID);

    // inherit default settings from parent frameset
    HTMLElementImpl *node = static_cast< HTMLElementImpl * >(parentNode());
    while(node)
    {
        if(node->id() == ID_FRAMESET)
        {
            HTMLFrameSetElementImpl *frameset = static_cast< HTMLFrameSetElementImpl * >(node);
            if(!frameBorderSet)
                frameBorder = frameset->frameBorder();
            if(!noresize)
                noresize = frameset->noResize();
            break;
        }
        node = static_cast< HTMLElementImpl * >(node->parentNode());
    }

    if(parentNode()->renderer() && getDocument()->isURLAllowed(url.string()))
    {
        RenderStyle *_style = getDocument()->styleSelector()->styleForElement(this);
        _style->ref();
        if(_style->display() != NONE)
        {
            m_render = new(getDocument()->renderArena()) RenderFrame(this);
            m_render->setStyle(_style);
            parentNode()->renderer()->addChild(m_render, nextRenderer());
        }
        _style->deref();
    }

    NodeBaseImpl::attach();

    if(!m_render)
        return;

    KHTMLView *w = getDocument()->view();
    if(w)
    {
        // we need a unique name for every frame in the frameset. Hope that's unique enough.
        if(name.isEmpty() || w->part()->frameExists(name.string()))
            name = DOMString(w->part()->requestFrameName());

        // load the frame contents
        w->part()->requestFrame(static_cast< RenderFrame * >(m_render), url.string(), name.string());
    }
}
// used by table cells to share style decls created by the enclosing table.
CSSMutableStyleDeclarationImpl* HTMLTableCellElementImpl::additionalAttributeStyleDecl()
{
    HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
    while(p && p->id() != ID_TABLE)
        p = static_cast<HTMLElementImpl*>(p->parentNode());

    if (p) {
        HTMLTableElementImpl* table = static_cast<HTMLTableElementImpl*>(p);
        return table->getSharedCellDecl();
    }

    return 0;
}
void HTMLFrameElementImpl::attach()
{
    assert(!attached());
    assert(parentNode());
    assert(parentNode()->renderer());

    // we should first look up via id, then via name.
    // this shortterm hack fixes the ugly case. ### rewrite needed for next release
    name = getAttribute(ATTR_NAME);
    if (name.isNull())
        name = getAttribute(ATTR_ID);

    // inherit default settings from parent frameset
    HTMLElementImpl* node = static_cast<HTMLElementImpl*>(parentNode());
    while(node)
    {
        if(node->id() == ID_FRAMESET)
        {
            HTMLFrameSetElementImpl* frameset = static_cast<HTMLFrameSetElementImpl*>(node);
            if(!frameBorderSet)  frameBorder = frameset->frameBorder();
            if(!noresize)  noresize = frameset->noResize();
            break;
        }
        node = static_cast<HTMLElementImpl*>(node->parentNode());
    }

    // ignore display: none for this element!
    KHTMLView* w = getDocument()->view();

    if (isURLAllowed(url.string()))  {
        m_render = new RenderFrame(this);
        m_render->setStyle(getDocument()->styleSelector()->styleForElement(this));
        parentNode()->renderer()->addChild(m_render, nextRenderer());
    }

    NodeBaseImpl::attach();

    if (!m_render)
        return;

    // we need a unique name for every frame in the frameset. Hope that's unique enough.
    if(name.isEmpty() || w->part()->frameExists( name.string() ) )
      name = DOMString(w->part()->requestFrameName());

    // load the frame contents
    w->part()->requestFrame( static_cast<RenderFrame*>(m_render), url.string(), name.string() );
}