Title: [260881] trunk/Source
- Revision
- 260881
- Author
- [email protected]
- Date
- 2020-04-29 00:09:44 -0700 (Wed, 29 Apr 2020)
Log Message
Add StringView::isAllSpecialCharacters()
https://bugs.webkit.org/show_bug.cgi?id=211150
Source/WebCore:
Reviewed by Darin Adler.
Uses new StringView::isAllSpecialCharacters() instead of creating a StringImpl.
No new tests.
* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintTextOrEmphasisMarks):
Source/WTF:
This enables checking for whitespace-only strings without allocating a StringImpl wrapper.
Reviewed by Darin Adler.
* wtf/text/StringView.h:
(WTF::isSpecialCharacter const):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (260880 => 260881)
--- trunk/Source/WTF/ChangeLog 2020-04-29 06:41:25 UTC (rev 260880)
+++ trunk/Source/WTF/ChangeLog 2020-04-29 07:09:44 UTC (rev 260881)
@@ -1,3 +1,15 @@
+2020-04-29 Noam Rosenthal <[email protected]>
+
+ Add StringView::isAllSpecialCharacters()
+ https://bugs.webkit.org/show_bug.cgi?id=211150
+
+ This enables checking for whitespace-only strings without allocating a StringImpl wrapper.
+
+ Reviewed by Darin Adler.
+
+ * wtf/text/StringView.h:
+ (WTF::isSpecialCharacter const):
+
2020-04-27 Ryan Haddad <[email protected]>
[Cocoa] stop using out arguments for document attributes when converting to attributed strings
Modified: trunk/Source/WTF/wtf/text/StringView.h (260880 => 260881)
--- trunk/Source/WTF/wtf/text/StringView.h 2020-04-29 06:41:25 UTC (rev 260880)
+++ trunk/Source/WTF/wtf/text/StringView.h 2020-04-29 07:09:44 UTC (rev 260881)
@@ -155,6 +155,8 @@
WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(const StringView&) const;
WTF_EXPORT_PRIVATE bool containsIgnoringASCIICase(const StringView&, unsigned startOffset) const;
+ template<bool isSpecialCharacter(UChar)> bool isAllSpecialCharacters() const;
+
WTF_EXPORT_PRIVATE bool startsWith(UChar) const;
WTF_EXPORT_PRIVATE bool startsWith(const StringView&) const;
WTF_EXPORT_PRIVATE bool startsWithIgnoringASCIICase(const StringView&) const;
@@ -508,6 +510,13 @@
return find(function) != notFound;
}
+template<bool isSpecialCharacter(UChar)> inline bool StringView::isAllSpecialCharacters() const
+{
+ if (is8Bit())
+ return WTF::isAllSpecialCharacters<isSpecialCharacter>(characters8(), length());
+ return WTF::isAllSpecialCharacters<isSpecialCharacter>(characters16(), length());
+}
+
inline void StringView::getCharactersWithUpconvert(LChar* destination) const
{
ASSERT(is8Bit());
Modified: trunk/Source/WebCore/ChangeLog (260880 => 260881)
--- trunk/Source/WebCore/ChangeLog 2020-04-29 06:41:25 UTC (rev 260880)
+++ trunk/Source/WebCore/ChangeLog 2020-04-29 07:09:44 UTC (rev 260881)
@@ -1,3 +1,17 @@
+2020-04-29 Noam Rosenthal <[email protected]>
+
+ Add StringView::isAllSpecialCharacters()
+ https://bugs.webkit.org/show_bug.cgi?id=211150
+
+ Reviewed by Darin Adler.
+
+ Uses new StringView::isAllSpecialCharacters() instead of creating a StringImpl.
+
+ No new tests.
+
+ * rendering/TextPainter.cpp:
+ (WebCore::TextPainter::paintTextOrEmphasisMarks):
+
2020-04-28 Said Abou-Hallawa <[email protected]>
Rendering update steps should use Seconds for the timestamps
Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (260880 => 260881)
--- trunk/Source/WebCore/rendering/TextPainter.cpp 2020-04-29 06:41:25 UTC (rev 260880)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp 2020-04-29 07:09:44 UTC (rev 260881)
@@ -108,7 +108,7 @@
ASSERT(startOffset < endOffset);
if (m_context.detectingContentfulPaint()) {
- if (!textRun.text().toStringWithoutCopying().isAllSpecialCharacters<isHTMLSpace>())
+ if (!textRun.text().isAllSpecialCharacters<isHTMLSpace>())
m_context.setContentfulPaintDetected();
return;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes