From 1378840ea2e22cd05b44e794590c2ffe73944115 Mon Sep 17 00:00:00 2001 From: "mrobinson@webkit.org" Date: Sat, 17 Mar 2012 02:54:48 +0000 Subject: [PATCH] [Cairo] Text extent of shadowed text is calculated incorrectly https://bugs.webkit.org/show_bug.cgi?id=65035 Source/WebCore: Reviewed by Martin Robinson. No new tests. This is already covered by fast/canvas/fillText-shadow.html. Correct determine the size of rendered text using x and y bearing from the font extents. * platform/graphics/cairo/FontCairo.cpp: (WebCore::drawGlyphsShadow): Use the x and y bearing to calculate text extents. This gives a more accurate sizing and avoids clipping the edges of the shadow. LayoutTests: Reviewed by Martin Robinson * platform/gtk/Skipped: Unskip a test that is now passing. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111110 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 9 +++++++++ LayoutTests/platform/gtk/Skipped | 4 ---- Source/WebCore/ChangeLog | 16 ++++++++++++++++ Source/WebCore/platform/graphics/cairo/FontCairo.cpp | 3 ++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 61091a5..dbaaa84 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,12 @@ +2012-03-16 Martin Robinson + + [Cairo] Text extent of shadowed text is calculated incorrectly + https://bugs.webkit.org/show_bug.cgi?id=65035 + + Reviewed by Martin Robinson + + * platform/gtk/Skipped: Unskip a test that is now passing. + 2012-03-16 Aaron Colwell Rebaselines for compositing tests with video diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped index 9dd9122..5fab569 100644 --- a/LayoutTests/platform/gtk/Skipped +++ b/LayoutTests/platform/gtk/Skipped @@ -1303,10 +1303,6 @@ http/tests/inspector/resource-main-cookies.php http/tests/inspector/resource-parameters.html -# Text shadow extents are calculated incorrectly -# https://bugs.webkit.org/show_bug.cgi?id=65035 -fast/canvas/fillText-shadow.html - # Font feature settings is not implemented. css3/font-feature-settings-rendering.html diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 8b154af..c211f2e 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,19 @@ +2012-03-16 Martin Robinson + + [Cairo] Text extent of shadowed text is calculated incorrectly + https://bugs.webkit.org/show_bug.cgi?id=65035 + + Reviewed by Martin Robinson. + + No new tests. This is already covered by fast/canvas/fillText-shadow.html. + + Correct determine the size of rendered text using x and y bearing from the font + extents. + + * platform/graphics/cairo/FontCairo.cpp: + (WebCore::drawGlyphsShadow): Use the x and y bearing to calculate text extents. + This gives a more accurate sizing and avoids clipping the edges of the shadow. + 2012-03-16 Kentaro Hara [Chromium][Performance] Optimize innerText and outerText in Chromium/Mac diff --git a/Source/WebCore/platform/graphics/cairo/FontCairo.cpp b/Source/WebCore/platform/graphics/cairo/FontCairo.cpp index 35d1e5b..d6e43eb 100644 --- a/Source/WebCore/platform/graphics/cairo/FontCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/FontCairo.cpp @@ -85,7 +85,8 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& cairo_text_extents_t extents; cairo_scaled_font_glyph_extents(font->platformData().scaledFont(), glyphs, numGlyphs, &extents); - FloatRect fontExtentsRect(point.x(), point.y() - extents.height, extents.width, extents.height); + FloatRect fontExtentsRect(point.x() + extents.x_bearing, point.y() + extents.y_bearing, extents.width, extents.height); + if (GraphicsContext* shadowContext = shadow.beginShadowLayer(graphicsContext, fontExtentsRect)) { drawGlyphsToContext(shadowContext->platformContext()->cr(), font, glyphs, numGlyphs); shadow.endShadowLayer(graphicsContext); -- 1.8.3.1