my webkit FAQ

来源:互联网 发布:杭州城市骑行大数据 编辑:程序博客网 时间:2024/06/05 15:37

转载请注明出处:http://blog.csdn.net/awebkit

1 paint phase

In RenderObject.h there are 12 phases of painting. Please explain what do these mean and in which sequence they are called. If there is some documentation already (either in code or on the website), please give me a link. Thank you.

enum PaintPhase {
    PaintPhaseBlockBackground,
    PaintPhaseChildBlockBackground,
    PaintPhaseChildBlockBackgrounds,
    PaintPhaseFloat,
    PaintPhaseForeground,
    PaintPhaseOutline,
    PaintPhaseChildOutlines,
    PaintPhaseSelfOutline,
    PaintPhaseSelection,
    PaintPhaseCollapsedTableBorders,
    PaintPhaseTextClip,
    PaintPhaseMask
};
You should look at the CSS specifications. That defines the order
of painting the various layers in each block stacking context. The code
in WebKit follows each of the layers in the stack with one render pass
for each of them.

       There is a good video somewhere that Eric Seidel describes the
rendering inside WebKit that covers this.
http://www.youtube.com/watch?v=RVnARGhhs9w

2. 何时下载
content-disposition
IE资料
http://support.microsoft.com/kb/260519


google 文档
http://code.google.com/p/browsersec/wiki/Part2#Downloads_and_Content-Disposition


3. js对网页的影响
   因为JS脚本的一些执行结果可能会在后续的HTML中使用,所以浏览器在遇到script标签的时候,一定会查找对应的结束标签,然后下载并执行JS。也就是说,JS的执行不是异步的,这样,会影响到后续标签的解析。
   当显式的在script标签中加了defer后,js是不会执行的,但是下载还是顺序的。
   webkit在解析script标签的时候,会走到HTMLTokenizer.cpp中的SearchEnd,在这里会processToken,然后到HTMLParser::parseToken,然后是Element类的Element::setAttributeMap,通知attributeChanged。在这里StyledElement就开始接管了。


4. MIME那些事
firefox关于MIME的介绍
https://developer.mozilla.org/en/how_mozilla_determines_mime_types

我们要重点关注一下MIME探测。
我们注意这句话

Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource.

不过我们还是需要探测,即使给了Content-Type

这里讲解的更加详细

http://kb.mozillazine.org/File_types_and_download_actions

我们看看IE 的MIME 探测
http://netsecurity.51cto.com/art/200902/112190.htm

5. 旧博客文章

[转贴]WebKit网页布局实现之基本概念及标准篇

WebKit网页布局实现之主要数据结构篇

WebKit网页布局实现之主要数据结构篇之二