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
0f0cb605
Commit
0f0cb605
authored
Dec 27, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Correctly parse color strings.
parent
9a264e54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
8 deletions
+48
-8
htmlbody.c
dlls/mshtml/htmlbody.c
+48
-8
No files found.
dlls/mshtml/htmlbody.c
View file @
0f0cb605
...
...
@@ -83,15 +83,58 @@ static const struct {
{
yellowW
,
0xffff00
}
};
static
int
comp_value
(
const
WCHAR
*
ptr
,
int
dpc
)
{
int
ret
=
0
;
WCHAR
ch
;
if
(
dpc
>
2
)
dpc
=
2
;
while
(
dpc
--
)
{
if
(
!*
ptr
)
ret
*=
16
;
else
if
(
isdigitW
(
ch
=
*
ptr
++
))
ret
=
ret
*
16
+
(
ch
-
'0'
);
else
if
(
'a'
<=
ch
&&
ch
<=
'f'
)
ret
=
ret
*
16
+
(
ch
-
'a'
)
+
10
;
else
if
(
'A'
<=
ch
&&
ch
<=
'F'
)
ret
=
ret
*
16
+
(
ch
-
'A'
)
+
10
;
else
ret
*=
16
;
}
return
ret
;
}
/* Based on Gecko NS_LooseHexToRGB */
static
int
loose_hex_to_rgb
(
const
WCHAR
*
hex
)
{
int
len
,
dpc
;
len
=
strlenW
(
hex
);
if
(
*
hex
==
'#'
)
{
hex
++
;
len
--
;
}
if
(
len
<=
3
)
return
0
;
dpc
=
min
(
len
/
3
+
(
len
%
3
?
1
:
0
),
4
);
return
(
comp_value
(
hex
,
dpc
)
<<
16
)
|
(
comp_value
(
hex
+
dpc
,
dpc
)
<<
8
)
|
comp_value
(
hex
+
2
*
dpc
,
dpc
);
}
static
HRESULT
nscolor_to_str
(
LPCWSTR
color
,
BSTR
*
ret
)
{
int
i
,
rgb
=
-
1
;
static
const
WCHAR
formatW
[]
=
{
'#'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
'%'
,
'0'
,
'2'
,
'x'
,
0
};
if
(
!
color
||
*
color
==
'#'
)
{
*
ret
=
SysAllocString
(
color
)
;
return
*
ret
?
S_OK
:
E_OUTOFMEMORY
;
if
(
!
color
||
!*
color
)
{
*
ret
=
NULL
;
return
S_OK
;
}
if
(
*
color
!=
'#'
)
{
...
...
@@ -100,11 +143,8 @@ static HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret)
rgb
=
keyword_table
[
i
].
rgb
;
}
}
if
(
rgb
==
-
1
)
{
WARN
(
"unknown color %s
\n
"
,
debugstr_w
(
color
));
*
ret
=
SysAllocString
(
color
);
return
*
ret
?
S_OK
:
E_OUTOFMEMORY
;
}
if
(
rgb
==
-
1
)
rgb
=
loose_hex_to_rgb
(
color
);
*
ret
=
SysAllocStringLen
(
NULL
,
7
);
if
(
!*
ret
)
...
...
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