Title: [239911] trunk/Source/WebCore
Revision
239911
Author
simon.fra...@apple.com
Date
2019-01-13 16:07:35 -0800 (Sun, 13 Jan 2019)

Log Message

Minor optimization to RenderText::setRenderedText()
https://bugs.webkit.org/show_bug.cgi?id=193388

Reviewed by Ryosuke Niwa.

Avoid the call to applyTextTransform() if TextTransform is None, so that we don't
have to call previousCharacter() and reassign m_text.

Similar optimization in RenderText::textWithoutConvertingBackslashToYenSymbol().

Speedometer profiles show a few samples here, but this isn't going to win any prizes.

* rendering/RenderText.cpp:
(WebCore::RenderText::setRenderedText):
(WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239910 => 239911)


--- trunk/Source/WebCore/ChangeLog	2019-01-13 23:19:14 UTC (rev 239910)
+++ trunk/Source/WebCore/ChangeLog	2019-01-14 00:07:35 UTC (rev 239911)
@@ -1,3 +1,21 @@
+2019-01-13  Simon Fraser  <simon.fra...@apple.com>
+
+        Minor optimization to RenderText::setRenderedText()
+        https://bugs.webkit.org/show_bug.cgi?id=193388
+
+        Reviewed by Ryosuke Niwa.
+
+        Avoid the call to applyTextTransform() if TextTransform is None, so that we don't
+        have to call previousCharacter() and reassign m_text.
+        
+        Similar optimization in RenderText::textWithoutConvertingBackslashToYenSymbol().
+
+        Speedometer profiles show a few samples here, but this isn't going to win any prizes.
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::setRenderedText):
+        (WebCore::RenderText::textWithoutConvertingBackslashToYenSymbol const):
+
 2019-01-13  Dan Bernstein  <m...@apple.com>
 
         Tried to fix the build.

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (239910 => 239911)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2019-01-13 23:19:14 UTC (rev 239910)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2019-01-14 00:07:35 UTC (rev 239911)
@@ -1169,10 +1169,12 @@
 
     if (m_useBackslashAsYenSymbol)
         m_text.replace('\\', yenSign);
+    
+    const auto& style = this->style();
+    if (style.textTransform() != TextTransform::None)
+        m_text = applyTextTransform(style, m_text, previousCharacter());
 
-    m_text = applyTextTransform(style(), m_text, previousCharacter());
-
-    switch (style().textSecurity()) {
+    switch (style.textSecurity()) {
     case TextSecurity::None:
         break;
 #if !PLATFORM(IOS_FAMILY)
@@ -1294,6 +1296,10 @@
 {
     if (!m_useBackslashAsYenSymbol || style().textSecurity() != TextSecurity::None)
         return text();
+
+    if (style().textTransform() == TextTransform::None)
+        return originalText();
+
     return applyTextTransform(style(), originalText(), previousCharacter());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to