OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "webkit/glue/glue_util.h" | 8 #include "webkit/glue/glue_util.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return GURL(spec.data(), spec.length(), url.parsed(), url.isValid()); | 85 return GURL(spec.data(), spec.length(), url.parsed(), url.isValid()); |
86 #else | 86 #else |
87 return StringToGURL(url.string()); | 87 return StringToGURL(url.string()); |
88 #endif | 88 #endif |
89 } | 89 } |
90 | 90 |
91 WebCore::KURL GURLToKURL(const GURL& url) { | 91 WebCore::KURL GURLToKURL(const GURL& url) { |
92 const std::string& spec = url.possibly_invalid_spec(); | 92 const std::string& spec = url.possibly_invalid_spec(); |
93 #if USE(GOOGLEURL) | 93 #if USE(GOOGLEURL) |
94 // Convert using the internal structures to avoid re-parsing. | 94 // Convert using the internal structures to avoid re-parsing. |
95 return WebCore::KURL(spec.c_str(), static_cast<int>(spec.length()), | 95 return WebCore::KURL( |
96 url.parsed_for_possibly_invalid_spec(), url.is_valid()); | 96 WebCore::CString(spec.c_str(), static_cast<int>(spec.length())), |
| 97 url.parsed_for_possibly_invalid_spec(), url.is_valid()); |
97 #else | 98 #else |
98 return WebCore::KURL(StdWStringToString(UTF8ToWide(spec))); | 99 return WebCore::KURL(StdWStringToString(UTF8ToWide(spec))); |
99 #endif | 100 #endif |
100 } | 101 } |
101 | 102 |
102 GURL StringToGURL(const WebCore::String& spec) { | 103 GURL StringToGURL(const WebCore::String& spec) { |
103 return GURL(WideToUTF8(StringToStdWString(spec))); | 104 return GURL(WideToUTF8(StringToStdWString(spec))); |
104 } | 105 } |
105 | 106 |
106 // Rect conversions ------------------------------------------------------------ | 107 // Rect conversions ------------------------------------------------------------ |
107 | 108 |
108 gfx::Rect FromIntRect(const WebCore::IntRect& r) { | 109 gfx::Rect FromIntRect(const WebCore::IntRect& r) { |
109 return gfx::Rect(r.x(), r.y(), r.width() < 0 ? 0 : r.width(), | 110 return gfx::Rect(r.x(), r.y(), r.width() < 0 ? 0 : r.width(), |
110 r.height() < 0 ? 0 : r.height()); | 111 r.height() < 0 ? 0 : r.height()); |
111 } | 112 } |
112 | 113 |
113 WebCore::IntRect ToIntRect(const gfx::Rect& r) { | 114 WebCore::IntRect ToIntRect(const gfx::Rect& r) { |
114 return WebCore::IntRect(r.x(), r.y(), r.width(), r.height()); | 115 return WebCore::IntRect(r.x(), r.y(), r.width(), r.height()); |
115 } | 116 } |
116 | 117 |
117 } // namespace webkit_glue | 118 } // namespace webkit_glue |
118 | 119 |
OLD | NEW |