2011-05-25 Martin Robinson <mrobinson@igalia.com>
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2011 17:39:53 +0000 (17:39 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 May 2011 17:39:53 +0000 (17:39 +0000)
commitaa2238f17c946e5e2b23d8d0bae25bfdc9f5d62d
tree9236fa6642b1b64eab62e3636ddc8b158b10864f
parentd887ac60c5fe40343f1c558770813fa65c44b8ab
2011-05-25  Martin Robinson  <mrobinson@igalia.com>

        Reviewed by Dirk Schulze.

        [GTK][Cairo] Twitter rendering breaks
        https://bugs.webkit.org/show_bug.cgi?id=60917

        Added a GTK+ specific test that verifies that zero pixel sized
        fonts do not corrupt the Cairo context.

        * platform/gtk/fonts/zero-pixel-sized-fonts-expected.png: Added.
        * platform/gtk/fonts/zero-pixel-sized-fonts-expected.txt: Added.
        * platform/gtk/fonts/zero-pixel-sized-fonts.html: Added.
2011-05-25  Martin Robinson  <mrobinson@igalia.com>

        Reviewed by Dirk Schulze.

        [GTK][Cairo] Twitter rendering breaks
        https://bugs.webkit.org/show_bug.cgi?id=60917

        When instantiating a cairo_scaled_font_t font would put the font in an error state,
        leave the m_scaledFont member of platform data as null. Rendering with scaled fonts
        in the error state can later lead to corrupted rendering.

        Due to this change, we must always null check cairo_scaled_font_t and the platform
        data now carries the cairo_font_face_t object with it, so that it can be accessed later
        if there is no cairo_scaled_font_t.

        Test: platform/gtk/fonts/zero-pixel-sized-fonts.html

        * platform/graphics/cairo/FontCairo.cpp:
        (WebCore::Font::drawGlyphs): If the scaled font is null, do not render.
        * platform/graphics/freetype/FontPlatformData.h: Now include the cairo_font_face_t.
        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
        (WebCore::FontPlatformData::FontPlatformData): Initialize the new member.
        (WebCore::FontPlatformData::operator=): Carry over the new member.
        (WebCore::FontPlatformData::operator==): Check equality with the new member.
        (WebCore::FontPlatformData::initializeWithFontFace): If the initialization of m_scaledFont
        put the font into an error state, then just free it and return.
        (WebCore::FontPlatformData::hasCompatibleCharmap): The font always has a compatible charmap
        when the scaled font is null, because rendering is always a no-op and the font data never
        needs to be read.
        * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
        (WebCore::GlyphPage::fill): Don't read font data when the scaled font is null.
        * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
        (WebCore::SimpleFontData::platformInit): Return early when there's no scaled font.
        (WebCore::SimpleFontData::scaledFontData): Use the new m_font member.
        (WebCore::SimpleFontData::containsCharacters): Return early when there's no scaled font.
        (WebCore::SimpleFontData::platformWidthForGlyph): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/gtk/fonts/zero-pixel-sized-fonts-expected.png [new file with mode: 0644]
LayoutTests/platform/gtk/fonts/zero-pixel-sized-fonts-expected.txt [new file with mode: 0644]
LayoutTests/platform/gtk/fonts/zero-pixel-sized-fonts.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cairo/FontCairo.cpp
Source/WebCore/platform/graphics/freetype/FontPlatformData.h
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp