Commit 6f4d6990 authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Commit Bot

Feedback: Fix the broken image screenshot

The spec suggests showing a broken image icon when and <img> element
has an alt text attribute but no src attribute. To avoid this, we
set the alt text only when we set the src of the img element.

BUG=773985
TEST=manual

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I3884e736a8a7b0e3fa40ea483882d20916a81a00
Reviewed-on: https://chromium-review.googlesource.com/727107Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510098}
parent 3edd34a4
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<div id="screenshot-container" class="checkbox-field-container"> <div id="screenshot-container" class="checkbox-field-container">
<input id="screenshot-checkbox" type="checkbox" aria-labelledby="screenshot-label"> <input id="screenshot-checkbox" type="checkbox" aria-labelledby="screenshot-label">
<label id="screenshot-label" i18n-content="screenshot"></label> <label id="screenshot-label" i18n-content="screenshot"></label>
<img id="screenshot-image" alt="screenshot"> <img id="screenshot-image">
</div> </div>
<!-- System Information --> <!-- System Information -->
<div class="checkbox-field-container"> <div class="checkbox-field-container">
......
...@@ -348,7 +348,11 @@ function initialize() { ...@@ -348,7 +348,11 @@ function initialize() {
chrome.app.window.current().show(); chrome.app.window.current().show();
var screenshotDataUrl = screenshotCanvas.toDataURL('image/png'); var screenshotDataUrl = screenshotCanvas.toDataURL('image/png');
// Only set the alt text when the src url is available, otherwise we'd
// get a broken image picture instead. crbug.com/773985.
$('screenshot-image').src = screenshotDataUrl; $('screenshot-image').src = screenshotDataUrl;
$('screenshot-image').alt = 'screenshot';
$('screenshot-image') $('screenshot-image')
.classList.toggle( .classList.toggle(
'wide-screen', 'wide-screen',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment