| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Motorola Mobility Inc. | 3 * Copyright (C) 2012 Motorola Mobility Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return; | 114 return; |
| 115 kurl.setPath(value); | 115 kurl.setPath(value); |
| 116 setURL(kurl); | 116 setURL(kurl); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void DOMURLUtils::setSearch(const String& value) | 119 void DOMURLUtils::setSearch(const String& value) |
| 120 { | 120 { |
| 121 KURL kurl = url(); | 121 KURL kurl = url(); |
| 122 if (!kurl.isValid()) | 122 if (!kurl.isValid()) |
| 123 return; | 123 return; |
| 124 kurl.setQuery(value); | 124 |
| 125 // FIXME: have KURL do this clearing of the query component |
| 126 // instead, if practical. Will require addressing |
| 127 // http://crbug.com/108690, for one. |
| 128 if (value[0] == '?') |
| 129 kurl.setQuery(value.length() == 1 ? String() : value.substring(1)); |
| 130 else |
| 131 kurl.setQuery(value.isEmpty() ? String() : value); |
| 132 |
| 125 setURL(kurl); | 133 setURL(kurl); |
| 126 } | 134 } |
| 127 | 135 |
| 128 void DOMURLUtils::setHash(const String& value) | 136 void DOMURLUtils::setHash(const String& value) |
| 129 { | 137 { |
| 130 KURL kurl = url(); | 138 KURL kurl = url(); |
| 131 if (kurl.isNull()) | 139 if (kurl.isNull()) |
| 132 return; | 140 return; |
| 133 | 141 |
| 142 // FIXME: have KURL handle the clearing of the fragment component |
| 143 // on the same input. |
| 134 if (value[0] == '#') | 144 if (value[0] == '#') |
| 135 kurl.setFragmentIdentifier(value.substring(1)); | 145 kurl.setFragmentIdentifier(value.length() == 1 ? String() : value.substr
ing(1)); |
| 136 else | 146 else |
| 137 kurl.setFragmentIdentifier(value); | 147 kurl.setFragmentIdentifier(value.isEmpty() ? String() : value); |
| 138 | 148 |
| 139 setURL(kurl); | 149 setURL(kurl); |
| 140 } | 150 } |
| 141 | 151 |
| 142 } // namespace blink | 152 } // namespace blink |
| OLD | NEW |