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
357994b7
Commit
357994b7
authored
Jun 17, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 17, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Moved IHTMLElement::put_outerHTML implementation to separated,…
mshtml: Moved IHTMLElement::put_outerHTML implementation to separated, HTMLElement object independent, function.
parent
d73af0d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
57 deletions
+62
-57
htmlelem.c
dlls/mshtml/htmlelem.c
+62
-57
No files found.
dlls/mshtml/htmlelem.c
View file @
357994b7
...
...
@@ -35,6 +35,8 @@
#include "htmlevent.h"
#include "htmlstyle.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
static
const
WCHAR
aW
[]
=
{
'A'
,
0
};
static
const
WCHAR
bodyW
[]
=
{
'B'
,
'O'
,
'D'
,
'Y'
,
0
};
static
const
WCHAR
embedW
[]
=
{
'E'
,
'M'
,
'B'
,
'E'
,
'D'
,
0
};
...
...
@@ -96,6 +98,65 @@ static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
return
NULL
;
}
static
HRESULT
replace_node_by_html
(
nsIDOMHTMLDocument
*
nsdoc
,
nsIDOMNode
*
nsnode
,
const
WCHAR
*
html
)
{
nsIDOMDocumentFragment
*
nsfragment
;
nsIDOMDocumentRange
*
nsdocrange
;
nsIDOMNSRange
*
nsrange
;
nsIDOMNode
*
nsparent
;
nsIDOMRange
*
range
;
nsAString
html_str
;
nsresult
nsres
;
HRESULT
hres
=
S_OK
;
nsres
=
nsIDOMHTMLDocument_QueryInterface
(
nsdoc
,
&
IID_nsIDOMDocumentRange
,
(
void
**
)
&
nsdocrange
);
if
(
NS_FAILED
(
nsres
))
return
E_FAIL
;
nsres
=
nsIDOMDocumentRange_CreateRange
(
nsdocrange
,
&
range
);
nsIDOMDocumentRange_Release
(
nsdocrange
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"CreateRange failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsIDOMRange_QueryInterface
(
range
,
&
IID_nsIDOMNSRange
,
(
void
**
)
&
nsrange
);
nsIDOMRange_Release
(
range
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMNSRange: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsAString_InitDepend
(
&
html_str
,
html
);
nsIDOMNSRange_CreateContextualFragment
(
nsrange
,
&
html_str
,
&
nsfragment
);
nsIDOMNSRange_Release
(
nsrange
);
nsAString_Finish
(
&
html_str
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"CreateContextualFragment failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsIDOMNode_GetParentNode
(
nsnode
,
&
nsparent
);
if
(
NS_SUCCEEDED
(
nsres
)
&&
nsparent
)
{
nsIDOMNode
*
nstmp
;
nsres
=
nsIDOMNode_ReplaceChild
(
nsparent
,
(
nsIDOMNode
*
)
nsfragment
,
nsnode
,
&
nstmp
);
nsIDOMNode_Release
(
nsparent
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"ReplaceChild failed: %08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
}
else
if
(
nstmp
)
{
nsIDOMNode_Release
(
nstmp
);
}
}
else
{
ERR
(
"GetParentNode failed: %08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
}
nsIDOMDocumentFragment_Release
(
nsfragment
);
return
hres
;
}
typedef
struct
{
DispatchEx
dispex
;
...
...
@@ -111,9 +172,6 @@ static inline HTMLFiltersCollection *impl_from_IHTMLFiltersCollection(IHTMLFilte
static
IHTMLFiltersCollection
*
HTMLFiltersCollection_Create
(
void
);
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
static
inline
HTMLElement
*
impl_from_IHTMLElement
(
IHTMLElement
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
HTMLElement
,
IHTMLElement_iface
);
...
...
@@ -1086,63 +1144,10 @@ static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
static
HRESULT
WINAPI
HTMLElement_put_outerHTML
(
IHTMLElement
*
iface
,
BSTR
v
)
{
HTMLElement
*
This
=
impl_from_IHTMLElement
(
iface
);
nsIDOMDocumentFragment
*
nsfragment
;
nsIDOMDocumentRange
*
nsdocrange
;
nsIDOMNSRange
*
nsrange
;
nsIDOMNode
*
nsparent
;
nsIDOMRange
*
range
;
nsAString
html_str
;
nsresult
nsres
;
HRESULT
hres
=
S_OK
;
TRACE
(
"(%p)->(%s)
\n
"
,
This
,
debugstr_w
(
v
));
nsres
=
nsIDOMHTMLDocument_QueryInterface
(
This
->
node
.
doc
->
nsdoc
,
&
IID_nsIDOMDocumentRange
,
(
void
**
)
&
nsdocrange
);
if
(
NS_FAILED
(
nsres
))
return
E_FAIL
;
nsres
=
nsIDOMDocumentRange_CreateRange
(
nsdocrange
,
&
range
);
nsIDOMDocumentRange_Release
(
nsdocrange
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"CreateRange failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsIDOMRange_QueryInterface
(
range
,
&
IID_nsIDOMNSRange
,
(
void
**
)
&
nsrange
);
nsIDOMRange_Release
(
range
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMNSRange: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsAString_InitDepend
(
&
html_str
,
v
);
nsIDOMNSRange_CreateContextualFragment
(
nsrange
,
&
html_str
,
&
nsfragment
);
nsIDOMNSRange_Release
(
nsrange
);
nsAString_Finish
(
&
html_str
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"CreateContextualFragment failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
}
nsres
=
nsIDOMNode_GetParentNode
(
This
->
node
.
nsnode
,
&
nsparent
);
if
(
NS_SUCCEEDED
(
nsres
)
&&
nsparent
)
{
nsIDOMNode
*
nstmp
;
nsres
=
nsIDOMNode_ReplaceChild
(
nsparent
,
(
nsIDOMNode
*
)
nsfragment
,
This
->
node
.
nsnode
,
&
nstmp
);
nsIDOMNode_Release
(
nsparent
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"ReplaceChild failed: %08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
}
else
if
(
nstmp
)
{
nsIDOMNode_Release
(
nstmp
);
}
}
else
{
ERR
(
"GetParentNode failed: %08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
}
nsIDOMDocumentFragment_Release
(
nsfragment
);
return
hres
;
return
replace_node_by_html
(
This
->
node
.
doc
->
nsdoc
,
This
->
node
.
nsnode
,
v
);
}
static
HRESULT
WINAPI
HTMLElement_get_outerHTML
(
IHTMLElement
*
iface
,
BSTR
*
p
)
...
...
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