Пример #1
0
JSValue* JSHTMLIFrameElement::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case AlignAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->align());
    }
    case FrameBorderAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->frameBorder());
    }
    case HeightAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->height());
    }
    case LongDescAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->longDesc());
    }
    case MarginHeightAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->marginHeight());
    }
    case MarginWidthAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->marginWidth());
    }
    case NameAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->name());
    }
    case ScrollingAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->scrolling());
    }
    case SrcAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->src());
    }
    case WidthAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return jsString(exec, imp->width());
    }
    case ContentDocumentAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return checkNodeSecurity(exec, imp->contentDocument()) ? toJS(exec, WTF::getPtr(imp->contentDocument())) : jsUndefined();
    }
    case ContentWindowAttrNum: {
        HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
        return toJS(exec, WTF::getPtr(imp->contentWindow()));
    }
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}
void RenderEmbeddedObject::viewCleared()
{
    // This is required for <object> elements whose contents are rendered by WebCore (e.g. src="foo.html").
    if (node() && widget() && widget()->isFrameView()) {
        FrameView* view = toFrameView(widget());
        int marginWidth = -1;
        int marginHeight = -1;
        if (node()->hasTagName(iframeTag)) {
            HTMLIFrameElement* frame = toHTMLIFrameElement(node());
            marginWidth = frame->marginWidth();
            marginHeight = frame->marginHeight();
        }
        if (marginWidth != -1)
            view->setMarginWidth(marginWidth);
        if (marginHeight != -1)
            view->setMarginHeight(marginHeight);
    }
}