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
0769ebc8
Commit
0769ebc8
authored
Sep 30, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 01, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Use create_all_collection in IHTMLElement::get_all implementation.
parent
53f00d02
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
81 deletions
+6
-81
htmldoc.c
dlls/mshtml/htmldoc.c
+1
-1
htmlelem.c
dlls/mshtml/htmlelem.c
+1
-77
htmlelemcol.c
dlls/mshtml/htmlelemcol.c
+3
-2
mshtml_private.h
dlls/mshtml/mshtml_private.h
+1
-1
No files found.
dlls/mshtml/htmldoc.c
View file @
0769ebc8
...
...
@@ -289,7 +289,7 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
return
S_OK
;
}
*
p
=
create_all_collection
(
get_node
(
This
,
(
nsIDOMNode
*
)
nselem
,
TRUE
));
*
p
=
create_all_collection
(
get_node
(
This
,
(
nsIDOMNode
*
)
nselem
,
TRUE
)
,
TRUE
);
nsIDOMElement_Release
(
nselem
);
return
S_OK
;
...
...
dlls/mshtml/htmlelem.c
View file @
0769ebc8
...
...
@@ -35,43 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
typedef
struct
{
HTMLElement
**
buf
;
DWORD
len
;
DWORD
size
;
}
elem_vector
;
static
void
elem_vector_add
(
elem_vector
*
buf
,
HTMLElement
*
elem
)
{
if
(
buf
->
len
==
buf
->
size
)
{
buf
->
size
<<=
1
;
buf
->
buf
=
heap_realloc
(
buf
->
buf
,
buf
->
size
*
sizeof
(
HTMLElement
**
));
}
buf
->
buf
[
buf
->
len
++
]
=
elem
;
}
static
void
elem_vector_normalize
(
elem_vector
*
buf
)
{
if
(
!
buf
->
len
)
{
heap_free
(
buf
->
buf
);
buf
->
buf
=
NULL
;
}
else
if
(
buf
->
size
>
buf
->
len
)
{
buf
->
buf
=
heap_realloc
(
buf
->
buf
,
buf
->
len
*
sizeof
(
HTMLElement
**
));
}
buf
->
size
=
buf
->
len
;
}
static
BOOL
is_elem_node
(
nsIDOMNode
*
node
)
{
PRUint16
type
=
0
;
nsIDOMNode_GetNodeType
(
node
,
&
type
);
return
type
==
ELEMENT_NODE
||
type
==
COMMENT_NODE
;
}
#define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
#define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
...
...
@@ -1230,52 +1193,13 @@ static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **
return
S_OK
;
}
static
void
create_all_list
(
HTMLDocument
*
doc
,
HTMLDOMNode
*
elem
,
elem_vector
*
buf
)
{
nsIDOMNodeList
*
nsnode_list
;
nsIDOMNode
*
iter
;
PRUint32
list_len
=
0
,
i
;
nsresult
nsres
;
nsres
=
nsIDOMNode_GetChildNodes
(
elem
->
nsnode
,
&
nsnode_list
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetChildNodes failed: %08x
\n
"
,
nsres
);
return
;
}
nsIDOMNodeList_GetLength
(
nsnode_list
,
&
list_len
);
if
(
!
list_len
)
return
;
for
(
i
=
0
;
i
<
list_len
;
i
++
)
{
nsres
=
nsIDOMNodeList_Item
(
nsnode_list
,
i
,
&
iter
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Item failed: %08x
\n
"
,
nsres
);
continue
;
}
if
(
is_elem_node
(
iter
))
{
HTMLDOMNode
*
node
=
get_node
(
doc
,
iter
,
TRUE
);
elem_vector_add
(
buf
,
HTMLELEM_NODE_THIS
(
node
));
create_all_list
(
doc
,
node
,
buf
);
}
}
}
static
HRESULT
WINAPI
HTMLElement_get_all
(
IHTMLElement
*
iface
,
IDispatch
**
p
)
{
HTMLElement
*
This
=
HTMLELEM_THIS
(
iface
);
elem_vector
buf
=
{
NULL
,
0
,
8
};
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
buf
.
buf
=
heap_alloc
(
buf
.
size
*
sizeof
(
HTMLElement
**
));
create_all_list
(
This
->
node
.
doc
,
&
This
->
node
,
&
buf
);
elem_vector_normalize
(
&
buf
);
*
p
=
(
IDispatch
*
)
HTMLElementCollection_Create
((
IUnknown
*
)
HTMLELEM
(
This
),
buf
.
buf
,
buf
.
len
);
*
p
=
(
IDispatch
*
)
create_all_collection
(
&
This
->
node
,
FALSE
);
return
S_OK
;
}
...
...
dlls/mshtml/htmlelemcol.c
View file @
0769ebc8
...
...
@@ -463,13 +463,14 @@ static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector_t
}
}
IHTMLElementCollection
*
create_all_collection
(
HTMLDOMNode
*
node
)
IHTMLElementCollection
*
create_all_collection
(
HTMLDOMNode
*
node
,
BOOL
include_root
)
{
elem_vector_t
buf
=
{
NULL
,
0
,
8
};
buf
.
buf
=
heap_alloc
(
buf
.
size
*
sizeof
(
HTMLElement
**
));
elem_vector_add
(
&
buf
,
HTMLELEM_NODE_THIS
(
node
));
if
(
include_root
)
elem_vector_add
(
&
buf
,
HTMLELEM_NODE_THIS
(
node
));
create_all_list
(
node
->
doc
,
node
,
&
buf
);
elem_vector_normalize
(
&
buf
);
...
...
dlls/mshtml/mshtml_private.h
View file @
0769ebc8
...
...
@@ -585,7 +585,7 @@ IDispatch *script_parse_event(HTMLDocument*,LPCWSTR);
void
set_script_mode
(
HTMLDocument
*
,
SCRIPTMODE
);
IHTMLElementCollection
*
HTMLElementCollection_Create
(
IUnknown
*
,
HTMLElement
**
,
DWORD
);
IHTMLElementCollection
*
create_all_collection
(
HTMLDOMNode
*
);
IHTMLElementCollection
*
create_all_collection
(
HTMLDOMNode
*
,
BOOL
);
IHTMLElementCollection
*
create_collection_from_nodelist
(
HTMLDocument
*
,
IUnknown
*
,
nsIDOMNodeList
*
);
/* commands */
...
...
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