mshtml: Moved more logic to HTMLStyle_Create.
This commit is contained in:
parent
f930085904
commit
5b633c29b9
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue