Commit ed41d7ae authored by Jonathan Kew's avatar Jonathan Kew
Browse files

bug 674373 pt 4 - pass device-to-CSS pixel ratio to LookAndFeel code when...

bug 674373 pt 4 - pass device-to-CSS pixel ratio to LookAndFeel code when requesting a font style. r=roc
parent c6a0685b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2981,7 +2981,9 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
    gfxFontStyle fontStyle;
    LookAndFeel::FontID fontID =
      (LookAndFeel::FontID)systemFontValue->GetIntValue();
    if (LookAndFeel::GetFont(fontID, systemFont.name, fontStyle)) {
    float devPerCSS = (float)nsPresContext::AppUnitsPerCSSPixel() /
                      aPresContext->AppUnitsPerDevPixel();
    if (LookAndFeel::GetFont(fontID, systemFont.name, fontStyle, devPerCSS)) {
      systemFont.style = fontStyle.style;
      systemFont.systemFont = fontStyle.systemFont;
      systemFont.variant = NS_FONT_VARIANT_NORMAL;
+3 −1
Original line number Diff line number Diff line
@@ -491,8 +491,10 @@ public:
   * @param aID    Which system-theme font is wanted.
   * @param aName  The name of the font to use.
   * @param aStyle Styling to apply to the font.
   * @param aDevPixPerCSSPixel  Ratio of device pixels to CSS pixels
   */
  static bool GetFont(FontID aID, nsString& aName, gfxFontStyle& aStyle);
  static bool GetFont(FontID aID, nsString& aName, gfxFontStyle& aStyle,
                      float aDevPixPerCSSPixel);

  /**
   * GetPasswordCharacter() returns a unicode character which should be used
+2 −1
Original line number Diff line number Diff line
@@ -446,7 +446,8 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
/*virtual*/
bool
nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
                           gfxFontStyle& aFontStyle)
                           gfxFontStyle& aFontStyle,
                           float aDevPixPerCSSPixel)
{
    aFontName.AssignLiteral("\"Droid Sans\"");
    aFontStyle.style = NS_FONT_STYLE_NORMAL;
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@ public:
    virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
    virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
    virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
    virtual bool GetFontImpl(FontID aID, nsString& aName, gfxFontStyle& aStyle);
    virtual bool GetFontImpl(FontID aID, nsString& aName, gfxFontStyle& aStyle,
                             float aDevPixPerCSSPixel);
    virtual bool GetEchoPasswordImpl();
    virtual uint32_t GetPasswordMaskDelayImpl();
    virtual PRUnichar GetPasswordCharacterImpl();
+2 −1
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@ public:
  virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
  virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
  virtual bool GetFontImpl(FontID aID, nsString& aFontName,
                           gfxFontStyle& aFontStyle);
                           gfxFontStyle& aFontStyle,
                           float aDevPixPerCSSPixel);
  virtual PRUnichar GetPasswordCharacterImpl()
  {
    // unicode value for the bullet character, used for password textfields.
Loading