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
992fa480
Commit
992fa480
authored
Mar 13, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added support for target attribute in submit function implementation.
parent
74067c56
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
33 deletions
+77
-33
htmlanchor.c
dlls/mshtml/htmlanchor.c
+58
-29
htmlform.c
dlls/mshtml/htmlform.c
+18
-4
mshtml_private.h
dlls/mshtml/mshtml_private.h
+1
-0
No files found.
dlls/mshtml/htmlanchor.c
View file @
992fa480
...
@@ -70,51 +70,81 @@ static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *targ
...
@@ -70,51 +70,81 @@ static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *targ
return
hres
;
return
hres
;
}
}
static
HRESULT
navigate_anchor
(
HTMLAnchorElement
*
This
)
HTMLOuterWindow
*
get_target_window
(
HTMLOuterWindow
*
window
,
nsAString
*
target_str
,
BOOL
*
use_new_window
)
{
{
nsAString
href_str
,
target_str
;
HTMLOuterWindow
*
top_window
,
*
ret_window
;
HTMLOuterWindow
*
window
=
NULL
;
const
PRUnichar
*
target
;
nsresult
nsres
;
HRESULT
hres
;
HRESULT
hres
=
E_FAIL
;
static
const
WCHAR
_parentW
[]
=
{
'_'
,
'p'
,
'a'
,
'r'
,
'e'
,
'n'
,
't'
,
0
};
static
const
WCHAR
_parentW
[]
=
{
'_'
,
'p'
,
'a'
,
'r'
,
'e'
,
'n'
,
't'
,
0
};
static
const
WCHAR
_selfW
[]
=
{
'_'
,
's'
,
'e'
,
'l'
,
'f'
,
0
};
static
const
WCHAR
_selfW
[]
=
{
'_'
,
's'
,
'e'
,
'l'
,
'f'
,
0
};
static
const
WCHAR
_topW
[]
=
{
'_'
,
't'
,
'o'
,
'p'
,
0
};
static
const
WCHAR
_topW
[]
=
{
'_'
,
't'
,
'o'
,
'p'
,
0
};
nsAString_Init
(
&
target_str
,
NULL
);
*
use_new_window
=
FALSE
;
nsres
=
nsIDOMHTMLAnchorElement_GetTarget
(
This
->
nsanchor
,
&
target_str
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsAString_GetData
(
target_str
,
&
target
);
const
PRUnichar
*
target
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
target
));
if
(
!*
target
||
!
strcmpiW
(
target
,
_selfW
))
{
IHTMLWindow2_AddRef
(
&
window
->
base
.
IHTMLWindow2_iface
);
return
window
;
}
nsAString_GetData
(
&
target_str
,
&
target
);
TRACE
(
"target %s
\n
"
,
debugstr_w
(
target
));
if
(
*
target
&&
strcmpiW
(
target
,
_selfW
))
{
if
(
!
strcmpiW
(
target
,
_topW
))
{
if
(
!
strcmpiW
(
target
,
_topW
))
{
TRACE
(
"target _top
\n
"
);
get_top_window
(
window
,
&
top_window
);
get_top_window
(
This
->
element
.
node
.
doc
->
basedoc
.
window
,
&
window
);
IHTMLWindow2_AddRef
(
&
top_window
->
base
.
IHTMLWindow2_iface
);
}
else
if
(
!
strcmpiW
(
target
,
_parentW
))
{
return
top_window
;
window
=
This
->
element
.
node
.
doc
->
basedoc
.
window
;
}
if
(
!
strcmpiW
(
target
,
_parentW
))
{
if
(
!
window
->
parent
)
{
if
(
!
window
->
parent
)
{
WARN
(
"Window has no parent
\n
"
);
WARN
(
"Window has no parent
\n
"
);
nsAString_Finish
(
&
target_str
);
return
NULL
;
return
S_OK
;
}
IHTMLWindow2_AddRef
(
&
window
->
parent
->
base
.
IHTMLWindow2_iface
);
return
window
->
parent
;
}
}
window
=
window
->
parent
;
}
else
{
HTMLOuterWindow
*
top_window
;
get_top_window
(
This
->
element
.
node
.
doc
->
basedoc
.
window
,
&
top_window
);
get_top_window
(
window
,
&
top_window
);
hres
=
get_frame_by_name
(
top_window
,
target
,
TRUE
,
&
window
);
hres
=
get_frame_by_name
(
top_window
,
target
,
TRUE
,
&
ret_window
);
if
(
FAILED
(
hres
)
||
!
window
)
{
if
(
FAILED
(
hres
)
||
!
ret_window
)
{
*
use_new_window
=
TRUE
;
return
NULL
;
}
IHTMLWindow2_AddRef
(
&
ret_window
->
base
.
IHTMLWindow2_iface
);
return
ret_window
;
}
static
HRESULT
navigate_anchor
(
HTMLAnchorElement
*
This
)
{
nsAString
href_str
,
target_str
;
HTMLOuterWindow
*
window
;
BOOL
use_new_window
;
nsresult
nsres
;
HRESULT
hres
=
E_FAIL
;
nsAString_Init
(
&
target_str
,
NULL
);
nsres
=
nsIDOMHTMLAnchorElement_GetTarget
(
This
->
nsanchor
,
&
target_str
);
if
(
NS_FAILED
(
nsres
))
return
E_FAIL
;
window
=
get_target_window
(
This
->
element
.
node
.
doc
->
basedoc
.
window
,
&
target_str
,
&
use_new_window
);
if
(
!
window
&&
use_new_window
)
{
const
PRUnichar
*
target
;
nsAString_GetData
(
&
target_str
,
&
target
);
hres
=
navigate_anchor_window
(
This
,
target
);
hres
=
navigate_anchor_window
(
This
,
target
);
nsAString_Finish
(
&
target_str
);
nsAString_Finish
(
&
target_str
);
return
hres
;
return
hres
;
}
}
}
}
}
nsAString_Finish
(
&
target_str
);
nsAString_Finish
(
&
target_str
);
if
(
!
window
)
return
S_OK
;
nsAString_Init
(
&
href_str
,
NULL
);
nsAString_Init
(
&
href_str
,
NULL
);
nsres
=
nsIDOMHTMLAnchorElement_GetHref
(
This
->
nsanchor
,
&
href_str
);
nsres
=
nsIDOMHTMLAnchorElement_GetHref
(
This
->
nsanchor
,
&
href_str
);
...
@@ -123,8 +153,6 @@ static HRESULT navigate_anchor(HTMLAnchorElement *This)
...
@@ -123,8 +153,6 @@ static HRESULT navigate_anchor(HTMLAnchorElement *This)
nsAString_GetData
(
&
href_str
,
&
href
);
nsAString_GetData
(
&
href_str
,
&
href
);
if
(
*
href
)
{
if
(
*
href
)
{
if
(
!
window
)
window
=
This
->
element
.
node
.
doc
->
basedoc
.
window
;
hres
=
navigate_url
(
window
,
href
,
window
->
uri_nofrag
,
BINDING_NAVIGATED
);
hres
=
navigate_url
(
window
,
href
,
window
->
uri_nofrag
,
BINDING_NAVIGATED
);
}
else
{
}
else
{
TRACE
(
"empty href
\n
"
);
TRACE
(
"empty href
\n
"
);
...
@@ -132,6 +160,7 @@ static HRESULT navigate_anchor(HTMLAnchorElement *This)
...
@@ -132,6 +160,7 @@ static HRESULT navigate_anchor(HTMLAnchorElement *This)
}
}
}
}
nsAString_Finish
(
&
href_str
);
nsAString_Finish
(
&
href_str
);
IHTMLWindow2_Release
(
&
window
->
base
.
IHTMLWindow2_iface
);
return
hres
;
return
hres
;
}
}
...
...
dlls/mshtml/htmlform.c
View file @
992fa480
...
@@ -362,9 +362,9 @@ static HRESULT WINAPI HTMLFormElement_get_onreset(IHTMLFormElement *iface, VARIA
...
@@ -362,9 +362,9 @@ static HRESULT WINAPI HTMLFormElement_get_onreset(IHTMLFormElement *iface, VARIA
static
HRESULT
WINAPI
HTMLFormElement_submit
(
IHTMLFormElement
*
iface
)
static
HRESULT
WINAPI
HTMLFormElement_submit
(
IHTMLFormElement
*
iface
)
{
{
HTMLFormElement
*
This
=
impl_from_IHTMLFormElement
(
iface
);
HTMLFormElement
*
This
=
impl_from_IHTMLFormElement
(
iface
);
HTMLOuterWindow
*
window
=
NULL
;
HTMLOuterWindow
*
window
=
NULL
,
*
this_window
=
NULL
;
nsIInputStream
*
post_stream
;
nsIInputStream
*
post_stream
;
nsAString
action_uri_str
;
nsAString
action_uri_str
,
target_str
;
IUri
*
uri
;
IUri
*
uri
;
nsresult
nsres
;
nsresult
nsres
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -374,19 +374,32 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
...
@@ -374,19 +374,32 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
if
(
This
->
element
.
node
.
doc
)
{
if
(
This
->
element
.
node
.
doc
)
{
HTMLDocumentNode
*
doc
=
This
->
element
.
node
.
doc
;
HTMLDocumentNode
*
doc
=
This
->
element
.
node
.
doc
;
if
(
doc
->
window
&&
doc
->
window
->
base
.
outer_window
)
if
(
doc
->
window
&&
doc
->
window
->
base
.
outer_window
)
window
=
doc
->
window
->
base
.
outer_window
;
this_
window
=
doc
->
window
->
base
.
outer_window
;
}
}
if
(
!
window
)
{
if
(
!
this_
window
)
{
TRACE
(
"No outer window
\n
"
);
TRACE
(
"No outer window
\n
"
);
return
S_OK
;
return
S_OK
;
}
}
nsAString_Init
(
&
target_str
,
NULL
);
nsres
=
nsIDOMHTMLFormElement_GetTarget
(
This
->
nsform
,
&
target_str
);
if
(
NS_SUCCEEDED
(
nsres
))
{
BOOL
use_new_window
;
window
=
get_target_window
(
this_window
,
&
target_str
,
&
use_new_window
);
if
(
use_new_window
)
FIXME
(
"submit to new window is not supported
\n
"
);
}
nsAString_Finish
(
&
target_str
);
if
(
!
window
)
return
S_OK
;
/*
/*
* FIXME: We currently don't use our submit implementation for sub-windows because
* FIXME: We currently don't use our submit implementation for sub-windows because
* load_nsuri can't support post data. We should fix it.
* load_nsuri can't support post data. We should fix it.
*/
*/
if
(
!
window
->
doc_obj
||
window
->
doc_obj
->
basedoc
.
window
!=
window
)
{
if
(
!
window
->
doc_obj
||
window
->
doc_obj
->
basedoc
.
window
!=
window
)
{
nsres
=
nsIDOMHTMLFormElement_Submit
(
This
->
nsform
);
nsres
=
nsIDOMHTMLFormElement_Submit
(
This
->
nsform
);
IHTMLWindow2_Release
(
&
window
->
base
.
IHTMLWindow2_iface
);
if
(
NS_FAILED
(
nsres
))
{
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Submit failed: %08x
\n
"
,
nsres
);
ERR
(
"Submit failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
return
E_FAIL
;
...
@@ -414,6 +427,7 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
...
@@ -414,6 +427,7 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface)
IUri_Release
(
uri
);
IUri_Release
(
uri
);
}
}
IHTMLWindow2_Release
(
&
window
->
base
.
IHTMLWindow2_iface
);
if
(
post_stream
)
if
(
post_stream
)
nsIInputStream_Release
(
post_stream
);
nsIInputStream_Release
(
post_stream
);
return
hres
;
return
hres
;
...
...
dlls/mshtml/mshtml_private.h
View file @
992fa480
...
@@ -943,6 +943,7 @@ HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
...
@@ -943,6 +943,7 @@ HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
HRESULT
search_window_props
(
HTMLInnerWindow
*
,
BSTR
,
DWORD
,
DISPID
*
)
DECLSPEC_HIDDEN
;
HRESULT
search_window_props
(
HTMLInnerWindow
*
,
BSTR
,
DWORD
,
DISPID
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_frame_by_name
(
HTMLOuterWindow
*
,
const
WCHAR
*
,
BOOL
,
HTMLOuterWindow
**
)
DECLSPEC_HIDDEN
;
HRESULT
get_frame_by_name
(
HTMLOuterWindow
*
,
const
WCHAR
*
,
BOOL
,
HTMLOuterWindow
**
)
DECLSPEC_HIDDEN
;
HRESULT
get_doc_elem_by_id
(
HTMLDocumentNode
*
,
const
WCHAR
*
,
HTMLElement
**
)
DECLSPEC_HIDDEN
;
HRESULT
get_doc_elem_by_id
(
HTMLDocumentNode
*
,
const
WCHAR
*
,
HTMLElement
**
)
DECLSPEC_HIDDEN
;
HTMLOuterWindow
*
get_target_window
(
HTMLOuterWindow
*
,
nsAString
*
,
BOOL
*
)
DECLSPEC_HIDDEN
;
HRESULT
wrap_iface
(
IUnknown
*
,
IUnknown
*
,
IUnknown
**
)
DECLSPEC_HIDDEN
;
HRESULT
wrap_iface
(
IUnknown
*
,
IUnknown
*
,
IUnknown
**
)
DECLSPEC_HIDDEN
;
...
...
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