Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
808c2d6c
Commit
808c2d6c
authored
Nov 19, 2015
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added support for getElementsByTagName in document fragment nodes.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ef127cae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
24 deletions
+72
-24
htmldoc.c
dlls/mshtml/htmldoc.c
+36
-10
dom.c
dlls/mshtml/tests/dom.c
+36
-14
No files found.
dlls/mshtml/htmldoc.c
View file @
808c2d6c
...
...
@@ -2371,19 +2371,45 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
v
),
pelColl
);
if
(
!
This
->
doc_node
->
nsdoc
)
{
WARN
(
"NULL nsdoc
\n
"
);
return
E_UNEXPECTED
;
}
if
(
This
->
doc_node
->
nsdoc
)
{
nsAString_InitDepend
(
&
id_str
,
v
);
nsres
=
nsIDOMHTMLDocument_GetElementsByTagName
(
This
->
doc_node
->
nsdoc
,
&
id_str
,
&
nslist
);
nsAString_Finish
(
&
id_str
);
if
(
FAILED
(
nsres
))
{
ERR
(
"GetElementByName failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
}
else
{
nsIDOMDocumentFragment
*
docfrag
;
nsAString
nsstr
;
if
(
v
)
{
const
WCHAR
*
ptr
;
for
(
ptr
=
v
;
*
ptr
;
ptr
++
)
{
if
(
!
isalnumW
(
*
ptr
))
{
FIXME
(
"Unsupported invalid tag %s
\n
"
,
debugstr_w
(
v
));
return
E_NOTIMPL
;
}
}
}
nsAString_InitDepend
(
&
id_str
,
v
);
nsres
=
nsIDOMHTMLDocument_GetElementsByTagName
(
This
->
doc_node
->
nsdoc
,
&
id_str
,
&
nslist
);
nsAString_Finish
(
&
id_str
);
if
(
FAILED
(
nsres
))
{
ERR
(
"GetElementByName failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
nsres
=
nsIDOMNode_QueryInterface
(
This
->
doc_node
->
node
.
nsnode
,
&
IID_nsIDOMDocumentFragment
,
(
void
**
)
&
docfrag
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMDocumentFragment iface: %08x
\n
"
,
nsres
);
return
E_UNEXPECTED
;
}
nsAString_InitDepend
(
&
nsstr
,
v
);
nsres
=
nsIDOMDocumentFragment_QuerySelectorAll
(
docfrag
,
&
nsstr
,
&
nslist
);
nsAString_Finish
(
&
nsstr
);
nsIDOMDocumentFragment_Release
(
docfrag
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"QuerySelectorAll failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
}
*
pelColl
=
create_collection_from_nodelist
(
This
->
doc_node
,
nslist
);
nsIDOMNodeList_Release
(
nslist
);
...
...
dlls/mshtml/tests/dom.c
View file @
808c2d6c
...
...
@@ -2693,6 +2693,35 @@ static void _test_elem_getelembytag(unsigned line, IUnknown *unk, elem_type_t ty
IHTMLElementCollection_Release
(
col
);
}
#define test_doc_getelembytag(a,b,c,d) _test_doc_getelembytag(__LINE__,a,b,c,d)
static
void
_test_doc_getelembytag
(
unsigned
line
,
IHTMLDocument2
*
unk
,
const
char
*
tag
,
elem_type_t
type
,
LONG
exlen
)
{
IHTMLDocument3
*
doc
=
_get_doc3_iface
(
line
,
unk
);
IHTMLElementCollection
*
col
=
NULL
;
elem_type_t
*
types
=
NULL
;
BSTR
tmp
;
int
i
;
HRESULT
hres
;
tmp
=
a2bstr
(
elem_type_infos
[
type
].
tag
);
hres
=
IHTMLDocument3_getElementsByTagName
(
doc
,
tmp
,
&
col
);
SysFreeString
(
tmp
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"getElementByTagName failed: %08x
\n
"
,
hres
);
ok_
(
__FILE__
,
line
)
(
col
!=
NULL
,
"col == NULL
\n
"
);
if
(
exlen
)
{
types
=
HeapAlloc
(
GetProcessHeap
(),
0
,
exlen
*
sizeof
(
elem_type_t
));
for
(
i
=
0
;
i
<
exlen
;
i
++
)
types
[
i
]
=
type
;
}
_test_elem_collection
(
line
,
(
IUnknown
*
)
col
,
types
,
exlen
);
HeapFree
(
GetProcessHeap
(),
0
,
types
);
IHTMLElementCollection_Release
(
col
);
IHTMLDocument3_Release
(
doc
);
}
#define test_elem_innertext(e,t) _test_elem_innertext(__LINE__,e,t)
static
void
_test_elem_innertext
(
unsigned
line
,
IHTMLElement
*
elem
,
const
char
*
extext
)
{
...
...
@@ -8283,20 +8312,7 @@ static void test_elems(IHTMLDocument2 *doc)
}
IDispatch_Release
(
disp
);
hres
=
IHTMLDocument2_QueryInterface
(
doc
,
&
IID_IHTMLDocument3
,
(
void
**
)
&
doc3
);
ok
(
hres
==
S_OK
,
"Could not get IHTMLDocument3 iface: %08x
\n
"
,
hres
);
str
=
a2bstr
(
"Img"
);
hres
=
IHTMLDocument3_getElementsByTagName
(
doc3
,
str
,
&
col
);
ok
(
hres
==
S_OK
,
"getElementsByTagName(%s) failed: %08x
\n
"
,
wine_dbgstr_w
(
str
),
hres
);
SysFreeString
(
str
);
if
(
hres
==
S_OK
)
{
static
const
elem_type_t
img_types
[]
=
{
ET_IMG
};
test_elem_collection
((
IUnknown
*
)
col
,
img_types
,
sizeof
(
img_types
)
/
sizeof
(
img_types
[
0
]));
IHTMLElementCollection_Release
(
col
);
}
test_doc_getelembytag
(
doc
,
"Img"
,
ET_IMG
,
1
);
elem
=
get_doc_elem_by_id
(
doc
,
"y"
);
test_elem_set_innerhtml
((
IUnknown
*
)
elem
,
"inner html"
);
...
...
@@ -8313,6 +8329,9 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLElement_Release
(
elem2
);
IHTMLElement_Release
(
elem
);
hres
=
IHTMLDocument2_QueryInterface
(
doc
,
&
IID_IHTMLDocument3
,
(
void
**
)
&
doc3
);
ok
(
hres
==
S_OK
,
"Could not get IHTMLDocument3 iface: %08x
\n
"
,
hres
);
hres
=
IHTMLDocument3_recalc
(
doc3
,
VARIANT_TRUE
);
ok
(
hres
==
S_OK
,
"recalc failed: %08x
\n
"
,
hres
);
...
...
@@ -9263,6 +9282,9 @@ static void test_docfrag(IHTMLDocument2 *doc)
test_elem_source_index
(
br
,
0
);
IHTMLElement_Release
(
br
);
test_doc_getelembytag
(
frag
,
"a"
,
ET_A
,
0
);
test_doc_getelembytag
(
frag
,
"Br"
,
ET_BR
,
1
);
div
=
get_elem_by_id
(
doc
,
"divid"
,
TRUE
);
test_node_append_child
((
IUnknown
*
)
div
,
(
IUnknown
*
)
frag
);
IHTMLElement_Release
(
div
);
...
...
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