查看: 1794| 回复: 1
跳转到指定楼层
上一主题 下一主题
收起左侧

[CareerCup] CareerCup 16.4

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
Write a step by step execution of things that happen after a user presses a key on the keyboard. Use as much detail as possible.

follow up, what happen if user is browing internet, how events like onClick() will be trigged?

上一篇:CareerCup 16.3
下一篇:careercup 16.5
🔗
 楼主| leonsu777 2012-10-11 23:20:00 | 只看该作者
全局:
本帖最后由 leonsu777 于 2012-10-12 00:55 编辑

1. keyboard controller received a scan code.
2. the keyboard controller interprets the code and stores it in buffer.
3. the keyboard controller send a hw interrupt to cpu. (via putting signal on "interrupt request line: IRQ1")
4. the interrupt controller unmask signal to maps IRQ1 into INT 9.
5. the process stop current task and invoke interrupt handler, fetch address of ISR from interrupt vector table.
6. ISR read scan code from port 60h, and decide whether to process it or pass the control to program for taking action. ----
hw and os part done
----
7. GUI toolkit(Qt/GTK/MFC)capature this event.
8. Event passed to Webkit(Webcore)
9. Webcore delegate this event to javascript engine's DOM document.
-----
Javascript Engine(part of Webkit) finally receive this Event.
-----
(when Webkit build DOM tree and Render tree. if it meets onClick() attribute, it will register a unique eventlistener on document
document handle all eventlisteners(jsLazyEventListener).)
10. windows.document is singleton that handle all eventlisteners.
11. pasing the Render Tree to find the eventTargetNode(in DOM) which contains all the event tree nodes.
12. get attributes of onClick() on those html nodes.
13. parse this String into a AST tree to intepret it. function definiton, parameters, var....
14. exec() it.

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表