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
f3d40454
Commit
f3d40454
authored
Feb 28, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added simple filter parser to support opacity.
parent
1745abfa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
1 deletion
+106
-1
htmlstyle.c
dlls/mshtml/htmlstyle.c
+105
-0
dom.c
dlls/mshtml/tests/dom.c
+1
-1
No files found.
dlls/mshtml/htmlstyle.c
View file @
f3d40454
...
...
@@ -2545,6 +2545,109 @@ static HRESULT WINAPI HTMLStyle_get_clip(IHTMLStyle *iface, BSTR *p)
return
E_NOTIMPL
;
}
static
void
set_opacity
(
HTMLStyle
*
This
,
const
WCHAR
*
val
)
{
nsAString
name_str
,
val_str
,
empty_str
;
nsresult
nsres
;
static
const
WCHAR
opacityW
[]
=
{
'o'
,
'p'
,
'a'
,
'c'
,
'i'
,
't'
,
'y'
,
0
};
TRACE
(
"%s
\n
"
,
debugstr_w
(
val
));
nsAString_InitDepend
(
&
name_str
,
opacityW
);
nsAString_InitDepend
(
&
val_str
,
val
);
nsAString_InitDepend
(
&
empty_str
,
emptyW
);
nsres
=
nsIDOMCSSStyleDeclaration_SetProperty
(
This
->
nsstyle
,
&
name_str
,
&
val_str
,
&
empty_str
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"SetProperty failed: %08x
\n
"
,
nsres
);
nsAString_Finish
(
&
name_str
);
nsAString_Finish
(
&
val_str
);
nsAString_Finish
(
&
empty_str
);
}
static
void
update_filter
(
HTMLStyle
*
This
)
{
const
WCHAR
*
ptr
=
This
->
filter
,
*
ptr2
;
static
const
WCHAR
alphaW
[]
=
{
'a'
,
'l'
,
'p'
,
'h'
,
'a'
};
if
(
!
ptr
)
{
set_opacity
(
This
,
emptyW
);
return
;
}
while
(
1
)
{
while
(
isspaceW
(
*
ptr
))
ptr
++
;
if
(
!*
ptr
)
break
;
ptr2
=
ptr
;
while
(
isalnumW
(
*
ptr
))
ptr
++
;
if
(
ptr
==
ptr2
)
{
WARN
(
"unexpected char '%c'
\n
"
,
*
ptr
);
break
;
}
if
(
*
ptr
!=
'('
)
{
WARN
(
"expected '('
\n
"
);
continue
;
}
if
(
ptr2
+
sizeof
(
alphaW
)
/
sizeof
(
WCHAR
)
==
ptr
&&
!
memcmp
(
ptr2
,
alphaW
,
sizeof
(
alphaW
)))
{
static
const
WCHAR
formatW
[]
=
{
'%'
,
'f'
,
0
};
static
const
WCHAR
opacityW
[]
=
{
'o'
,
'p'
,
'a'
,
'c'
,
'i'
,
't'
,
'y'
,
'='
};
ptr
++
;
do
{
while
(
isspaceW
(
*
ptr
))
ptr
++
;
ptr2
=
ptr
;
while
(
*
ptr
&&
*
ptr
!=
','
&&
*
ptr
!=
')'
)
ptr
++
;
if
(
!*
ptr
)
{
WARN
(
"unexpected end of string
\n
"
);
break
;
}
if
(
ptr
-
ptr2
>
sizeof
(
opacityW
)
/
sizeof
(
WCHAR
)
&&
!
memcmp
(
ptr2
,
opacityW
,
sizeof
(
opacityW
)))
{
float
fval
=
0
.
0
f
,
e
=
0
.
1
f
;
WCHAR
buf
[
32
];
ptr2
+=
sizeof
(
opacityW
)
/
sizeof
(
WCHAR
);
while
(
isdigitW
(
*
ptr2
))
fval
=
fval
*
10
.
0
f
+
(
float
)(
*
ptr2
++
-
'0'
);
if
(
*
ptr2
==
'.'
)
{
while
(
isdigitW
(
*++
ptr2
))
{
fval
+=
e
*
(
float
)(
*
ptr2
++
-
'0'
);
e
*=
0
.
1
f
;
}
}
sprintfW
(
buf
,
formatW
,
fval
*
0
.
01
f
);
set_opacity
(
This
,
buf
);
}
else
{
FIXME
(
"unknown param %s
\n
"
,
debugstr_wn
(
ptr2
,
ptr
-
ptr2
));
}
if
(
*
ptr
==
','
)
ptr
++
;
}
while
(
*
ptr
!=
')'
);
}
else
{
FIXME
(
"unknown filter %s
\n
"
,
debugstr_wn
(
ptr2
,
ptr
-
ptr2
));
ptr
=
strchrW
(
ptr
,
')'
);
if
(
!
ptr
)
break
;
ptr
++
;
}
}
}
static
HRESULT
WINAPI
HTMLStyle_put_filter
(
IHTMLStyle
*
iface
,
BSTR
v
)
{
HTMLStyle
*
This
=
impl_from_IHTMLStyle
(
iface
);
...
...
@@ -2560,6 +2663,8 @@ static HRESULT WINAPI HTMLStyle_put_filter(IHTMLStyle *iface, BSTR v)
heap_free
(
This
->
filter
);
This
->
filter
=
new_filter
;
update_filter
(
This
);
return
S_OK
;
}
...
...
dlls/mshtml/tests/dom.c
View file @
f3d40454
...
...
@@ -5608,7 +5608,7 @@ static void test_style_filters(IHTMLElement *elem)
ok
(
hres
==
S_OK
,
"get_style failed: %08x
\n
"
,
hres
);
test_style_filter
(
style
,
NULL
);
set_style_filter
(
style
,
"alpha(opacity=50.00
00
0)"
);
set_style_filter
(
style
,
"alpha(opacity=50.00
4
0)"
);
set_style_filter
(
style
,
"alpha(opacity=100)"
);
IHTMLStyle_Release
(
style
);
...
...
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