Value DOMCSSStyleDeclarationProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args) { KJS_CHECK_THIS(KJS::DOMCSSStyleDeclaration, thisObj); DOM::CSSStyleDeclaration styleDecl = static_cast< DOMCSSStyleDeclaration * >(thisObj.imp())->toStyleDecl(); String str = args[0].toString(exec); DOM::DOMString s = str.value().string(); switch(id) { case DOMCSSStyleDeclaration::GetPropertyValue: return String(styleDecl.getPropertyValue(s)); case DOMCSSStyleDeclaration::GetPropertyCSSValue: return getDOMCSSValue(exec, styleDecl.getPropertyCSSValue(s)); case DOMCSSStyleDeclaration::RemoveProperty: return String(styleDecl.removeProperty(s)); case DOMCSSStyleDeclaration::GetPropertyPriority: return String(styleDecl.getPropertyPriority(s)); case DOMCSSStyleDeclaration::SetProperty: styleDecl.setProperty(args[0].toString(exec).string(), args[1].toString(exec).string(), args[2].toString(exec).string()); return Undefined(); case DOMCSSStyleDeclaration::Item: return String(styleDecl.item(args[0].toInteger(exec))); default: return Undefined(); } }
void DOMTreeView::initializeCSSInfoFromElement(const DOM::Element &element) { DOM::Document doc = element.ownerDocument(); DOM::AbstractView view = doc.defaultView(); DOM::CSSStyleDeclaration styleDecl = view.getComputedStyle(element, DOM::DOMString()); unsigned long l = styleDecl.length(); cssProperties->clear(); cssProperties->setEnabled(true); QList<QTreeWidgetItem *> items; for (unsigned long i = 0; i < l; ++i) { DOM::DOMString name = styleDecl.item(i); DOM::DOMString value = styleDecl.getPropertyValue(name); QStringList values; values.append(name.string()); values.append(value.string()); items.append(new QTreeWidgetItem(static_cast<QTreeWidget*>(0), values)); } cssProperties->insertTopLevelItems(0, items); cssProperties->resizeColumnToContents(0); }