Jacek Caban : mshtml: Reimplement IHTMLStyle:: put_backgroundPositionX using background-position property.
Alexandre Julliard
julliard at winehq.org
Fri Feb 25 11:19:47 CST 2011
Module: wine
Branch: master
Commit: be29542f29e4f3443c8491b46bf9681ee513a800
URL: http://source.winehq.org/git/wine.git/?a=commit;h=be29542f29e4f3443c8491b46bf9681ee513a800
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Feb 25 14:11:52 2011 +0100
mshtml: Reimplement IHTMLStyle::put_backgroundPositionX using background-position property.
Current implementation can't work because backgroundPositionX is IE
extension, not handled by Gecko.
---
dlls/mshtml/htmlstyle.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 679e363..23dc394 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -986,8 +986,55 @@ static HRESULT WINAPI HTMLStyle_get_backgroundPosition(IHTMLStyle *iface, BSTR *
static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIANT v)
{
HTMLStyle *This = impl_from_IHTMLStyle(iface);
+ WCHAR buf[14], *pos_val;
+ nsAString pos_str;
+ const WCHAR *val;
+ DWORD val_len;
+ HRESULT hres;
+
TRACE("(%p)->(v%d)\n", This, V_VT(&v));
- return set_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, &v, 0);
+
+ hres = var_to_styleval(&v, buf, ATTR_FIX_PX, &val);
+ if(FAILED(hres))
+ return hres;
+
+ val_len = val ? strlenW(val) : 0;
+
+ nsAString_Init(&pos_str, NULL);
+ hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
+ if(SUCCEEDED(hres)) {
+ const PRUnichar *pos, *posy;
+ DWORD posy_len;
+
+ nsAString_GetData(&pos_str, &pos);
+ posy = strchrW(pos, ' ');
+ if(!posy) {
+ static const WCHAR zero_pxW[] = {' ','0','p','x',0};
+
+ TRACE("no space in %s\n", debugstr_w(pos));
+ posy = zero_pxW;
+ }
+
+ posy_len = strlenW(posy);
+ pos_val = heap_alloc((val_len+posy_len+1)*sizeof(WCHAR));
+ if(pos_val) {
+ if(val_len)
+ memcpy(pos_val, val, val_len*sizeof(WCHAR));
+ if(posy_len)
+ memcpy(pos_val+val_len, posy, posy_len*sizeof(WCHAR));
+ pos_val[val_len+posy_len] = 0;
+ }else {
+ hres = E_OUTOFMEMORY;
+ }
+ }
+ nsAString_Finish(&pos_str);
+ if(FAILED(hres))
+ return hres;
+
+ TRACE("setting position to %s\n", debugstr_w(pos_val));
+ hres = set_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_POSITION, pos_val, ATTR_FIX_PX);
+ heap_free(pos_val);
+ return hres;
}
static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
More information about the wine-cvs
mailing list