OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 const KURL& url = this->url(); | 116 const KURL& url = this->url(); |
117 return url.path().isEmpty() ? "/" : url.path(); | 117 return url.path().isEmpty() ? "/" : url.path(); |
118 } | 118 } |
119 | 119 |
120 String Location::search() const | 120 String Location::search() const |
121 { | 121 { |
122 if (!m_frame) | 122 if (!m_frame) |
123 return String(); | 123 return String(); |
124 | 124 |
125 const KURL& url = this->url(); | 125 const KURL& url = this->url(); |
126 return url.query(); | 126 return url.query().isEmpty() ? "" : "?" + url.query(); |
127 } | 127 } |
128 | 128 |
129 String Location::hash() const | 129 String Location::hash() const |
130 { | 130 { |
131 if (!m_frame) | 131 if (!m_frame) |
132 return String(); | 132 return String(); |
133 | 133 |
134 const KURL& url = this->url(); | 134 const KURL& url = this->url(); |
135 return url.ref().isEmpty() ? "" : "#" + url.ref(); | 135 return url.ref().isEmpty() ? "" : "#" + url.ref(); |
136 } | 136 } |
137 | 137 |
138 String Location::toString() const | 138 String Location::toString() const |
139 { | 139 { |
140 if (!m_frame) | 140 if (!m_frame) |
141 return String(); | 141 return String(); |
142 | 142 |
143 const KURL& url = this->url(); | 143 const KURL& url = this->url(); |
144 return url.hasPath() ? url.prettyURL() : url.prettyURL() + "/"; | 144 return url.hasPath() ? url.prettyURL() : url.prettyURL() + "/"; |
145 } | 145 } |
146 | 146 |
147 } // namespace WebCore | 147 } // namespace WebCore |
OLD | NEW |