[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

zimmermann at webkit.org zimmermann at webkit.org
Sun Feb 20 23:38:13 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit d72d070deab51158eb9fe2f2f28714e29752bdaf
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 22 13:46:31 2011 +0000

    2011-01-22  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            REGRESSION: Vertical line metrics incorrect
            https://bugs.webkit.org/show_bug.cgi?id=52960
    
            SimpleFontDataMac.mm contains a hack to modifiy lineGap/descent for the 'Hiragino' font.
            That didn't influence the lineSpacing so far, but does now, causing regressions.
    
            Restore old line spacing behaviour to fix the regression.
            Covered by existing fast/blockflow, fast/repaint and fast/text/international test cases.
    
            * platform/graphics/FontMetrics.h:
            (WebCore::FontMetrics::FontMetrics):
            (WebCore::FontMetrics::floatLineSpacing):
            (WebCore::FontMetrics::setLineSpacing):
            (WebCore::FontMetrics::lineSpacing):
            (WebCore::FontMetrics::reset):
            * platform/graphics/SimpleFontData.cpp:
            (WebCore::SimpleFontData::SimpleFontData):
            * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/chromium/SimpleFontDataLinux.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/haiku/SimpleFontDataHaiku.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/mac/SimpleFontDataMac.mm:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/pango/SimpleFontDataPango.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/qt/SimpleFontDataQt.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/win/SimpleFontDataCGWin.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/win/SimpleFontDataCairoWin.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/win/SimpleFontDataWin.cpp:
            (WebCore::SimpleFontData::initGDIFont):
            * platform/graphics/wince/SimpleFontDataWinCE.cpp:
            (WebCore::SimpleFontData::platformInit):
            * platform/graphics/wx/SimpleFontDataWx.cpp:
            (WebCore::SimpleFontData::platformInit):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76445 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7ffa608..2b04b8d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,49 @@
+2011-01-22  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        REGRESSION: Vertical line metrics incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=52960
+
+        SimpleFontDataMac.mm contains a hack to modifiy lineGap/descent for the 'Hiragino' font.
+        That didn't influence the lineSpacing so far, but does now, causing regressions.
+
+        Restore old line spacing behaviour to fix the regression.
+        Covered by existing fast/blockflow, fast/repaint and fast/text/international test cases.
+
+        * platform/graphics/FontMetrics.h:
+        (WebCore::FontMetrics::FontMetrics):
+        (WebCore::FontMetrics::floatLineSpacing):
+        (WebCore::FontMetrics::setLineSpacing):
+        (WebCore::FontMetrics::lineSpacing):
+        (WebCore::FontMetrics::reset):
+        * platform/graphics/SimpleFontData.cpp:
+        (WebCore::SimpleFontData::SimpleFontData):
+        * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/chromium/SimpleFontDataLinux.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/haiku/SimpleFontDataHaiku.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/pango/SimpleFontDataPango.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/qt/SimpleFontDataQt.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/win/SimpleFontDataCGWin.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/win/SimpleFontDataWin.cpp:
+        (WebCore::SimpleFontData::initGDIFont):
+        * platform/graphics/wince/SimpleFontDataWinCE.cpp:
+        (WebCore::SimpleFontData::platformInit):
+        * platform/graphics/wx/SimpleFontDataWx.cpp:
+        (WebCore::SimpleFontData::platformInit):
+
 2011-01-22  Andreas Kling  <kling at webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/Source/WebCore/platform/graphics/FontMetrics.h b/Source/WebCore/platform/graphics/FontMetrics.h
index a101cbc..89c5545 100644
--- a/Source/WebCore/platform/graphics/FontMetrics.h
+++ b/Source/WebCore/platform/graphics/FontMetrics.h
@@ -33,6 +33,7 @@ public:
         , m_ascent(0)
         , m_descent(0)
         , m_lineGap(0)
+        , m_lineSpacing(0)
         , m_xHeight(0)
     {
     }
@@ -66,7 +67,8 @@ public:
     float floatLineGap() const { return m_lineGap; }
     void setLineGap(float lineGap) { m_lineGap = lineGap; }
 
-    float floatLineSpacing() const { return m_ascent + m_descent + m_lineGap; }
+    float floatLineSpacing() const { return m_lineSpacing; }
+    void setLineSpacing(float lineSpacing) { m_lineSpacing = lineSpacing; }
 
     float xHeight() const { return m_xHeight; }
     void setXHeight(float xHeight) { m_xHeight = xHeight; }
@@ -92,12 +94,7 @@ public:
     }
 
     int lineGap() const { return lroundf(m_lineGap); }
-
-    int lineSpacing() const
-    {
-        // This mimics the old WebCore definition of lineSpacing. Changing to lroundf(m_ascent + m_descent + m_lineGap) causes lots of 1px height differences in the DRT dumps
-        return lroundf(m_ascent) + lroundf(m_descent) + lroundf(m_lineGap);
-    }
+    int lineSpacing() const { return lroundf(m_lineSpacing); }
 
 private:
     friend class SimpleFontData;
@@ -108,6 +105,7 @@ private:
         m_ascent = 0;
         m_descent = 0;
         m_lineGap = 0;
+        m_lineSpacing = 0;
         m_xHeight = 0;
     }
 
@@ -115,6 +113,7 @@ private:
     float m_ascent;
     float m_descent;
     float m_lineGap;
+    float m_lineSpacing;
     float m_xHeight;
 };
 
diff --git a/Source/WebCore/platform/graphics/SimpleFontData.cpp b/Source/WebCore/platform/graphics/SimpleFontData.cpp
index 81b54f2..19e2d4a 100644
--- a/Source/WebCore/platform/graphics/SimpleFontData.cpp
+++ b/Source/WebCore/platform/graphics/SimpleFontData.cpp
@@ -88,6 +88,7 @@ SimpleFontData::SimpleFontData(PassOwnPtr<SVGFontData> svgFontData, int size, bo
     m_fontMetrics.setAscent(ascent);
     m_fontMetrics.setDescent(descent);
     m_fontMetrics.setLineGap(lineGap);
+    m_fontMetrics.setLineSpacing(ascent + descent + lineGap);
     m_fontMetrics.setXHeight(xHeight);
 
     SVGFontElement* associatedFontElement = svgFontFaceElement->associatedFontElement();
diff --git a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
index 750a317..1450c5a 100644
--- a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
+++ b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp
@@ -97,6 +97,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setDescent(descent);
     m_fontMetrics.setLineGap(lineGap);
     m_fontMetrics.setXHeight(xHeight);
+    m_fontMetrics.setLineSpacing(ascent + descent + lineGap);
 
     SelectObject(dc, oldFont);
     ReleaseDC(0, dc);
diff --git a/Source/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp b/Source/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp
index b995a4a..787d3be 100644
--- a/Source/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp
+++ b/Source/WebCore/platform/graphics/chromium/SimpleFontDataLinux.cpp
@@ -109,8 +109,10 @@ void SimpleFontData::platformInit()
         xHeight = ascent * 0.56f;
     }
 
-    m_fontMetrics.setLineGap(SkScalarToFloat(metrics.fLeading));
+    float lineGap = SkScalarToFloat(metrics.fLeading);
+    m_fontMetrics.setLineGap(lineGap);
     m_fontMetrics.setXHeight(xHeight);
+    m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
 
     if (m_orientation == Vertical) {
         static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a');
diff --git a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
index fcbf54b..6290eeb 100644
--- a/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
+++ b/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
@@ -62,6 +62,8 @@ void SimpleFontData::platformInit()
     float lineSpacing = font_extents.height;
     if (lineSpacing < font_extents.ascent + font_extents.descent)
         lineSpacing = font_extents.ascent + font_extents.descent;
+
+    m_fontMetrics.setLineSpacing(lroundf(lineSpacing));
     m_fontMetrics.setLineGap(lineSpacing - font_extents.ascent - font_extents.descent);
 
     cairo_scaled_font_text_extents(m_platformData.scaledFont(), "x", &text_extents);
diff --git a/Source/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp b/Source/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp
index 468b000..4ded761 100644
--- a/Source/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp
+++ b/Source/WebCore/platform/graphics/haiku/SimpleFontDataHaiku.cpp
@@ -52,6 +52,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setDescent(height.descent);
     m_fontMetrics.setXHeight(height.ascent * 0.56f); // Hack taken from the win port.
     m_fontMetrics.setLineGap(height.leading);
+    m_fontMetrics.setLineSpacing(lroundf(height.ascent) + lroundf(height.descent) + lroundf(height.leading));
 }
 
 void SimpleFontData::platformCharWidthInit()
diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
index 2b58e92..29fb9a0 100644
--- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
+++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
@@ -249,6 +249,9 @@ void SimpleFontData::platformInit()
         descent *= 2.f;
     }
 
