Title: [158012] trunk/Source/WebCore
Revision
158012
Author
[email protected]
Date
2013-10-25 08:58:24 -0700 (Fri, 25 Oct 2013)

Log Message

Faster way for simple line layout to check if text has fallback fonts
https://bugs.webkit.org/show_bug.cgi?id=123342

Reviewed by Andreas Kling.
        
Don't use RenderText::knownToHaveNoOverflowAndNoFallbackFonts as it is slow.

Simple text code path test already guarantees there is no overflow. Test for fallback
fonts explicitly.

* platform/graphics/SimpleFontData.h:
        
    Make FINAL.

* rendering/RenderText.cpp:
* rendering/RenderText.h:
        
    Remove knownToHaveNoOverflowAndNoFallbackFonts() as it has no clients.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseFor):
        
    Check if all characters can be found from the primary font.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158011 => 158012)


--- trunk/Source/WebCore/ChangeLog	2013-10-25 14:42:22 UTC (rev 158011)
+++ trunk/Source/WebCore/ChangeLog	2013-10-25 15:58:24 UTC (rev 158012)
@@ -1,3 +1,29 @@
+2013-10-25  Antti Koivisto  <[email protected]>
+
+        Faster way for simple line layout to check if text has fallback fonts
+        https://bugs.webkit.org/show_bug.cgi?id=123342
+
+        Reviewed by Andreas Kling.
+        
+        Don't use RenderText::knownToHaveNoOverflowAndNoFallbackFonts as it is slow.
+
+        Simple text code path test already guarantees there is no overflow. Test for fallback
+        fonts explicitly.
+
+        * platform/graphics/SimpleFontData.h:
+        
+            Make FINAL.
+
+        * rendering/RenderText.cpp:
+        * rendering/RenderText.h:
+        
+            Remove knownToHaveNoOverflowAndNoFallbackFonts() as it has no clients.
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseFor):
+        
+            Check if all characters can be found from the primary font.
+
 2013-10-25  Andreas Kling  <[email protected]>
 
         SVGResourcesCache::clientDestroyed() should take a RenderElement&.

Modified: trunk/Source/WebCore/platform/graphics/SimpleFontData.h (158011 => 158012)


--- trunk/Source/WebCore/platform/graphics/SimpleFontData.h	2013-10-25 14:42:22 UTC (rev 158011)
+++ trunk/Source/WebCore/platform/graphics/SimpleFontData.h	2013-10-25 15:58:24 UTC (rev 158012)
@@ -65,7 +65,7 @@
 enum FontDataVariant { AutoVariant, NormalVariant, SmallCapsVariant, EmphasisMarkVariant, BrokenIdeographVariant };
 enum Pitch { UnknownPitch, FixedPitch, VariablePitch };
 
-class SimpleFontData : public FontData {
+class SimpleFontData FINAL : public FontData {
 public:
     class AdditionalFontData {
         WTF_MAKE_FAST_ALLOCATED;

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (158011 => 158012)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2013-10-25 14:42:22 UTC (rev 158011)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2013-10-25 15:58:24 UTC (rev 158012)
@@ -510,14 +510,6 @@
     return m_maxWidth;
 }
 
-bool RenderText::knownToHaveNoOverflowAndNoFallbackFonts() const
-{
-    if (preferredLogicalWidthsDirty())
-        const_cast<RenderText*>(this)->computePreferredLogicalWidths(0);
-
-    return m_knownToHaveNoOverflowAndNoFallbackFonts;
-}
-
 void RenderText::computePreferredLogicalWidths(float leadWidth)
 {
     HashSet<const SimpleFontData*> fallbackFonts;

Modified: trunk/Source/WebCore/rendering/RenderText.h (158011 => 158012)


--- trunk/Source/WebCore/rendering/RenderText.h	2013-10-25 14:42:22 UTC (rev 158011)
+++ trunk/Source/WebCore/rendering/RenderText.h	2013-10-25 15:58:24 UTC (rev 158012)
@@ -140,7 +140,6 @@
     bool isAllCollapsibleWhitespace() const;
 
     bool canUseSimpleFontCodePath() const { return m_canUseSimpleFontCodePath; }
-    bool knownToHaveNoOverflowAndNoFallbackFonts() const;
 
     void removeAndDestroyTextBoxes();
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (158011 => 158012)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2013-10-25 14:42:22 UTC (rev 158011)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2013-10-25 15:58:24 UTC (rev 158012)
@@ -148,9 +148,9 @@
         return false;
     if (style.font().codePath(TextRun(textRenderer.text())) != Font::Simple)
         return false;
-    if (!textRenderer.knownToHaveNoOverflowAndNoFallbackFonts())
-        return false;
 
+    auto primaryFontData = style.font().primaryFont();
+
     unsigned length = textRenderer.textLength();
     unsigned consecutiveSpaceCount = 0;
     for (unsigned i = 0; i < length; ++i) {
@@ -178,6 +178,8 @@
                 || direction == U_LEFT_TO_RIGHT_EMBEDDING || direction == U_LEFT_TO_RIGHT_OVERRIDE)
                 return false;
         }
+        if (!primaryFontData->glyphForCharacter(character))
+            return false;
     }
     return true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to