Jacek Caban : mshtml: Store nsIDOMCSSStyleSheet in HTMLStyleSheet object if available.

Alexandre Julliard julliard at winehq.org
Mon Nov 26 08:16:19 CST 2007


Module: wine
Branch: master
Commit: 4b302f9c89aa78557e1f3f656d152762ab2ae31d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b302f9c89aa78557e1f3f656d152762ab2ae31d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Nov 25 19:08:40 2007 +0100

mshtml: Store nsIDOMCSSStyleSheet in HTMLStyleSheet object if available.

---

 dlls/mshtml/htmldoc.c        |    2 +-
 dlls/mshtml/htmlstylesheet.c |   14 +++++++++++++-
 dlls/mshtml/mshtml_private.h |    2 +-
 dlls/mshtml/nsiface.idl      |   33 ++++++++++++++++++++++++++++++++-
 4 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index e9df70e..6ad153a 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1046,7 +1046,7 @@ static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR
 
     FIXME("(%p)->(%s %ld %p) semi-stub\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
 
-    *ppnewStyleSheet = HTMLStyleSheet_Create();
+    *ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
     return S_OK;
 }
 
diff --git a/dlls/mshtml/htmlstylesheet.c b/dlls/mshtml/htmlstylesheet.c
index 30be079..823e5f5 100644
--- a/dlls/mshtml/htmlstylesheet.c
+++ b/dlls/mshtml/htmlstylesheet.c
@@ -38,7 +38,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 typedef struct {
     const IHTMLStyleSheetVtbl *lpHTMLStyleSheetVtbl;
+
     LONG ref;
+
+    nsIDOMCSSStyleSheet *nsstylesheet;
 } HTMLStyleSheet;
 
 typedef struct {
@@ -470,12 +473,21 @@ static const IHTMLStyleSheetVtbl HTMLStyleSheetVtbl = {
     HTMLStyleSheet_get_rules
 };
 
-IHTMLStyleSheet *HTMLStyleSheet_Create(void)
+IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet *nsstylesheet)
 {
     HTMLStyleSheet *ret = mshtml_alloc(sizeof(HTMLStyleSheet));
+    nsresult nsres;
 
     ret->lpHTMLStyleSheetVtbl = &HTMLStyleSheetVtbl;
     ret->ref = 1;
+    ret->nsstylesheet = NULL;
+
+    if(nsstylesheet) {
+        nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
+                (void**)&ret->nsstylesheet);
+        if(NS_FAILED(nsres))
+            ERR("Could not get nsICSSStyleSheet interface: %08x\n", nsres);
+    }
 
     return HTMLSTYLESHEET(ret);
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 2bf926b..03837ad 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -430,7 +430,7 @@ void set_current_mon(HTMLDocument*,IMoniker*);
 IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
 IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
 IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
-IHTMLStyleSheet *HTMLStyleSheet_Create(void);
+IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
 IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
 
 void detach_selection(HTMLDocument*);
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index aac9a87..8f2876c 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -123,7 +123,8 @@ typedef nsISupports nsIPrincipal;
 typedef nsISupports nsIAtom;
 typedef nsISupports nsISupportsArray;
 typedef nsISupports nsIContentFilter;
-typedef nsISupports nsIDOMStyleSheet;
+typedef nsISupports nsIDOMMediaList;
+typedef nsISupports nsIDOMCSSRuleList;
 
 [
     object,
@@ -572,6 +573,36 @@ interface nsIDOMCSSStyleDeclaration : nsISupports
 
 [
     object,
+    uuid(a6cf9080-15b3-11d2-932e-00805f8add32)
+    /* FROZEN */
+]
+interface nsIDOMStyleSheet : nsISupports
+{
+    nsresult GetType(nsAString *aType);
+    nsresult GetDisabled(PRBool *aDisabled);
+    nsresult SetDisabled(PRBool aDisabled);
+    nsresult GetOwnerNode(nsIDOMNode **aOwnerNode);
+    nsresult GetParentStyleSheet(nsIDOMStyleSheet **aParentStyleSheet);
+    nsresult GetHref(nsAString *aHref);
+    nsresult GetTitle(nsAString *aTitle);
+    nsresult GetMedia(nsIDOMMediaList **aMedia);
+}
+
+[
+    object,
+    uuid(a6cf90c2-15b3-11d2-932e-00805f8add32)
+    /* FROZEN */
+]
+interface nsIDOMCSSStyleSheet : nsIDOMStyleSheet
+{
+    nsresult GetOwnerRule(nsIDOMCSSRule **aOwnerRule);
+    nsresult GetCssRules(nsIDOMCSSRuleList **aCssRules);
+    nsresult InsertRule(const nsAString *rule, PRUint32 index, PRUint32 *_retval);
+    nsresult DeleteRule(PRUint32 index);
+}
+
+[
+    object,
     uuid(a6cf9081-15b3-11d2-932e-00805f8add32)
     /* FROZEN */
 ]




More information about the wine-cvs mailing list