Comments: let the web view size gallery images instead of the main screen
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Swift
- Estrellas
- 3.9k
- Forks
- 1.2k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 136
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de wordpress-mobile/WordPress-iOS
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
wordpress-mobile/WordPress-iOS#26423 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Pri] Low [Status] Ready for Dev [Type] Bug /Me
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
wordpress-mobile/WordPress-iOS#26279 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Pri] Low [Status] Ready for Dev [Type] Bug Share Extension
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
wordpress-mobile/WordPress-iOS#26276 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Pri] Low [Status] Ready for Dev [Type] Bug Blogging Prompts Notifications
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
wordpress-mobile/WordPress-iOS#26256 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Status] Ready for Dev [Type] Bug Reader
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
wordpress-mobile/WordPress-iOS#26254 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de wordpress-mobile/WordPress-iOS
Issues similares
-
Optional callbacks log "Unable to create JSCallback" when passed nullPosiblemente ocupada @cmsj la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
cmsj/Hammerspoon2#464 ·
-
android bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
VocaHQ/vocaphone#470 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
new-compilers request
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
compiler-explorer/compiler-explorer#9640 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100