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