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
cbc186b8
Commit
cbc186b8
authored
Oct 07, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added support for accessing style attributes by CSS syntax.
parent
844d1cfc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
33 deletions
+64
-33
htmlstyle.c
dlls/mshtml/htmlstyle.c
+63
-32
htmlstyle.h
dlls/mshtml/htmlstyle.h
+1
-1
No files found.
dlls/mshtml/htmlstyle.c
View file @
cbc186b8
...
...
@@ -24,6 +24,7 @@
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "mshtmdid.h"
#include "mshtml_private.h"
#include "htmlstyle.h"
...
...
@@ -84,32 +85,35 @@ static const WCHAR attrWidth[] =
static
const
WCHAR
attrZIndex
[]
=
{
'z'
,
'-'
,
'i'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
LPCWSTR
style_strings
[]
=
{
attrBackground
,
attrBackgroundColor
,
attrBackgroundImage
,
attrBorder
,
attrBorderLeft
,
attrColor
,
attrCursor
,
attrDisplay
,
attrFontFamily
,
attrFontSize
,
attrFontStyle
,
attrFontWeight
,
attrHeight
,
attrLeft
,
attrMargin
,
attrMarginLeft
,
attrMarginRight
,
attrPaddingLeft
,
attrPosition
,
attrTextDecoration
,
attrTop
,
attrVerticalAlign
,
attrVisibility
,
attrWidth
,
attrZIndex
static
const
struct
{
const
WCHAR
*
name
;
DISPID
dispid
;
}
style_tbl
[]
=
{
{
attrBackground
,
DISPID_IHTMLSTYLE_BACKGROUND
},
{
attrBackgroundColor
,
DISPID_IHTMLSTYLE_BACKGROUNDCOLOR
},
{
attrBackgroundImage
,
DISPID_IHTMLSTYLE_BACKGROUNDIMAGE
},
{
attrBorder
,
DISPID_IHTMLSTYLE_BORDER
},
{
attrBorderLeft
,
DISPID_IHTMLSTYLE_BORDERLEFT
},
{
attrColor
,
DISPID_IHTMLSTYLE_COLOR
},
{
attrCursor
,
DISPID_IHTMLSTYLE_CURSOR
},
{
attrDisplay
,
DISPID_IHTMLSTYLE_DISPLAY
},
{
attrFontFamily
,
DISPID_IHTMLSTYLE_FONTFAMILY
},
{
attrFontSize
,
DISPID_IHTMLSTYLE_FONTSIZE
},
{
attrFontStyle
,
DISPID_IHTMLSTYLE_FONTSTYLE
},
{
attrFontWeight
,
DISPID_IHTMLSTYLE_FONTWEIGHT
},
{
attrHeight
,
DISPID_IHTMLSTYLE_HEIGHT
},
{
attrLeft
,
DISPID_IHTMLSTYLE_LEFT
},
{
attrMargin
,
DISPID_IHTMLSTYLE_MARGIN
},
{
attrMarginLeft
,
DISPID_IHTMLSTYLE_MARGINLEFT
},
{
attrMarginRight
,
DISPID_IHTMLSTYLE_MARGINRIGHT
},
{
attrPaddingLeft
,
DISPID_IHTMLSTYLE_PADDINGLEFT
},
{
attrPosition
,
DISPID_IHTMLSTYLE2_POSITION
},
{
attrTextDecoration
,
DISPID_IHTMLSTYLE_TEXTDECORATION
},
{
attrTop
,
DISPID_IHTMLSTYLE_TOP
},
{
attrVerticalAlign
,
DISPID_IHTMLSTYLE_VERTICALALIGN
},
{
attrVisibility
,
DISPID_IHTMLSTYLE_VISIBILITY
},
{
attrWidth
,
DISPID_IHTMLSTYLE_WIDTH
},
{
attrZIndex
,
DISPID_IHTMLSTYLE_ZINDEX
}
};
static
const
WCHAR
valLineThrough
[]
=
...
...
@@ -192,7 +196,7 @@ HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCW
if
(
flags
&
ATTR_FIX_URL
)
val
=
fix_url_value
(
value
);
nsAString_Init
(
&
str_name
,
style_
strings
[
sid
]
);
nsAString_Init
(
&
str_name
,
style_
tbl
[
sid
].
name
);
nsAString_Init
(
&
str_value
,
val
?
val
:
value
);
nsAString_Init
(
&
str_empty
,
wszEmpty
);
heap_free
(
val
);
...
...
@@ -218,7 +222,7 @@ static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, stylei
nsAString
str_name
;
nsresult
nsres
;
nsAString_Init
(
&
str_name
,
style_
strings
[
sid
]
);
nsAString_Init
(
&
str_name
,
style_
tbl
[
sid
].
name
);
nsres
=
nsIDOMCSSStyleDeclaration_GetPropertyValue
(
nsstyle
,
&
str_name
,
value
);
if
(
NS_FAILED
(
nsres
))
{
...
...
@@ -245,7 +249,7 @@ HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, BSTR
nsAString_Finish
(
&
str_value
);
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
style_
strings
[
sid
]
),
debugstr_w
(
*
p
));
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
style_
tbl
[
sid
].
name
),
debugstr_w
(
*
p
));
return
S_OK
;
}
...
...
@@ -296,7 +300,7 @@ HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid,
nsAString_Finish
(
&
str_value
);
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
style_
strings
[
sid
]
),
debugstr_variant
(
p
));
TRACE
(
"%s -> %s
\n
"
,
debugstr_w
(
style_
tbl
[
sid
].
name
),
debugstr_variant
(
p
));
return
S_OK
;
}
...
...
@@ -318,7 +322,7 @@ static HRESULT check_style_attr_value(HTMLStyle *This, styleid_t sid, LPCWSTR ex
*
p
=
strcmpW
(
value
,
exval
)
?
VARIANT_FALSE
:
VARIANT_TRUE
;
nsAString_Finish
(
&
str_value
);
TRACE
(
"%s -> %x
\n
"
,
debugstr_w
(
style_
strings
[
sid
]
),
*
p
);
TRACE
(
"%s -> %x
\n
"
,
debugstr_w
(
style_
tbl
[
sid
].
name
),
*
p
);
return
S_OK
;
}
...
...
@@ -1907,6 +1911,28 @@ static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
return
E_NOTIMPL
;
}
static
HRESULT
HTMLStyle_get_dispid
(
IUnknown
*
iface
,
BSTR
name
,
DWORD
flags
,
DISPID
*
dispid
)
{
int
c
,
i
,
min
=
0
,
max
=
sizeof
(
style_tbl
)
/
sizeof
(
*
style_tbl
)
-
1
;
while
(
min
<=
max
)
{
i
=
(
min
+
max
)
/
2
;
c
=
strcmpW
(
style_tbl
[
i
].
name
,
name
);
if
(
!
c
)
{
*
dispid
=
style_tbl
[
i
].
dispid
;
return
S_OK
;
}
if
(
c
>
0
)
max
=
i
-
1
;
else
min
=
i
+
1
;
}
return
DISP_E_UNKNOWNNAME
;
}
static
const
IHTMLStyleVtbl
HTMLStyleVtbl
=
{
HTMLStyle_QueryInterface
,
HTMLStyle_AddRef
,
...
...
@@ -2096,13 +2122,18 @@ static const IHTMLStyleVtbl HTMLStyleVtbl = {
HTMLStyle_toString
};
static
const
dispex_static_data_vtbl_t
HTMLStyle_dispex_vtbl
=
{
HTMLStyle_get_dispid
,
NULL
};
static
const
tid_t
HTMLStyle_iface_tids
[]
=
{
IHTMLStyle_tid
,
IHTMLStyle2_tid
,
0
};
static
dispex_static_data_t
HTMLStyle_dispex
=
{
NULL
,
&
HTMLStyle_dispex_vtbl
,
DispHTMLStyle_tid
,
NULL
,
HTMLStyle_iface_tids
...
...
dlls/mshtml/htmlstyle.h
View file @
cbc186b8
...
...
@@ -29,7 +29,7 @@ typedef struct {
#define HTMLSTYLE(x) ((IHTMLStyle*) &(x)->lpHTMLStyleVtbl)
#define HTMLSTYLE2(x) ((IHTMLStyle2*) &(x)->lpHTMLStyle2Vtbl)
/* NOTE: Make sure to keep in sync with st
ryle_strings in htmlstr
le.c */
/* NOTE: Make sure to keep in sync with st
yle_tbl in htmlsty
le.c */
typedef
enum
{
STYLEID_BACKGROUND
,
STYLEID_BACKGROUND_COLOR
,
...
...
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