Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Motivation
Additional details
#25551 の修正
154713e で、
<svg>
要素からwidth
属性を削除しました。画像が小さく表示される原因が<svg>
要素のwidth
属性に単位が%
の値が指定されているためです。rari ではローカル画像のサイズを取得して
<img>
要素のwidth
およびheight
属性の値として設定する処理が行われます。画像の幅は svg-metadata クレートを利用して取得されるメタデータを利用しています。このクレートではwidth
属性値の単位が%
の場合はviewBox
属性の値をもとに幅を計算するwidth
メソッドが提供されています。しかし、rari はこのメソッドではなくWidth
構造体のwidth
の値を直接利用しているために単位が無視され、100%
が100
と解釈されてしまっています。英語版でこの問題が起こらないのは、
<img>
要素へのwidth
およびheight
の設定をあくまで同一ホストから提供される画像に限定しているためのようです(英語版の画像は mdn.github.io でホストされています)。rari 側の問題ですが、現時点ではコントリビューションを受け付けていないため svg を変更して対応します。この修正を適用すると
viewBox
属性で指定された幅と高さが利用されます。文字がはみ出さないような図形のサイズの調整
c1fef84 で、該当の
<rect>
の幅および横位置を変更しました。Related issues and pull requests
Fixes #25551