Title: [106261] releases/WebKitGTK/webkit-1.6

Diff

Modified: releases/WebKitGTK/webkit-1.6/LayoutTests/ChangeLog (106260 => 106261)


--- releases/WebKitGTK/webkit-1.6/LayoutTests/ChangeLog	2012-01-30 19:09:23 UTC (rev 106260)
+++ releases/WebKitGTK/webkit-1.6/LayoutTests/ChangeLog	2012-01-30 19:13:28 UTC (rev 106261)
@@ -1,3 +1,18 @@
+2012-01-30  Martin Robinson  <[email protected]>
+
+        [Freetype] Some text in Planet GNOME renders in the wrong place
+        https://bugs.webkit.org/show_bug.cgi?id=69099
+
+        Reviewed by Dirk Schulze.
+
+        Add a test which exercises this issue. It seems the problem grows worse
+        as the y component of the text position increases, so position the text
+        about halfway down the page.
+
+        * platform/gtk/fonts/synthetic-oblique-positioning-expected.png: Added.
+        * platform/gtk/fonts/synthetic-oblique-positioning-expected.txt: Added.
+        * platform/gtk/fonts/synthetic-oblique-positioning.html: Added.
+
 2011-09-19  Ryosuke Niwa  <[email protected]>
 
         Hit testing on margins of body and head elements doesn't recur

Added: releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning-expected.txt (0 => 106261)


--- releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning-expected.txt	2012-01-30 19:13:28 UTC (rev 106261)
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+layer at (8,200) size 200x40
+  RenderBlock (positioned) {DIV} at (8,200) size 200x40
+    RenderText {#text} at (0,0) size 80x40
+      text run at (0,0) width 80: "A "
+    RenderInline {CITE} at (0,0) size 40x40
+      RenderText {#text} at (80,0) size 40x40
+        text run at (80,0) width 40: "B"
+    RenderText {#text} at (120,0) size 80x40
+      text run at (120,0) width 80: " C"
Property changes on: releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning.html (0 => 106261)


--- releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning.html	2012-01-30 19:13:28 UTC (rev 106261)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<style>
+    @font-face {
+        font-family: webkit-ahem;
+        font-style: normal;
+        src: url(resources/Ahem.ttf) format(truetype);
+    }
+</style>
+</head>
+
+<body>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    document._onreadystatechange_ = function() {
+        if (document.readyState === 'complete')
+            setTimeout(function() {layoutTestController.notifyDone();}, 100);
+    };
+}
+</script>
+
+<!-- This test verifies that the CTM does not cause text that has a synthetic
+oblique to render in the wrong part of the page. You should be able to see
+three separate block characters with the middle rendered in italic.  -->
+
+<div style="position: absolute; top: 200px; font-family: webkit-ahem; font-size: 30pt;">
+A <cite>B</cite> C
+</div>
+</body>
+</html>
Property changes on: releases/WebKitGTK/webkit-1.6/LayoutTests/platform/gtk/fonts/synthetic-oblique-positioning.html
___________________________________________________________________

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.6/Source/WebCore/ChangeLog (106260 => 106261)


--- releases/WebKitGTK/webkit-1.6/Source/WebCore/ChangeLog	2012-01-30 19:09:23 UTC (rev 106260)
+++ releases/WebKitGTK/webkit-1.6/Source/WebCore/ChangeLog	2012-01-30 19:13:28 UTC (rev 106261)
@@ -1,3 +1,25 @@
+2012-01-30  Martin Robinson  <[email protected]>
+
+        [Freetype] Some text in Planet GNOME renders in the wrong place
+        https://bugs.webkit.org/show_bug.cgi?id=69099
+
+        Reviewed by Dirk Schulze.
+
+        Test: platform/gtk/fonts/synthetic-oblique-positioning.html
+
+        Fold the oblique transform into the font matrix itself rather than transforming
+        the CTM of the context at render time. Not only does this fix the issue, it
+        prevents unnecessary work on every paint.
+
+        * platform/graphics/cairo/FontCairo.cpp:
+        No longer set the synthetic oblique transformation matrix on the context
+        when rendering the text. Instead it is now folded into the TM of the font
+        itself.
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
+        (WebCore::FontPlatformData::initializeWithFontFace): Fold the oblique transform into the scaled font.
+        * platform/graphics/win/FontPlatformDataCairoWin.cpp:
+        (WebCore::FontPlatformData::FontPlatformData): Ditto.
+
 2011-09-27  Xan Lopez  <[email protected]>
 
         [GTK] Add compatibility methods for DOM bindings

Modified: releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/cairo/FontCairo.cpp (106260 => 106261)


--- releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2012-01-30 19:09:23 UTC (rev 106260)
+++ releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/cairo/FontCairo.cpp	2012-01-30 19:13:28 UTC (rev 106261)
@@ -43,26 +43,14 @@
 
 namespace WebCore {
 
-static const float gSyntheticObliqueSkew = -tanf(14 * acosf(0) / 90);
-
-static void prepareContextForGlyphDrawing(cairo_t* context, const SimpleFontData* font)
-{
-    cairo_set_scaled_font(context, font->platformData().scaledFont());
-
-    if (font->platformData().syntheticOblique()) {
-        cairo_matrix_t mat = {1, 0, gSyntheticObliqueSkew, 1, 0, 0};
-        cairo_transform(context, &mat);
-    }
-}
-
 static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
 {
     cairo_matrix_t originalTransform;
     float syntheticBoldOffset = font->syntheticBoldOffset();
-    if (font->platformData().syntheticOblique() || syntheticBoldOffset)
+    if (syntheticBoldOffset)
         cairo_get_matrix(context, &originalTransform);
 
-    prepareContextForGlyphDrawing(context, font);
+    cairo_set_scaled_font(context, font->platformData().scaledFont());
     cairo_show_glyphs(context, glyphs, numGlyphs);
 
     if (syntheticBoldOffset) {
@@ -70,7 +58,7 @@
         cairo_show_glyphs(context, glyphs, numGlyphs);
     }
 
-    if (font->platformData().syntheticOblique() || syntheticBoldOffset)
+    if (syntheticBoldOffset)
         cairo_set_matrix(context, &originalTransform);
 }
 
@@ -139,7 +127,7 @@
         cairo_set_line_width(cr, context->strokeThickness());
 
         // This may disturb the CTM, but we are going to call cairo_restore soon after.
-        prepareContextForGlyphDrawing(cr, font);
+        cairo_set_scaled_font(cr, font->platformData().scaledFont());
         cairo_glyph_path(cr, glyphs, numGlyphs);
         cairo_stroke(cr);
     }

Modified: releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (106260 => 106261)


--- releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2012-01-30 19:09:23 UTC (rev 106260)
+++ releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2012-01-30 19:13:28 UTC (rev 106261)
@@ -270,6 +270,12 @@
         cairo_matrix_scale(&fontMatrix, realSize, realSize);
     }
 
+    if (syntheticOblique()) {
+        static const float syntheticObliqueSkew = -tanf(14 * acosf(0) / 90);
+        cairo_matrix_t skew = {1, 0, syntheticObliqueSkew, 1, 0, 0};
+        cairo_matrix_multiply(&fontMatrix, &skew, &fontMatrix);
+    }
+
     m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
     cairo_font_options_destroy(options);
 }

Modified: releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp (106260 => 106261)


--- releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp	2012-01-30 19:09:23 UTC (rev 106260)
+++ releases/WebKitGTK/webkit-1.6/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp	2012-01-30 19:13:28 UTC (rev 106261)
@@ -79,6 +79,12 @@
    cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
    cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
 
+    if (syntheticOblique()) {
+        static const float syntheticObliqueSkew = -tanf(14 * acosf(0) / 90);
+        cairo_matrix_t skew = {1, 0, syntheticObliqueSkew, 1, 0, 0};
+        cairo_matrix_multiply(&fontMatrix, &skew, &fontMatrix);
+    }
+
    m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
    cairo_font_options_destroy(options);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to