Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
59c66e34
Commit
59c66e34
authored
Oct 13, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 14, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added IHTMLElement::put_innerText implementation.
parent
3fc0c731
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
136 additions
and
54 deletions
+136
-54
htmlelem.c
dlls/mshtml/htmlelem.c
+41
-2
dom.c
dlls/mshtml/tests/dom.c
+95
-52
No files found.
dlls/mshtml/htmlelem.c
View file @
59c66e34
...
...
@@ -832,8 +832,47 @@ static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
static
HRESULT
WINAPI
HTMLElement_put_innerText
(
IHTMLElement
*
iface
,
BSTR
v
)
{
HTMLElement
*
This
=
HTMLELEM_THIS
(
iface
);
FIXME
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
v
));
return
E_NOTIMPL
;
nsIDOMNode
*
nschild
,
*
tmp
;
nsIDOMText
*
text_node
;
nsAString
text_str
;
nsresult
nsres
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
v
));
while
(
1
)
{
nsres
=
nsIDOMHTMLElement_GetLastChild
(
This
->
nselem
,
&
nschild
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetLastChild failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
if
(
!
nschild
)
break
;
nsres
=
nsIDOMHTMLElement_RemoveChild
(
This
->
nselem
,
nschild
,
&
tmp
);
nsIDOMNode_Release
(
nschild
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"RemoveChild failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsIDOMNode_Release
(
tmp
);
}
nsAString_Init
(
&
text_str
,
v
);
nsres
=
nsIDOMHTMLDocument_CreateTextNode
(
This
->
node
.
doc
->
nsdoc
,
&
text_str
,
&
text_node
);
nsAString_Finish
(
&
text_str
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"CreateTextNode failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsIDOMHTMLElement_AppendChild
(
This
->
nselem
,
(
nsIDOMNode
*
)
text_node
,
&
tmp
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"AppendChild failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsIDOMNode_Release
(
tmp
);
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLElement_get_innerText
(
IHTMLElement
*
iface
,
BSTR
*
p
)
...
...
dlls/mshtml/tests/dom.c
View file @
59c66e34
...
...
@@ -559,6 +559,58 @@ static void _test_elem_type(unsigned line, IUnknown *unk, elem_type_t type)
_test_disp
(
line
,
unk
,
elem_type_infos
[
type
].
dispiid
);
}
#define get_node_type(n) _get_node_type(__LINE__,n)
static
long
_get_node_type
(
unsigned
line
,
IUnknown
*
unk
)
{
IHTMLDOMNode
*
node
=
_get_node_iface
(
line
,
unk
);
long
type
=
-
1
;
HRESULT
hres
;
hres
=
IHTMLDOMNode_get_nodeType
(
node
,
&
type
);
ok
(
hres
==
S_OK
,
"get_nodeType failed: %08x
\n
"
,
hres
);
IHTMLDOMNode_Release
(
node
);
return
type
;
}
#define get_child_nodes(u) _get_child_nodes(__LINE__,u)
static
IHTMLDOMChildrenCollection
*
_get_child_nodes
(
unsigned
line
,
IUnknown
*
unk
)
{
IHTMLDOMNode
*
node
=
_get_node_iface
(
line
,
unk
);
IHTMLDOMChildrenCollection
*
col
=
NULL
;
IDispatch
*
disp
;
HRESULT
hres
;
hres
=
IHTMLDOMNode_get_childNodes
(
node
,
&
disp
);
IHTMLDOMNode_Release
(
node
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"get_childNodes failed: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
NULL
;
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IHTMLDOMChildrenCollection
,
(
void
**
)
&
col
);
IDispatch_Release
(
disp
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"Could not get IHTMLDOMChildrenCollection: %08x
\n
"
,
hres
);
return
col
;
}
#define get_child_item(c,i) _get_child_item(__LINE__,c,i)
static
IHTMLDOMNode
*
_get_child_item
(
unsigned
line
,
IHTMLDOMChildrenCollection
*
col
,
long
idx
)
{
IHTMLDOMNode
*
node
=
NULL
;
IDispatch
*
disp
;
HRESULT
hres
;
hres
=
IHTMLDOMChildrenCollection_item
(
col
,
idx
,
&
disp
);
ok
(
hres
==
S_OK
,
"item failed: %08x
\n
"
,
hres
);
node
=
_get_node_iface
(
line
,
(
IUnknown
*
)
disp
);
IDispatch_Release
(
disp
);
return
node
;
}
#define test_elem_attr(e,n,v) _test_elem_attr(__LINE__,e,n,v)
static
void
_test_elem_attr
(
unsigned
line
,
IHTMLElement
*
elem
,
LPCWSTR
name
,
LPCWSTR
exval
)
{
...
...
@@ -1027,6 +1079,44 @@ static void _test_elem_innertext(unsigned line, IHTMLElement *elem, const char *
SysFreeString
(
text
);
}
#define test_elem_set_innertext(e,t) _test_elem_set_innertext(__LINE__,e,t)
static
void
_test_elem_set_innertext
(
unsigned
line
,
IHTMLElement
*
elem
,
const
char
*
text
)
{
IHTMLDOMChildrenCollection
*
col
;
BSTR
str
;
HRESULT
hres
;
str
=
a2bstr
(
text
);
hres
=
IHTMLElement_put_innerText
(
elem
,
str
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"put_innerText failed: %08x
\n
"
,
hres
);
SysFreeString
(
str
);
_test_elem_innertext
(
line
,
elem
,
text
);
col
=
_get_child_nodes
(
line
,
(
IUnknown
*
)
elem
);
ok
(
col
!=
NULL
,
"col == NULL
\n
"
);
if
(
col
)
{
long
length
=
0
,
type
;
IHTMLDOMNode
*
node
;
hres
=
IHTMLDOMChildrenCollection_get_length
(
col
,
&
length
);
ok
(
hres
==
S_OK
,
"get_length failed: %08x
\n
"
,
hres
);
ok
(
length
==
1
,
"length = %ld
\n
"
,
length
);
node
=
_get_child_item
(
line
,
col
,
0
);
ok
(
node
!=
NULL
,
"node == NULL
\n
"
);
if
(
node
)
{
type
=
_get_node_type
(
line
,
(
IUnknown
*
)
node
);
ok
(
type
==
3
,
"type=%ld
\n
"
,
type
);
IHTMLDOMNode_Release
(
node
);
}
IHTMLDOMChildrenCollection_Release
(
col
);
}
}
#define get_first_child(n) _get_first_child(__LINE__,n)
static
IHTMLDOMNode
*
_get_first_child
(
unsigned
line
,
IUnknown
*
unk
)
{
...
...
@@ -1069,21 +1159,6 @@ static IHTMLDOMNode *_test_node_get_parent(unsigned line, IUnknown *unk)
return
parent
;
}
#define get_node_type(n) _get_node_type(__LINE__,n)
static
long
_get_node_type
(
unsigned
line
,
IUnknown
*
unk
)
{
IHTMLDOMNode
*
node
=
_get_node_iface
(
line
,
unk
);
long
type
=
-
1
;
HRESULT
hres
;
hres
=
IHTMLDOMNode_get_nodeType
(
node
,
&
type
);
ok
(
hres
==
S_OK
,
"get_nodeType failed: %08x
\n
"
,
hres
);
IHTMLDOMNode_Release
(
node
);
return
type
;
}
#define test_elem_get_parent(u) _test_elem_get_parent(__LINE__,u)
static
IHTMLElement
*
_test_elem_get_parent
(
unsigned
line
,
IUnknown
*
unk
)
{
...
...
@@ -1351,27 +1426,6 @@ static void _test_input_put_value(unsigned line, IUnknown *unk, const char *val)
IHTMLInputElement_Release
(
input
);
}
#define get_child_nodes(u) _get_child_nodes(__LINE__,u)
static
IHTMLDOMChildrenCollection
*
_get_child_nodes
(
unsigned
line
,
IUnknown
*
unk
)
{
IHTMLDOMNode
*
node
=
_get_node_iface
(
line
,
unk
);
IHTMLDOMChildrenCollection
*
col
=
NULL
;
IDispatch
*
disp
;
HRESULT
hres
;
hres
=
IHTMLDOMNode_get_childNodes
(
node
,
&
disp
);
IHTMLDOMNode_Release
(
node
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"get_childNodes failed: %08x
\n
"
,
hres
);
if
(
FAILED
(
hres
))
return
NULL
;
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IHTMLDOMChildrenCollection
,
(
void
**
)
&
col
);
IDispatch_Release
(
disp
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"Could not get IHTMLDOMChildrenCollection: %08x
\n
"
,
hres
);
return
col
;
}
#define test_elem_class(u,c) _test_elem_class(__LINE__,u,c)
static
void
_test_elem_class
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exclass
)
{
...
...
@@ -1431,22 +1485,6 @@ static void _test_elem_set_class(unsigned line, IUnknown *unk, const char *class
_test_elem_class
(
line
,
unk
,
class
);
}
#define get_child_item(c,i) _get_child_item(__LINE__,c,i)
static
IHTMLDOMNode
*
_get_child_item
(
unsigned
line
,
IHTMLDOMChildrenCollection
*
col
,
long
idx
)
{
IHTMLDOMNode
*
node
=
NULL
;
IDispatch
*
disp
;
HRESULT
hres
;
hres
=
IHTMLDOMChildrenCollection_item
(
col
,
idx
,
&
disp
);
ok
(
hres
==
S_OK
,
"item failed: %08x
\n
"
,
hres
);
node
=
_get_node_iface
(
line
,
(
IUnknown
*
)
disp
);
IDispatch_Release
(
disp
);
return
node
;
}
#define test_elem_id(e,i) _test_elem_id(__LINE__,e,i)
static
void
_test_elem_id
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exid
)
{
...
...
@@ -3141,6 +3179,11 @@ static void test_elems(IHTMLDocument2 *doc)
test_stylesheets
(
doc
);
test_create_option_elem
(
doc
);
elem
=
get_doc_elem_by_id
(
doc
,
tblW
);
ok
(
elem
!=
NULL
,
"elem = NULL
\n
"
);
test_elem_set_innertext
(
elem
,
"inner text"
);
IHTMLElement_Release
(
elem
);
test_doc_title
(
doc
,
"test"
);
test_doc_set_title
(
doc
,
"test title"
);
test_doc_title
(
doc
,
"test title"
);
...
...
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