Module: wine Branch: master Commit: 5b633c29b932dc48e04517965453f2ad8d60882a URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b633c29b932dc48e045179654...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jul 25 14:46:54 2012 +0200
mshtml: Moved more logic to HTMLStyle_Create.
---
dlls/mshtml/htmlelem.c | 25 +------------------------ dlls/mshtml/htmlstyle.c | 26 ++++++++++++++++++++++++-- dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/mshtml_private.h | 1 - 4 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 82967d8..5c38ebb 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -446,32 +446,9 @@ static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p) TRACE("(%p)->(%p)\n", This, p);
if(!This->style) { - nsIDOMElementCSSInlineStyle *nselemstyle; - nsIDOMCSSStyleDeclaration *nsstyle; - nsresult nsres; HRESULT hres;
- if(!This->nselem) { - FIXME("NULL nselem\n"); - return E_NOTIMPL; - } - - nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMElementCSSInlineStyle, - (void**)&nselemstyle); - if(NS_FAILED(nsres)) { - ERR("Could not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres); - return E_FAIL; - } - - nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle); - nsIDOMElementCSSInlineStyle_Release(nselemstyle); - if(NS_FAILED(nsres)) { - ERR("GetStyle failed: %08x\n", nsres); - return E_FAIL; - } - - hres = HTMLStyle_Create(This, nsstyle, &This->style); - nsIDOMCSSStyleDeclaration_Release(nsstyle); + hres = HTMLStyle_Create(This, &This->style); if(FAILED(hres)) return hres; } diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index b9f0ddd..3d67402 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -17,6 +17,7 @@ */
#include <stdarg.h> +#include <assert.h> #include <math.h>
#define COBJMACROS @@ -3039,13 +3040,34 @@ static dispex_static_data_t HTMLStyle_dispex = { HTMLStyle_iface_tids };
-HRESULT HTMLStyle_Create(HTMLElement *elem, nsIDOMCSSStyleDeclaration *nsstyle, HTMLStyle **ret) +HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret) { + nsIDOMElementCSSInlineStyle *nselemstyle; + nsIDOMCSSStyleDeclaration *nsstyle; HTMLStyle *style; + nsresult nsres; + + if(!elem->nselem) { + FIXME("NULL nselem\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLElement_QueryInterface(elem->nselem, &IID_nsIDOMElementCSSInlineStyle, + (void**)&nselemstyle); + assert(nsres == NS_OK); + + nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle); + nsIDOMElementCSSInlineStyle_Release(nselemstyle); + if(NS_FAILED(nsres)) { + ERR("GetStyle failed: %08x\n", nsres); + return E_FAIL; + }
style = heap_alloc_zero(sizeof(HTMLStyle)); - if(!style) + if(!style) { + nsIDOMCSSStyleDeclaration_Release(nsstyle); return E_OUTOFMEMORY; + }
style->IHTMLStyle_iface.lpVtbl = &HTMLStyleVtbl; style->ref = 1; diff --git a/dlls/mshtml/htmlstyle.h b/dlls/mshtml/htmlstyle.h index ce42d3e..571931b 100644 --- a/dlls/mshtml/htmlstyle.h +++ b/dlls/mshtml/htmlstyle.h @@ -106,6 +106,7 @@ typedef enum { STYLEID_Z_INDEX } styleid_t;
+HRESULT HTMLStyle_Create(HTMLElement*,HTMLStyle**) DECLSPEC_HIDDEN; void HTMLStyle2_Init(HTMLStyle*) DECLSPEC_HIDDEN; void HTMLStyle3_Init(HTMLStyle*) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 1f51804..abc9794 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -806,7 +806,6 @@ void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**) DECLSPEC_HIDDEN; HRESULT HTMLTxtRange_Create(HTMLDocumentNode*,nsIDOMRange*,IHTMLTxtRange**) DECLSPEC_HIDDEN; -HRESULT HTMLStyle_Create(HTMLElement*,nsIDOMCSSStyleDeclaration*,HTMLStyle**) DECLSPEC_HIDDEN; IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*) DECLSPEC_HIDDEN; IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*) DECLSPEC_HIDDEN;