SVG Font kerning can take an early out if the font has no kerning information
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Aug 2014 23:14:30 +0000 (23:14 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Aug 2014 23:14:30 +0000 (23:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135524

Reviewed by Dean Jackson.

Rather than calling SVGFontElement::horizontalKerningForPairOfStringsAndGlyphs() again
and again, skip the iteration entirely if every call would return 0.

No new tests because there is no behavior change.

* rendering/svg/SVGTextRunRenderingContext.cpp:
(WebCore::SVGTextRunRenderingContext::applySVGKerning):
* svg/SVGFontElement.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171955 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp
Source/WebCore/svg/SVGFontElement.h

index 751fbf185b9b5f5f55605f8d7141ac31528812ec..7a47f407a623eb66e0c9f06eed7b165070e9d6d2 100644 (file)
@@ -1,3 +1,19 @@
+2014-08-01  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        SVG Font kerning can take an early out if the font has no kerning information
+        https://bugs.webkit.org/show_bug.cgi?id=135524
+
+        Reviewed by Dean Jackson.
+
+        Rather than calling SVGFontElement::horizontalKerningForPairOfStringsAndGlyphs() again
+        and again, skip the iteration entirely if every call would return 0.
+
+        No new tests because there is no behavior change.
+
+        * rendering/svg/SVGTextRunRenderingContext.cpp:
+        (WebCore::SVGTextRunRenderingContext::applySVGKerning):
+        * svg/SVGFontElement.h:
+
 2014-08-01  Beth Dakin  <bdakin@apple.com>
 
         Inspector highlights clipped at the bottom on the page in WK1 views with 
index 61773863c7cf4332e2d439c11dfa9e77fdb7d874..e928f1b6a8d857737fe47ed607bd5dd6776f5904 100644 (file)
@@ -72,6 +72,9 @@ bool SVGTextRunRenderingContext::applySVGKerning(const SimpleFontData* fontData,
     if (!fontElement || !fontFaceElement)
         return false;
 
+    if (fontElement->horizontalKerningMapIsEmpty())
+        return true;
+
     float scale = scaleEmToUnits(fontData->platformData().size(), fontFaceElement->unitsPerEm());
 
     String lastGlyphName;
index 89f3b3306fb6af36f87dfb03185a869943ffb5a9..8e4274dd0cb3c3d58051b7e7cbeb09b77cfa9269 100644 (file)
@@ -81,6 +81,7 @@ public:
     Glyph missingGlyph();
 
     const SVGMissingGlyphElement* firstMissingGlyphElement() const;
+    bool horizontalKerningMapIsEmpty() const { return m_horizontalKerningMap.isEmpty(); }
 
 private:
     SVGFontElement(const QualifiedName&, Document&);