Closed Bug 1645712 Opened 4 years ago Closed 4 years ago

[wpt-sync] Sync PR 24143 - Fixes img without src but with title doesn't respect CSS dimensions.

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 24143 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/24143
Details from upstream follow.

Yu Han <yuzhehan@chromium.org> wrote:

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/2239473
WPT-Export-Revision: cbb5b2938fdec8263f8b3a0091bc14e59b1a97e6

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests and 1 subtests

Status Summary

Firefox

OK : 1
PASS: 1

Chrome

OK : 1
FAIL: 1

Safari

OK : 1
PASS: 1

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5e1ec38dd7a1 [wpt PR 24143] - Fixes img without src but with title doesn't respect CSS dimensions., a=testonly
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
You need to log in before you can comment on or make changes to this bug.