Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes img without src but with title doesn't respect CSS dimensions.
Prior to this CL, img with CSS height, width and a title attribute is treated as inline text without the CSS dimensions applied. The reason is that title attribute is treated as a backup for alt text [1]. Thus, this prevents the img to be treated as replaced element with intrinsic dimensions [2]:represents-2, but it's treated as non-replaced text [2]:represents-3 where the CSS dimensions are ignored. The fix is instead of checking the HTMLElement::AltText(), check only the presence of alt attribute when determining if the element should be treated as a replaced element. I had considered making the fix in [1] so that AltText() doesn't fallback to title. However, I decided against it to minimized the impact of this change and only fix it when the img doesn't represent an image and defaults to its fallback behavior. [1] https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/html/html_image_element.cc;l=321 [2] https://html.spec.whatwg.org/multipage/rendering.html#images-3 Bug: 958250 Change-Id: I78b3d84d8237b72505fdc5389702d119d61ae405 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2239473 Commit-Queue: Yu Han <[email protected]> Reviewed-by: Stephen Chenney <[email protected]> Reviewed-by: Fredrik Söderquist <[email protected]> Reviewed-by: Mason Freed <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#779100} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: ac9f839eca574f5195d2282ed3e83d1883a8ddae
- Loading branch information