[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

agl at chromium.org agl at chromium.org
Wed Apr 7 23:54:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 1b2a507bd7e9d393064ef3fe18e336485f1a6af6
Author: agl at chromium.org <agl at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 23 22:10:55 2009 +0000

    2009-11-23  Adam Langley  <agl at google.com>
    
            Reviewed by Dmitry Titov.
    
            Chromium Linux: Limit the stroke width and mitre limit.
    
            Limit the stroke width and mitre limit that we'll pass into Skia to
            avoid overflowing Skia's uint16_t glyph widths.
    
            http://code.google.com/p/chromium/issues/detail?id=28250
            https://bugs.webkit.org/show_bug.cgi?id=31747
    
            * platform/graphics/skia/PlatformContextSkia.cpp:
            (scalarBound):
            (PlatformContextSkia::setupPaintForStroking):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 026bf6c..006e6b8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-11-23  Adam Langley  <agl at google.com>
+
+        Reviewed by Dmitry Titov.
+
+        Chromium Linux: Limit the stroke width and mitre limit.
+
+        Limit the stroke width and mitre limit that we'll pass into Skia to
+        avoid overflowing Skia's uint16_t glyph widths.
+
+        http://code.google.com/p/chromium/issues/detail?id=28250
+        https://bugs.webkit.org/show_bug.cgi?id=31747
+
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (scalarBound):
+        (PlatformContextSkia::setupPaintForStroking):
+
 2009-11-23  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index a079da0..dfffa0d 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -343,6 +343,15 @@ void PlatformContextSkia::setupPaintForFilling(SkPaint* paint) const
     paint->setShader(m_state->m_fillShader);
 }
 
+static SkScalar scalarBound(SkScalar v, SkScalar min, SkScalar max)
+{
+    if (v < min)
+        return min;
+    if (v > max)
+        return max;
+    return v;
+}
+
 float PlatformContextSkia::setupPaintForStroking(SkPaint* paint, SkRect* rect, int length) const
 {
     setupPaintCommon(paint);
@@ -351,10 +360,13 @@ float PlatformContextSkia::setupPaintForStroking(SkPaint* paint, SkRect* rect, i
     paint->setColor(m_state->applyAlpha(m_state->m_strokeColor));
     paint->setShader(m_state->m_strokeShader);
     paint->setStyle(SkPaint::kStroke_Style);
-    paint->setStrokeWidth(SkFloatToScalar(width));
+    // The limits here (512 and 256) were made up but are hopefully large
+    // enough to be reasonable. They are, empirically, small enough not to
+    // cause overflows in Skia.
+    paint->setStrokeWidth(scalarBound(SkFloatToScalar(width), 0, 512));
     paint->setStrokeCap(m_state->m_lineCap);
     paint->setStrokeJoin(m_state->m_lineJoin);
-    paint->setStrokeMiter(SkFloatToScalar(m_state->m_miterLimit));
+    paint->setStrokeMiter(scalarBound(SkFloatToScalar(m_state->m_miterLimit), 0, 256));
 
     if (m_state->m_dash)
         paint->setPathEffect(m_state->m_dash);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list