您的位置:首页 > 其它

WebKit之零散记录

2016-02-21 22:32 295 查看
1、采用Perl脚本生成binding文件的语句

E:\qt48\src\3rdparty\webkit\Source\WebCore\bindings\scripts\test\JS



perl generate-bindings.pl ./test/TestPC.idl --generator=JS --outputDir=./test/fhf --defines=DPC

2、chrome的隐藏url功能

chrome://system/

>>内存使用分布

>>OS版本和Chrome版本

chrome://bookmarks/

>>书签的管理

这是一个完美的Chrome的工具的设计效果

chrome://memory-redirect/

>>内存使用分布

chrome://plugins/

>>页面支持的插件

3、阅读webkit相关源码的零散疑问和记录

#客户关系

Chrome 、 ChromeClient、ChromeClientQt

ColorChooser、ColorChooserClient

DataTimerChooser、DataTimerChooserClient

FileChooser、?

PopupMenu、PopupMenuClient

SearchPopupMenu

FileIconLoader、?

HitTestRequest、HitTestResult

NavigationAction

Frame、FrameLoader、FrameLoaderRequest

Document、Page、Frame、Node

PlatformPageClient

设置光标

7、RenderTheme[Qt][Gtk][QtMobile]

>>RenderThemeQtMobile::create(page);作为默认的创建RenderTheme的工厂(Page->主题)

MobileQt是平台独立的Theme

>>相互之间可以进行Copy抄袭,作为各自的主题的设置。

8、ScrollbarTheme.h单独定制ScrollBar?

9、TimeRanges.h用于干什么?

10、含义

#if QT_VERSION >= 0x050000

#include <QStyleHints>

#endif

11、#include <wtf/Forward.h>是什么含义?

>>wtf负责智能指针的管理

12、FontData是什么?

13、FontDescription是什么?

14、FontSelector和FontSelectorClient的关系是什么?

15、解析的哪个阶段创建HTMLAnchorElement对象?

16、HTMLAnchorElement(tagName,Document*)

>>tagName表示名称

>>Document表示创建所归属的DOM树

17、m_hasRootEditaleElementForSelectionOnMouseDown的含义?

18、WebCore中字符串操作

static unsigned parsePortFromStringPosition(const String& value, unsigned portStart, unsigned& portEnd)

{

portEnd = portStart;

while (isASCIIDigit(value[portEnd]))

++portEnd;

return value.substring(portStart, portEnd - portStart).toUInt();

}

19、renderIsEditable()的含义?

>>isLink() 含义?

20、HTMLAnchorElement

>>defaultEventHandler(Event)

>>

21、进行HTML解析时,则会设置属性如isLink() 后期处理事件等需要判断用到。

22、事件的类型判断。

>>isEnterKeyKeydownEvent(event):Enter按键的话

