X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=style_sheets.cpp;h=6093585f527c29114391b59028c1e8cdffb105ea;hp=1f66810771976c7d89beae43017bfae0247c8831;hb=HEAD;hpb=095c46b0de5edd5ae14b4e311d54c723eb73e11f diff --git a/style_sheets.cpp b/style_sheets.cpp index 1f66810..6093585 100644 --- a/style_sheets.cpp +++ b/style_sheets.cpp @@ -1,31 +1,25 @@ -// Copyright 2005 Ben Hutchings . +// Copyright 2005-6 Ben Hutchings . // See the file "COPYING" for licence details. #include "style_sheets.hpp" +#include "wchar_t_short.h" +#include #include -#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) -# include -# include -#else -# include -# include -# include -# include -#endif +#include +#include #include #include +#include "wchar_t_default.h" #include "xpcom_support.hpp" using xpcom_support::check; -#if MOZ_VERSION_MAJOR > 1 || (MOZ_VERSION_MAJOR == 1 && MOZ_VERSION_MINOR >= 8) - // We just have to load and register a style-sheet as a user // style-sheet. There is no need to do anything for each page. -agent_style_sheet_holder init_agent_style_sheet(const char * uri) +void init_agent_style_sheet(const char * uri) { nsCOMPtr style_sheet_uri; check(NS_NewURI(getter_AddRefs(style_sheet_uri), nsCString(uri))); @@ -41,42 +35,4 @@ agent_style_sheet_holder init_agent_style_sheet(const char * uri) style_sheet_service_cid, getter_AddRefs(style_sheet_service))); check(style_sheet_service->LoadAndRegisterSheet( style_sheet_uri, nsIStyleSheetService::USER_SHEET)); - - return agent_style_sheet_holder(); -} - -#else // Mozilla version < 1.8 - -already_AddRefed init_agent_style_sheet(const char * uri) -{ - nsCOMPtr css_loader; - static const nsCID css_loader_cid = NS_CSS_LOADER_CID; - check(CallGetService(css_loader_cid, - getter_AddRefs(css_loader))); - - nsCOMPtr style_sheet_uri; - check(NS_NewURI(getter_AddRefs(style_sheet_uri), nsCString(uri))); - - nsICSSStyleSheet * style_sheet; - check(css_loader->LoadAgentSheet(style_sheet_uri, &style_sheet)); - return style_sheet; -} - -// Apply a style-sheet to a given presentation shell as the top-priority -// agent style-sheet and disable the preferences-derived style rules. -void apply_agent_style_sheet(nsIStyleSheet * style_sheet, - nsIPresShell * pres_shell) -{ - nsCOMArray style_sheets; - check(pres_shell->GetAgentStyleSheets(style_sheets)); - check(style_sheets.InsertObjectAt(style_sheet, 0)); - check(pres_shell->SetAgentStyleSheets(style_sheets)); - - check(pres_shell->EnablePrefStyleRules(false)); - - // Update the display - check(pres_shell->ReconstructStyleData()); - check(pres_shell->FlushPendingNotifications(true)); } - -#endif // Mozilla version >=/< 1.8