查看RenderObject树的内部表示
来源:互联网 发布:万达电商 淘宝卖货 编辑:程序博客网 时间:2024/05/16 12:05
有时候我们需要知道自己写的页面排版的具体细节,DumpRenderTree是个不错工具。它位于WebKit/WebKitBuild/[Debug|Release]/bin目录下,直接运行会出错:
gdb ./DumpRenderTree
./DumpRenderTree http://192.168.1.100/BoxModeofCSS.html
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGABRT, Aborted.
0x00007ffff2e89cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56 ../nptl/sysdeps/unix/sysv/linux/raise.c: 没有那个文件或目录.
查看callstack:
(gdb) bt
#0 0x00007ffff2e89cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff2e8d0d8 in __GI_abort () at abort.c:89
#2 0x00007ffff37c3247 in qt_message_output (msgType=QtFatalMsg,
buf=0x654758 "\n\n", '-' <repeats 70 times>, "\nWEBKIT_TESTFONTS environment variable is not set correctly.\nThis variable has to point to the directory containing the fonts\nyo"...) at Qt/src/corelib/global/qglobal.cpp:2323
#3 0x00007ffff37c32f2 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg,
msg=0x42ebc0 "\n\n", '-' <repeats 70 times>, "\nWEBKIT_TESTFONTS environment variable is not set correctly.\nThis variable has to point to the directory containing the fonts\nyo"..., ap=0x7fffffffd998) at Qt/src/corelib/global/qglobal.cpp:2369
#4 0x00007ffff37c389a in qFatal (
msg=0x42ebc0 "\n\n", '-' <repeats 70 times>, "\nWEBKIT_TESTFONTS environment variable is not set correctly.\nThis variable has to point to the directory containing the fonts\nyo"...) at Qt/src/corelib/global/qglobal.cpp:2552
#5 0x0000000000425432 in WebKit::initializeTestFonts () Tools/DumpRenderTree/qt/QtInitializeTestFonts.cpp:62
#6 0x0000000000426bf0 in main (argc=2, argv=0x7fffffffdda8) Tools/DumpRenderTree/qt/main.cpp:147
原来是没有依赖的字体,随便找一个字体:locate fonts.conf
WebKit-r174650/Tools/WebKitTestRunner/gtk/fonts/fonts.conf
WebKit/Tools/DumpRenderTree/chromium/fonts.conf
WebKit/Tools/DumpRenderTree/gtk/fonts/fonts.conf
export WEBKIT_TESTFONTS=/opt/src/webkit/Tools/DumpRenderTree/gtk/fonts/
这回就可以运行了:
./DumpRenderTree http://192.168.1.100/BoxModelofCSS.html
ERROR: Application Cache Storage: failed to execute statement "DELETE FROM CacheGroups" error "no such table: CacheGroups"
webkit/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp(561) : bool WebCore::ApplicationCacheStorage::executeSQLCommand(const WTF::String&)
ERROR: Application Cache Storage: failed to execute statement "DELETE FROM Caches" error "no such table: Caches"
webkit//Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp(561) : bool WebCore::ApplicationCacheStorage::executeSQLCommand(const WTF::String&)
ERROR: Application Cache Storage: failed to execute statement "DELETE FROM Origins" error "no such table: Origins"
webkit//Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp(561) : bool WebCore::ApplicationCacheStorage::executeSQLCommand(const WTF::String&)
Source:
<html><head>
<style type="text/css">
#adiv /*id 选择器*/
{
width: 300px;
background-color: #efefef;
border: 10px solid black;
}
</style>
<style type="text/css">
.aclass /*class 选择器*/
{
border: 5px solid red;
margin: 150px 100px 10px 40px;
padding: 15px 20px 25px 30px;
color: rgb(250,0,0);
}
</style>
</head>
<body>
<p>This layout mechanizm of CSS</p>
<div id="adiv">
<div class="aclass"> A B C D E F G H I J K L M N O P Q R S T</div>
</div>
</body></html>
Content-Type: text/plain
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x17
RenderText {#text} at (0,0) size 448x17
text run at (0,0) width 448: "This layout mechanizm of CSS"
RenderBlock {DIV} at (0,33) size 320x349 [bgcolor=#EFEFEF] [border: (10px solid #000000)]
RenderBlock {DIV} at (50,160) size 160x169 [color=#FA0000] [border: (5px solid #FF0000)]
RenderText {#text} at (35,20) size 80x119
text run at (35,20) width 80: "A B C"
text run at (35,37) width 80: "D E F"
text run at (35,54) width 80: "G H I"
text run at (35,71) width 80: "J K L"
text run at (35,88) width 80: "M N O"
text run at (35,105) width 80: "P Q R"
text run at (35,122) width 48: "S T"
#EOF
#EOF
#EOF
LEAK: 26 WebCoreNode
红色的是有些错误,别理他,没事。蓝色的是我写的页面,紫色的就是我们要的RenderObject树,可视化的页面元素打印也是按照树型排列,好看吧。
- 查看RenderObject树的内部表示
- 查看数字在计算机内部的二进制表示
- webkit dom 是如何创建renderobject的
- 字符串常量的内部表示
- java 数字的内部表示
- DOM树、RenderObject树、RenderLayer树
- Render树、RenderObject与RenderLayer (补充)
- 第4章 文件的内部表示
- 第四章 文件系统的内部表示
- 查看电脑内部的配置
- 查看 wininet 内部的 serverinfo cache
- Erlang如何查看gen_server内部的状态
- kprobes查看内核内部信息的使用方法
- 深入了解整数在计算机内部的表示
- 无法转换为内部表示
- 无法转换为内部表示
- linux硬件设备的表示方法及查看工具
- 查看oracle内部事件
- 【浅墨Unity3D Shader编程】之六 暗黑城堡篇: 表面着色器(Surface Shader)的写法(一)
- C#程序员整理的Unity 3D笔记(十五):Unity 3D UI控件至尊–NGUI
- POJ 2251--Dungeon Master【BFS】
- ACM--steps--4.2.3--A strange lift
- 泛函编程(5)-数据结构(Functional Data Structures)
- 查看RenderObject树的内部表示
- as…as 结构用法详解
- Debug your ASP.NET Application while Hosted on IIS
- memory dump analysis anthology volume 7 online
- Consecutive Numbers
- new/delete和malloc/free异同
- HTML+CSS基础知识整理总结2015.3.10
- 【浅墨Unity3D Shader编程】之一 夏威夷篇:游戏场景的创建 & 第一个Shader的书写
- C++字符串操作整理