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
d3b77c45
Commit
d3b77c45
authored
Sep 03, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Moved getting frame by name to separated function.
parent
9f042298
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
54 deletions
+73
-54
htmlwindow.c
dlls/mshtml/htmlwindow.c
+73
-54
No files found.
dlls/mshtml/htmlwindow.c
View file @
d3b77c45
...
@@ -322,108 +322,127 @@ static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMembe
...
@@ -322,108 +322,127 @@ static HRESULT WINAPI HTMLWindow2_Invoke(IHTMLWindow2 *iface, DISPID dispIdMembe
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
}
}
static
HRESULT
get_frame_by_index
(
nsIDOMWindowCollection
*
nsFrame
s
,
PRUint32
index
,
HTMLOuterWindow
**
ret
)
static
HRESULT
get_frame_by_index
(
HTMLOuterWindow
*
Thi
s
,
PRUint32
index
,
HTMLOuterWindow
**
ret
)
{
{
nsIDOMWindowCollection
*
nsframes
;
nsIDOMWindow
*
nswindow
;
PRUint32
length
;
PRUint32
length
;
nsIDOMWindow
*
nsWindow
;
nsresult
nsres
;
nsresult
nsres
;
nsres
=
nsIDOMWindow
Collection_GetLength
(
nsFrames
,
&
length
);
nsres
=
nsIDOMWindow
_GetFrames
(
This
->
nswindow
,
&
nsframes
);
if
(
NS_FAILED
(
nsres
))
{
if
(
NS_FAILED
(
nsres
))
{
FIXME
(
"nsIDOMWindow
Collection_GetLength
failed: 0x%08x
\n
"
,
nsres
);
FIXME
(
"nsIDOMWindow
_GetFrames
failed: 0x%08x
\n
"
,
nsres
);
return
E_FAIL
;
return
E_FAIL
;
}
}
if
(
index
>=
length
)
nsres
=
nsIDOMWindowCollection_GetLength
(
nsframes
,
&
length
);
assert
(
nsres
==
NS_OK
);
if
(
index
>=
length
)
{
nsIDOMWindowCollection_Release
(
nsframes
);
return
DISP_E_MEMBERNOTFOUND
;
return
DISP_E_MEMBERNOTFOUND
;
}
nsres
=
nsIDOMWindowCollection_Item
(
nsFrames
,
index
,
&
nsWindow
);
nsres
=
nsIDOMWindowCollection_Item
(
nsframes
,
index
,
&
nswindow
);
nsIDOMWindowCollection_Release
(
nsframes
);
if
(
NS_FAILED
(
nsres
))
{
if
(
NS_FAILED
(
nsres
))
{
FIXME
(
"nsIDOMWindowCollection_Item failed: 0x%08x
\n
"
,
nsres
);
FIXME
(
"nsIDOMWindowCollection_Item failed: 0x%08x
\n
"
,
nsres
);
return
E_FAIL
;
return
E_FAIL
;
}
}
*
ret
=
nswindow_to_window
(
nsWindow
);
*
ret
=
nswindow_to_window
(
nswindow
);
nsIDOMWindow_Release
(
nsWindow
);
nsIDOMWindow_Release
(
nswindow
);
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
HTMLWindow2_item
(
IHTMLWindow2
*
iface
,
VARIANT
*
pvarIndex
,
VARIANT
*
pvarResul
t
)
static
HRESULT
get_frame_by_name
(
HTMLOuterWindow
*
This
,
const
WCHAR
*
name
,
HTMLOuterWindow
**
re
t
)
{
{
HTMLWindow
*
This
=
impl_from_IHTMLWindow2
(
iface
);
nsIDOMWindowCollection
*
nsframes
;
nsIDOMWindowCollection
*
nsFrames
;
HTMLOuterWindow
*
window
=
NULL
;
HTMLOuterWindow
*
window
=
NULL
;
HRESULT
hres
=
S_OK
;
PRUint32
length
,
i
;
nsresult
nsres
;
nsresult
nsres
;
HRESULT
hres
=
S_OK
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
pvarIndex
,
pvarResult
);
nsres
=
nsIDOMWindow_GetFrames
(
This
->
nswindow
,
&
nsframes
);
nsres
=
nsIDOMWindow_GetFrames
(
This
->
outer_window
->
nswindow
,
&
nsFrames
);
if
(
NS_FAILED
(
nsres
))
{
if
(
NS_FAILED
(
nsres
))
{
FIXME
(
"nsIDOMWindow_GetFrames failed: 0x%08x
\n
"
,
nsres
);
FIXME
(
"nsIDOMWindow_GetFrames failed: 0x%08x
\n
"
,
nsres
);
return
E_FAIL
;
return
E_FAIL
;
}
}
nsres
=
nsIDOMWindowCollection_GetLength
(
nsframes
,
&
length
);
assert
(
nsres
==
NS_OK
);
for
(
i
=
0
;
i
<
length
&&
!
window
;
++
i
)
{
HTMLOuterWindow
*
window_iter
;
nsIDOMWindow
*
nswindow
;
BSTR
id
;
nsres
=
nsIDOMWindowCollection_Item
(
nsframes
,
i
,
&
nswindow
);
if
(
NS_FAILED
(
nsres
))
{
FIXME
(
"nsIDOMWindowCollection_Item failed: 0x%08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
break
;
}
window_iter
=
nswindow_to_window
(
nswindow
);
nsIDOMWindow_Release
(
nswindow
);
hres
=
IHTMLElement_get_id
(
&
window_iter
->
frame_element
->
element
.
IHTMLElement_iface
,
&
id
);
if
(
FAILED
(
hres
))
{
FIXME
(
"IHTMLElement_get_id failed: 0x%08x
\n
"
,
hres
);
break
;
}
if
(
id
&&
!
strcmpiW
(
id
,
name
))
window
=
window_iter
;
SysFreeString
(
id
);
}
nsIDOMWindowCollection_Release
(
nsframes
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
window
;
return
NS_OK
;
}
static
HRESULT
WINAPI
HTMLWindow2_item
(
IHTMLWindow2
*
iface
,
VARIANT
*
pvarIndex
,
VARIANT
*
pvarResult
)
{
HTMLWindow
*
This
=
impl_from_IHTMLWindow2
(
iface
);
HTMLOuterWindow
*
window
=
NULL
;
HRESULT
hres
;
TRACE
(
"(%p)->(%p %p)
\n
"
,
This
,
pvarIndex
,
pvarResult
);
switch
(
V_VT
(
pvarIndex
))
{
switch
(
V_VT
(
pvarIndex
))
{
case
VT_I4
:
{
case
VT_I4
:
{
int
index
=
V_I4
(
pvarIndex
);
int
index
=
V_I4
(
pvarIndex
);
TRACE
(
"Getting index %d
\n
"
,
index
);
TRACE
(
"Getting index %d
\n
"
,
index
);
if
(
index
<
0
)
if
(
index
<
0
)
break
;
return
DISP_E_MEMBERNOTFOUND
;
hres
=
get_frame_by_index
(
nsFrames
,
index
,
&
window
);
hres
=
get_frame_by_index
(
This
->
outer_window
,
index
,
&
window
);
break
;
break
;
}
}
case
VT_UINT
:
{
case
VT_UINT
:
{
unsigned
int
index
=
V_UINT
(
pvarIndex
);
unsigned
int
index
=
V_UINT
(
pvarIndex
);
TRACE
(
"Getting index %u
\n
"
,
index
);
TRACE
(
"Getting index %u
\n
"
,
index
);
hres
=
get_frame_by_index
(
nsFrames
,
index
,
&
window
);
hres
=
get_frame_by_index
(
This
->
outer_window
,
index
,
&
window
);
break
;
break
;
}
}
case
VT_BSTR
:
{
case
VT_BSTR
:
{
BSTR
str
=
V_BSTR
(
pvarIndex
);
BSTR
str
=
V_BSTR
(
pvarIndex
);
PRUint32
length
,
i
;
TRACE
(
"Getting name %s
\n
"
,
wine_dbgstr_w
(
str
));
TRACE
(
"Getting name %s
\n
"
,
wine_dbgstr_w
(
str
));
hres
=
get_frame_by_name
(
This
->
outer_window
,
str
,
&
window
);
nsIDOMWindowCollection_GetLength
(
nsFrames
,
&
length
);
window
=
NULL
;
for
(
i
=
0
;
i
<
length
&&
!
window
;
++
i
)
{
HTMLOuterWindow
*
cur_window
;
nsIDOMWindow
*
nsWindow
;
BSTR
id
;
nsres
=
nsIDOMWindowCollection_Item
(
nsFrames
,
i
,
&
nsWindow
);
if
(
NS_FAILED
(
nsres
))
{
FIXME
(
"nsIDOMWindowCollection_Item failed: 0x%08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
break
;
}
cur_window
=
nswindow_to_window
(
nsWindow
);
nsIDOMWindow_Release
(
nsWindow
);
hres
=
IHTMLElement_get_id
(
&
cur_window
->
frame_element
->
element
.
IHTMLElement_iface
,
&
id
);
if
(
FAILED
(
hres
))
{
FIXME
(
"IHTMLElement_get_id failed: 0x%08x
\n
"
,
hres
);
break
;
}
if
(
!
strcmpW
(
id
,
str
))
window
=
cur_window
;
SysFreeString
(
id
);
}
break
;
break
;
}
}
default:
default:
hres
=
E_INVALIDARG
;
WARN
(
"Invalid index %s
\n
"
,
debugstr_variant
(
pvarIndex
));
return
E_INVALIDARG
;
}
}
nsIDOMWindowCollection_Release
(
nsFrames
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
if
(
!
window
)
if
(
!
window
)
...
...
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