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
85c31979
Commit
85c31979
authored
Aug 22, 2015
by
Zhenbo Li
Committed by
Alexandre Julliard
Aug 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Add IHTMLOptionElement::defaultSelected property implementation.
parent
b471b217
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
4 deletions
+97
-4
htmloption.c
dlls/mshtml/htmloption.c
+42
-4
dom.c
dlls/mshtml/tests/dom.c
+55
-0
No files found.
dlls/mshtml/htmloption.c
View file @
85c31979
...
...
@@ -166,15 +166,53 @@ static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BST
static
HRESULT
WINAPI
HTMLOptionElement_put_defaultSelected
(
IHTMLOptionElement
*
iface
,
VARIANT_BOOL
v
)
{
HTMLOptionElement
*
This
=
impl_from_IHTMLOptionElement
(
iface
);
FIXME
(
"(%p)->(%x)
\n
"
,
This
,
v
);
return
E_NOTIMPL
;
cpp_bool
val
,
selected
;
nsresult
nsres
;
TRACE
(
"(%p)->(%x)
\n
"
,
This
,
v
);
val
=
(
v
==
VARIANT_TRUE
);
nsres
=
nsIDOMHTMLOptionElement_GetSelected
(
This
->
nsoption
,
&
selected
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetSelected failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsIDOMHTMLOptionElement_SetDefaultSelected
(
This
->
nsoption
,
val
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"SetDefaultSelected failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
if
(
val
!=
selected
)
{
nsres
=
nsIDOMHTMLOptionElement_SetSelected
(
This
->
nsoption
,
selected
);
/* WinAPI will reserve selected property */
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"SetSelected failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
}
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLOptionElement_get_defaultSelected
(
IHTMLOptionElement
*
iface
,
VARIANT_BOOL
*
p
)
{
HTMLOptionElement
*
This
=
impl_from_IHTMLOptionElement
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
p
);
return
E_NOTIMPL
;
cpp_bool
val
;
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
!
p
)
return
E_POINTER
;
nsres
=
nsIDOMHTMLOptionElement_GetDefaultSelected
(
This
->
nsoption
,
&
val
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetDefaultSelected failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
*
p
=
val
?
VARIANT_TRUE
:
VARIANT_FALSE
;
return
S_OK
;
}
static
HRESULT
WINAPI
HTMLOptionElement_put_index
(
IHTMLOptionElement
*
iface
,
LONG
v
)
...
...
dlls/mshtml/tests/dom.c
View file @
85c31979
...
...
@@ -1692,6 +1692,60 @@ static void _test_option_get_index(unsigned line, IHTMLOptionElement *option, LO
"value = %d, expected = %d
\n
"
,
val
,
exval
);
}
#define test_option_put_defaultSelected(o,d) _test_option_put_defaultSelected(__LINE__,o,d)
static
void
_test_option_put_defaultSelected
(
unsigned
line
,
IHTMLOptionElement
*
option
,
VARIANT_BOOL
b
)
{
HRESULT
hres
;
hres
=
IHTMLOptionElement_put_defaultSelected
(
option
,
b
);
ok_
(
__FILE__
,
line
)(
hres
==
S_OK
,
"put_defaultSelected %08x
\n
"
,
hres
);
}
#define test_option_defaultSelected(o,e) _test_option_defaultSelected(__LINE__,o,e)
static
void
_test_option_defaultSelected
(
unsigned
line
,
IHTMLOptionElement
*
option
,
VARIANT_BOOL
ex
)
{
HRESULT
hres
;
VARIANT_BOOL
b
;
hres
=
IHTMLOptionElement_get_defaultSelected
(
option
,
NULL
);
ok_
(
__FILE__
,
line
)(
hres
==
E_POINTER
,
"Expect E_POINTER, got %08x
\n
"
,
hres
);
b
=
0x100
;
hres
=
IHTMLOptionElement_get_defaultSelected
(
option
,
&
b
);
ok_
(
__FILE__
,
line
)(
hres
==
S_OK
,
"get_defaultSelected failed: %08x
\n
"
,
hres
);
ok_
(
__FILE__
,
line
)(
b
==
ex
,
"b = %x, expected = %x
\n
"
,
b
,
ex
);
}
static
void
test_option_defaultSelected_property
(
IHTMLOptionElement
*
option
)
{
test_option_defaultSelected
(
option
,
VARIANT_FALSE
);
test_option_selected
(
option
,
VARIANT_FALSE
);
test_option_put_defaultSelected
(
option
,
0x100
);
/* Invalid value */
test_option_defaultSelected
(
option
,
VARIANT_FALSE
);
test_option_selected
(
option
,
VARIANT_FALSE
);
test_option_put_defaultSelected
(
option
,
VARIANT_TRUE
);
test_option_defaultSelected
(
option
,
VARIANT_TRUE
);
test_option_selected
(
option
,
VARIANT_FALSE
);
test_option_put_defaultSelected
(
option
,
0x100
);
/* Invalid value */
test_option_defaultSelected
(
option
,
VARIANT_FALSE
);
test_option_selected
(
option
,
VARIANT_FALSE
);
test_option_put_selected
(
option
,
VARIANT_TRUE
);
test_option_selected
(
option
,
VARIANT_TRUE
);
test_option_defaultSelected
(
option
,
VARIANT_FALSE
);
test_option_put_defaultSelected
(
option
,
VARIANT_TRUE
);
test_option_defaultSelected
(
option
,
VARIANT_TRUE
);
test_option_selected
(
option
,
VARIANT_TRUE
);
/* Restore defaultSelected */
test_option_put_defaultSelected
(
option
,
VARIANT_TRUE
);
test_option_put_selected
(
option
,
VARIANT_FALSE
);
}
#define test_textarea_value(t,v) _test_textarea_value(__LINE__,t,v)
static
void
_test_textarea_value
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exval
)
{
...
...
@@ -5085,6 +5139,7 @@ static void test_create_option_elem(IHTMLDocument2 *doc)
test_option_put_text
(
option
,
"new text"
);
test_option_put_value
(
option
,
"new value"
);
test_option_get_index
(
option
,
0
);
test_option_defaultSelected_property
(
option
);
test_option_put_selected
(
option
,
VARIANT_TRUE
);
test_option_put_selected
(
option
,
VARIANT_FALSE
);
...
...
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