+    // Compute and store line spacing, before the line metrics hacks are applied.
+    m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
+
     // Hack Hiragino line metrics to allow room for marked text underlines.
     // <rdar://problem/5386183>
     if (descent < 3 && lineGap >= 3 && [familyName hasPrefix:@"Hiragino"]) {
diff --git a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
index aa37255..3fe15b3 100644
--- a/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
+++ b/Source/WebCore/platform/graphics/pango/SimpleFontDataPango.cpp
@@ -61,6 +61,7 @@ void SimpleFontData::platformInit()
     float lineSpacing = font_extents.height;
     if (lineSpacing < font_extents.ascent + font_extents.descent)
         lineSpacing = font_extents.ascent + font_extents.descent;
+    m_fontMetrics.setLineSpacing(lroundf(lineSpacing));
     m_fontMetrics.setLineGap(lineSpacing - font_extents.ascent - font_extents.descent);
 
     cairo_scaled_font_text_extents(m_platformData.m_scaledFont, "x", &text_extents);
diff --git a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
index ac8fe39..9e43558 100644
--- a/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
+++ b/Source/WebCore/platform/graphics/qt/SimpleFontDataQt.cpp
@@ -52,6 +52,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setDescent(fm.descent());
     m_fontMetrics.setXHeight(fm.xHeight());
     m_fontMetrics.setLineGap(fm.leading());
+    m_fontMetrics.setLineSpacing(fm.lineSpacing());
     m_spaceWidth = fm.width(QLatin1Char(' '));
 }
 
diff --git a/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp b/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
index 21f2533..e8f066f 100644
--- a/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
+++ b/Source/WebCore/platform/graphics/win/SimpleFontDataCGWin.cpp
@@ -96,6 +96,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setAscent(fAscent);
     m_fontMetrics.setDescent(fDescent);
     m_fontMetrics.setLineGap(fLineGap);
+    m_fontMetrics.setLineSpacing(lroundf(fAscent) + lroundf(fDescent) + lroundf(fLineGap));
 
     // Measure the actual character "x", because AppKit synthesizes X height rather than getting it from the font.
     // Unfortunately, NSFont will round this for us so we don't quite get the right value.
diff --git a/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp b/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
index 452f819..eea10df 100644
--- a/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
+++ b/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
@@ -70,6 +70,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setAscent(ascent);
     m_fontMetrics.setDescent(descent);
     m_fontMetrics.setLineGap(lineGap);
+    m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
     m_avgCharWidth = textMetrics.tmAveCharWidth * metricsMultiplier;
     m_maxCharWidth = textMetrics.tmMaxCharWidth * metricsMultiplier;
 
diff --git a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
index d31e040..d466c29 100644
--- a/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
+++ b/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
@@ -83,6 +83,7 @@ void SimpleFontData::initGDIFont()
      m_fontMetrics.setAscent(ascent);
      m_fontMetrics.setDescent(descent);
      m_fontMetrics.setLineGap(lineGap);
+     m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
      m_avgCharWidth = textMetrics.tmAveCharWidth;
      m_maxCharWidth = textMetrics.tmMaxCharWidth;
      float xHeight = ascent * 0.56f; // Best guess for xHeight if no x glyph is present.
diff --git a/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp b/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
index 0c1be21..f3e511c 100644
--- a/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
+++ b/Source/WebCore/platform/graphics/wince/SimpleFontDataWinCE.cpp
@@ -57,6 +57,7 @@ void SimpleFontData::platformInit()
     m_fontMetrics.setAscent(ascent);
     m_fontMetrics.setDescent(descent);
     m_fontMetrics.setLineGap(lineGap);
+    m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap));
     m_fontMetrics.setXHeight(ascent * 0.56f);
 }
 
diff --git a/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp b/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
index cbabc29..4f24e4c 100644
--- a/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
+++ b/Source/WebCore/platform/graphics/wx/SimpleFontDataWx.cpp
@@ -58,6 +58,7 @@ void SimpleFontData::platformInit()
         m_fontMetrics.setXHeight(props.GetXHeight());
         m_fontMetrics.setUnitsPerEm(1); // FIXME!
         m_fontMetrics.setLineGap(props.GetLineGap());
+        m_fontMetrics.setLineSpacing(props.GetLineSpacing());
     }
 
     m_syntheticBoldOffset = 0.0f;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list