Jacek Caban : mshtml: Reimplement IHTMLStyle:: get_backgroundPositionX using background-position property.

Alexandre Julliard julliard at winehq.org
Fri Feb 25 11:19:47 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Feb 25 14:12:02 2011 +0100

mshtml: Reimplement IHTMLStyle::get_backgroundPositionX using background-position property.

---

 dlls/mshtml/htmlstyle.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 23dc394..914c1ce 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -1040,8 +1040,40 @@ static HRESULT WINAPI HTMLStyle_put_backgroundPositionX(IHTMLStyle *iface, VARIA
 static HRESULT WINAPI HTMLStyle_get_backgroundPositionX(IHTMLStyle *iface, VARIANT *p)
 {
     HTMLStyle *This = impl_from_IHTMLStyle(iface);
+    nsAString pos_str;
+    BSTR ret;
+    HRESULT hres;
+
     TRACE("(%p)->(%p)\n", This, p);
-    return get_nsstyle_attr_var(This->nsstyle, STYLEID_BACKGROUND_POSITION_X, p, 0);
+
+    nsAString_Init(&pos_str, NULL);
+    hres = get_nsstyle_attr_nsval(This->nsstyle, STYLEID_BACKGROUND_POSITION, &pos_str);
+    if(SUCCEEDED(hres)) {
+        const PRUnichar *pos, *space;
+
+        nsAString_GetData(&pos_str, &pos);
+        space = strchrW(pos, ' ');
+        if(!space) {
+            WARN("no space in %s\n", debugstr_w(pos));
+            space = pos + strlenW(pos);
+        }
+
+        if(space != pos) {
+            ret = SysAllocStringLen(pos, space-pos);
+            if(!ret)
+                hres = E_OUTOFMEMORY;
+        }else {
+            ret = NULL;
+        }
+    }
+    nsAString_Finish(&pos_str);
+    if(FAILED(hres))
+        return hres;
+
+    TRACE("returning %s\n", debugstr_w(ret));
+    V_VT(p) = VT_BSTR;
+    V_BSTR(p) = ret;
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLStyle_put_backgroundPositionY(IHTMLStyle *iface, VARIANT v)




More information about the wine-cvs mailing list