What is the relationship between WebIDL and WebKitIDL
来源:互联网 发布:win10电脑优化软件 编辑:程序博客网 时间:2024/05/22 05:07
WebKit的JS Binding解析
WebKit提供了一组perl脚本完成IDL转换功能。入口脚本为generate-binding.pl, 示意图如下:
生成的接口通过JSNode与Node关联,从而实现了与DOM各组件的关联。
JSDocument会在初始化时被JSGlobalObject的addStaticGlobals压入一个jsNull到JSC的Heap, 在准备解析脚本前将一个对象通过JSDomWindowBase::updateDocument更新到JSC::Heap中,供JSC在执行期使用。Frame的setDocument方法也会在读到脚本时被调用,以更新合适的document对象到JSC。
当JavaScript以document为接口,呼叫如getElementById获取组件时, 其执行序列如下:
下面是jsDocumentPrototypeFunctionGetElementById的实现:
EncodedJSValue JSC_HOST_CALL jsDocumentPrototypeFunctionGetElementById(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
……
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->getElementById(elementId)));
return JSValue::encode(result);
}
*其中的impl就是通过JSNode接口关联到的Document对象.
参考:为JavaScript Binding添加新DOM对象的三种方式及实作
- What is the relationship between WebIDL and WebKitIDL
- what's annotations is in java? what's the relationship between annotation and reflection?
- What is the difference between test, [ and [[ ?
- what is the difference between the setTimeout and setInterval
- What is the difference between DHTML and the DOM?
- What is the difference between the mouseover and mouseenter events?
- The relationship between OpenCore and OMX
- The relationship between Swing,AWT and SWT.
- The relationship between Objects and Closures
- What is the difference between AWT and SWT?
- What is the difference between User Control and Custom Control?
- What is the difference between an EXE and a DLL?
- What is the difference between XML and C or C ?
- What is the difference between SMOD and CMOD?
- what is the difference between little-endian and big-endian.
- What is the difference between procedural and nonprocedural language?
- What is the difference between a thread and a process?
- What is the difference between objectForKey and valueForKey?
- c#抓取网页截屏代码
- mysql性能测试及不同版本的比较
- EJB3.0 有状态会话bean无状态会话bean详解
- 第一讲:Obj-C 基本语法
- android 本地抓包
- What is the relationship between WebIDL and WebKitIDL
- Java异常大全
- MVC Razor
- C语言 gets()和scanf()函数的区别
- Android获取应用程序的版本信息
- ListView的适配器BaseAdapter使用详解
- ListCtrl处理大数据时的方法之虚拟列表总结
- 5个人三门成绩的总分和平均分
- 复制对象