>>isLinkClick(event:点击link跳转的话

>>event->type() == eventNames().mousedownEvent && event->isMouseEvent()

static_cast<MouseEvent*>(event)->button() != RightButton

>>event->type() == eventNames().mouseoverEvent

>>event->isMouseEvent()

>>event->type() == eventNames().keydownEvent

>>event->type() == eventNames().clickEvent

>>static_cast<MouseEvent*>(event)->button() != RightButton

>>event->isKeyboardEvent()

static_cast<KeyboardEvent*>(event)->keyIdentifier() == "Enter"

23、treatLinkAsLiveForEventType() 什么含义?

24、事件处理。

>>dispatchSimulatedClick(event);:将Enter事件模拟转换为Click事件进行触发。

>>event->setDefaultHandled();:设置事件处理的状态。

>>handleClick(event):将事件作为Click的事件进行处理。

25、FrameSelection(页面存在选中区域时)

>>document()->frame()->selection()

26、HTMLElement::defaultEventHandler() ??

27、// Don't set the link to be active if the current selection is in the same editable block as this link

document()->frame()->selection()->rootEditableElement() == rootEditableElement(

28、标签对应于哪个对象、Render哪个对象?

>>属性对应于是解析与哪个层次

>>常见标签 && 属性等访问

29、命名好坏

>>protocolIs(parsedURL, "http")

30、判断属性的类型

attribute.name().localName() == hrefAttr

31、获取属性的值

>>const AtomicString& value = getAttribute(draggableAttr);

>>if (equalIgnoringCase(value, "true"))

>>hasAttribute(hrefAttr);

>>getAttribute(targetAttr); //target属性

32、获取<a>的URL对象

>>return document()->completeURL(stripLeadingAndTrailingHTMLSpaces(getAttribute(hrefAttr)));

33、设置属性的值

>>setAttribute(hrefAttr, value);

34、URL的结构

>>http://www.baidu.com/#tagname (tagname为fragmentIdentifier)

35、整型值 与 String类型关系

String::number(url.port())

36、字符串的查找子串。

>>void HTMLAnchorElement::setHost(const String& value) (设计之优美)

>>size_t separator = value.find(':');

>>if (!separator)

>>if (separator == notFound)

>>url.setHost(value.substring(i));

37、KURL->host/protocolIs/port/search

38、isLiveLink():是否为一个活的link链接?

39、<a>存在ping属性吗?

>>void HTMLAnchorElement::sendPings(const KURL& destinationURL)

40、下载资源内容

>>frame->loader()->client()->startDownload(request, fastGetAttribute(downloadAttr));

>>frame->loader()->addExtraFieldsToMainResourceRequest(request);

41、<a>的rel属性,然后内部构建ResourceRequest ,最终借助于FrameLoader发出请求。

42、sendPings() 是什么函数?

43、WebCore中常见数据结构:

>>DEFINE_STATIC_LOCAL(RootEditableElementMap, map, ());

>>该宏的含义

44、引用局部方法

>>using std::min;

45、智能指针的总结/概括

>>return adoptRef(new HTMLElement(tagName, document));

46、元素->DOM文档,文档类型

>>document()->isHTMLDocument()

47、tagQName()的含义是什么??

>> hasLocalName(wbrTag)) ??

48、常见String的操作

>>return tagQName().localNameUpper();

49、宏 && Settings的联合开发的效果?

50、常见值

>>CSSValueWebkitPlaintext

>>CSSValueWebkitIsolate

51、操作CSS属性

>>addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitLocale, quoteCSSString(value));

52、HTMLElement 继承与 StyledElement

53、部分标签名是属于XMLNames

