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" | 5 #include "webkit/glue/dom_operations.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_split.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" |
14 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" |
15 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
16 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
17 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebNode.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebNodeCollection.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebNodeCollection.h" |
19 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebNodeList.h" |
20 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 if (!base::StringToInt(text, &output)) | 410 if (!base::StringToInt(text, &output)) |
410 return 0; | 411 return 0; |
411 return output; | 412 return output; |
412 } | 413 } |
413 | 414 |
414 // Parses an icon size. An icon size must match the following regex: | 415 // Parses an icon size. An icon size must match the following regex: |
415 // [1-9][0-9]*x[1-9][0-9]*. | 416 // [1-9][0-9]*x[1-9][0-9]*. |
416 // If the input couldn't be parsed, a size with a width/height < 0 is returned. | 417 // If the input couldn't be parsed, a size with a width/height < 0 is returned. |
417 static gfx::Size ParseIconSize(const string16& text) { | 418 static gfx::Size ParseIconSize(const string16& text) { |
418 std::vector<string16> sizes; | 419 std::vector<string16> sizes; |
419 SplitStringDontTrim(text, L'x', &sizes); | 420 base::SplitStringDontTrim(text, L'x', &sizes); |
420 if (sizes.size() != 2) | 421 if (sizes.size() != 2) |
421 return gfx::Size(); | 422 return gfx::Size(); |
422 | 423 |
423 return gfx::Size(ParseSingleIconSize(sizes[0]), | 424 return gfx::Size(ParseSingleIconSize(sizes[0]), |
424 ParseSingleIconSize(sizes[1])); | 425 ParseSingleIconSize(sizes[1])); |
425 } | 426 } |
426 | 427 |
427 bool ParseIconSizes(const string16& text, | 428 bool ParseIconSizes(const string16& text, |
428 std::vector<gfx::Size>* sizes, | 429 std::vector<gfx::Size>* sizes, |
429 bool* is_any) { | 430 bool* is_any) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 if (!element.hasTagName("meta")) | 613 if (!element.hasTagName("meta")) |
613 continue; | 614 continue; |
614 WebString value = element.getAttribute(attribute_name); | 615 WebString value = element.getAttribute(attribute_name); |
615 if (value.isNull() || value != attribute_value) | 616 if (value.isNull() || value != attribute_value) |
616 continue; | 617 continue; |
617 meta_elements->push_back(element); | 618 meta_elements->push_back(element); |
618 } | 619 } |
619 } | 620 } |
620 | 621 |
621 } // webkit_glue | 622 } // webkit_glue |
OLD | NEW |