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
09c63b22
Commit
09c63b22
authored
Dec 17, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 17, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added IHTMLStyleElement::media property implementation.
parent
96efe799
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
5 deletions
+103
-5
htmlstyleelem.c
dlls/mshtml/htmlstyleelem.c
+35
-4
nsiface.idl
dlls/mshtml/nsiface.idl
+15
-0
dom.c
dlls/mshtml/tests/dom.c
+53
-1
No files found.
dlls/mshtml/htmlstyleelem.c
View file @
09c63b22
...
...
@@ -36,6 +36,8 @@ typedef struct {
HTMLElement
element
;
const
IHTMLStyleElementVtbl
*
lpIHTMLStyleElementVtbl
;
nsIDOMHTMLStyleElement
*
nsstyle
;
}
HTMLStyleElement
;
#define HTMLSTYLE(x) (&(x)->lpIHTMLStyleElementVtbl)
...
...
@@ -180,15 +182,33 @@ static HRESULT WINAPI HTMLStyleElement_get_disabled(IHTMLStyleElement *iface, VA
static
HRESULT
WINAPI
HTMLStyleElement_put_media
(
IHTMLStyleElement
*
iface
,
BSTR
v
)
{
HTMLStyleElement
*
This
=
HTMLSTYLE_THIS
(
iface
);
FIXME
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
v
));
return
E_NOTIMPL
;
nsAString
media_str
;
nsresult
nsres
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
v
));
nsAString_InitDepend
(
&
media_str
,
v
);
nsres
=
nsIDOMHTMLStyleElement_SetMedia
(
This
->
nsstyle
,
&
media_str
);
nsAString_Finish
(
&
media_str
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"SetMedia failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLStyleElement_get_media
(
IHTMLStyleElement
*
iface
,
BSTR
*
p
)
{
HTMLStyleElement
*
This
=
HTMLSTYLE_THIS
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
p
);
return
E_NOTIMPL
;
nsAString
nsstr
;
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
nsAString_Init
(
&
nsstr
,
NULL
);
nsres
=
nsIDOMHTMLStyleElement_GetMedia
(
This
->
nsstyle
,
&
nsstr
);
return
return_nsstr
(
nsres
,
&
nsstr
,
p
);
}
#undef HTMLSTYLE_THIS
...
...
@@ -244,6 +264,9 @@ static void HTMLStyleElement_destructor(HTMLDOMNode *iface)
{
HTMLStyleElement
*
This
=
HTMLSTYLE_NODE_THIS
(
iface
);
if
(
This
->
nsstyle
)
nsIDOMHTMLStyleElement_Release
(
This
->
nsstyle
);
HTMLElement_destructor
(
&
This
->
element
.
node
);
}
...
...
@@ -270,6 +293,7 @@ static dispex_static_data_t HTMLStyleElement_dispex = {
HRESULT
HTMLStyleElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMHTMLElement
*
nselem
,
HTMLElement
**
elem
)
{
HTMLStyleElement
*
ret
;
nsresult
nsres
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
if
(
!
ret
)
...
...
@@ -278,6 +302,13 @@ HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem
ret
->
lpIHTMLStyleElementVtbl
=
&
HTMLStyleElementVtbl
;
ret
->
element
.
node
.
vtbl
=
&
HTMLStyleElementImplVtbl
;
nsres
=
nsIDOMHTMLElement_QueryInterface
(
nselem
,
&
IID_nsIDOMHTMLStyleElement
,
(
void
**
)
&
ret
->
nsstyle
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMHTMLStyleElement iface: %08x
\n
"
,
nsres
);
heap_free
(
ret
);
return
E_FAIL
;
}
HTMLElement_Init
(
&
ret
->
element
,
doc
,
nselem
,
&
HTMLStyleElement_dispex
);
*
elem
=
&
ret
->
element
;
return
S_OK
;
...
...
dlls/mshtml/nsiface.idl
View file @
09c63b22
...
...
@@ -1704,6 +1704,21 @@ interface nsIDOMHTMLParamElement : nsIDOMHTMLElement
[
object,
uuid(a6cf908d-15b3-11d2-932e-00805f8add32),
local
]
interface nsIDOMHTMLStyleElement : nsIDOMHTMLElement
{
nsresult GetDisabled(PRBool *aDisabled);
nsresult SetDisabled(PRBool aDisabled);
nsresult GetMedia(nsAString *aMedia);
nsresult SetMedia(const nsAString *aMedia);
nsresult GetType(nsAString *aType);
nsresult SetType(const nsAString *aType);
}
[
object,
uuid(94928ab3-8b63-11d3-989d-001083010e9b),
local
]
...
...
dlls/mshtml/tests/dom.c
View file @
09c63b22
...
...
@@ -40,7 +40,7 @@ static const char range_test_str[] =
static
const
char
range_test2_str
[]
=
"<html><body>abc<hr />123<br /><hr />def</body></html>"
;
static
const
char
elem_test_str
[]
=
"<html><head><title>test</title><style>.body { margin-right: 0px; }</style>"
"<html><head><title>test</title><style
id=
\"
styleid
\"
>.body { margin-right: 0px; }</style>"
"<body onload=
\"
Testing()
\"
>text test<!-- a comment -->"
"<a id=
\"
a
\"
href=
\"
http://test
\"
name=
\"
x
\"
>link</a>"
"<input id=
\"
in
\"
class=
\"
testclass
\"
tabIndex=
\"
2
\"
title=
\"
test title
\"
/>"
...
...
@@ -787,6 +787,17 @@ static IHTMLObjectElement *_get_object_iface(unsigned line, IUnknown *unk)
return
obj
;
}
#define get_style_iface(u) _get_style_iface(__LINE__,u)
static
IHTMLStyleElement
*
_get_style_iface
(
unsigned
line
,
IUnknown
*
unk
)
{
IHTMLStyleElement
*
obj
;
HRESULT
hres
;
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IHTMLStyleElement
,
(
void
**
)
&
obj
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"Could not get IHTMLStyleElement: %08x
\n
"
,
hres
);
return
obj
;
}
#define test_node_name(u,n) _test_node_name(__LINE__,u,n)
static
void
_test_node_name
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exname
)
{
...
...
@@ -2435,6 +2446,40 @@ static void _test_elem_set_tabindex(unsigned line, IUnknown *unk, short index)
_test_elem_tabindex
(
line
,
unk
,
index
);
}
#define test_style_media(s,m) _test_style_media(__LINE__,s,m)
static
void
_test_style_media
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exmedia
)
{
IHTMLStyleElement
*
style
=
_get_style_iface
(
line
,
unk
);
BSTR
media
;
HRESULT
hres
;
hres
=
IHTMLStyleElement_get_media
(
style
,
&
media
);
ok_
(
__FILE__
,
line
)(
hres
==
S_OK
,
"get_media failed: %08x
\n
"
,
hres
);
if
(
exmedia
)
ok_
(
__FILE__
,
line
)(
!
strcmp_wa
(
media
,
exmedia
),
"media = %s, expected %s
\n
"
,
wine_dbgstr_w
(
media
),
exmedia
);
else
ok_
(
__FILE__
,
line
)(
!
media
,
"media = %s, expected NULL
\n
"
,
wine_dbgstr_w
(
media
));
IHTMLStyleElement_Release
(
style
);
SysFreeString
(
media
);
}
#define test_style_put_media(s,m) _test_style_put_media(__LINE__,s,m)
static
void
_test_style_put_media
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
media
)
{
IHTMLStyleElement
*
style
=
_get_style_iface
(
line
,
unk
);
BSTR
str
;
HRESULT
hres
;
str
=
a2bstr
(
media
);
hres
=
IHTMLStyleElement_put_media
(
style
,
str
);
ok_
(
__FILE__
,
line
)(
hres
==
S_OK
,
"put_media failed: %08x
\n
"
,
hres
);
IHTMLStyleElement_Release
(
style
);
SysFreeString
(
str
);
_test_style_media
(
line
,
unk
,
media
);
}
#define test_elem_filters(u) _test_elem_filters(__LINE__,u)
static
void
_test_elem_filters
(
unsigned
line
,
IUnknown
*
unk
)
{
...
...
@@ -6279,6 +6324,13 @@ static void test_elems(IHTMLDocument2 *doc)
IHTMLElement_Release
(
elem
);
}
elem
=
get_elem_by_id
(
doc
,
"styleid"
,
TRUE
);
if
(
elem
)
{
test_style_media
((
IUnknown
*
)
elem
,
NULL
);
test_style_put_media
((
IUnknown
*
)
elem
,
"screen"
);
IHTMLElement_Release
(
elem
);
}
elem
=
get_doc_elem_by_id
(
doc
,
"tbl"
);
ok
(
elem
!=
NULL
,
"elem == NULL
\n
"
);
if
(
elem
)
{
...
...
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