Skip to content

fix: remove the hardcoded font size in the HTML#619

Merged
mhduiy merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0514-fix-361035
May 14, 2026
Merged

fix: remove the hardcoded font size in the HTML#619
mhduiy merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0514-fix-361035

Conversation

@MyLeeJiEun
Copy link
Copy Markdown
Contributor

@MyLeeJiEun MyLeeJiEun commented May 14, 2026

  1. Remove font size from the website link style in AboutDialog
  2. Allow the link text to inherit the default font size

Log: Remove hardcoded font-size from AboutDialog website link style

fix: 移除HTML中硬编码的字体大小

  1. 移除 AboutDialog 中网站链接样式
  2. 允许链接文字继承默认字体大小

Log: 移除关于对话框网站链接样式中硬编码的字体大小
PMS: BUG-361035

Summary by Sourcery

Bug Fixes:

  • Allow the About dialog website link text to inherit the default font size instead of using a hardcoded 13px value.

@deepin-ci-robot
Copy link
Copy Markdown
Contributor

Hi @MyLeeJiEun. Thanks for your PR. 😃

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 14, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes the hardcoded 13px font size from the AboutDialog website link so that it inherits the default text size, aligning the link styling with global typography settings.

File-Level Changes

Change Details Files
Update AboutDialog website link HTML template to stop forcing a 13px font size and instead inherit the surrounding font size.
  • Removed the inline font-size:13px declaration from the website link <a> tag style attribute.
  • Kept existing text-decoration and color styles intact so only font sizing behavior changes.
qt6/src/qml/AboutDialog.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link
Copy Markdown
Contributor

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Since you're already touching this template, consider moving the remaining inline styles (color, text-decoration) into a themed QML style or shared component so they can adapt more easily to palette changes (e.g., dark mode) and future design updates.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since you're already touching this template, consider moving the remaining inline styles (color, text-decoration) into a themed QML style or shared component so they can adapt more easily to palette changes (e.g., dark mode) and future design updates.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@MyLeeJiEun MyLeeJiEun force-pushed the fork-from-master-0514-fix-361035 branch 2 times, most recently from a3677c7 to 421cdff Compare May 14, 2026 11:58
@deepin-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1. Remove the font size style for HTML links in the AboutDialog.
2. Allow the link text to inherit the default font size

Log: Remove the hardcoded font size in the HTML link style of the dialog box.

fix: 移除HTML中硬编码的字体大小

1. 移除 AboutDialog 中HTML链接样式的字体大小
2. 允许链接文字继承默认字体大小

Log: 移除关于对话框HTML链接样式中硬编码的字体大小
PMS: BUG-361035
@MyLeeJiEun MyLeeJiEun force-pushed the fork-from-master-0514-fix-361035 branch from 421cdff to 7c5aa8a Compare May 14, 2026 12:13
@MyLeeJiEun
Copy link
Copy Markdown
Contributor Author

/test all

@deepin-ci-robot
Copy link
Copy Markdown
Contributor

@MyLeeJiEun: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/test all

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mhduiy
Copy link
Copy Markdown
Contributor

mhduiy commented May 14, 2026

/test all

2 similar comments
@mhduiy
Copy link
Copy Markdown
Contributor

mhduiy commented May 14, 2026

/test all

@mhduiy
Copy link
Copy Markdown
Contributor

mhduiy commented May 14, 2026

/test all

@deepin-ci-robot
Copy link
Copy Markdown
Contributor

deepin pr auto review

你好!我是CodeGeeX,你的智能编程助手。我已仔细审查了你提供的 Git Diff 输入。本次修改针对 QML 文件中的一个超链接 HTML 模板进行了样式调整。

以下是详细的代码审查意见:

1. 语法逻辑

  • 评价:语法正确,逻辑清晰。修改仅移除了 HTML style 属性中的 font-size:13px; 声明,没有引入任何语法错误,也不会影响字符串的 %1, %2 占位符替换逻辑。

2. 代码质量

  • 评价改进方向明确,值得肯定。
  • 将硬编码的 font-size:13px 移除,使得超链接的字体大小能够继承其父 QML 组件(如 TextLabel)的字体设置。这大大提高了代码的可维护性和 UI 的一致性。如果未来全局字体大小发生改变,此处不再需要同步修改,符合样式与结构分离的设计原则。

3. 代码性能

  • 评价无明显影响。
  • 减少一个 CSS 属性的解析在底层渲染引擎(如 Qt Quick 的文本渲染模块)中带来的性能提升微乎其微,可忽略不计。但保持样式精简本身是一个好习惯。

4. 代码安全

  • 评价存在潜在的 XSS(跨站脚本)风险,但并非本次修改引入,属于历史遗留问题。
  • 在该模板中,href 的值使用了单引号 '<a href='%1' ...>',而显示文本使用了 %2。如果传入的 %1%2 来源于不可信的外部输入(例如用户输入、未经验证的 API 数据),且其中包含单引号 ',攻击者可以闭合 href 属性并注入恶意的 HTML/JavaScript 代码(例如 javascript:alert(1))。
  • 改进建议
    1. 输入校验:在 QML 层面或后端确保赋给 websiteLink 和显示文本的变量是合法的 URL 和纯文本。
    2. 使用 QML 原生属性:相比于在 HTML 字符串中拼接链接,更安全、更符合 QML 规范的做法是使用 TextLabel 组件的 textonLinkActivatedHoverHandler 来处理超链接交互,这样可以完全避免 HTML 注入风险。

💡 综合改进建议(针对安全与 QML 最佳实践)

如果条件允许,建议将这种 HTML 模板拼接的方式重构为原生的 QML 组件交互方式。这不仅能解决安全问题,还能让样式控制更加 QML 原生化:

重构前(当前方案,存在硬编码样式和潜在注入风险):

readonly property string __websiteLinkTemplate:
    "<a href='%1' style='text-decoration: none; color: #004EE5;'>%2</a>"

// 某处使用
Text {
    text: __websiteLinkTemplate.arg("https://example.com").arg("访问官网")
    onLinkActivated: Qt.openUrlExternally(link)
}

重构后(推荐方案,样式由 QML 控制,安全且易维护):

Text {
    id: websiteLinkText
    text: "访问官网" // 或者绑定到动态属性
    color: "#004EE5"
    font.underline: false // 等同于 text-decoration: none
    
    MouseArea {
        anchors.fill: parent
        cursorShape: Qt.PointingHandCursor
        onClicked: Qt.openUrlExternally(websiteLink) // websiteLink 为纯 URL 属性
    }
}

总结:本次 Diff 的修改本身是合理且积极的,成功移除了不合理的硬编码字体大小。建议在后续迭代中关注 HTML 模板拼接可能带来的安全隐患,并考虑向 QML 原生组件交互方式迁移。

@MyLeeJiEun
Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented May 14, 2026

This pr cannot be merged! (status: unstable)

@mhduiy mhduiy merged commit 5d800eb into linuxdeepin:master May 14, 2026
18 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants