Title: [157456] trunk/Source/WebCore
Revision
157456
Author
[email protected]
Date
2013-10-15 11:17:56 -0700 (Tue, 15 Oct 2013)

Log Message

Skip unnecessary null check in RenderText::textLength().
<https://webkit.org/b/122841>

Reviewed by Antti Koivisto.

RenderText will never have a null String in m_text, so textLength()
can grab at the StringImpl directly, avoiding a null check.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157455 => 157456)


--- trunk/Source/WebCore/ChangeLog	2013-10-15 18:16:51 UTC (rev 157455)
+++ trunk/Source/WebCore/ChangeLog	2013-10-15 18:17:56 UTC (rev 157456)
@@ -1,5 +1,15 @@
 2013-10-15  Andreas Kling  <[email protected]>
 
+        Skip unnecessary null check in RenderText::textLength().
+        <https://webkit.org/b/122841>
+
+        Reviewed by Antti Koivisto.
+
+        RenderText will never have a null String in m_text, so textLength()
+        can grab at the StringImpl directly, avoiding a null check.
+
+2013-10-15  Andreas Kling  <[email protected]>
+
         FontGenericFamilies should not be ref-counted.
         <https://webkit.org/b/122835>
 

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (157455 => 157456)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2013-10-15 18:16:51 UTC (rev 157455)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2013-10-15 18:17:56 UTC (rev 157456)
@@ -159,7 +159,7 @@
     ASSERT(!m_text.isNull());
     setIsText();
     m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath();
-    view().frameView().incrementVisuallyNonEmptyCharacterCount(m_text.length());
+    view().frameView().incrementVisuallyNonEmptyCharacterCount(textLength());
 }
 
 RenderText::RenderText(Document& document, const String& text)
@@ -182,7 +182,7 @@
     ASSERT(!m_text.isNull());
     setIsText();
     m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath();
-    view().frameView().incrementVisuallyNonEmptyCharacterCount(m_text.length());
+    view().frameView().incrementVisuallyNonEmptyCharacterCount(textLength());
 }
 
 #ifndef NDEBUG
@@ -950,7 +950,7 @@
 
 void RenderText::secureText(UChar mask)
 {
-    if (!m_text.length())
+    if (!textLength())
         return;
 
     int lastTypedCharacterOffsetToReveal = -1;

Modified: trunk/Source/WebCore/rendering/RenderText.h (157455 => 157456)


--- trunk/Source/WebCore/rendering/RenderText.h	2013-10-15 18:16:51 UTC (rev 157455)
+++ trunk/Source/WebCore/rendering/RenderText.h	2013-10-15 18:17:56 UTC (rev 157456)
@@ -77,7 +77,7 @@
     const UChar* characters() const { return m_text.characters(); }
     UChar characterAt(unsigned i) const { return is8Bit() ? characters8()[i] : characters16()[i]; }
     UChar operator[](unsigned i) const { return characterAt(i); }
-    unsigned textLength() const { return m_text.length(); } // non virtual implementation of length()
+    unsigned textLength() const { return m_text.impl()->length(); } // non virtual implementation of length()
     void positionLineBox(InlineBox*);
 
     virtual float width(unsigned from, unsigned len, const Font&, float xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to