summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLBaseElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-23 10:25:11 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-23 10:25:11 +0200
commit5ea819f80c6840c492386bfafbffb059c7e2091f (patch)
tree42ad0b1d82eff090d14278a088ea0f4840a0f938 /Source/WebCore/html/HTMLBaseElement.cpp
parent43a42f108af6bcbd91f2672731c3047c26213af1 (diff)
downloadqtwebkit-5ea819f80c6840c492386bfafbffb059c7e2091f.tar.gz
Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191)
New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal
Diffstat (limited to 'Source/WebCore/html/HTMLBaseElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLBaseElement.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/WebCore/html/HTMLBaseElement.cpp b/Source/WebCore/html/HTMLBaseElement.cpp
index 2754717c0..b58035e99 100644
--- a/Source/WebCore/html/HTMLBaseElement.cpp
+++ b/Source/WebCore/html/HTMLBaseElement.cpp
@@ -26,6 +26,8 @@
#include "Attribute.h"
#include "Document.h"
#include "HTMLNames.h"
+#include "HTMLParserIdioms.h"
+#include "TextResourceDecoder.h"
namespace WebCore {
@@ -75,4 +77,29 @@ String HTMLBaseElement::target() const
return fastGetAttribute(targetAttr);
}
+KURL HTMLBaseElement::href() const
+{
+ // This does not use the getURLAttribute function because that will resolve relative to the document's base URL;
+ // base elements like this one can be used to set that base URL. Thus we need to resolve relative to the document's
+ // URL and ignore the base URL.
+
+ const AtomicString& attributeValue = fastGetAttribute(hrefAttr);
+ if (attributeValue.isNull())
+ return document()->url();
+
+ KURL url = !document()->decoder() ?
+ KURL(document()->url(), stripLeadingAndTrailingHTMLSpaces(attributeValue)) :
+ KURL(document()->url(), stripLeadingAndTrailingHTMLSpaces(attributeValue), document()->decoder()->encoding());
+
+ if (!url.isValid())
+ return KURL();
+
+ return url;
+}
+
+void HTMLBaseElement::setHref(const AtomicString& value)
+{
+ setAttribute(hrefAttr, value);
+}
+
}