Comments: let the web view size gallery images instead of the main screen
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with RichContentFormatter.resizeGalleryImageURL and its caller, CommentService; trace how it rewrites gallery image src values and how WPImageURLHelper builds URLs for private sites. Check existing srcset handling and the CommentWebView display path. Done means the saved comment HTML lets WebKit choose gallery image widths, including on private sites and for images with an existing srcset.
索引モデルが issue の本文から書いたものです。
説明
Gallery images in comments are sized for one screen when the comment is synced, not for the view that shows them. Let the web view that displays the comment pick the size instead.
What happens today
CommentServiceformats comment content when it syncs comments, and saves the result to Core Data.- As part of that,
RichContentFormatter.resizeGalleryImageURLrewrites thesrcof each gallery image (<img data-orig-file=…>) to one fixed size. - That size comes from the main screen's bounds. After #26202 it uses a fixed 3x scale (
UITraitCollection.largestDisplayScale), but it still readsUIScreen.main.bounds.
Why it's a problem
- The saved HTML depends on the device and window size that synced it, not the one that shows it.
- The size is the whole screen, so on iPad, or in a narrow window, it's larger than the space the image is shown in.
UIScreen.mainassumes a single, fixed display. The code has aTODO: Modernizationcomment for this.
Suggested fix
Comments are shown as HTML in a web view (CommentWebView), and the web view already knows the layout width and the display scale.
- In
resizeGalleryImageURL, add asrcsetwith a few Photon widths (for example 400, 800, 1200 and 2048 px) andsizes="100vw", instead of setting one size insrc. Keepsrcas a fallback. - WebKit then picks the right image when the comment is displayed, and picks again if the window moves to another display.
- Drop the
boundsandtraitCollectionparameters fromformatContentStringandresizeGalleryImageURL.CommentServiceis the only caller.
Things to check
- Find or create a comment with a gallery image, and confirm it goes through this path.
- Private sites use
WPImageURLHelperinstead of Photon. Check it can produce width-only URLs. - Gallery images with an existing
srcsetattribute.
Not affected
The Reader post view formats content separately and isn't part of this.
- 主要言語
- Swift
- スター
- 3.9k
- フォーク
- 1.2k
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 136
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wordpress-mobile/WordPress-iOS のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
wordpress-mobile/WordPress-iOS#26423 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wordpress-mobile/WordPress-iOS#26279 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
wordpress-mobile/WordPress-iOS#26276 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
wordpress-mobile/WordPress-iOS#26256 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Status] Ready for Dev [Type] Bug Reader
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
wordpress-mobile/WordPress-iOS#26254 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
wordpress-mobile/WordPress-iOS の issue をすべて見る
似ている issue
-
Optional callbacks log "Unable to create JSCallback" when passed null対応中かも @cmsj が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
cmsj/Hammerspoon2#464 ·
-
android bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
VocaHQ/vocaphone#470 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
new-compilers request
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
compiler-explorer/compiler-explorer#9640 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100