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
4ac1ba13
Commit
4ac1ba13
authored
Dec 06, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Added IHTMLStyleSheet::get_rules implementation.
parent
da391700
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
199 additions
and
6 deletions
+199
-6
htmlstylesheet.c
dlls/mshtml/htmlstylesheet.c
+155
-4
nsiface.idl
dlls/mshtml/nsiface.idl
+26
-2
dom.c
dlls/mshtml/tests/dom.c
+18
-0
No files found.
dlls/mshtml/htmlstylesheet.c
View file @
4ac1ba13
...
...
@@ -52,8 +52,148 @@ typedef struct {
nsIDOMStyleSheetList
*
nslist
;
}
HTMLStyleSheetsCollection
;
#define HTMLSTYLESHEET(x) ((IHTMLStyleSheet*) &(x)->lpHTMLStyleSheetVtbl);
#define HTMLSTYLESHEETSCOL(x) ((IHTMLStyleSheetsCollection*) &(x)->lpHTMLStyleSheetsCollectionVtbl);
typedef
struct
{
const
IHTMLStyleSheetRulesCollectionVtbl
*
lpHTMLStyleSheetRulesCollectionVtbl
;
LONG
ref
;
nsIDOMCSSRuleList
*
nslist
;
}
HTMLStyleSheetRulesCollection
;
#define HTMLSTYLESHEET(x) ((IHTMLStyleSheet*) &(x)->lpHTMLStyleSheetVtbl);
#define HTMLSTYLESHEETSCOL(x) ((IHTMLStyleSheetsCollection*) &(x)->lpHTMLStyleSheetsCollectionVtbl);
#define HTMLSTYLERULESCOL(x) ((IHTMLStyleSheetRulesCollection*) &(x)->lpHTMLStyleSheetRulesCollectionVtbl)
#define HTMLSTYLERULESCOL_THIS(iface) \
DEFINE_THIS(HTMLStyleSheetRulesCollection, HTMLStyleSheetRulesCollection, iface)
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_QueryInterface
(
IHTMLStyleSheetRulesCollection
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
{
TRACE
(
"(%p)->(IID_IUnknown %p)
\n
"
,
This
,
ppv
);
*
ppv
=
HTMLSTYLERULESCOL
(
This
);
}
else
if
(
IsEqualGUID
(
&
IID_IHTMLStyleSheetRulesCollection
,
riid
))
{
TRACE
(
"(%p)->(IID_IHTMLStyleSheetRulesCollection %p)
\n
"
,
This
,
ppv
);
*
ppv
=
HTMLSTYLERULESCOL
(
This
);
}
if
(
*
ppv
)
{
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
}
FIXME
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppv
);
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
HTMLStyleSheetRulesCollection_AddRef
(
IHTMLStyleSheetRulesCollection
*
iface
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
HTMLStyleSheetRulesCollection_Release
(
IHTMLStyleSheetRulesCollection
*
iface
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
This
->
nslist
)
nsIDOMCSSRuleList_Release
(
This
->
nslist
);
heap_free
(
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_GetTypeInfoCount
(
IHTMLStyleSheetRulesCollection
*
iface
,
UINT
*
pctinfo
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
pctinfo
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_GetTypeInfo
(
IHTMLStyleSheetRulesCollection
*
iface
,
UINT
iTInfo
,
LCID
lcid
,
ITypeInfo
**
ppTInfo
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
FIXME
(
"(%p)->(%u %u %p)
\n
"
,
This
,
iTInfo
,
lcid
,
ppTInfo
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_GetIDsOfNames
(
IHTMLStyleSheetRulesCollection
*
iface
,
REFIID
riid
,
LPOLESTR
*
rgszNames
,
UINT
cNames
,
LCID
lcid
,
DISPID
*
rgDispId
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
FIXME
(
"(%p)->(%s %p %u %u %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
rgszNames
,
cNames
,
lcid
,
rgDispId
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_Invoke
(
IHTMLStyleSheetRulesCollection
*
iface
,
DISPID
dispIdMember
,
REFIID
riid
,
LCID
lcid
,
WORD
wFlags
,
DISPPARAMS
*
pDispParams
,
VARIANT
*
pVarResult
,
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
FIXME
(
"(%p)->(%d %s %d %d %p %p %p %p)
\n
"
,
This
,
dispIdMember
,
debugstr_guid
(
riid
),
lcid
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_get_length
(
IHTMLStyleSheetRulesCollection
*
iface
,
long
*
p
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
p
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
HTMLStyleSheetRulesCollection_item
(
IHTMLStyleSheetRulesCollection
*
iface
,
long
index
,
IHTMLStyleSheetRule
**
ppHTMLStyleSheetRule
)
{
HTMLStyleSheetRulesCollection
*
This
=
HTMLSTYLERULESCOL_THIS
(
iface
);
FIXME
(
"(%p)->(%ld %p)
\n
"
,
This
,
index
,
ppHTMLStyleSheetRule
);
return
E_NOTIMPL
;
}
#undef HTMLSTYLERULECOL_THIS
static
const
IHTMLStyleSheetRulesCollectionVtbl
HTMLStyleSheetRulesCollectionVtbl
=
{
HTMLStyleSheetRulesCollection_QueryInterface
,
HTMLStyleSheetRulesCollection_AddRef
,
HTMLStyleSheetRulesCollection_Release
,
HTMLStyleSheetRulesCollection_GetTypeInfoCount
,
HTMLStyleSheetRulesCollection_GetTypeInfo
,
HTMLStyleSheetRulesCollection_GetIDsOfNames
,
HTMLStyleSheetRulesCollection_Invoke
,
HTMLStyleSheetRulesCollection_get_length
,
HTMLStyleSheetRulesCollection_item
};
static
IHTMLStyleSheetRulesCollection
*
HTMLStyleSheetRulesCollection_Create
(
nsIDOMCSSRuleList
*
nslist
)
{
HTMLStyleSheetRulesCollection
*
ret
;
ret
=
heap_alloc
(
sizeof
(
*
ret
));
ret
->
lpHTMLStyleSheetRulesCollectionVtbl
=
&
HTMLStyleSheetRulesCollectionVtbl
;
ret
->
ref
=
1
;
ret
->
nslist
=
nslist
;
if
(
nslist
)
nsIDOMCSSRuleList_AddRef
(
nslist
);
return
HTMLSTYLERULESCOL
(
ret
);
}
#define HTMLSTYLESHEETSCOL_THIS(iface) \
DEFINE_THIS(HTMLStyleSheetsCollection, HTMLStyleSheetsCollection, iface)
...
...
@@ -468,8 +608,19 @@ static HRESULT WINAPI HTMLStyleSheet_get_rules(IHTMLStyleSheet *iface,
IHTMLStyleSheetRulesCollection
**
p
)
{
HTMLStyleSheet
*
This
=
HTMLSTYLESHEET_THIS
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
p
);
return
E_NOTIMPL
;
nsIDOMCSSRuleList
*
nslist
=
NULL
;
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
/* Gecko has buggy security checks and GetCssRules will fail. We have a correct
* implementation and it will work when the bug will be fixed in Gecko. */
nsres
=
nsIDOMCSSStyleSheet_GetCssRules
(
This
->
nsstylesheet
,
&
nslist
);
if
(
NS_FAILED
(
nsres
))
WARN
(
"GetCssRules failed: %08x
\n
"
,
nsres
);
*
p
=
HTMLStyleSheetRulesCollection_Create
(
nslist
);
return
S_OK
;
}
static
const
IHTMLStyleSheetVtbl
HTMLStyleSheetVtbl
=
{
...
...
dlls/mshtml/nsiface.idl
View file @
4ac1ba13
...
...
@@ -81,6 +81,7 @@ interface nsIOutputStream;
interface
nsIEditorObserver
;
interface
nsIEditActionListener
;
interface
nsIDocumentStateListener
;
interface
nsIDOMCSSStyleSheet
;
interface
IMoniker
;
...
...
@@ -116,7 +117,6 @@ typedef nsISupports nsIDOMHTMLOptionsCollection;
typedef nsISupports nsIDOMHTMLCollection;
typedef nsISupports nsIWebProgressListener;
typedef nsISupports nsIDOMCSSValue;
typedef nsISupports nsIDOMCSSRule;
typedef nsISupports nsIPrintSession;
typedef nsISupports nsIControllerCommandTable;
typedef nsISupports nsIPrincipal;
...
...
@@ -124,7 +124,6 @@ typedef nsISupports nsIAtom;
typedef nsISupports nsISupportsArray;
typedef nsISupports nsIContentFilter;
typedef nsISupports nsIDOMMediaList;
typedef nsISupports nsIDOMCSSRuleList;
[
object,
...
...
@@ -553,6 +552,20 @@ interface nsIUploadChannel : nsISupports
[
object,
uuid(a6cf90c1-15b3-11d2-932e-00805f8add32)
/* FROZEN */
]
interface nsIDOMCSSRule : nsISupports
{
nsresult GetType(PRUint16 *aType);
nsresult GetCssText(nsAString *aCssText);
nsresult SetCssText(const nsAString *aCssText);
nsresult GetParentStyleSheet(nsIDOMCSSStyleSheet **aParentStyleSheet);
nsresult GetParentRule(nsIDOMCSSRule **aParentRule);
}
[
object,
uuid(a6cf90be-15b3-11d2-932e-00805f8add32)
/* FROZEN */
]
...
...
@@ -573,6 +586,17 @@ interface nsIDOMCSSStyleDeclaration : nsISupports
[
object,
uuid(a6cf90c0-15b3-11d2-932e-00805f8add32)
/* FROZEN */
]
interface nsIDOMCSSRuleList : nsISupports
{
nsresult GetLength(PRUint32 *aLength);
nsresult Item(PRUint32 index, nsIDOMCSSRule **_retval);
}
[
object,
uuid(a6cf9080-15b3-11d2-932e-00805f8add32)
/* FROZEN */
]
...
...
dlls/mshtml/tests/dom.c
View file @
4ac1ba13
...
...
@@ -1084,6 +1084,23 @@ static void test_defaults(IHTMLDocument2 *doc)
test_default_selection
(
doc
);
}
static
void
test_stylesheet
(
IDispatch
*
disp
)
{
IHTMLStyleSheetRulesCollection
*
col
=
NULL
;
IHTMLStyleSheet
*
stylesheet
;
HRESULT
hres
;
hres
=
IDispatch_QueryInterface
(
disp
,
&
IID_IHTMLStyleSheet
,
(
void
**
)
&
stylesheet
);
ok
(
hres
==
S_OK
,
"Could not get IHTMLStyleSheet: %08x
\n
"
,
hres
);
hres
=
IHTMLStyleSheet_get_rules
(
stylesheet
,
&
col
);
ok
(
hres
==
S_OK
,
"get_rules failed: %08x
\n
"
,
hres
);
ok
(
col
!=
NULL
,
"col == NULL
\n
"
);
IHTMLStyleSheetRulesCollection_Release
(
col
);
IHTMLStyleSheet_Release
(
stylesheet
);
}
static
void
test_stylesheets
(
IHTMLDocument2
*
doc
)
{
IHTMLStyleSheetsCollection
*
col
=
NULL
;
...
...
@@ -1107,6 +1124,7 @@ static void test_stylesheets(IHTMLDocument2 *doc)
ok
(
hres
==
S_OK
,
"item failed: %08x
\n
"
,
hres
);
ok
(
V_VT
(
&
res
)
==
VT_DISPATCH
,
"V_VT(res) = %d
\n
"
,
V_VT
(
&
res
));
ok
(
V_DISPATCH
(
&
res
)
!=
NULL
,
"V_DISPATCH(&res) == NULL
\n
"
);
test_stylesheet
(
V_DISPATCH
(
&
res
));
VariantClear
(
&
res
);
V_VT
(
&
res
)
=
VT_I4
;
...
...
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