Jacek Caban : mshtml: Added implementation of remaining IHTMLRect getters.

Alexandre Julliard julliard at winehq.org
Mon Jul 19 11:05:30 CDT 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sat Jul 17 13:31:15 2010 +0200

mshtml: Added implementation of remaining IHTMLRect getters.

---

 dlls/mshtml/htmlelem2.c |   45 +++++++++++++++++++++++++++++++++++++++------
 dlls/mshtml/tests/dom.c |   15 +++++++++++++++
 2 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/htmlelem2.c b/dlls/mshtml/htmlelem2.c
index 251763f..0c20723 100644
--- a/dlls/mshtml/htmlelem2.c
+++ b/dlls/mshtml/htmlelem2.c
@@ -138,8 +138,19 @@ static HRESULT WINAPI HTMLRect_put_left(IHTMLRect *iface, LONG v)
 static HRESULT WINAPI HTMLRect_get_left(IHTMLRect *iface, LONG *p)
 {
     HTMLRect *This = HTMLRECT_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    float left;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMClientRect_GetLeft(This->nsrect, &left);
+    if(NS_FAILED(nsres)) {
+        ERR("GetLeft failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    *p = floor(left+0.5);
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLRect_put_top(IHTMLRect *iface, LONG v)
@@ -177,8 +188,19 @@ static HRESULT WINAPI HTMLRect_put_right(IHTMLRect *iface, LONG v)
 static HRESULT WINAPI HTMLRect_get_right(IHTMLRect *iface, LONG *p)
 {
     HTMLRect *This = HTMLRECT_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    float right;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMClientRect_GetRight(This->nsrect, &right);
+    if(NS_FAILED(nsres)) {
+        ERR("GetRight failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    *p = floor(right+0.5);
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
@@ -191,8 +213,19 @@ static HRESULT WINAPI HTMLRect_put_bottom(IHTMLRect *iface, LONG v)
 static HRESULT WINAPI HTMLRect_get_bottom(IHTMLRect *iface, LONG *p)
 {
     HTMLRect *This = HTMLRECT_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    float bottom;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    nsres = nsIDOMClientRect_GetBottom(This->nsrect, &bottom);
+    if(NS_FAILED(nsres)) {
+        ERR("GetBottom failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    *p = floor(bottom+0.5);
+    return S_OK;
 }
 
 #undef HTMLRECT_THIS
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index fa3763c..b19822e 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2875,6 +2875,21 @@ static void test_elem_bounding_client_rect(IUnknown *unk)
     ok(hres == S_OK, "get_top failed: %08x\n", hres);
     ok(l != 0xdeadbeef, "l = 0xdeadbeef\n");
 
+    l = 0xdeadbeef;
+    hres = IHTMLRect_get_left(rect, &l);
+    ok(hres == S_OK, "get_left failed: %08x\n", hres);
+    ok(l != 0xdeadbeef, "l = 0xdeadbeef\n");
+
+    l = 0xdeadbeef;
+    hres = IHTMLRect_get_bottom(rect, &l);
+    ok(hres == S_OK, "get_bottom failed: %08x\n", hres);
+    ok(l != 0xdeadbeef, "l = 0xdeadbeef\n");
+
+    l = 0xdeadbeef;
+    hres = IHTMLRect_get_right(rect, &l);
+    ok(hres == S_OK, "get_right failed: %08x\n", hres);
+    ok(l != 0xdeadbeef, "l = 0xdeadbeef\n");
+
     IHTMLRect_Release(rect);
 }
 




More information about the wine-cvs mailing list