| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "public/platform/WebIconSizesParser.h" | 5 #include "public/platform/WebIconSizesParser.h" |
| 6 | 6 |
| 7 #include "public/platform/WebSize.h" | 7 #include "public/platform/WebSize.h" |
| 8 #include "public/platform/WebString.h" | 8 #include "public/platform/WebString.h" |
| 9 #include "wtf/text/StringToNumber.h" | 9 #include "wtf/text/StringToNumber.h" |
| 10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 for (unsigned i = 0; i < length; ++i) { | 59 for (unsigned i = 0; i < length; ++i) { |
| 60 // Skip whitespaces. | 60 // Skip whitespaces. |
| 61 i = std::min(sizesString.find(isNotWhitespace, i), | 61 i = std::min(sizesString.find(isNotWhitespace, i), |
| 62 static_cast<size_t>(length)); | 62 static_cast<size_t>(length)); |
| 63 if (i >= length) | 63 if (i >= length) |
| 64 break; | 64 break; |
| 65 | 65 |
| 66 // See if the current size is "any". | 66 // See if the current size is "any". |
| 67 if (sizesString.findIgnoringCase("any", i) == i && | 67 if (sizesString.findIgnoringCase("any", i) == i && |
| 68 (i + 3 == length || isWhitespace(sizesString[i + 3]))) { | 68 (i + 3 == length || isWhitespace(sizesString[i + 3]))) { |
| 69 iconSizes.append(WebSize(0, 0)); | 69 iconSizes.push_back(WebSize(0, 0)); |
| 70 i = i + 3; | 70 i = i + 3; |
| 71 continue; | 71 continue; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Parse the width. | 74 // Parse the width. |
| 75 if (!isIntegerStart(sizesString[i])) { | 75 if (!isIntegerStart(sizesString[i])) { |
| 76 i = findEndOfWord(sizesString, i); | 76 i = findEndOfWord(sizesString, i); |
| 77 continue; | 77 continue; |
| 78 } | 78 } |
| 79 unsigned widthStart = i; | 79 unsigned widthStart = i; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 91 } | 91 } |
| 92 unsigned heightStart = i; | 92 unsigned heightStart = i; |
| 93 i = std::min(sizesString.find(isNonDigit, i), static_cast<size_t>(length)); | 93 i = std::min(sizesString.find(isNonDigit, i), static_cast<size_t>(length)); |
| 94 if (i < length && !isWhitespace(sizesString[i])) { | 94 if (i < length && !isWhitespace(sizesString[i])) { |
| 95 i = findEndOfWord(sizesString, i); | 95 i = findEndOfWord(sizesString, i); |
| 96 continue; | 96 continue; |
| 97 } | 97 } |
| 98 unsigned heightEnd = i; | 98 unsigned heightEnd = i; |
| 99 | 99 |
| 100 // Append the parsed size to iconSizes. | 100 // Append the parsed size to iconSizes. |
| 101 iconSizes.append( | 101 iconSizes.push_back( |
| 102 WebSize(partialStringToInt(sizesString, widthStart, widthEnd), | 102 WebSize(partialStringToInt(sizesString, widthStart, widthEnd), |
| 103 partialStringToInt(sizesString, heightStart, heightEnd))); | 103 partialStringToInt(sizesString, heightStart, heightEnd))); |
| 104 } | 104 } |
| 105 return iconSizes; | 105 return iconSizes; |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |