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
8d7066b2
Commit
8d7066b2
authored
Jun 23, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added support to accessing child nodes by index in IHTMLDOMChildrenCollection.
parent
c8284724
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
5 deletions
+120
-5
htmlnode.c
dlls/mshtml/htmlnode.c
+74
-5
dom.c
dlls/mshtml/tests/dom.c
+46
-0
No files found.
dlls/mshtml/htmlnode.c
View file @
8d7066b2
...
...
@@ -180,6 +180,58 @@ static HRESULT WINAPI HTMLDOMChildrenCollection_item(IHTMLDOMChildrenCollection
return
S_OK
;
}
#define DISPID_CHILDCOL_0 MSHTML_DISPID_CUSTOM_MIN
static
HRESULT
HTMLDOMChildrenCollection_get_dispid
(
IUnknown
*
iface
,
BSTR
name
,
DWORD
flags
,
DISPID
*
dispid
)
{
HTMLDOMChildrenCollection
*
This
=
HTMLCHILDCOL_THIS
(
iface
);
WCHAR
*
ptr
;
DWORD
idx
=
0
;
PRUint32
len
=
0
;
for
(
ptr
=
name
;
*
ptr
&&
isdigitW
(
*
ptr
);
ptr
++
)
idx
=
idx
*
10
+
(
*
ptr
-
'0'
);
if
(
*
ptr
)
return
DISP_E_UNKNOWNNAME
;
nsIDOMNodeList_GetLength
(
This
->
nslist
,
&
len
);
if
(
idx
>=
len
)
return
DISP_E_UNKNOWNNAME
;
*
dispid
=
DISPID_CHILDCOL_0
+
idx
;
TRACE
(
"ret %x
\n
"
,
*
dispid
);
return
S_OK
;
}
static
HRESULT
HTMLDOMChildrenCollection_invoke
(
IUnknown
*
iface
,
DISPID
id
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
params
,
VARIANT
*
res
,
EXCEPINFO
*
ei
,
IServiceProvider
*
caller
)
{
HTMLDOMChildrenCollection
*
This
=
HTMLCHILDCOL_THIS
(
iface
);
TRACE
(
"(%p)->(%x %x %x %p %p %p %p)
\n
"
,
This
,
id
,
lcid
,
flags
,
params
,
res
,
ei
,
caller
);
switch
(
flags
)
{
case
INVOKE_PROPERTYGET
:
{
IDispatch
*
disp
=
NULL
;
HRESULT
hres
;
hres
=
IHTMLDOMChildrenCollection_item
(
HTMLCHILDCOL
(
This
),
id
-
DISPID_CHILDCOL_0
,
&
disp
);
if
(
0
&&
FAILED
(
hres
))
return
hres
;
V_VT
(
res
)
=
VT_DISPATCH
;
V_DISPATCH
(
res
)
=
disp
;
break
;
}
default:
FIXME
(
"unimplemented flags %x
\n
"
,
flags
);
return
E_NOTIMPL
;
}
return
S_OK
;
}
#undef HTMLCHILDCOL_THIS
static
const
IHTMLDOMChildrenCollectionVtbl
HTMLDOMChildrenCollectionVtbl
=
{
...
...
@@ -199,8 +251,14 @@ static const tid_t HTMLDOMChildrenCollection_iface_tids[] = {
IHTMLDOMChildrenCollection_tid
,
0
};
static
const
dispex_static_data_vtbl_t
HTMLDOMChildrenCollection_dispex_vtbl
=
{
HTMLDOMChildrenCollection_get_dispid
,
HTMLDOMChildrenCollection_invoke
};
static
dispex_static_data_t
HTMLDOMChildrenCollection_dispex
=
{
NULL
,
&
HTMLDOMChildrenCollection_dispex_vtbl
,
DispDOMChildrenCollection_tid
,
NULL
,
HTMLDOMChildrenCollection_iface_tids
...
...
@@ -374,11 +432,11 @@ static HRESULT WINAPI HTMLDOMNode_insertBefore(IHTMLDOMNode *iface, IHTMLDOMNode
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
HTMLDOMNode_removeChild
(
IHTMLDOMNode
*
iface
,
IHTMLDOMNode
*
new
Child
,
static
HRESULT
WINAPI
HTMLDOMNode_removeChild
(
IHTMLDOMNode
*
iface
,
IHTMLDOMNode
*
old
Child
,
IHTMLDOMNode
**
node
)
{
HTMLDOMNode
*
This
=
HTMLDOMNODE_THIS
(
iface
);
FIXME
(
"(%p)->(%p %p)
\n
"
,
This
,
new
Child
,
node
);
FIXME
(
"(%p)->(%p %p)
\n
"
,
This
,
old
Child
,
node
);
return
E_NOTIMPL
;
}
...
...
@@ -548,8 +606,19 @@ static HRESULT WINAPI HTMLDOMNode_get_firstChild(IHTMLDOMNode *iface, IHTMLDOMNo
static
HRESULT
WINAPI
HTMLDOMNode_get_lastChild
(
IHTMLDOMNode
*
iface
,
IHTMLDOMNode
**
p
)
{
HTMLDOMNode
*
This
=
HTMLDOMNODE_THIS
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
p
);
return
E_NOTIMPL
;
nsIDOMNode
*
nschild
=
NULL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
nsIDOMNode_GetLastChild
(
This
->
nsnode
,
&
nschild
);
if
(
nschild
)
{
*
p
=
HTMLDOMNODE
(
get_node
(
This
->
doc
,
nschild
,
TRUE
));
IHTMLDOMNode_AddRef
(
*
p
);
}
else
{
*
p
=
NULL
;
}
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLDOMNode_get_previousSibling
(
IHTMLDOMNode
*
iface
,
IHTMLDOMNode
**
p
)
...
...
dlls/mshtml/tests/dom.c
View file @
8d7066b2
...
...
@@ -1792,6 +1792,50 @@ static void test_stylesheets(IHTMLDocument2 *doc)
IHTMLStyleSheetsCollection_Release
(
col
);
}
static
void
test_child_col_disp
(
IHTMLDOMChildrenCollection
*
col
)
{
IDispatchEx
*
dispex
;
IHTMLDOMNode
*
node
;
DISPPARAMS
dp
=
{
NULL
,
NULL
,
0
,
0
};
VARIANT
var
;
EXCEPINFO
ei
;
long
type
;
DISPID
id
;
BSTR
bstr
;
HRESULT
hres
;
static
const
WCHAR
w0
[]
=
{
'0'
,
0
};
static
const
WCHAR
w100
[]
=
{
'1'
,
'0'
,
'0'
,
0
};
hres
=
IHTMLDOMChildrenCollection_QueryInterface
(
col
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
ok
(
hres
==
S_OK
,
"Could not get IDispatchEx: %08x
\n
"
,
hres
);
bstr
=
SysAllocString
(
w0
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
bstr
,
fdexNameCaseSensitive
,
&
id
);
ok
(
hres
==
S_OK
,
"GetDispID failed: %08x
\n
"
,
hres
);
SysFreeString
(
bstr
);
VariantInit
(
&
var
);
hres
=
IDispatchEx_InvokeEx
(
dispex
,
id
,
LOCALE_NEUTRAL
,
INVOKE_PROPERTYGET
,
&
dp
,
&
var
,
&
ei
,
NULL
);
ok
(
hres
==
S_OK
,
"InvokeEx failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
var
)
==
VT_DISPATCH
,
"V_VT(var)=%d
\n
"
,
V_VT
(
&
var
));
ok
(
V_DISPATCH
(
&
var
)
!=
NULL
,
"V_DISPATCH(var) == NULL
\n
"
);
node
=
get_node_iface
((
IUnknown
*
)
V_DISPATCH
(
&
var
));
type
=
get_node_type
((
IUnknown
*
)
node
);
ok
(
type
==
3
,
"type=%ld
\n
"
,
type
);
IHTMLDOMNode_Release
(
node
);
VariantClear
(
&
var
);
bstr
=
SysAllocString
(
w100
);
hres
=
IDispatchEx_GetDispID
(
dispex
,
bstr
,
fdexNameCaseSensitive
,
&
id
);
ok
(
hres
==
DISP_E_UNKNOWNNAME
,
"GetDispID failed: %08x, expected DISP_E_UNKNOWNNAME
\n
"
,
hres
);
SysFreeString
(
bstr
);
IDispatchEx_Release
(
dispex
);
}
static
void
test_elems
(
IHTMLDocument2
*
doc
)
{
IHTMLElementCollection
*
col
;
...
...
@@ -1998,6 +2042,8 @@ static void test_elems(IHTMLDocument2 *doc)
ok
(
hres
==
E_INVALIDARG
,
"item failed: %08x, expected E_INVALIDARG
\n
"
,
hres
);
ok
(
disp
==
(
void
*
)
0xdeadbeef
,
"disp=%p
\n
"
,
disp
);
test_child_col_disp
(
child_col
);
IHTMLDOMChildrenCollection_Release
(
child_col
);
}
...
...
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