From: Ben Hutchings Date: Thu, 3 Mar 2011 03:04:05 +0000 (+0000) Subject: Use new version of GetBoxObjectFor on XULRunner 2.0 X-Git-Tag: 1.2.11~9 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=8f745bbf14bb08b74d89a9a95c3310feea3d6df6;p=videolink.git Use new version of GetBoxObjectFor on XULRunner 2.0 --- diff --git a/videolink.cpp b/videolink.cpp index e0b71d8..2a1295b 100644 --- a/videolink.cpp +++ b/videolink.cpp @@ -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 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 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 ns_doc(do_QueryInterface(basic_doc)); assert(ns_doc); +#if MOZ_VERSION_GE(2,0,-1) + nsCOMPtr doc(do_QueryInterface(basic_doc)); + assert(doc); +#endif nsCOMPtr pres_shell; check(doc_shell->GetPresShell(getter_AddRefs(pres_shell))); nsCOMPtr event_state_man( @@ -634,7 +641,11 @@ namespace // window. nsCOMPtr 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())