Title: [292043] trunk/Source/WebCore
- Revision
- 292043
- Author
- za...@apple.com
- Date
- 2022-03-29 10:55:21 -0700 (Tue, 29 Mar 2022)
Log Message
RenderText::width should call FontCascade directly on single space characters
https://bugs.webkit.org/show_bug.cgi?id=238484
Reviewed by Antti Koivisto.
Some "text and inline box" heavy pages (e.g. wikipedia) have the pattern of leaving one space
gap between adjacent inline boxes (<span>some content</span> <span>and some more</span>).
This patch ensures that we don't construct redundant TextRun objects (and measure their widths)
for such simple cases when applicable.
* rendering/RenderText.cpp:
(WebCore::RenderText::width const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (292042 => 292043)
--- trunk/Source/WebCore/ChangeLog 2022-03-29 17:37:39 UTC (rev 292042)
+++ trunk/Source/WebCore/ChangeLog 2022-03-29 17:55:21 UTC (rev 292043)
@@ -1,3 +1,18 @@
+2022-03-29 Alan Bujtas <za...@apple.com>
+
+ RenderText::width should call FontCascade directly on single space characters
+ https://bugs.webkit.org/show_bug.cgi?id=238484
+
+ Reviewed by Antti Koivisto.
+
+ Some "text and inline box" heavy pages (e.g. wikipedia) have the pattern of leaving one space
+ gap between adjacent inline boxes (<span>some content</span> <span>and some more</span>).
+ This patch ensures that we don't construct redundant TextRun objects (and measure their widths)
+ for such simple cases when applicable.
+
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::width const):
+
2022-03-29 Devin Rousso <drou...@apple.com>
Unreviewed, fix UAF after r291980
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (292042 => 292043)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2022-03-29 17:37:39 UTC (rev 292042)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2022-03-29 17:55:21 UTC (rev 292043)
@@ -1560,6 +1560,9 @@
if (auto width = combineTextWidth(*this, fontCascade, style))
return *width;
+ if (length == 1 && (characterAt(from) == space))
+ return canUseSimplifiedTextMeasuring() ? fontCascade.primaryFont().spaceWidth() : fontCascade.widthOfSpaceString();
+
float width = 0.f;
if (&fontCascade == &style.fontCascade()) {
if (!style.preserveNewline() && !from && length == text().length() && (!glyphOverflow || !glyphOverflow->computeBounds)) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes