Commit d4a5d416 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Compile core/html/ with -Wshadow.

Bug: 294205
Change-Id: I4f96c26c813abcb8e6825c0dfe2b1d4fa3f2653a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463227Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815669}
parent 0abf4177
......@@ -5,6 +5,8 @@
import("//third_party/blink/renderer/core/core.gni")
blink_core_sources("html") {
configs += [ "//build/config/compiler:noshadowing" ]
sources = [
"anchor_element_metrics.cc",
"anchor_element_metrics.h",
......
......@@ -64,14 +64,16 @@ void TextMetrics::Update(const Font& font,
if (!font_data)
return;
// TODO(kojii): Need to figure out the desired behavior of |advances| when
// bidi reorder occurs.
TextRun text_run(
text, /* xpos */ 0, /* expansion */ 0,
TextRun::kAllowTrailingExpansion | TextRun::kForbidLeadingExpansion,
direction, false);
text_run.SetNormalizeSpace(true);
advances_ = font.IndividualCharacterAdvances(text_run);
{
// TODO(kojii): Need to figure out the desired behavior of |advances| when
// bidi reorder occurs.
TextRun text_run(
text, /* xpos */ 0, /* expansion */ 0,
TextRun::kAllowTrailingExpansion | TextRun::kForbidLeadingExpansion,
direction, false);
text_run.SetNormalizeSpace(true);
advances_ = font.IndividualCharacterAdvances(text_run);
}
// x direction
// Run bidi algorithm on the given text. Step 5 of:
......
......@@ -695,16 +695,18 @@ void HTMLSelectElement::ChildrenChanged(const ChildrenChange& change) {
OptionInserted(*option, option->Selected());
} else if (auto* optgroup =
DynamicTo<HTMLOptGroupElement>(change.sibling_changed)) {
for (auto& option : Traversal<HTMLOptionElement>::ChildrenOf(*optgroup))
OptionInserted(option, option.Selected());
for (auto& child_option :
Traversal<HTMLOptionElement>::ChildrenOf(*optgroup))
OptionInserted(child_option, child_option.Selected());
}
} else if (change.type == ChildrenChangeType::kElementRemoved) {
if (auto* option = DynamicTo<HTMLOptionElement>(change.sibling_changed)) {
OptionRemoved(*option);
} else if (auto* optgroup =
DynamicTo<HTMLOptGroupElement>(change.sibling_changed)) {
for (auto& option : Traversal<HTMLOptionElement>::ChildrenOf(*optgroup))
OptionRemoved(option);
for (auto& child_option :
Traversal<HTMLOptionElement>::ChildrenOf(*optgroup))
OptionRemoved(child_option);
}
} else if (change.type == ChildrenChangeType::kAllChildrenRemoved) {
DCHECK(change.removed_nodes);
......@@ -712,8 +714,9 @@ void HTMLSelectElement::ChildrenChanged(const ChildrenChange& change) {
if (auto* option = DynamicTo<HTMLOptionElement>(node)) {
OptionRemoved(*option);
} else if (auto* optgroup = DynamicTo<HTMLOptGroupElement>(node)) {
for (auto& option : Traversal<HTMLOptionElement>::ChildrenOf(*optgroup))
OptionRemoved(option);
for (auto& child_option :
Traversal<HTMLOptionElement>::ChildrenOf(*optgroup))
OptionRemoved(child_option);
}
}
}
......@@ -922,10 +925,11 @@ void HTMLSelectElement::RestoreFormControlState(const FormControlState& state) {
} else {
wtf_size_t found_index = SearchOptionsForValue(state[0], 0, items_size);
if (found_index != kNotFound) {
auto* option_element = To<HTMLOptionElement>(items[found_index].Get());
option_element->SetSelectedState(true);
option_element->SetDirty(true);
last_on_change_option_ = option_element;
auto* found_option_element =
To<HTMLOptionElement>(items[found_index].Get());
found_option_element->SetSelectedState(true);
found_option_element->SetDirty(true);
last_on_change_option_ = found_option_element;
}
}
} else {
......@@ -947,9 +951,10 @@ void HTMLSelectElement::RestoreFormControlState(const FormControlState& state) {
found_index = SearchOptionsForValue(value, 0, start_index);
if (found_index == kNotFound)
continue;
auto* option_element = To<HTMLOptionElement>(items[found_index].Get());
option_element->SetSelectedState(true);
option_element->SetDirty(true);
auto* found_option_element =
To<HTMLOptionElement>(items[found_index].Get());
found_option_element->SetSelectedState(true);
found_option_element->SetDirty(true);
start_index = found_index + 1;
}
}
......
......@@ -449,7 +449,7 @@ void MenuListSelectType::DidRecalcStyle(const StyleRecalcChange change) {
}
String MenuListSelectType::UpdateTextStyleInternal() {
HTMLOptionElement* option = OptionToBeShown();
HTMLOptionElement* option_to_be_shown = OptionToBeShown();
String text = g_empty_string;
const ComputedStyle* option_style = nullptr;
......@@ -475,9 +475,9 @@ String MenuListSelectType::UpdateTextStyleInternal() {
DCHECK(!option_style);
}
} else {
if (option) {
text = option->TextIndentedToRespectGroupLabel();
option_style = option->GetComputedStyle();
if (option_to_be_shown) {
text = option_to_be_shown->TextIndentedToRespectGroupLabel();
option_style = option_to_be_shown->GetComputedStyle();
}
}
option_style_ = option_style;
......@@ -499,7 +499,7 @@ String MenuListSelectType::UpdateTextStyleInternal() {
}
}
if (select_->GetLayoutObject())
DidUpdateActiveOption(option);
DidUpdateActiveOption(option_to_be_shown);
return text.StripWhiteSpace();
}
......
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