Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename widthForSimpleText, floatWidthForSimpleText, floatWidthForComplexText #26483

Merged

Conversation

vitorroriz
Copy link
Contributor

@vitorroriz vitorroriz commented Mar 26, 2024

31aadb0

Rename widthForSimpleText, floatWidthForSimpleText, floatWidthForComplexText
https://bugs.webkit.org/show_bug.cgi?id=271729
rdar://problem/125440731

Reviewed by Alan Baradlay.

We currently have 3 functions for width calculation named:

1. widthForSimpleText
2. floatWidthForSimpleText
3. floatWidthForComplexText

These functions all do something similar but their names are a bit confusing, specially by the different meanings of the word "simple" here.
They scale in level of complexity:

1. widthForSimpleText: does not use any width iterator, but has to pass "computeCanUseSimplifiedTextMeasuring" to be used.
2. floatWidthForSimpleText: It is used when we have a CodePath::Simple (calculated on FontCascade). It uses iterator WidthIterator
3. floatWidthForComplexText: It is used when we have a CodePath::Complex (calculated on FontCascade). It uses the ComplexTextControler, a more complete and slower iterator (supports kerning and ligaments, for example, which are currently not supported by WidthIterator).

We are renaming them to:

1. widthForSimpleText -> widthForTextUsingSimplifiedMeasuring
2. floatWidthForSimpleText -> widthForTextUsingWidthIterator
3. floatWidthForComplexText -> floatWidthForTextUsingComplexTextController

* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::width const):
(WebCore::FontCascade::widthForTextUsingWidthIterator const):
(WebCore::FontCascade::widthForTextUsingComplexTextController const):
(WebCore::FontCascade::offsetForPositionForSimpleText const):
(WebCore::FontCascade::floatWidthForSimpleText const): Deleted.
(WebCore::FontCascade::floatWidthForComplexText const): Deleted.
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::widthForTextUsingSimplifiedMeasuring const):
(WebCore::FontCascade::widthForSimpleText const): Deleted.
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
* Tools/TestWebKitAPI/Tests/WebCore/MonospaceFontTests.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/276716@main

8ca8092

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
  πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-skia
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
βœ… πŸ›  tv   πŸ§ͺ mac-AS-debug-wk2 ⏳ πŸ§ͺ gtk-wk2
βœ… πŸ›  tv-sim ⏳ πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@vitorroriz vitorroriz self-assigned this Mar 26, 2024
@vitorroriz vitorroriz added the Text For bugs in text layout and rendering, including international text support. label Mar 26, 2024
@vitorroriz vitorroriz force-pushed the eng/Rename-widthFor-functions branch from 0389680 to 8ca8092 Compare March 26, 2024 22:05
@vitorroriz vitorroriz added the merge-queue Applied to send a pull request to merge-queue label Mar 26, 2024
…lexText

https://bugs.webkit.org/show_bug.cgi?id=271729
rdar://problem/125440731

Reviewed by Alan Baradlay.

We currently have 3 functions for width calculation named:

1. widthForSimpleText
2. floatWidthForSimpleText
3. floatWidthForComplexText

These functions all do something similar but their names are a bit confusing, specially by the different meanings of the word "simple" here.
They scale in level of complexity:

1. widthForSimpleText: does not use any width iterator, but has to pass "computeCanUseSimplifiedTextMeasuring" to be used.
2. floatWidthForSimpleText: It is used when we have a CodePath::Simple (calculated on FontCascade). It uses iterator WidthIterator
3. floatWidthForComplexText: It is used when we have a CodePath::Complex (calculated on FontCascade). It uses the ComplexTextControler, a more complete and slower iterator (supports kerning and ligaments, for example, which are currently not supported by WidthIterator).

We are renaming them to:

1. widthForSimpleText -> widthForTextUsingSimplifiedMeasuring
2. floatWidthForSimpleText -> widthForTextUsingWidthIterator
3. floatWidthForComplexText -> floatWidthForTextUsingComplexTextController

* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::width const):
(WebCore::FontCascade::widthForTextUsingWidthIterator const):
(WebCore::FontCascade::widthForTextUsingComplexTextController const):
(WebCore::FontCascade::offsetForPositionForSimpleText const):
(WebCore::FontCascade::floatWidthForSimpleText const): Deleted.
(WebCore::FontCascade::floatWidthForComplexText const): Deleted.
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::widthForTextUsingSimplifiedMeasuring const):
(WebCore::FontCascade::widthForSimpleText const): Deleted.
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advanceInternal):
* Tools/TestWebKitAPI/Tests/WebCore/MonospaceFontTests.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/276716@main
@webkit-commit-queue
Copy link
Collaborator

Committed 276716@main (31aadb0): https://commits.webkit.org/276716@main

Reviewed commits have been landed. Closing PR #26483 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 31aadb0 into WebKit:main Mar 27, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Text For bugs in text layout and rendering, including international text support.
Projects
None yet
4 participants