>>name.matches(XMLNames::langAttr

54、建立本地事件的Map表

AtomicString HTMLElement::eventNameForAttributeName(const QualifiedName& attrName) const

{

>>attributeNameToEventNameMap.set(onmouseoutAttr.localName(), eventNames().mouseoutEvent);

>>return attributeNameToEventNameMap.get(attrName.localName());

}

55、专门处理事件属性:

AtomicString eventName = eventNameForAttributeName(name);

if (!eventName.isNull())

setAttributeEventListener(eventName, createAttributeEventListener(this, name, value));

56、加速合成的模块->RenderLayer合成模块

#if USE(ACCELERATED_COMPOSITING)

#include "RenderLayerCompositor.h"

#endif

57、根据支持的模块,启动对应的文件(宏->Setting接口->对应功能文件)

#if ENABLE(TOUCH_EVENTS)

#include "TouchList.h"

#endif

58、文本编码U8、U16、U32、U64、U128

59、Document中对<tagName>的组成有效性进行严格的判断

>>static inline bool isValidNameStart(UChar32 c)

>>static inline bool isValidNamePart(UChar32 c)

>>url.isBlankURL(); #判断URL的类型

60、将Focus的Node转换为Widget对象。

static Widget* widgetForNode(Node* focusedNode)

>>Node->RenderObject

>>RenderObject->isWidget()类型,然后才能转换为Widget。

>>toRenderWidget(renderer)->widget();

61、编辑部件:frame->editor()

62、rangeOfContents(Node)返回值是什么含义?

63、遍历Frame树结构:

>>for (Frame* ancestorFrame = targetFrame; ancestorFrame; ancestorFrame = ancestorFrame->tree()->parent()) {

64、 SecurityOrigin是什么含义??

65、打印控制台信息:

>> frame->document()->url().string()

>> frame->document()->domWindow()->printErrorMessage(message);

66、需要样式重计算的Document专门存放于一个hash表进行管理

>> static HashSet<Document*>* documentsThatNeedStyleRecalc = 0;

67、Document->Frame->Node

68、Attr -> Element -> Node -> Document -> Frame -> Page -> WebView

>> provideContextFeaturesToDocumentFrom(this, m_frame->page());

>>Page具备更多的默认设置,可以用他们进行初始化Document

69、拥有Frame的元素

>> frame->ownerElement()

70、以下元素功能?

>> DocumentMarkerController

71、Loader系列

>> m_cachedResourceLoader = m_frame->loader()->activeDocumentLoader()->cachedResourceLoader();

>> m_cachedResourceLoader = CachedResourceLoader::create(0);

>> m_cachedResourceLoader->setDocument(this);

>> 大型对象的创建,往往伴随着大量的辅助设备的一起创建

72、宏的引入(相关文件、相关Settings、相关对象一并引入)

#if ENABLE(TEXT_AUTOSIZING)

m_textAutosizer = TextAutosizer::create(this);

#endif

73、对于超链接的效果操作:

>> resetLinkColor(); m_linkColor = Color(0, 0, 238);

>> resetVisitedLinkColor(); m_visitedLinkColor = Color(85, 26, 139);

>> resetActiveLinkColor() m_activeLinkColor.setNamedColor("red");

74、属性名

>> const WebCore::QualifiedName& attribute,

75、HTMLFrameOwnerElement

>>该对象什么含义?

76、该API是什么功能

>> ownerDocument->didRemoveEventTargetNode(this);

77、顶层文档

>> if (this == topDocument())

78、文档与样式的关系

if (m_styleSheetList)

m_styleSheetList->detachFromDocument();

79、解除解析关系?

>> detachParser();

80、Document的常见操作

>> Element* Document::getElementById(const AtomicString& id) const

return TreeScope::getElementById(id);

>> Document是抽象层的概念,本质的数据结构就是一个节点树(被Document封装化)

81、String::impl() 是什么类型?

82、节点遍历

>> ContainerNode* rootNode = scope->rootNode();

>> for (Element* element = ElementTraversal::firstWithin(rootNode); element; element = ElementTraversal::next(element, rootNode)) {

83、ShadowRoot到底是什么东西?

>> if (ShadowRoot* root = element->shadowRoot())

84、什么角色?什么功能?

>> SelectorQueryCache* Document::selectorQueryCache()

>> MediaQueryMatcher* Document::mediaQueryMatcher()

85、Document的实现

>> DOMImplementation* Document::implementation()

>> m_implementation = DOMImplementation::create(this);

86、Document 与 Mainfest的关系

>> 对于下载内容进行列举清单一般

>> documentElement() 是什么?

>> documentElement() && documentElement()->hasTagName(htmlTag) && documentElement()->hasAttribute(manifestAttr);

87、Document的层次性变化

>> void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)

88、Document的API,创建元素

>> PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionCode& ec)

89、自定义元素的含义?

90、文档片段的含义?

>> DocumentFragment::create(document());

91、根据数据创建文本节点

>> PassRefPtr<Text> Document::createTextNode(const String& data)

>> return Text::create(this, data);

>> 底层依赖于QFontEngine的支撑

92、元素的创建

>> PassRefPtr<Text> Document::createTextNode(const String& data)

return Text::create(this, data);

>> PassRefPtr<Comment> Document::createComment(const String& data)

return Comment::create(this, data);

>> PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionCode& ec)

return CDATASection::create(this, data);

>> PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionCode& ec)

return ProcessingInstruction::create(this, target, data);

>> PassRefPtr<EntityReference> Document::createEntityReference(const String& name, ExceptionCode& ec)

return EntityReference::create(this, name);

>> PassRefPtr<Text> Document::createEditingTextNode(const String& text)

return Text::createEditingText(this, text);

>> PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()

return MutableStylePropertySet::create()->ensureCSSStyleDeclaration();

>> 创节点、节点类型

>> RefPtr<Element> newElement = createElement(oldElement->tagQName(), false);

创建元素节点

>> newElement->cloneDataFromElement(*oldElement);

创建节点后的数据拷贝(决定是否为神拷贝,将所有的孩子全部进行拷贝)

>> newElement->appendChild(newChild.release(), ec);

93、基本类型判断

>> isHTMLDocument()

94、

>> Attr::create()

95、该函数的实现目的?

PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)

96、Document::creatElement()

>>会根据命名空间的URI采用不同的创建工厂

>> HTMLElementFactory::createHTMLElement(qName, this, 0, createdByParser);

>> SVGElementFactory::createSVGElement(qName, this, createdByParser);

>> MathMLElementFactory::createMathMLElement(qName, this, createdByParser);

>> e = Element::create(qName, document());

97、Document创建接口(封装settings)

98、语法的含义

DEFINE_STATIC_LOCAL(const String, loading, (ASCIILiteral("loading")));

99、意义?

ASSERT_NOT_REACHED();

100、状态改变的同时对外发送事件

>> dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false));

101、Document::view() => FrameView

>> FrameView* frameView = view();

102、判断是否需要Layout

>> bool needsLayout = frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout());

>> if (needsLayout)

>> updateLayout();

103、Document->RenderView的关系

>> if (RenderView* renderView = this->renderView())

104、获取编码(文本资源的解码器)

String Document::encoding() const

{

if (TextResourceDecoder* d = decoder())

return d->encoding().domName();

return String();

}

105、defaultCharset()默认字符集

>> return settings->defaultTextEncodingName();

106、样式更新

>> Recalculate style so language is used when selecting the initial font.

>> styleResolverChanged(DeferRecalcStyle);

107、设置值的一种新方式(变量 + 更新)

>> void Document::setDocumentURI(const String& uri)

>> m_documentURI = uri;

>> updateBaseURL();

108、setContent()是读取文本的关键函数

>> void Document::setContent(const String& content)

>> 核心分析的过程

109、根据(x,y)定位元素

>> Element* Document::elementFromPoint(int x, int y) const

>> return TreeScope::elementFromPoint(x, y);

110、实现原理的研究?、

>> PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y)

>> return Range::create(this, rangeCompliantPosition, rangeCompliantPosition);

111、updateTitle()

>> Document <title>XXXX</title>的更新操作

112、创建FormController

>> FormController& Document::formController()

>> m_formController = FormController::create();

113、树状遍历

>> return TreeWalker::create(root, whatToShow, filter, expandEntityReferences);

14、样式更新。

>> scheduleStyleRecalc(); 强行

>> updateStyleIfNeeded(); 有需要时更新

>> recalcStyle(NoChange);

>> updateStyleForAllDocuments() 调用的时机?

>> styleResolverChanged(RecalcStyleImmediately);

>> recalcStyle(Force);

15、Layout是从FrameView作为入口点的

>> if (frameView && frameView->isInLayout()) {

>> 如果已经处于layout状态时则不需要去更新

16、Document::ownerElement()的含义是什么?

17、重新layout操作

>> if (frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout()))

frameView->layout();

18、站在Document角度,为指定元素获取RenderStyle元素

PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Element* element)

19、是什么对象??为何掌管着样式

>> ensureStyleResolver()

20、BOX的margin的计算

>> marginTop = style->marginTop().isAuto() ? marginTop : intValueForLength(style->marginTop(), width, view);

21、StykeResolver()对象是干什么的?与CSS是什么关系??

22、Document::attach(AttachContext & context)

23、RenderArena::create();是什么含义??

24、遍历DOM树(Document只是发起一个号召)

>> 删除所有的事件监听器

EventTarget::removeAllEventListeners();

if (DOMWindow* domWindow = this->domWindow())

domWindow->removeAllEventListeners();

for (Node* node = firstChild(); node; node = NodeTraversal::next(node))

node->removeAllEventListeners();

25、为Document提供接口控制

>> ScriptExecutionContext::suspendActiveDOMObjects(why);

26、创建Document的解析器

PassRefPtr<DocumentParser> Document::createParser()

{

// FIXME: this should probably pass the frame instead

return XMLDocumentParser::create(this, view());

}

27、获取Document的body(frameset 或是body标签)

>> HTMLElement* Document::body() const

28、HTMLHeadElement* Document::head()

>>获取docuemntElement() 然后遍历Dom树,判断标签的类型即可

>> 最后强转

29、时间计算

>> return static_cast<int>((currentTime() - m_startTime) * 1000);

30、EventTarget、EventSource

>> DOMWindow() 作为事件触发的最后响应者

31、Document获取userAgent()属性

>> return frame() ? frame()->loader()->userAgent(url) : String();

32、操控ScriptController

>> frame()->script()->disableEval(errorMessage);

33、Hitest操作

>> MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& request, const LayoutPoint& documentPoint, const PlatformMouseEvent& event)

>> HitTestResult result(documentPoint);

>> renderView()->hitTest(request, result);

>> if (!request.readOnly())

>> updateHoverActiveState(request, result.innerElement(), &event);

34、Docuemtn获取StyleShettList信息

>> StyleSheetList* Document::styleSheets()

35、Docuemtn设置焦点元素的方法实现

>> bool Document::setFocusedElement(PassRefPtr<Element> prpNewFocusedElement, FocusDirection direction)

>> oldFocusedElement->dispatchBlurEvent(newFocusedElement);

发送事件是为了通知Node执行其它动作

>> oldFocusedElement->dispatchFocusOutEvent(eventNames().focusoutEvent, newFocusedElement); // DOM level 3 name for the bubbling blur event.

36、void Document::updateHoverActiveState(

const HitTestRequest& request,

Element* innerElement, const PlatformMouseEvent* event)

{

>>更新Hover的激活状态

>> Element* oldActiveElement = activeElement();

>> for (RenderObject* curr = oldActiveElement->renderer(); curr; curr = curr->parent()) {

element->setActive(false);

m_userActionElements.setInActiveChain(element, false);

setActiveElement(0);

37、WTF宏的实现机制和原理

>> WTF_MAKE_NONCOPYABLE(FontGlyphs);

38、WebCore中常见数据结构

>> HashMap

>> std::pair<GlyphData, GlyphPage*>

>> typedef HashMap<int, GlyphPageTreeNode*, DefaultHash<int>::Hash> GlyphPages;

39、设计启发

>> FontGlyphs内容庞大时,用Hash表进行存储数据GlyphPages。

>> 对于庞大对象的状态的管理,我们可以单独建立一个GlyphyPageStateSaver

>> 如果是小对象,我们也许没有必要只需要定义一个简单那的成员变量即可。

>> 定义子对象就是讲责任直接分配给你即可。

40、抽象概念

>> 管理者

>> 数据存储对象

>> 状态管理对象(相当于一个数据线连接一般)(push/pop--save restore一般,稳定且方便使用)

41、

create()接口、内部采用new进行封装~

42、

>> void ChromeClientQt::runJavaScriptAlert(Frame* f, const String& msg)

>> void QWebPage::javaScriptAlert(QWebFrame *frame, const QString& msg)

具体实现为弹出QMessageBox box(view()); 弹出的QMessageBox是QWebView的附着于QWebView对象的。

43、

GraphicsContext:绘制图形方面

ScriptExecutionContext:脚本、事件

Document:节点、属性等解析等

44、ScriptExecutionContext是一个抽象的概念。

>>Event、EventSource、EventTarget、EventListener、EventQueue

>>CachedScript、ScriptCallStack

#ScriptState表征的是JSC引擎的内部执行状态

>>typedef JSC::ExecState ScriptState;

45、节点、ScriptExecutionContext全部可以被转换为Document对象

46、QFile、QFileInfo、QMimeDatabase

>> 文件、文件类型

>> QBuffer、Type

>> 只有告诉一个事物的类型,才具备各自的意义。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: