[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

inferno at chromium.org inferno at chromium.org
Fri Jan 21 14:44:30 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit fe68f9795e7891b1988e997dfd52c0f6312bb1a4
Author: inferno at chromium.org <inferno at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 28 19:18:36 2010 +0000

    2010-12-28  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Kenneth Russell.
    
            Fix crash with invalid font in m_fontList by not drawing text when a custom font is in the
            process of loading.
            https://bugs.webkit.org/show_bug.cgi?id=51681
    
            Test: canvas/philip/tests/2d.text-custom-font-load-crash.html
    
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::drawTextInternal): bail out if a custom font is loading.
            * platform/graphics/Font.cpp:
            (WebCore::Font::operator==): Replace condition with new function loadingCustomFonts()
            (WebCore::Font::drawText): Replace condition with new function loadingCustomFonts()
            (WebCore::Font::drawEmphasisMarks): Replace condition with new function loadingCustomFonts()
            * platform/graphics/Font.h:
            (WebCore::Font::loadingCustomFonts): new function that returns if a custom font is loading.
    2010-12-28  Abhishek Arya  <inferno at chromium.org>
    
            Reviewed by Kenneth Russell.
    
            Tests that we do not crash when drawing text during custom font load.
            https://bugs.webkit.org/show_bug.cgi?id=51681
    
            * canvas/philip/tests/2d.text-custom-font-load-crash-expected.txt: Added.
            * canvas/philip/tests/2d.text-custom-font-load-crash.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74716 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4a394c0..97076d7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-12-28  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Tests that we do not crash when drawing text during custom font load.
+        https://bugs.webkit.org/show_bug.cgi?id=51681
+
+        * canvas/philip/tests/2d.text-custom-font-load-crash-expected.txt: Added.
+        * canvas/philip/tests/2d.text-custom-font-load-crash.html: Added.
+
 2010-12-28  Andrey Kosyakov  <caseq at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/LayoutTests/fast/text/one-letter-transform-crash-expected.txt b/LayoutTests/canvas/philip/tests/2d.text-custom-font-load-crash-expected.txt
similarity index 100%
copy from LayoutTests/fast/text/one-letter-transform-crash-expected.txt
copy to LayoutTests/canvas/philip/tests/2d.text-custom-font-load-crash-expected.txt
diff --git a/LayoutTests/canvas/philip/tests/2d.text-custom-font-load-crash.html b/LayoutTests/canvas/philip/tests/2d.text-custom-font-load-crash.html
new file mode 100644
index 0000000..c24b0cb
--- /dev/null
+++ b/LayoutTests/canvas/philip/tests/2d.text-custom-font-load-crash.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<div>Test passes if it does not crash.</div>
+<script src="../tests.js"></script>
+<style>
+ at font-face {
+font-family: CanvasTest; 
+  src: url("does_not_exist.ttf");
+}
+</style>
+<applet>
+<canvas id="c">
+</applet>
+<ul id="d"></ul>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+_addTest(function(canvas, ctx) {
+
+ctx.fillRect(0, 0, 100, 50);
+ctx.font = '1px CanvasTest';
+ctx.fillText('AA', 0, 50);
+deferTest();
+
+setTimeout(wrapFunction(function () {
+    ctx.fillText('AA', 0, 50);
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}), 500);
+
+});
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f152806..716a242 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-12-28  Abhishek Arya  <inferno at chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        Fix crash with invalid font in m_fontList by not drawing text when a custom font is in the
+        process of loading.
+        https://bugs.webkit.org/show_bug.cgi?id=51681
+
+        Test: canvas/philip/tests/2d.text-custom-font-load-crash.html
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::drawTextInternal): bail out if a custom font is loading.
+        * platform/graphics/Font.cpp:
+        (WebCore::Font::operator==): Replace condition with new function loadingCustomFonts()
+        (WebCore::Font::drawText): Replace condition with new function loadingCustomFonts()
+        (WebCore::Font::drawEmphasisMarks): Replace condition with new function loadingCustomFonts()
+        * platform/graphics/Font.h:
+        (WebCore::Font::loadingCustomFonts): new function that returns if a custom font is loading.
+
 2010-12-28  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index d498538..f2b6147 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -1760,6 +1760,10 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
         return;
 
     const Font& font = accessFont();
+    
+    // Don't draw anything while we are using custom fonts that are in the process of loading.
+    if (font.loadingCustomFonts())
+        return;
 
     // FIXME: Handle maxWidth.
     // FIXME: Need to turn off font smoothing.
diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp
index 8828a31..887e21d 100644
--- a/WebCore/platform/graphics/Font.cpp
+++ b/WebCore/platform/graphics/Font.cpp
@@ -109,8 +109,7 @@ bool Font::operator==(const Font& other) const
 {
     // Our FontData don't have to be checked, since checking the font description will be fine.
     // FIXME: This does not work if the font was made with the FontPlatformData constructor.
-    if ((m_fontList && m_fontList->loadingCustomFonts()) ||
-        (other.m_fontList && other.m_fontList->loadingCustomFonts()))
+    if (loadingCustomFonts() || other.loadingCustomFonts())
         return false;
     
     FontSelector* first = m_fontList ? m_fontList->fontSelector() : 0;
@@ -138,7 +137,7 @@ void Font::update(PassRefPtr<FontSelector> fontSelector) const
 void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
 {
     // Don't draw anything while we are using custom fonts that are in the process of loading.
-    if (m_fontList && m_fontList->loadingCustomFonts())
+    if (loadingCustomFonts())
         return;
     
     to = (to == -1 ? run.length() : to);
@@ -158,7 +157,7 @@ void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoi
 
 void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
 {
-    if (m_fontList && m_fontList->loadingCustomFonts())
+    if (loadingCustomFonts())
         return;
 
     if (to < 0)
diff --git a/WebCore/platform/graphics/Font.h b/WebCore/platform/graphics/Font.h
index 4097f1e..ec3d220 100644
--- a/WebCore/platform/graphics/Font.h
+++ b/WebCore/platform/graphics/Font.h
@@ -210,6 +210,11 @@ public:
     }
 
     FontSelector* fontSelector() const;
+    bool loadingCustomFonts() const
+    {
+        return m_fontList && m_fontList->loadingCustomFonts();
+    }
+
     static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
     static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || (c >= 0x200c && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == objectReplacementCharacter; }
     static bool canReceiveTextEmphasis(UChar32 c);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list