Commit d8000dc8 authored by v.paturi's avatar v.paturi Committed by Commit Bot

Fix setting image's alt text content in html_image_element.cc.

The change to AttributeModificationParams (http://crrev.com/2623513005)
has changed the use of the local variable |value| to params.new_value
without noticing that the local variable was shadowing the function
parameter. Since AltText() looks at both alt and text attributes, and
we don't know which of the two is being parsed in this block, we should
compare text->textContent to AltText(), and not params.new_value.
The local variable |value| is being renamed to a more appropriate
|alt_text_content|.This variable containing AltText() can be used for
both comparison and setting which will save one extra function call.

Bug: None
Change-Id: I7f27ab77f1877c6e405aa41b4e912d826ace0fbf
Reviewed-on: https://chromium-review.googlesource.com/1049425
Commit-Queue: Prashant Nevase <prashant.n@samsung.com>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Reviewed-by: default avatarPrashant Nevase <prashant.n@samsung.com>
Cr-Commit-Position: refs/heads/master@{#561531}
parent 198dc253
......@@ -849,6 +849,7 @@ Vaibhav Agrawal <vaibhav1.a@samsung.com>
Valentin Ilie <valentin.ilie@intel.com>
Vamshikrishna Yellenki <vamshi@motorola.com>
Vani Hegde <vani.hegde@samsung.com>
Varun Chowdhary Paturi <v.paturi@samsung.com>
Vartul Katiyar <vartul.k@samsung.com>
Vedran Šajatović <vedran.sajatovic@gmail.com>
Vernon Tang <vt@foilhead.net>
......
......@@ -258,9 +258,9 @@ void HTMLImageElement::ParseAttribute(
if (name == altAttr || name == titleAttr) {
if (UserAgentShadowRoot()) {
Element* text = UserAgentShadowRoot()->getElementById("alttext");
String value = AltText();
if (text && text->textContent() != params.new_value)
text->setTextContent(AltText());
String alt_text_content = AltText();
if (text && text->textContent() != alt_text_content)
text->setTextContent(alt_text_content);
}
} else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) {
SelectSourceURL(ImageLoader::kUpdateIgnorePreviousError);
......
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