Skip to content

[macOS] Ensure context menu images are localized consistently and update paragraph direction images #47227

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

Merged
merged 1 commit into from
Jun 29, 2025

Conversation

lilyspiniolas
Copy link
Contributor

@lilyspiniolas lilyspiniolas commented Jun 26, 2025

e95e526

[macOS] Ensure context menu images are localized consistently and update paragraph direction images
https://bugs.webkit.org/show_bug.cgi?id=295021
rdar://154374848

Reviewed by Abrar Rahman Protyasha and Wenson Hsieh.

Only show images in the context menu’s transformations submenu if a localized
image exists for all 3 items, otherwise show nothing. Update the images for
the paragraph direction items as well.

Renamed `localeToScriptCodeForFontSelection` to `localeToScriptCode` since
it is no longer used solely for font selection.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::setSpecifiedLocale):
* Source/WebCore/platform/text/LocaleToScriptMapping.cpp:
(WebCore::localeToScriptCode):
(WebCore::localeToScriptCodeForFontSelection): Deleted.
* Source/WebCore/platform/text/LocaleToScriptMapping.h:
* Source/WebKit/Platform/mac/MenuUtilities.mm:
(WebKit::symbolForTransformationItem):
(WebKit::symbolNameWithTypeForAction):

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

c09c4f3

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ❌ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@lilyspiniolas lilyspiniolas requested a review from cdumez as a code owner June 26, 2025 09:33
@lilyspiniolas lilyspiniolas self-assigned this Jun 26, 2025
@lilyspiniolas lilyspiniolas added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Jun 26, 2025
RetainPtr scriptCode = [currentLocale scriptCode];
RetainPtr languageCode = [currentLocale languageCode];

const auto isoScriptCode = scriptCode ? scriptNameToCode(String(scriptCode.get())) : localeToScriptCode(languageCode.get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to create WTF::String for either

Suggested change
const auto isoScriptCode = scriptCode ? scriptNameToCode(String(scriptCode.get())) : localeToScriptCode(languageCode.get());
const auto isoScriptCode = scriptCode ? scriptNameToCode(scriptCode.get()) : localeToScriptCode(languageCode.get());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scriptNameToCode takes a StringView, so the build fails with this suggestion

@lilyspiniolas lilyspiniolas added the merge-queue Applied to send a pull request to merge-queue label Jun 29, 2025
…ate paragraph direction images

https://bugs.webkit.org/show_bug.cgi?id=295021
rdar://154374848

Reviewed by Abrar Rahman Protyasha and Wenson Hsieh.

Only show images in the context menu’s transformations submenu if a localized
image exists for all 3 items, otherwise show nothing. Update the images for
the paragraph direction items as well.

Renamed `localeToScriptCodeForFontSelection` to `localeToScriptCode` since
it is no longer used solely for font selection.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::setSpecifiedLocale):
* Source/WebCore/platform/text/LocaleToScriptMapping.cpp:
(WebCore::localeToScriptCode):
(WebCore::localeToScriptCodeForFontSelection): Deleted.
* Source/WebCore/platform/text/LocaleToScriptMapping.h:
* Source/WebKit/Platform/mac/MenuUtilities.mm:
(WebKit::symbolForTransformationItem):
(WebKit::symbolNameWithTypeForAction):

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

Committed 296777@main (e95e526): https://commits.webkit.org/296777@main

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

@webkit-commit-queue webkit-commit-queue merged commit e95e526 into WebKit:main Jun 29, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants