OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/dom_operations.h" |
| 6 |
5 #include <set> | 7 #include <set> |
6 | 8 |
7 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
8 #include "base/string_util.h" | 10 #include "base/string_number_conversions.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
14 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
15 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" |
16 #include "third_party/WebKit/WebKit/chromium/public/WebNodeCollection.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebNodeCollection.h" |
17 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
19 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
20 #include "webkit/glue/dom_operations.h" | |
21 #include "webkit/glue/form_data.h" | 22 #include "webkit/glue/form_data.h" |
22 #include "webkit/glue/password_form_dom_manager.h" | 23 #include "webkit/glue/password_form_dom_manager.h" |
23 #include "webkit/glue/webpasswordautocompletelistener_impl.h" | 24 #include "webkit/glue/webpasswordautocompletelistener_impl.h" |
24 | 25 |
25 using WebKit::WebAnimationController; | 26 using WebKit::WebAnimationController; |
26 using WebKit::WebDocument; | 27 using WebKit::WebDocument; |
27 using WebKit::WebElement; | 28 using WebKit::WebElement; |
28 using WebKit::WebFormElement; | 29 using WebKit::WebFormElement; |
29 using WebKit::WebFrame; | 30 using WebKit::WebFrame; |
30 using WebKit::WebInputElement; | 31 using WebKit::WebInputElement; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 static int ParseSingleIconSize(const string16& text) { | 399 static int ParseSingleIconSize(const string16& text) { |
399 // Size must not start with 0, and be between 0 and 9. | 400 // Size must not start with 0, and be between 0 and 9. |
400 if (text.empty() || !(text[0] >= L'1' && text[0] <= L'9')) | 401 if (text.empty() || !(text[0] >= L'1' && text[0] <= L'9')) |
401 return 0; | 402 return 0; |
402 // Make sure all chars are from 0-9. | 403 // Make sure all chars are from 0-9. |
403 for (size_t i = 1; i < text.length(); ++i) { | 404 for (size_t i = 1; i < text.length(); ++i) { |
404 if (!(text[i] >= L'0' && text[i] <= L'9')) | 405 if (!(text[i] >= L'0' && text[i] <= L'9')) |
405 return 0; | 406 return 0; |
406 } | 407 } |
407 int output; | 408 int output; |
408 if (!StringToInt(text, &output)) | 409 if (!base::StringToInt(text, &output)) |
409 return 0; | 410 return 0; |
410 return output; | 411 return output; |
411 } | 412 } |
412 | 413 |
413 // Parses an icon size. An icon size must match the following regex: | 414 // Parses an icon size. An icon size must match the following regex: |
414 // [1-9][0-9]*x[1-9][0-9]*. | 415 // [1-9][0-9]*x[1-9][0-9]*. |
415 // If the input couldn't be parsed, a size with a width/height < 0 is returned. | 416 // If the input couldn't be parsed, a size with a width/height < 0 is returned. |
416 static gfx::Size ParseIconSize(const string16& text) { | 417 static gfx::Size ParseIconSize(const string16& text) { |
417 std::vector<string16> sizes; | 418 std::vector<string16> sizes; |
418 SplitStringDontTrim(text, L'x', &sizes); | 419 SplitStringDontTrim(text, L'x', &sizes); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 if (!element.hasTagName("meta")) | 611 if (!element.hasTagName("meta")) |
611 continue; | 612 continue; |
612 WebString meta_name = element.getAttribute("name"); | 613 WebString meta_name = element.getAttribute("name"); |
613 if (meta_name.isNull() || meta_name != name) | 614 if (meta_name.isNull() || meta_name != name) |
614 continue; | 615 continue; |
615 meta_elements->push_back(element); | 616 meta_elements->push_back(element); |
616 } | 617 } |
617 } | 618 } |
618 | 619 |
619 } // webkit_glue | 620 } // webkit_glue |
OLD | NEW |