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
fe105adf
Commit
fe105adf
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: Use replace_node_by_html instead of document.write for conditional comments.
parent
357994b7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
52 deletions
+30
-52
htmlelem.c
dlls/mshtml/htmlelem.c
+1
-1
mshtml_private.h
dlls/mshtml/mshtml_private.h
+1
-0
mutation.c
dlls/mshtml/mutation.c
+28
-51
No files found.
dlls/mshtml/htmlelem.c
View file @
fe105adf
...
@@ -98,7 +98,7 @@ static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
...
@@ -98,7 +98,7 @@ static const tag_desc_t *get_tag_desc(const WCHAR *tag_name)
return
NULL
;
return
NULL
;
}
}
static
HRESULT
replace_node_by_html
(
nsIDOMHTMLDocument
*
nsdoc
,
nsIDOMNode
*
nsnode
,
const
WCHAR
*
html
)
HRESULT
replace_node_by_html
(
nsIDOMHTMLDocument
*
nsdoc
,
nsIDOMNode
*
nsnode
,
const
WCHAR
*
html
)
{
{
nsIDOMDocumentFragment
*
nsfragment
;
nsIDOMDocumentFragment
*
nsfragment
;
nsIDOMDocumentRange
*
nsdocrange
;
nsIDOMDocumentRange
*
nsdocrange
;
...
...
dlls/mshtml/mshtml_private.h
View file @
fe105adf
...
@@ -753,6 +753,7 @@ IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetLis
...
@@ -753,6 +753,7 @@ IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetLis
void
detach_selection
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
detach_selection
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
detach_ranges
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
void
detach_ranges
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_node_text
(
HTMLDOMNode
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_node_text
(
HTMLDOMNode
*
,
BSTR
*
)
DECLSPEC_HIDDEN
;
HRESULT
replace_node_by_html
(
nsIDOMHTMLDocument
*
,
nsIDOMNode
*
,
const
WCHAR
*
);
HRESULT
create_nselem
(
HTMLDocumentNode
*
,
const
WCHAR
*
,
nsIDOMHTMLElement
**
)
DECLSPEC_HIDDEN
;
HRESULT
create_nselem
(
HTMLDocumentNode
*
,
const
WCHAR
*
,
nsIDOMHTMLElement
**
)
DECLSPEC_HIDDEN
;
...
...
dlls/mshtml/mutation.c
View file @
fe105adf
...
@@ -44,14 +44,12 @@ static const IID NS_ICONTENTUTILS_CID =
...
@@ -44,14 +44,12 @@ static const IID NS_ICONTENTUTILS_CID =
static
nsIContentUtils
*
content_utils
;
static
nsIContentUtils
*
content_utils
;
static
BOOL
handle_insert_comment
(
HTMLDocumentNode
*
doc
,
const
PRUnichar
*
comment
)
static
PRUnichar
*
handle_insert_comment
(
HTMLDocumentNode
*
doc
,
const
PRUnichar
*
comment
)
{
{
DWORD
len
;
int
majorv
=
0
,
minorv
=
0
;
int
majorv
=
0
,
minorv
=
0
;
const
PRUnichar
*
ptr
,
*
end
;
const
PRUnichar
*
ptr
,
*
end
;
nsAString
nsstr
;
PRUnichar
*
buf
;
PRUnichar
*
buf
;
nsresult
nsres
;
DWORD
len
;
enum
{
enum
{
CMP_EQ
,
CMP_EQ
,
...
@@ -64,7 +62,7 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
...
@@ -64,7 +62,7 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
static
const
PRUnichar
endifW
[]
=
{
'<'
,
'!'
,
'['
,
'e'
,
'n'
,
'd'
,
'i'
,
'f'
,
']'
};
static
const
PRUnichar
endifW
[]
=
{
'<'
,
'!'
,
'['
,
'e'
,
'n'
,
'd'
,
'i'
,
'f'
,
']'
};
if
(
comment
[
0
]
!=
'['
||
comment
[
1
]
!=
'i'
||
comment
[
2
]
!=
'f'
)
if
(
comment
[
0
]
!=
'['
||
comment
[
1
]
!=
'i'
||
comment
[
2
]
!=
'f'
)
return
FALSE
;
return
NULL
;
ptr
=
comment
+
3
;
ptr
=
comment
+
3
;
while
(
isspaceW
(
*
ptr
))
while
(
isspaceW
(
*
ptr
))
...
@@ -89,28 +87,28 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
...
@@ -89,28 +87,28 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
}
}
if
(
!
isspaceW
(
*
ptr
++
))
if
(
!
isspaceW
(
*
ptr
++
))
return
FALSE
;
return
NULL
;
while
(
isspaceW
(
*
ptr
))
while
(
isspaceW
(
*
ptr
))
ptr
++
;
ptr
++
;
if
(
ptr
[
0
]
!=
'I'
||
ptr
[
1
]
!=
'E'
)
if
(
ptr
[
0
]
!=
'I'
||
ptr
[
1
]
!=
'E'
)
return
FALSE
;
return
NULL
;
ptr
+=
2
;
ptr
+=
2
;
if
(
!
isspaceW
(
*
ptr
++
))
if
(
!
isspaceW
(
*
ptr
++
))
return
FALSE
;
return
NULL
;
while
(
isspaceW
(
*
ptr
))
while
(
isspaceW
(
*
ptr
))
ptr
++
;
ptr
++
;
if
(
!
isdigitW
(
*
ptr
))
if
(
!
isdigitW
(
*
ptr
))
return
FALSE
;
return
NULL
;
while
(
isdigitW
(
*
ptr
))
while
(
isdigitW
(
*
ptr
))
majorv
=
majorv
*
10
+
(
*
ptr
++
-
'0'
);
majorv
=
majorv
*
10
+
(
*
ptr
++
-
'0'
);
if
(
*
ptr
==
'.'
)
{
if
(
*
ptr
==
'.'
)
{
ptr
++
;
ptr
++
;
if
(
!
isdigitW
(
*
ptr
))
if
(
!
isdigitW
(
*
ptr
))
return
FALSE
;
return
NULL
;
while
(
isdigitW
(
*
ptr
))
while
(
isdigitW
(
*
ptr
))
minorv
=
minorv
*
10
+
(
*
ptr
++
-
'0'
);
minorv
=
minorv
*
10
+
(
*
ptr
++
-
'0'
);
}
}
...
@@ -118,74 +116,64 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
...
@@ -118,74 +116,64 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
while
(
isspaceW
(
*
ptr
))
while
(
isspaceW
(
*
ptr
))
ptr
++
;
ptr
++
;
if
(
ptr
[
0
]
!=
']'
||
ptr
[
1
]
!=
'>'
)
if
(
ptr
[
0
]
!=
']'
||
ptr
[
1
]
!=
'>'
)
return
FALSE
;
return
NULL
;
ptr
+=
2
;
ptr
+=
2
;
len
=
strlenW
(
ptr
);
len
=
strlenW
(
ptr
);
if
(
len
<
sizeof
(
endifW
)
/
sizeof
(
WCHAR
))
if
(
len
<
sizeof
(
endifW
)
/
sizeof
(
WCHAR
))
return
FALSE
;
return
NULL
;
end
=
ptr
+
len
-
sizeof
(
endifW
)
/
sizeof
(
WCHAR
);
end
=
ptr
+
len
-
sizeof
(
endifW
)
/
sizeof
(
WCHAR
);
if
(
memcmp
(
end
,
endifW
,
sizeof
(
endifW
)))
if
(
memcmp
(
end
,
endifW
,
sizeof
(
endifW
)))
return
FALSE
;
return
NULL
;
switch
(
cmpt
)
{
switch
(
cmpt
)
{
case
CMP_EQ
:
case
CMP_EQ
:
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
==
IE_MINOR_VERSION
)
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
==
IE_MINOR_VERSION
)
break
;
break
;
return
FALSE
;
return
NULL
;
case
CMP_LT
:
case
CMP_LT
:
if
(
majorv
>
IE_MAJOR_VERSION
)
if
(
majorv
>
IE_MAJOR_VERSION
)
break
;
break
;
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
>
IE_MINOR_VERSION
)
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
>
IE_MINOR_VERSION
)
break
;
break
;
return
FALSE
;
return
NULL
;
case
CMP_LTE
:
case
CMP_LTE
:
if
(
majorv
>
IE_MAJOR_VERSION
)
if
(
majorv
>
IE_MAJOR_VERSION
)
break
;
break
;
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
>=
IE_MINOR_VERSION
)
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
>=
IE_MINOR_VERSION
)
break
;
break
;
return
FALSE
;
return
NULL
;
case
CMP_GT
:
case
CMP_GT
:
if
(
majorv
<
IE_MAJOR_VERSION
)
if
(
majorv
<
IE_MAJOR_VERSION
)
break
;
break
;
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
<
IE_MINOR_VERSION
)
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
<
IE_MINOR_VERSION
)
break
;
break
;
return
FALSE
;
return
NULL
;
case
CMP_GTE
:
case
CMP_GTE
:
if
(
majorv
<
IE_MAJOR_VERSION
)
if
(
majorv
<
IE_MAJOR_VERSION
)
break
;
break
;
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
<=
IE_MINOR_VERSION
)
if
(
majorv
==
IE_MAJOR_VERSION
&&
minorv
<=
IE_MINOR_VERSION
)
break
;
break
;
return
FALSE
;
return
NULL
;
}
}
buf
=
heap_alloc
((
end
-
ptr
+
1
)
*
sizeof
(
WCHAR
));
buf
=
heap_alloc
((
end
-
ptr
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
buf
)
if
(
!
buf
)
return
FALSE
;
return
NULL
;
memcpy
(
buf
,
ptr
,
(
end
-
ptr
)
*
sizeof
(
WCHAR
));
memcpy
(
buf
,
ptr
,
(
end
-
ptr
)
*
sizeof
(
WCHAR
));
buf
[
end
-
ptr
]
=
0
;
buf
[
end
-
ptr
]
=
0
;
nsAString_InitDepend
(
&
nsstr
,
buf
);
/* FIXME: Find better way to insert HTML to document. */
nsres
=
nsIDOMHTMLDocument_Write
(
doc
->
nsdoc
,
&
nsstr
);
nsAString_Finish
(
&
nsstr
);
heap_free
(
buf
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Write failed: %08x
\n
"
,
nsres
);
return
FALSE
;
}
return
TRUE
;
return
buf
;
}
}
static
nsresult
run_insert_comment
(
HTMLDocumentNode
*
doc
,
nsISupports
*
comment_iface
,
nsISupports
*
arg2
)
static
nsresult
run_insert_comment
(
HTMLDocumentNode
*
doc
,
nsISupports
*
comment_iface
,
nsISupports
*
arg2
)
{
{
const
PRUnichar
*
comment
;
const
PRUnichar
*
comment
;
nsIDOMComment
*
nscomment
;
nsIDOMComment
*
nscomment
;
PRUnichar
*
replace_html
;
nsAString
comment_str
;
nsAString
comment_str
;
BOOL
remove_comment
;
nsresult
nsres
;
nsresult
nsres
;
nsres
=
nsISupports_QueryInterface
(
comment_iface
,
&
IID_nsIDOMComment
,
(
void
**
)
&
nscomment
);
nsres
=
nsISupports_QueryInterface
(
comment_iface
,
&
IID_nsIDOMComment
,
(
void
**
)
&
nscomment
);
...
@@ -200,32 +188,21 @@ static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_i
...
@@ -200,32 +188,21 @@ static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_i
return
nsres
;
return
nsres
;
nsAString_GetData
(
&
comment_str
,
&
comment
);
nsAString_GetData
(
&
comment_str
,
&
comment
);
re
move_comment
=
handle_insert_comment
(
doc
,
comment
);
re
place_html
=
handle_insert_comment
(
doc
,
comment
);
nsAString_Finish
(
&
comment_str
);
nsAString_Finish
(
&
comment_str
);
if
(
remove_comment
)
{
if
(
replace_html
)
{
nsIDOMNode
*
nsparent
,
*
tmp
;
HRESULT
hres
;
nsAString
magic_str
;
static
const
PRUnichar
remove_comment_magicW
[]
=
hres
=
replace_node_by_html
(
doc
->
nsdoc
,
(
nsIDOMNode
*
)
nscomment
,
replace_html
);
{
'#'
,
'!'
,
'w'
,
'i'
,
'n'
,
'e'
,
'r'
,
'e'
,
'm'
,
'o'
,
'v'
,
'e'
,
'!'
,
'#'
,
0
};
heap_free
(
replace_html
);
if
(
FAILED
(
hres
))
nsAString_InitDepend
(
&
magic_str
,
remove_comment_magicW
);
nsres
=
NS_ERROR_FAILURE
;
nsres
=
nsIDOMComment_SetData
(
nscomment
,
&
magic_str
);
nsAString_Finish
(
&
magic_str
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"SetData failed: %08x
\n
"
,
nsres
);
nsIDOMComment_GetParentNode
(
nscomment
,
&
nsparent
);
if
(
nsparent
)
{
nsIDOMNode_RemoveChild
(
nsparent
,
(
nsIDOMNode
*
)
nscomment
,
&
tmp
);
nsIDOMNode_Release
(
nsparent
);
nsIDOMNode_Release
(
tmp
);
}
}
}
nsIDOMComment_Release
(
nscomment
);
nsIDOMComment_Release
(
nscomment
);
return
NS_OK
;
return
nsres
;
}
}
static
nsresult
run_bind_to_tree
(
HTMLDocumentNode
*
doc
,
nsISupports
*
nsiface
,
nsISupports
*
arg2
)
static
nsresult
run_bind_to_tree
(
HTMLDocumentNode
*
doc
,
nsISupports
*
nsiface
,
nsISupports
*
arg2
)
...
...
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