From 56d1e9ec861e046c83b44203ea7d1e8ddcbac371 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 2 Oct 2008 15:27:17 +0200 Subject: [PATCH] mshtml: Added IHTMLElement2::get_currentStyle implementation. --- dlls/mshtml/Makefile.in | 1 + dlls/mshtml/htmlcurstyle.c | 880 +++++++++++++++++++++++++++++++++++ dlls/mshtml/htmlelem2.c | 6 +- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/dom.c | 26 +- 5 files changed, 911 insertions(+), 3 deletions(-) create mode 100644 dlls/mshtml/htmlcurstyle.c diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 877ffdbea67..b3b5eed807b 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -15,6 +15,7 @@ C_SRCS = \ htmlanchor.c \ htmlbody.c \ htmlcomment.c \ + htmlcurstyle.c \ htmldoc.c \ htmldoc3.c \ htmldoc5.c \ diff --git a/dlls/mshtml/htmlcurstyle.c b/dlls/mshtml/htmlcurstyle.c new file mode 100644 index 00000000000..55ff8428106 --- /dev/null +++ b/dlls/mshtml/htmlcurstyle.c @@ -0,0 +1,880 @@ +/* + * Copyright 2008 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +typedef struct { + const IHTMLCurrentStyleVtbl *lpIHTMLCurrentStyleVtbl; + + LONG ref; +} HTMLCurrentStyle; + +#define HTMLCURSTYLE(x) ((IHTMLCurrentStyle*) &(x)->lpIHTMLCurrentStyleVtbl) + +#define HTMLCURSTYLE_THIS(iface) DEFINE_THIS(HTMLCurrentStyle, IHTMLCurrentStyle, iface) + +static HRESULT WINAPI HTMLCurrentStyle_QueryInterface(IHTMLCurrentStyle *iface, REFIID riid, void **ppv) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + + *ppv = NULL; + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = HTMLCURSTYLE(This); + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); + *ppv = HTMLCURSTYLE(This); + }else if(IsEqualGUID(&IID_IHTMLCurrentStyle, riid)) { + TRACE("(%p)->(IID_IHTMLCurrentStyle %p)\n", This, ppv); + *ppv = HTMLCURSTYLE(This); + } + + if(*ppv) { + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + + WARN("unsupported %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI HTMLCurrentStyle_AddRef(IHTMLCurrentStyle *iface) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfoCount(IHTMLCurrentStyle *iface, UINT *pctinfo) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_GetTypeInfo(IHTMLCurrentStyle *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_GetIDsOfNames(IHTMLCurrentStyle *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_Invoke(IHTMLCurrentStyle *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_color(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_backgroundColor(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionY(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_backgroundRepeat(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftColor(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderTopColor(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderRightColor(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomColor(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderRightWidth(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomWidth(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftWidth(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_paddingRight(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_paddingBottom(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_visibility(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_lineHeight(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textIndent(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_marginTop(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_marginLeft(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_clear(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_listStyleType(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_listStylePosition(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_listStyleImage(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_clipTop(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_clipRight(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_clipBottom(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_clipLeft(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_overflow(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakBefore(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_pageBreakAfter(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderCollapse(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_direction(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_behavior(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_getAttribute(IHTMLCurrentStyle *iface, BSTR strAttributeName, + LONG lFlags, VARIANT *AttributeValue) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_unicodeBidi(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_right(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_bottom(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_imeMode(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_rubyAlign(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_rubyPosition(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_rubyOverhang(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textAutospace(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_lineBreak(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_wordBreak(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textJustify(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textJustifyTrim(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textKashida(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_blockDirection(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridChar(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridLine(IHTMLCurrentStyle *iface, VARIANT *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridMode(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_layoutGridType(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderStyle(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderColor(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_borderWidth(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_padding(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_margin(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_accelerator(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_overflowX(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_overflowY(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLCurrentStyle_get_textTransform(IHTMLCurrentStyle *iface, BSTR *p) +{ + HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +#undef HTMLCURSTYLE_THIS + +static const IHTMLCurrentStyleVtbl HTMLCurrentStyleVtbl = { + HTMLCurrentStyle_QueryInterface, + HTMLCurrentStyle_AddRef, + HTMLCurrentStyle_Release, + HTMLCurrentStyle_GetTypeInfoCount, + HTMLCurrentStyle_GetTypeInfo, + HTMLCurrentStyle_GetIDsOfNames, + HTMLCurrentStyle_Invoke, + HTMLCurrentStyle_get_position, + HTMLCurrentStyle_get_styleFloat, + HTMLCurrentStyle_get_color, + HTMLCurrentStyle_get_backgroundColor, + HTMLCurrentStyle_get_fontFamily, + HTMLCurrentStyle_get_fontStyle, + HTMLCurrentStyle_get_fontVariant, + HTMLCurrentStyle_get_fontWeight, + HTMLCurrentStyle_get_fontSize, + HTMLCurrentStyle_get_backgroundImage, + HTMLCurrentStyle_get_backgroundPositionX, + HTMLCurrentStyle_get_backgroundPositionY, + HTMLCurrentStyle_get_backgroundRepeat, + HTMLCurrentStyle_get_borderLeftColor, + HTMLCurrentStyle_get_borderTopColor, + HTMLCurrentStyle_get_borderRightColor, + HTMLCurrentStyle_get_borderBottomColor, + HTMLCurrentStyle_get_borderTopStyle, + HTMLCurrentStyle_get_borderRightStyle, + HTMLCurrentStyle_get_borderBottomStyle, + HTMLCurrentStyle_get_borderLeftStyle, + HTMLCurrentStyle_get_borderTopWidth, + HTMLCurrentStyle_get_borderRightWidth, + HTMLCurrentStyle_get_borderBottomWidth, + HTMLCurrentStyle_get_borderLeftWidth, + HTMLCurrentStyle_get_left, + HTMLCurrentStyle_get_top, + HTMLCurrentStyle_get_width, + HTMLCurrentStyle_get_height, + HTMLCurrentStyle_get_paddingLeft, + HTMLCurrentStyle_get_paddingTop, + HTMLCurrentStyle_get_paddingRight, + HTMLCurrentStyle_get_paddingBottom, + HTMLCurrentStyle_get_textAlign, + HTMLCurrentStyle_get_textDecoration, + HTMLCurrentStyle_get_display, + HTMLCurrentStyle_get_visibility, + HTMLCurrentStyle_get_zIndex, + HTMLCurrentStyle_get_letterSpacing, + HTMLCurrentStyle_get_lineHeight, + HTMLCurrentStyle_get_textIndent, + HTMLCurrentStyle_get_verticalAlign, + HTMLCurrentStyle_get_backgroundAttachment, + HTMLCurrentStyle_get_marginTop, + HTMLCurrentStyle_get_marginRight, + HTMLCurrentStyle_get_marginBottom, + HTMLCurrentStyle_get_marginLeft, + HTMLCurrentStyle_get_clear, + HTMLCurrentStyle_get_listStyleType, + HTMLCurrentStyle_get_listStylePosition, + HTMLCurrentStyle_get_listStyleImage, + HTMLCurrentStyle_get_clipTop, + HTMLCurrentStyle_get_clipRight, + HTMLCurrentStyle_get_clipBottom, + HTMLCurrentStyle_get_clipLeft, + HTMLCurrentStyle_get_overflow, + HTMLCurrentStyle_get_pageBreakBefore, + HTMLCurrentStyle_get_pageBreakAfter, + HTMLCurrentStyle_get_cursor, + HTMLCurrentStyle_get_tableLayout, + HTMLCurrentStyle_get_borderCollapse, + HTMLCurrentStyle_get_direction, + HTMLCurrentStyle_get_behavior, + HTMLCurrentStyle_getAttribute, + HTMLCurrentStyle_get_unicodeBidi, + HTMLCurrentStyle_get_right, + HTMLCurrentStyle_get_bottom, + HTMLCurrentStyle_get_imeMode, + HTMLCurrentStyle_get_rubyAlign, + HTMLCurrentStyle_get_rubyPosition, + HTMLCurrentStyle_get_rubyOverhang, + HTMLCurrentStyle_get_textAutospace, + HTMLCurrentStyle_get_lineBreak, + HTMLCurrentStyle_get_wordBreak, + HTMLCurrentStyle_get_textJustify, + HTMLCurrentStyle_get_textJustifyTrim, + HTMLCurrentStyle_get_textKashida, + HTMLCurrentStyle_get_blockDirection, + HTMLCurrentStyle_get_layoutGridChar, + HTMLCurrentStyle_get_layoutGridLine, + HTMLCurrentStyle_get_layoutGridMode, + HTMLCurrentStyle_get_layoutGridType, + HTMLCurrentStyle_get_borderStyle, + HTMLCurrentStyle_get_borderColor, + HTMLCurrentStyle_get_borderWidth, + HTMLCurrentStyle_get_padding, + HTMLCurrentStyle_get_margin, + HTMLCurrentStyle_get_accelerator, + HTMLCurrentStyle_get_overflowX, + HTMLCurrentStyle_get_overflowY, + HTMLCurrentStyle_get_textTransform +}; + +HRESULT HTMLCurrentStyle_Create(IHTMLCurrentStyle **p) +{ + HTMLCurrentStyle *ret; + + ret = heap_alloc_zero(sizeof(HTMLCurrentStyle)); + if(!ret) + return E_OUTOFMEMORY; + + ret->lpIHTMLCurrentStyleVtbl = &HTMLCurrentStyleVtbl; + ret->ref = 1; + + *p = HTMLCURSTYLE(ret); + return S_OK; +} diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c index 02349338992..36676c675eb 100644 --- a/dlls/mshtml/htmlelem2.c +++ b/dlls/mshtml/htmlelem2.c @@ -318,8 +318,10 @@ static HRESULT WINAPI HTMLElement2_get_onpaste(IHTMLElement2 *iface, VARIANT *p) static HRESULT WINAPI HTMLElement2_get_currentStyle(IHTMLElement2 *iface, IHTMLCurrentStyle **p) { HTMLElement *This = HTMLELEM2_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return HTMLCurrentStyle_Create(p); } static HRESULT WINAPI HTMLElement2_put_onpropertychange(IHTMLElement2 *iface, VARIANT v) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 31df9e4e8a1..c3065053747 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -486,6 +486,7 @@ void HTMLDocument_Service_Init(HTMLDocument*); void HTMLDocument_Hlink_Init(HTMLDocument*); void HTMLStyle2_Init(HTMLStyle*); +HRESULT HTMLCurrentStyle_Create(IHTMLCurrentStyle**); void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID); void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*); diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index aa6996ce8d3..fa1189315a7 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -278,6 +278,13 @@ static const IID * const style_iids[] = { NULL }; +static const IID * const cstyle_iids[] = { + &IID_IUnknown, + &IID_IDispatch, + &IID_IHTMLCurrentStyle, + NULL +}; + typedef struct { const char *tag; REFIID *iids; @@ -1976,6 +1983,11 @@ static void test_navigator(IHTMLDocument2 *doc) ok(!ref, "navigator should be destroyed here\n"); } +static void test_current_style(IHTMLCurrentStyle *current_style) +{ + test_ifaces((IUnknown*)current_style, cstyle_iids); +} + static void test_default_style(IHTMLStyle *style) { VARIANT_BOOL b; @@ -2224,7 +2236,9 @@ static void test_window(IHTMLDocument2 *doc) static void test_defaults(IHTMLDocument2 *doc) { IHTMLStyleSheetsCollection *stylesheetcol; + IHTMLCurrentStyle *cstyle; IHTMLBodyElement *body; + IHTMLElement2 *elem2; IHTMLElement *elem; IHTMLStyle *style; long l; @@ -2240,7 +2254,6 @@ static void test_defaults(IHTMLDocument2 *doc) IHTMLBodyElement_Release(body); hres = IHTMLElement_get_style(elem, &style); - IHTMLElement_Release(elem); ok(hres == S_OK, "get_style failed: %08x\n", hres); test_default_style(style); @@ -2251,6 +2264,17 @@ static void test_defaults(IHTMLDocument2 *doc) IHTMLStyle_Release(style); + elem2 = get_elem2_iface((IUnknown*)elem); + hres = IHTMLElement2_get_currentStyle(elem2, &cstyle); + ok(hres == S_OK, "get_currentStyle failed: %08x\n", hres); + if(SUCCEEDED(hres)) { + test_current_style(cstyle); + IHTMLCurrentStyle_Release(cstyle); + } + IHTMLElement2_Release(elem2); + + IHTMLElement_Release(elem); + hres = IHTMLDocument2_get_styleSheets(doc, &stylesheetcol); ok(hres == S_OK, "get_styleSheets failed: %08x\n", hres);