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
11015509
Commit
11015509
authored
Mar 02, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 02, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Reuse attribute objects.
parent
b9975bf8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
12 deletions
+39
-12
htmlattr.c
dlls/mshtml/htmlattr.c
+6
-1
htmlelem.c
dlls/mshtml/htmlelem.c
+7
-0
htmlelem3.c
dlls/mshtml/htmlelem3.c
+21
-9
mshtml_private.h
dlls/mshtml/mshtml_private.h
+5
-1
dom.c
dlls/mshtml/tests/dom.c
+0
-1
No files found.
dlls/mshtml/htmlattr.c
View file @
11015509
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <stdarg.h>
#include <stdarg.h>
#include <assert.h>
#define COBJMACROS
#define COBJMACROS
...
@@ -78,6 +79,7 @@ static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface)
...
@@ -78,6 +79,7 @@ static ULONG WINAPI HTMLDOMAttribute_Release(IHTMLDOMAttribute *iface)
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
!
ref
)
{
assert
(
!
This
->
elem
);
nsIDOMAttr_Release
(
This
->
nsattr
);
nsIDOMAttr_Release
(
This
->
nsattr
);
release_dispex
(
&
This
->
dispex
);
release_dispex
(
&
This
->
dispex
);
heap_free
(
This
);
heap_free
(
This
);
...
@@ -189,7 +191,7 @@ static dispex_static_data_t HTMLDOMAttribute_dispex = {
...
@@ -189,7 +191,7 @@ static dispex_static_data_t HTMLDOMAttribute_dispex = {
HTMLDOMAttribute_iface_tids
HTMLDOMAttribute_iface_tids
};
};
HRESULT
HTMLDOMAttribute_Create
(
HTML
DocumentNode
*
doc
,
nsIDOMAttr
*
nsattr
,
HTMLDOMAttribute
**
attr
)
HRESULT
HTMLDOMAttribute_Create
(
HTML
Element
*
elem
,
nsIDOMAttr
*
nsattr
,
HTMLDOMAttribute
**
attr
)
{
{
HTMLDOMAttribute
*
ret
;
HTMLDOMAttribute
*
ret
;
...
@@ -203,6 +205,9 @@ HRESULT HTMLDOMAttribute_Create(HTMLDocumentNode *doc, nsIDOMAttr *nsattr, HTMLD
...
@@ -203,6 +205,9 @@ HRESULT HTMLDOMAttribute_Create(HTMLDocumentNode *doc, nsIDOMAttr *nsattr, HTMLD
nsIDOMAttr_AddRef
(
nsattr
);
nsIDOMAttr_AddRef
(
nsattr
);
ret
->
nsattr
=
nsattr
;
ret
->
nsattr
=
nsattr
;
ret
->
elem
=
elem
;
list_add_tail
(
&
elem
->
attrs
,
&
ret
->
entry
);
init_dispex
(
&
ret
->
dispex
,
(
IUnknown
*
)
&
ret
->
IHTMLDOMAttribute_iface
,
init_dispex
(
&
ret
->
dispex
,
(
IUnknown
*
)
&
ret
->
IHTMLDOMAttribute_iface
,
&
HTMLDOMAttribute_dispex
);
&
HTMLDOMAttribute_dispex
);
...
...
dlls/mshtml/htmlelem.c
View file @
11015509
...
@@ -1647,6 +1647,12 @@ HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
...
@@ -1647,6 +1647,12 @@ HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
void
HTMLElement_destructor
(
HTMLDOMNode
*
iface
)
void
HTMLElement_destructor
(
HTMLDOMNode
*
iface
)
{
{
HTMLElement
*
This
=
impl_from_HTMLDOMNode
(
iface
);
HTMLElement
*
This
=
impl_from_HTMLDOMNode
(
iface
);
HTMLDOMAttribute
*
attr
;
LIST_FOR_EACH_ENTRY
(
attr
,
&
This
->
attrs
,
HTMLDOMAttribute
,
entry
)
{
attr
->
elem
=
NULL
;
IHTMLDOMAttribute_Release
(
&
attr
->
IHTMLDOMAttribute_iface
);
}
ConnectionPointContainer_Destroy
(
&
This
->
cp_container
);
ConnectionPointContainer_Destroy
(
&
This
->
cp_container
);
...
@@ -1742,6 +1748,7 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen
...
@@ -1742,6 +1748,7 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen
if
(
nselem
)
if
(
nselem
)
nsIDOMHTMLElement_AddRef
(
nselem
);
nsIDOMHTMLElement_AddRef
(
nselem
);
This
->
nselem
=
nselem
;
This
->
nselem
=
nselem
;
list_init
(
&
This
->
attrs
);
HTMLDOMNode_Init
(
doc
,
&
This
->
node
,
(
nsIDOMNode
*
)
nselem
);
HTMLDOMNode_Init
(
doc
,
&
This
->
node
,
(
nsIDOMNode
*
)
nselem
);
...
...
dlls/mshtml/htmlelem3.c
View file @
11015509
...
@@ -560,7 +560,7 @@ static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
...
@@ -560,7 +560,7 @@ static HRESULT WINAPI HTMLElement4_normalize(IHTMLElement4 *iface)
static
HRESULT
WINAPI
HTMLElement4_getAttributeNode
(
IHTMLElement4
*
iface
,
BSTR
bstrname
,
IHTMLDOMAttribute
**
ppAttribute
)
static
HRESULT
WINAPI
HTMLElement4_getAttributeNode
(
IHTMLElement4
*
iface
,
BSTR
bstrname
,
IHTMLDOMAttribute
**
ppAttribute
)
{
{
HTMLElement
*
This
=
impl_from_IHTMLElement4
(
iface
);
HTMLElement
*
This
=
impl_from_IHTMLElement4
(
iface
);
HTMLDOMAttribute
*
attr
;
HTMLDOMAttribute
*
attr
=
NULL
,
*
iter
;
nsAString
name_str
;
nsAString
name_str
;
nsIDOMAttr
*
nsattr
;
nsIDOMAttr
*
nsattr
;
nsresult
nsres
;
nsresult
nsres
;
...
@@ -576,16 +576,28 @@ static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR b
...
@@ -576,16 +576,28 @@ static HRESULT WINAPI HTMLElement4_getAttributeNode(IHTMLElement4 *iface, BSTR b
return
E_FAIL
;
return
E_FAIL
;
}
}
if
(
nsattr
)
{
if
(
!
nsattr
)
{
hres
=
HTMLDOMAttribute_Create
(
This
->
node
.
doc
,
nsattr
,
&
attr
);
nsIDOMAttr_Release
(
nsattr
);
if
(
FAILED
(
hres
))
return
hres
;
*
ppAttribute
=
&
attr
->
IHTMLDOMAttribute_iface
;
}
else
{
*
ppAttribute
=
NULL
;
*
ppAttribute
=
NULL
;
return
S_OK
;
}
LIST_FOR_EACH_ENTRY
(
iter
,
&
This
->
attrs
,
HTMLDOMAttribute
,
entry
)
{
if
(
iter
->
nsattr
==
nsattr
)
{
attr
=
iter
;
break
;
}
}
}
if
(
!
attr
)
{
hres
=
HTMLDOMAttribute_Create
(
This
,
nsattr
,
&
attr
);
if
(
FAILED
(
hres
))
{
nsIDOMAttr_Release
(
nsattr
);
return
hres
;
}
}
IHTMLDOMAttribute_AddRef
(
&
attr
->
IHTMLDOMAttribute_iface
);
*
ppAttribute
=
&
attr
->
IHTMLDOMAttribute_iface
;
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/mshtml/mshtml_private.h
View file @
11015509
...
@@ -561,6 +561,7 @@ typedef struct {
...
@@ -561,6 +561,7 @@ typedef struct {
nsIDOMHTMLElement
*
nselem
;
nsIDOMHTMLElement
*
nselem
;
HTMLStyle
*
style
;
HTMLStyle
*
style
;
struct
list
attrs
;
}
HTMLElement
;
}
HTMLElement
;
#define HTMLELEMENT_TIDS \
#define HTMLELEMENT_TIDS \
...
@@ -749,9 +750,12 @@ typedef struct {
...
@@ -749,9 +750,12 @@ typedef struct {
LONG
ref
;
LONG
ref
;
nsIDOMAttr
*
nsattr
;
nsIDOMAttr
*
nsattr
;
HTMLElement
*
elem
;
struct
list
entry
;
}
HTMLDOMAttribute
;
}
HTMLDOMAttribute
;
HRESULT
HTMLDOMAttribute_Create
(
HTML
DocumentNode
*
,
nsIDOMAttr
*
,
HTMLDOMAttribute
**
);
HRESULT
HTMLDOMAttribute_Create
(
HTML
Element
*
,
nsIDOMAttr
*
,
HTMLDOMAttribute
**
);
HRESULT
HTMLElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
BOOL
,
HTMLElement
**
);
HRESULT
HTMLElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
BOOL
,
HTMLElement
**
);
HRESULT
HTMLCommentElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLElement
**
);
HRESULT
HTMLCommentElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLElement
**
);
...
...
dlls/mshtml/tests/dom.c
View file @
11015509
...
@@ -6812,7 +6812,6 @@ static void test_attr(IHTMLElement *elem)
...
@@ -6812,7 +6812,6 @@ static void test_attr(IHTMLElement *elem)
test_no_iface
((
IUnknown
*
)
attr
,
&
IID_IHTMLDOMNode
);
test_no_iface
((
IUnknown
*
)
attr
,
&
IID_IHTMLDOMNode
);
attr2
=
get_elem_attr_node
((
IUnknown
*
)
elem
,
"id"
,
TRUE
);
attr2
=
get_elem_attr_node
((
IUnknown
*
)
elem
,
"id"
,
TRUE
);
todo_wine
ok
(
iface_cmp
((
IUnknown
*
)
attr
,
(
IUnknown
*
)
attr2
),
"attr != attr2
\n
"
);
ok
(
iface_cmp
((
IUnknown
*
)
attr
,
(
IUnknown
*
)
attr2
),
"attr != attr2
\n
"
);
IHTMLDOMAttribute_Release
(
attr2
);
IHTMLDOMAttribute_Release
(
attr2
);
...
...
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