| Index: third_party/libaddressinput/chromium/cpp/src/address_ui.cc
|
| diff --git a/third_party/libaddressinput/chromium/cpp/src/address_ui.cc b/third_party/libaddressinput/chromium/cpp/src/address_ui.cc
|
| index cf57543bb743e2e9012f72e2bad16732dd799083..21d281a97217709cdbdc8cec35f94ae6ed768105 100644
|
| --- a/third_party/libaddressinput/chromium/cpp/src/address_ui.cc
|
| +++ b/third_party/libaddressinput/chromium/cpp/src/address_ui.cc
|
| @@ -76,20 +76,37 @@ std::vector<AddressUiComponent> BuildComponents(
|
| return result;
|
| }
|
|
|
| - for (std::vector<std::vector<AddressField> >::const_iterator
|
| - line_it = rule.GetFormat().begin();
|
| + for (std::vector<std::vector<FormatElement> >::const_iterator
|
| + line_it = rule.GetFormat().begin();
|
| line_it != rule.GetFormat().end();
|
| ++line_it) {
|
| - for (std::vector<AddressField>::const_iterator field_it = line_it->begin();
|
| - field_it != line_it->end(); ++field_it) {
|
| + int num_fields = 0;
|
| + for (std::vector<FormatElement>::const_iterator element_it =
|
| + line_it->begin();
|
| + element_it != line_it->end();
|
| + ++element_it) {
|
| + if (element_it->type == FormatElement::FIELD) {
|
| + ++num_fields;
|
| + }
|
| + }
|
| +
|
| + for (std::vector<FormatElement>::const_iterator element_it =
|
| + line_it->begin();
|
| + element_it != line_it->end();
|
| + ++element_it) {
|
| + if (element_it->type != FormatElement::FIELD) {
|
| + continue;
|
| + }
|
| +
|
| AddressUiComponent component;
|
| component.length_hint =
|
| - line_it->size() == 1 ? AddressUiComponent::HINT_LONG
|
| - : AddressUiComponent::HINT_SHORT;
|
| - component.field = *field_it;
|
| + num_fields == 1 ? AddressUiComponent::HINT_LONG
|
| + : AddressUiComponent::HINT_SHORT;
|
| + component.field = element_it->field;
|
| component.name = localization.GetString(
|
| - GetMessageIdForField(*field_it, rule.GetAdminAreaNameMessageId(),
|
| - rule.GetPostalCodeNameMessageId()));
|
| + GetMessageIdForField(element_it->field,
|
| + rule.GetAdminAreaNameMessageId(),
|
| + rule.GetPostalCodeNameMessageId()));
|
| result.push_back(component);
|
| }
|
| }
|
|
|