Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HybridOS
hiDOMLayout
Commits
78f23460
Commit
78f23460
authored
May 16, 2022
by
XueShuming
Browse files
add print
parent
a182f4dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/layout_pcdom_element.c
View file @
78f23460
...
...
@@ -97,21 +97,30 @@ void destory_user_data(void* data)
}
void
print_node_info
(
HLDomElementNode
*
node
,
void
*
user_data
)
void
print_layout_info
(
pcdom_element_t
*
node
)
{
fprintf
(
stderr
,
"................................node=%s|id=%s
\n
"
,
hilayout_element_node_get_tag_name
(
node
),
hilayout_element_node_get_id
(
node
));
if
(
node
->
node
.
type
==
PCDOM_NODE_TYPE_TEXT
||
node
->
node
.
type
==
PCDOM_NODE_TYPE_UNDEF
)
{
return
;
}
const
char
*
name
=
pcdom_element_tag_name
(
node
,
NULL
);
const
char
*
id
=
pcdom_element_get_attribute
(
node
,
"id"
,
2
,
NULL
);
const
HLUsedBoxValues
*
box
=
hilayout_get_pcdom_layout_box
(
node
);
fprintf
(
stderr
,
"node|name=%s|id=%s|(x,y,w,h)=(%f,%f,%f,%f)
\n
"
,
name
,
id
,
box
->
x
,
box
->
y
,
box
->
w
,
box
->
h
);
}
void
print_layout_
node
(
HLContext
*
ctx
,
HiLayoutNode
*
node
,
void
*
user_data
)
void
print_layout_
result
(
pcdom_element_t
*
elem
)
{
if
(
hi_layout_node_get_type
(
node
)
==
DOM_UNDEF
)
{
fprintf
(
stderr
,
"................................node=UNDEF
\n
"
);
}
else
{
const
char
*
name
=
hi_layout_node_get_name
(
node
);
fprintf
(
stderr
,
"................................node=%s
\n
"
,
name
);
print_layout_info
(
elem
);
pcdom_element_t
*
child
=
(
pcdom_element_t
*
)
elem
->
node
.
first_child
;
while
(
child
)
{
print_layout_result
(
child
);
child
=
(
pcdom_element_t
*
)
child
->
node
.
next
;
}
}
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -177,6 +186,7 @@ int main(int argc, char **argv)
fprintf
(
stderr
,
"####################################### layout ###########################
\n
"
);
ret
=
hilayout_do_pcdom_layout
(
&
hl_media
,
css
,
root
);
print_layout_result
(
root
);
hilayout_css_destroy
(
css
);
pchtml_html_document_destroy
(
doc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment