X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=videolink.cpp;h=a15bbea1bfe125a2cf9c67e152935203a1e3e2a3;hp=1d473fac03fd102630ac1ff289c8dd58a4e83f1f;hb=HEAD;hpb=08d62241a742a68cde7cce7ffb7de7ffa62e538c diff --git a/videolink.cpp b/videolink.cpp index 1d473fa..a15bbea 100644 --- a/videolink.cpp +++ b/videolink.cpp @@ -22,8 +22,10 @@ #include #include +#include "videolink.hpp" +#include "wchar_t_short.h" #include -#if MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR == 9 +#if MOZ_VERSION_GE(1,9,0) #include /* For some reason no longer defines this */ typedef nsCOMPtr nsWeakPtr; @@ -56,6 +58,7 @@ typedef nsCOMPtr nsWeakPtr; #else #include #endif +#include "wchar_t_default.h" #include "browser_widget.hpp" #include "child_iterator.hpp" @@ -78,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)); @@ -104,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); } } @@ -417,7 +423,9 @@ namespace { // Check whether the load was successful, ignoring this // pseudo-error. +#ifdef NS_IMAGELIB_ERROR_LOAD_ABORTED if (status != NS_IMAGELIB_ERROR_LOAD_ABORTED) +#endif check(status); pending_window_update_ = false; @@ -579,6 +587,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( @@ -605,10 +617,17 @@ namespace nsCOMPtr node(*state->links_it); // Find the link URI and separate any fragment from it. + nsCOMPtr uri_iface; +#if MOZ_VERSION_GE(2,0,-1) + nsCOMPtr content(do_QueryInterface(node)); + assert(content); + uri_iface = content->GetHrefURI(); + assert(uri_iface); +#else nsCOMPtr link(do_QueryInterface(node)); assert(link); - nsCOMPtr uri_iface; check(link->GetHrefURI(getter_AddRefs(uri_iface))); +#endif std::string uri, fragment; { nsCString link_target_ns; @@ -631,7 +650,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())