Title: [170871] trunk/Source/WebCore
Revision
170871
Author
mmaxfi...@apple.com
Date
2014-07-07 19:27:14 -0700 (Mon, 07 Jul 2014)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170870 => 170871)


--- trunk/Source/WebCore/ChangeLog	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/ChangeLog	2014-07-08 02:27:14 UTC (rev 170871)
@@ -1,3 +1,33 @@
+2014-07-07  Myles C. Maxfield  <mmaxfi...@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  <beid...@apple.com>
 
         Move Gamepad index down into PlatformGamepad.

Modified: trunk/Source/WebCore/platform/graphics/Font.h (170870 => 170871)


--- trunk/Source/WebCore/platform/graphics/Font.h	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2014-07-08 02:27:14 UTC (rev 170871)
@@ -157,7 +157,6 @@
     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(); }
 

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (170870 => 170871)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-07-08 02:27:14 UTC (rev 170871)
@@ -576,7 +576,8 @@
 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.

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (170870 => 170871)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2014-07-08 02:27:14 UTC (rev 170871)
@@ -1438,7 +1438,7 @@
 
     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.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (170870 => 170871)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-07-08 02:27:14 UTC (rev 170871)
@@ -4114,7 +4114,7 @@
     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 @@
             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));
     }

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (170870 => 170871)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2014-07-08 02:27:14 UTC (rev 170871)
@@ -178,7 +178,7 @@
         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.

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (170870 => 170871)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2014-07-08 02:27:14 UTC (rev 170871)
@@ -430,7 +430,7 @@
                 , direction()
                 , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */);
 
-    if (style->font().isSVGFont())
+    if (style->font().primaryFont()->isSVGFont())
         run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
 
     run.disableRoundingHacks();

Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp (170870 => 170871)


--- trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp	2014-07-08 01:56:28 UTC (rev 170870)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp	2014-07-08 02:27:14 UTC (rev 170871)
@@ -70,7 +70,7 @@
                 , 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(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);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to