Title: [272578] trunk/Source/WebCore
- Revision
- 272578
- Author
- [email protected]
- Date
- 2021-02-09 06:56:00 -0800 (Tue, 09 Feb 2021)
Log Message
[LFC][IFC] Remove misleading TextUtil::fixedPitchWidth
https://bugs.webkit.org/show_bug.cgi?id=221581
Reviewed by Antti Koivisto.
Fonts lie about being monospaced. see webkit.org/b/162546
* layout/inlineformatting/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):
(WebCore::Layout::TextUtil::fixedPitchWidth): Deleted.
* layout/inlineformatting/text/TextUtil.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (272577 => 272578)
--- trunk/Source/WebCore/ChangeLog 2021-02-09 14:53:58 UTC (rev 272577)
+++ trunk/Source/WebCore/ChangeLog 2021-02-09 14:56:00 UTC (rev 272578)
@@ -1,3 +1,17 @@
+2021-02-09 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Remove misleading TextUtil::fixedPitchWidth
+ https://bugs.webkit.org/show_bug.cgi?id=221581
+
+ Reviewed by Antti Koivisto.
+
+ Fonts lie about being monospaced. see webkit.org/b/162546
+
+ * layout/inlineformatting/text/TextUtil.cpp:
+ (WebCore::Layout::TextUtil::width):
+ (WebCore::Layout::TextUtil::fixedPitchWidth): Deleted.
+ * layout/inlineformatting/text/TextUtil.h:
+
2021-02-09 Philippe Normand <[email protected]>
Permission request API for MediaKeySystem access support
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp (272577 => 272578)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp 2021-02-09 14:53:58 UTC (rev 272577)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp 2021-02-09 14:56:00 UTC (rev 272578)
@@ -66,12 +66,9 @@
if (measureWithEndSpace)
++to;
float width = 0;
- if (inlineTextBox.canUseSimplifiedContentMeasuring()) {
- if (font.isFixedPitch())
- width = fixedPitchWidth(text, style, from, to, contentLogicalLeft);
- else
- width = font.widthForSimpleText(StringView(text).substring(from, to - from));
- } else {
+ if (inlineTextBox.canUseSimplifiedContentMeasuring())
+ width = font.widthForSimpleText(StringView(text).substring(from, to - from));
+ else {
auto tabWidth = style.collapseWhiteSpace() ? TabSize(0) : style.tabSize();
WebCore::TextRun run(StringView(text).substring(from, to - from), contentLogicalLeft);
if (tabWidth)
@@ -85,25 +82,6 @@
return width;
}
-InlineLayoutUnit TextUtil::fixedPitchWidth(const StringView& text, const RenderStyle& style, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft)
-{
- RELEASE_ASSERT(to <= text.length());
- auto& font = style.fontCascade();
- auto monospaceCharacterWidth = font.spaceWidth();
- float width = 0;
- for (auto i = from; i < to; ++i) {
- auto character = text[i];
- if (character >= ' ' || character == '\n')
- width += monospaceCharacterWidth;
- else if (character == '\t')
- width += style.collapseWhiteSpace() ? monospaceCharacterWidth : font.tabWidth(style.tabSize(), contentLogicalLeft + width);
-
- if (i > from && (character == ' ' || character == '\t' || character == '\n'))
- width += font.wordSpacing();
- }
- return width;
-}
-
TextUtil::SplitData TextUtil::split(const InlineTextItem& inlineTextItem, InlineLayoutUnit textWidth, InlineLayoutUnit availableWidth, InlineLayoutUnit contentLogicalLeft)
{
ASSERT(availableWidth >= 0);
Modified: trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h (272577 => 272578)
--- trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2021-02-09 14:53:58 UTC (rev 272577)
+++ trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.h 2021-02-09 14:56:00 UTC (rev 272578)
@@ -56,9 +56,6 @@
static bool shouldPreserveSpacesAndTabs(const Box&);
static bool shouldPreserveNewline(const Box&);
-
-private:
- static InlineLayoutUnit fixedPitchWidth(const StringView&, const RenderStyle&, unsigned from, unsigned to, InlineLayoutUnit contentLogicalLeft);
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes