float pixelsToTwips = PixelsToTwips(); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THIN] = NSIntPixelsToTwips(1, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_MEDIUM] = NSIntPixelsToTwips(3, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THICK] = NSIntPixelsToTwips(5, pixelsToTwips);
nsPresContext::Init(nsIDeviceContext* aDeviceContext){  NS_ASSERTION(!(mInitialized == PR_TRUE), "attempt to reinit pres context");  NS_ENSURE_ARG(aDeviceContext);  mDeviceContext = aDeviceContext;  NS_ADDREF(mDeviceContext);  // Get the look and feel service here; default colors will be initialized  // from calling GetUserPreferences() below.  nsresult rv = CallGetService(kLookAndFeelCID, &mLookAndFeel);  if (NS_FAILED(rv)) {    NS_ERROR("LookAndFeel service must be implemented for this toolkit");    return rv;  }  mEventManager = new nsEventStateManager();  if (!mEventManager)    return NS_ERROR_OUT_OF_MEMORY;  NS_ADDREF(mEventManager);  mLangService = do_GetService(NS_LANGUAGEATOMSERVICE_CONTRACTID);  // Register callbacks so we're notified when the preferences change  nsContentUtils::RegisterPrefCallback("font.",                                       nsPresContext::PrefChangedCallback,                                       this);  nsContentUtils::RegisterPrefCallback("browser.display.",                                       nsPresContext::PrefChangedCallback,                                       this);  nsContentUtils::RegisterPrefCallback("browser.underline_anchors",                                       nsPresContext::PrefChangedCallback,                                       this);  nsContentUtils::RegisterPrefCallback("browser.anchor_color",                                       nsPresContext::PrefChangedCallback,                                       this);  nsContentUtils::RegisterPrefCallback("browser.active_color",                                       nsPresContext::PrefChangedCallback,                                       this);  nsContentUtils::RegisterPrefCallback("browser.visited_color",                                       nsPresContext::PrefChangedCallback,                                       this);  nsContentUtils::RegisterPrefCallback("image.animation_mode",                                       nsPresContext::PrefChangedCallback,                                       this);#ifdef IBMBIDI  nsContentUtils::RegisterPrefCallback("bidi.", PrefChangedCallback,                                       this);#endif  // Initialize our state from the user preferences  GetUserPreferences();  rv = mEventManager->Init();  NS_ENSURE_SUCCESS(rv, rv);  mEventManager->SetPresContext(this);#ifdef DEBUG  mInitialized = PR_TRUE;#endif  float pixelsToTwips = PixelsToTwips();  mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THIN] = NSIntPixelsToTwips(1, pixelsToTwips);  mBorderWidthTable[NS_STYLE_BORDER_WIDTH_MEDIUM] = NSIntPixelsToTwips(3, pixelsToTwips);  mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THICK] = NSIntPixelsToTwips(5, pixelsToTwips);  return NS_OK;}