Index: chrome/browser/autofill/address_field.cc |
diff --git a/chrome/browser/autofill/address_field.cc b/chrome/browser/autofill/address_field.cc |
index 244a12576f58f0ffebf8a21ad0f23ac2de4fb499..c2933d18e475c1e1c915feabf5e496959c95c799 100644 |
--- a/chrome/browser/autofill/address_field.cc |
+++ b/chrome/browser/autofill/address_field.cc |
@@ -387,14 +387,20 @@ AddressType AddressField::AddressTypeFromText(const string16 &text) { |
// Not all pages say "billing address" and "shipping address" explicitly; |
// for example, Craft Catalog1.html has "Bill-to Address" and |
// "Ship-to Address". |
- size_t bill = text.find_last_of(ASCIIToUTF16("bill")); |
- size_t ship = text.find_last_of(ASCIIToUTF16("ship")); |
+ size_t bill = text.rfind(ASCIIToUTF16("bill")); |
+ size_t ship = text.rfind(ASCIIToUTF16("ship")); |
- if (bill != string16::npos && bill > ship) |
+ if (bill == string16::npos && ship == string16::npos) |
+ return kGenericAddress; |
+ |
+ if (bill != string16::npos && ship == string16::npos) |
return kBillingAddress; |
- if (ship != string16::npos) |
+ if (bill == string16::npos && ship != string16::npos) |
return kShippingAddress; |
- return kGenericAddress; |
+ if (bill > ship) |
+ return kBillingAddress; |
+ |
+ return kShippingAddress; |
} |