Remove misleadingly-named Font::isSVGFont()
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jul 2014 02:27:14 +0000 (02:27 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jul 2014 02:27:14 +0000 (02:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134697

Reviewed by Dean Jackson.

Being a SVG font is a property of the FontData object, not
the Font object. Providing an isSVGFont() function on the
Font class will likely lead to incorrect code and non-obvious
bugs.

No new tests because there is no behavior change.

* platform/graphics/Font.h:
(WebCore::Font::isSVGFont): Deleted.
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::primaryFontDataIsSystemFont):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::constructTextRun):
* rendering/RenderBlock.cpp:
(WebCore::constructTextRunInternal):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::constructTextRun):
* rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):
(WebCore::SVGTextMetrics::SVGTextMetrics):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/mac/FontMac.mm
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/rendering/svg/SVGTextMetrics.cpp

index dc48afc67476a55a353604733460cf37f94562da..c687779d557bd2a7bc6f2c3701153ed9c76aa82a 100644 (file)
@@ -1,3 +1,33 @@
+2014-07-07  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Remove misleadingly-named Font::isSVGFont()
+        https://bugs.webkit.org/show_bug.cgi?id=134697
+
+        Reviewed by Dean Jackson.
+
+        Being a SVG font is a property of the FontData object, not
+        the Font object. Providing an isSVGFont() function on the
+        Font class will likely lead to incorrect code and non-obvious
+        bugs.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/Font.h:
+        (WebCore::Font::isSVGFont): Deleted.
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::Font::primaryFontDataIsSystemFont):
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::constructTextRun):
+        * rendering/RenderBlock.cpp:
+        (WebCore::constructTextRunInternal):
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseFor):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::constructTextRun):
+        * rendering/svg/SVGTextMetrics.cpp:
+        (WebCore::SVGTextMetrics::constructTextRun):
+        (WebCore::SVGTextMetrics::SVGTextMetrics):
+
 2014-07-07  Brady Eidson  <beidson@apple.com>
 
         Move Gamepad index down into PlatformGamepad.
index 8d2d74ce3f0d9c6cef3cdde035df8b60709ce16a..f19ae6d5eac08198822c2bc45ffe4fff4e84a244 100644 (file)
@@ -157,7 +157,6 @@ public:
     void setLetterSpacing(float s) { m_letterSpacing = s; }
     bool isFixedPitch() const;
     bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
-    bool isSVGFont() const { return primaryFont()->isSVGFont(); }
     
     FontRenderingMode renderingMode() const { return m_fontDescription.renderingMode(); }
 
index ad57c5d2f823307cd2753fdb87a5ea9af764af67..6c6f1417ed97e7ec817fa28bd3819090809771bb 100644 (file)
@@ -576,7 +576,8 @@ DashArray Font::dashesForIntersectionsWithRect(const TextRun& run, const FloatPo
 bool Font::primaryFontDataIsSystemFont() const
 {
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090
-    return !isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(primaryFont()->platformData().ctFont())).get());
+    const auto* fontData = primaryFont();
+    return !fontData->isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData->platformData().ctFont())).get());
 #else
     // System fonts are hidden by having a name that begins with a period, so simply search
     // for that here rather than try to keep the list up to date.
index 03a237761a63b9a15737ed16fdd8aa2a594c2661..6fe2e2f224b6f142a95d500e8bfbc5d09b12314a 100644 (file)
@@ -1438,7 +1438,7 @@ TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& fo
 
     TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath());
     run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
-    if (font.isSVGFont())
+    if (font.primaryFont()->isSVGFont())
         run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
 
     // Propagate the maximum length of the characters buffer to the TextRun, even when we're only processing a substring.
index d14db03748fa24159b03b6926e97fa4f126ff839..bdaacd0b0458a2ca4aaf050ab1b56755966d8605 100644 (file)
@@ -4114,7 +4114,7 @@ static inline TextRun constructTextRunInternal(RenderObject* context, const Font
     bool directionalOverride = style.rtlOrdering() == VisualOrder;
 
     TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
-    if (font.isSVGFont()) {
+    if (font.primaryFont()->isSVGFont()) {
         ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
         run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
     }
@@ -4134,7 +4134,7 @@ static inline TextRun constructTextRunInternal(RenderObject* context, const Font
             directionalOverride |= isOverride(style.unicodeBidi());
     }
     TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
-    if (font.isSVGFont()) {
+    if (font.primaryFont()->isSVGFont()) {
         ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
         run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
     }
index ca97b1ef3af683f05778a97ccf1d79c400ebe4f7..6106c1d487e5e7baa8767310944c0929c2d67ce7 100644 (file)
@@ -178,7 +178,7 @@ bool canUseFor(const RenderBlockFlow& flow)
         return false;
     if (style.font().codePath(TextRun(textRenderer.text())) != Font::Simple)
         return false;
-    if (style.font().isSVGFont())
+    if (style.font().primaryFont()->isSVGFont())
         return false;
 
     // We assume that all lines have metrics based purely on the primary font.
index ca0f5edf1f20ea96d09947f04d3219d3ae4b2da5..d083fdbe866eb1f58c96a34c4bd7eadb3b24930f 100644 (file)
@@ -430,7 +430,7 @@ TextRun SVGInlineTextBox::constructTextRun(RenderStyle* style, const SVGTextFrag
                 , direction()
                 , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */);
 
-    if (style->font().isSVGFont())
+    if (style->font().primaryFont()->isSVGFont())
         run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
 
     run.disableRoundingHacks();
index ceca0ee84629f1a13652155ece4de47e6c81c9ff..9cf62dffb21d59d5e22b8f08917f97ad891e0b58 100644 (file)
@@ -70,7 +70,7 @@ TextRun SVGTextMetrics::constructTextRun(RenderSVGInlineText& text, unsigned pos
                 , style.direction()
                 , isOverride(style.unicodeBidi()) /* directionalOverride */);
 
-    if (style.font().isSVGFont())
+    if (style.font().primaryFont()->isSVGFont())
         run.setRenderingContext(SVGTextRunRenderingContext::create(text));
 
     run.disableRoundingHacks();
@@ -91,7 +91,7 @@ SVGTextMetrics SVGTextMetrics::measureCharacterRange(RenderSVGInlineText& text,
 
 SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText& text, unsigned position, unsigned length, float width, const String& glyphName)
 {
-    bool needsContext = text.style().font().isSVGFont();
+    bool needsContext = text.style().font().primaryFont()->isSVGFont();
     float scalingFactor = text.scalingFactor();
     ASSERT(scalingFactor);