JSValue* JSCSSRule::getValueProperty(ExecState* exec, int token) const { switch (token) { case TypeAttrNum: { CSSRule* imp = static_cast<CSSRule*>(impl()); return jsNumber(imp->type()); } case CssTextAttrNum: { CSSRule* imp = static_cast<CSSRule*>(impl()); return jsStringOrNull(imp->cssText()); } case ParentStyleSheetAttrNum: { CSSRule* imp = static_cast<CSSRule*>(impl()); return toJS(exec, WTF::getPtr(imp->parentStyleSheet())); } case ParentRuleAttrNum: { CSSRule* imp = static_cast<CSSRule*>(impl()); return toJS(exec, WTF::getPtr(imp->parentRule())); } case ConstructorAttrNum: return getConstructor(exec); } return 0; }
JSValue jsCSSRuleParentRule(ExecState* exec, JSValue slotBase, const Identifier&) { JSCSSRule* castedThis = static_cast<JSCSSRule*>(asObject(slotBase)); UNUSED_PARAM(exec); CSSRule* imp = static_cast<CSSRule*>(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentRule())); return result; }
static v8::Handle<v8::Value> parentRuleAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { CSSRule* imp = V8CSSRule::toNative(info.Holder()); RefPtr<CSSRule> result = imp->parentRule(); v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined(); if (wrapper.IsEmpty()) { wrapper = toV8(result.get(), info.Holder(), info.GetIsolate()); if (!wrapper.IsEmpty()) V8DOMWrapper::setNamedHiddenReference(info.Holder(), "parentRule", wrapper); } return wrapper; }