| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2008, 2009, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (insertionPoint->isConnected()) | 59 if (insertionPoint->isConnected()) |
| 60 document().processBaseElement(); | 60 document().processBaseElement(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool HTMLBaseElement::isURLAttribute(const Attribute& attribute) const { | 63 bool HTMLBaseElement::isURLAttribute(const Attribute& attribute) const { |
| 64 return attribute.name().localName() == hrefAttr || | 64 return attribute.name().localName() == hrefAttr || |
| 65 HTMLElement::isURLAttribute(attribute); | 65 HTMLElement::isURLAttribute(attribute); |
| 66 } | 66 } |
| 67 | 67 |
| 68 KURL HTMLBaseElement::href() const { | 68 KURL HTMLBaseElement::href() const { |
| 69 // This does not use the getURLAttribute function because that will resolve re
lative to the document's base URL; | 69 // This does not use the getURLAttribute function because that will resolve |
| 70 // base elements like this one can be used to set that base URL. Thus we need
to resolve relative to the document's | 70 // relative to the document's base URL; base elements like this one can be |
| 71 // URL and ignore the base URL. | 71 // used to set that base URL. Thus we need to resolve relative to the |
| 72 // document's URL and ignore the base URL. |
| 72 | 73 |
| 73 const AtomicString& attributeValue = fastGetAttribute(hrefAttr); | 74 const AtomicString& attributeValue = fastGetAttribute(hrefAttr); |
| 74 if (attributeValue.isNull()) | 75 if (attributeValue.isNull()) |
| 75 return document().url(); | 76 return document().url(); |
| 76 | 77 |
| 77 KURL url = document().encoding().isValid() | 78 KURL url = document().encoding().isValid() |
| 78 ? KURL(document().url(), | 79 ? KURL(document().url(), |
| 79 stripLeadingAndTrailingHTMLSpaces(attributeValue)) | 80 stripLeadingAndTrailingHTMLSpaces(attributeValue)) |
| 80 : KURL(document().url(), | 81 : KURL(document().url(), |
| 81 stripLeadingAndTrailingHTMLSpaces(attributeValue), | 82 stripLeadingAndTrailingHTMLSpaces(attributeValue), |
| 82 document().encoding()); | 83 document().encoding()); |
| 83 | 84 |
| 84 if (!url.isValid()) | 85 if (!url.isValid()) |
| 85 return KURL(); | 86 return KURL(); |
| 86 | 87 |
| 87 return url; | 88 return url; |
| 88 } | 89 } |
| 89 | 90 |
| 90 void HTMLBaseElement::setHref(const AtomicString& value) { | 91 void HTMLBaseElement::setHref(const AtomicString& value) { |
| 91 setAttribute(hrefAttr, value); | 92 setAttribute(hrefAttr, value); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |