+ bool webdvd_window::process_page()
+ {
+ assert(!page_queue_.empty());
+
+ nsCOMPtr<nsIWebBrowser> browser(browser_widget_.get_browser());
+ nsCOMPtr<nsIDocShell> doc_shell(do_GetInterface(browser));
+ assert(doc_shell);
+ nsCOMPtr<nsIPresShell> pres_shell;
+ check(doc_shell->GetPresShell(getter_AddRefs(pres_shell)));
+ nsCOMPtr<nsIPresContext> pres_context;
+ check(doc_shell->GetPresContext(getter_AddRefs(pres_context)));
+ nsCOMPtr<nsIDOMWindow> dom_window;
+ check(browser->GetContentDOMWindow(getter_AddRefs(dom_window)));
+
+ // If we haven't done so already, apply the stylesheet and
+ // disable scrollbars.
+ if (!have_tweaked_page_)
+ {
+ apply_style_sheet(stylesheet_, pres_shell);
+
+ // This actually only needs to be done once.
+ nsCOMPtr<nsIDOMBarProp> dom_bar_prop;
+ check(dom_window->GetScrollbars(getter_AddRefs(dom_bar_prop)));
+ check(dom_bar_prop->SetVisible(false));
+
+ have_tweaked_page_ = true;
+
+ // Might need to wait a while for things to load or more
+ // likely for a re-layout.
+ if (pending_req_count_ > 0)
+ return true;
+ }
+
+ // All further work should only be done if we're not in preview mode.
+ if (!output_dir_.empty())
+ {
+ // If we haven't already started work on this menu, save a
+ // screenshot of its normal appearance.
+ if (!page_state_.get())
+ save_screenshot();
+
+ // Start or continue processing links.
+ process_links(pres_shell, pres_context, dom_window);
+
+ // If we've finished work on the links, move on to the
+ // next page, if any, or else generate the DVD filesystem.
+ if (!page_state_.get())
+ {
+ page_queue_.pop();
+ if (page_queue_.empty())
+ {
+ generate_dvd();
+ return false;
+ }
+ else
+ {
+ load_next_page();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ void webdvd_window::save_screenshot()