]> git.decadent.org.uk Git - videolink.git/commitdiff
Use new version of GetBoxObjectFor on XULRunner 2.0
authorBen Hutchings <ben@decadent.org.uk>
Thu, 3 Mar 2011 03:04:05 +0000 (03:04 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 3 Mar 2011 03:42:15 +0000 (03:42 +0000)
videolink.cpp

index e0b71d8acc981ddf3b7aee6a2bdda2f26475ead8..2a1295b20235818230f887f992398b0ece82420d 100644 (file)
@@ -81,14 +81,17 @@ using xpcom_support::check;
 
 namespace
 {
-    rectangle get_elem_rect(nsIDOMNSDocument * ns_doc,
-                           nsIDOMElement * elem)
+#if MOZ_VERSION_GE(2,0,-1)
+    rectangle get_elem_rect(nsIDocument * doc, nsIDOMElement * elem)
+#else
+    rectangle get_elem_rect(nsIDOMNSDocument * doc, nsIDOMElement * elem)
+#endif
     {
        rectangle result;
 
        // Start with this element's bounding box
        nsCOMPtr<nsIBoxObject> box;
-       check(ns_doc->GetBoxObjectFor(elem, getter_AddRefs(box)));
+       check(doc->GetBoxObjectFor(elem, getter_AddRefs(box)));
        int width, height;
        check(box->GetScreenX(&result.left));
        check(box->GetScreenY(&result.top));
@@ -107,7 +110,7 @@ namespace
            {
                nsCOMPtr<nsIDOMElement> child_elem(
                    do_QueryInterface(child_node));
-               result |= get_elem_rect(ns_doc, child_elem);
+               result |= get_elem_rect(doc, child_elem);
            }
        }
 
@@ -582,6 +585,10 @@ namespace
 
        nsCOMPtr<nsIDOMNSDocument> ns_doc(do_QueryInterface(basic_doc));
        assert(ns_doc);
+#if MOZ_VERSION_GE(2,0,-1)
+       nsCOMPtr<nsIDocument> doc(do_QueryInterface(basic_doc));
+       assert(doc);
+#endif
        nsCOMPtr<nsIPresShell> pres_shell;
        check(doc_shell->GetPresShell(getter_AddRefs(pres_shell)));
        nsCOMPtr<nsIEventStateManager> event_state_man(
@@ -634,7 +641,11 @@ namespace
                // window.
                nsCOMPtr<nsIDOMElement> elem(do_QueryInterface(node));
                assert(elem);
+#if MOZ_VERSION_GE(2,0,-1)
+               state->link_rect = get_elem_rect(doc, elem);
+#else
                state->link_rect = get_elem_rect(ns_doc, elem);
+#endif
                state->link_rect &= window_rect;
 
                if (state->link_rect.empty())