Skip to content

Commit

Permalink
Rename (again) *widthFor* functions in FontCascade keeping Simple/Com…
Browse files Browse the repository at this point in the history
…plex names

https://bugs.webkit.org/show_bug.cgi?id=272831
<rdar://problem/126631132>

Reviewed by Fujii Hironori.

After our recent rename to these functions at 31aadb0,
we got feedback requesting that we keep the "Simple"/"Complex"
names in the meaning, since it is consistently used along FontCascade.

* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::width const):
(WebCore::FontCascade::widthForSimpleText const):
(WebCore::FontCascade::widthForComplexText const):
(WebCore::FontCascade::offsetForPositionForSimpleText const):
(WebCore::FontCascade::widthForTextUsingWidthIterator const): Deleted.
(WebCore::FontCascade::widthForTextUsingComplexTextController const): Deleted.
* Source/WebCore/platform/graphics/FontCascade.h:

Canonical link: https://commits.webkit.org/277634@main
  • Loading branch information
vitorroriz committed Apr 17, 2024
1 parent 9c719c7 commit 5cb9d01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Source/WebCore/platform/graphics/FontCascade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ float FontCascade::width(const TextRun& run, SingleThreadWeakHashSet<const Font>

float result;
if (codePathToUse == CodePath::Complex)
result = widthForTextUsingComplexTextController(run, fallbackFonts, glyphOverflow);
result = widthForComplexText(run, fallbackFonts, glyphOverflow);
else
result = widthForTextUsingWidthIterator(run, fallbackFonts, glyphOverflow);
result = widthForSimpleText(run, fallbackFonts, glyphOverflow);

if (cacheEntry && fallbackFonts->isEmptyIgnoringNullReferences())
*cacheEntry = result;
Expand Down Expand Up @@ -1541,7 +1541,7 @@ void FontCascade::drawEmphasisMarks(GraphicsContext& context, const GlyphBuffer&
drawGlyphBuffer(context, markBuffer, startPoint, CustomFontNotReadyAction::DoNotPaintIfFontNotReady);
}

float FontCascade::widthForTextUsingWidthIterator(const TextRun& run, SingleThreadWeakHashSet<const Font>* fallbackFonts, GlyphOverflow* glyphOverflow) const
float FontCascade::widthForSimpleText(const TextRun& run, SingleThreadWeakHashSet<const Font>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
WidthIterator it(*this, run, fallbackFonts, glyphOverflow);
GlyphBuffer glyphBuffer;
Expand All @@ -1558,7 +1558,7 @@ float FontCascade::widthForTextUsingWidthIterator(const TextRun& run, SingleThre
return it.runWidthSoFar();
}

float FontCascade::widthForTextUsingComplexTextController(const TextRun& run, SingleThreadWeakHashSet<const Font>* fallbackFonts, GlyphOverflow* glyphOverflow) const
float FontCascade::widthForComplexText(const TextRun& run, SingleThreadWeakHashSet<const Font>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
ComplexTextController controller(*this, run, true, fallbackFonts);
if (glyphOverflow) {
Expand Down Expand Up @@ -1614,7 +1614,7 @@ int FontCascade::offsetForPositionForSimpleText(const TextRun& run, float x, boo
GlyphBuffer localGlyphBuffer;
unsigned offset;
if (run.rtl()) {
delta -= widthForTextUsingWidthIterator(run);
delta -= widthForSimpleText(run);
while (1) {
offset = it.currentCharacterIndex();
float w;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/platform/graphics/FontCascade.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class FontCascade final : public CanMakeWeakPtr<FontCascade>, public CanMakeChec
GlyphBuffer layoutSimpleText(const TextRun&, unsigned from, unsigned to, ForTextEmphasisOrNot = NotForTextEmphasis) const;
void drawGlyphBuffer(GraphicsContext&, const GlyphBuffer&, FloatPoint&, CustomFontNotReadyAction) const;
void drawEmphasisMarks(GraphicsContext&, const GlyphBuffer&, const AtomString&, const FloatPoint&) const;
float widthForTextUsingWidthIterator(const TextRun&, SingleThreadWeakHashSet<const Font>* fallbackFonts = nullptr, GlyphOverflow* = nullptr) const;
float widthForSimpleText(const TextRun&, SingleThreadWeakHashSet<const Font>* fallbackFonts = nullptr, GlyphOverflow* = nullptr) const;
int offsetForPositionForSimpleText(const TextRun&, float position, bool includePartialGlyphs) const;
void adjustSelectionRectForSimpleText(const TextRun&, LayoutRect& selectionRect, unsigned from, unsigned to) const;
WEBCORE_EXPORT float widthForSimpleTextSlow(StringView text, TextDirection, float*) const;
Expand All @@ -247,7 +247,7 @@ class FontCascade final : public CanMakeWeakPtr<FontCascade>, public CanMakeChec
static bool canExpandAroundIdeographsInComplexText();

GlyphBuffer layoutComplexText(const TextRun&, unsigned from, unsigned to, ForTextEmphasisOrNot = NotForTextEmphasis) const;
float widthForTextUsingComplexTextController(const TextRun&, SingleThreadWeakHashSet<const Font>* fallbackFonts = nullptr, GlyphOverflow* = nullptr) const;
float widthForComplexText(const TextRun&, SingleThreadWeakHashSet<const Font>* fallbackFonts = nullptr, GlyphOverflow* = nullptr) const;
int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const;
void adjustSelectionRectForComplexText(const TextRun&, LayoutRect& selectionRect, unsigned from, unsigned to) const;

Expand Down

0 comments on commit 5cb9d01

Please sign in to comment.