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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights
reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * | 10 * |
(...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 m_url = newURL; | 2370 m_url = newURL; |
2371 m_documentURI = m_url.string(); | 2371 m_documentURI = m_url.string(); |
2372 updateBaseURL(); | 2372 updateBaseURL(); |
2373 } | 2373 } |
2374 | 2374 |
2375 void Document::updateBaseURL() | 2375 void Document::updateBaseURL() |
2376 { | 2376 { |
2377 // DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HT
ML], the base URI is computed using | 2377 // DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HT
ML], the base URI is computed using |
2378 // first the value of the href attribute of the HTML BASE element if any, an
d the value of the documentURI attribute | 2378 // first the value of the href attribute of the HTML BASE element if any, an
d the value of the documentURI attribute |
2379 // from the Document interface otherwise. | 2379 // from the Document interface otherwise. |
2380 if (m_baseElementURL.isEmpty()) { | 2380 if (!m_baseElementURL.isEmpty()) |
| 2381 m_baseURL = m_baseElementURL; |
| 2382 else if (!m_baseURLOverride.isEmpty()) |
| 2383 m_baseURL = m_baseURLOverride; |
| 2384 else { |
2381 // The documentURI attribute is an arbitrary string. DOM 3 Core does not
specify how it should be resolved, | 2385 // The documentURI attribute is an arbitrary string. DOM 3 Core does not
specify how it should be resolved, |
2382 // so we use a null base URL. | 2386 // so we use a null base URL. |
2383 m_baseURL = KURL(KURL(), documentURI()); | 2387 m_baseURL = KURL(KURL(), documentURI()); |
2384 } else | 2388 } |
2385 m_baseURL = m_baseElementURL; | 2389 |
2386 if (!m_baseURL.isValid()) | 2390 if (!m_baseURL.isValid()) |
2387 m_baseURL = KURL(); | 2391 m_baseURL = KURL(); |
2388 | 2392 |
2389 if (m_elemSheet) | 2393 if (m_elemSheet) |
2390 m_elemSheet->setFinalURL(m_baseURL); | 2394 m_elemSheet->setFinalURL(m_baseURL); |
2391 if (m_mappedElementSheet) | 2395 if (m_mappedElementSheet) |
2392 m_mappedElementSheet->setFinalURL(m_baseURL); | 2396 m_mappedElementSheet->setFinalURL(m_baseURL); |
2393 } | 2397 } |
2394 | 2398 |
| 2399 void Document::setBaseURLOverride(const KURL& url) |
| 2400 { |
| 2401 m_baseURLOverride = url; |
| 2402 updateBaseURL(); |
| 2403 } |
| 2404 |
2395 void Document::processBaseElement() | 2405 void Document::processBaseElement() |
2396 { | 2406 { |
2397 // Find the first href attribute in a base element and the first target attr
ibute in a base element. | 2407 // Find the first href attribute in a base element and the first target attr
ibute in a base element. |
2398 const AtomicString* href = 0; | 2408 const AtomicString* href = 0; |
2399 const AtomicString* target = 0; | 2409 const AtomicString* target = 0; |
2400 for (Node* node = document()->firstChild(); node && (!href || !target); node
= node->traverseNextNode()) { | 2410 for (Node* node = document()->firstChild(); node && (!href || !target); node
= node->traverseNextNode()) { |
2401 if (node->hasTagName(baseTag)) { | 2411 if (node->hasTagName(baseTag)) { |
2402 if (!href) { | 2412 if (!href) { |
2403 const AtomicString& value = static_cast<Element*>(node)->fastGet
Attribute(hrefAttr); | 2413 const AtomicString& value = static_cast<Element*>(node)->fastGet
Attribute(hrefAttr); |
2404 if (!value.isNull()) | 2414 if (!value.isNull()) |
(...skipping 2798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5203 | 5213 |
5204 NodeListsNodeData* data = rareData()->nodeLists(); | 5214 NodeListsNodeData* data = rareData()->nodeLists(); |
5205 | 5215 |
5206 String localTypeNames = typeNames.isNull() ? String("http://webkit.org/micro
data/undefinedItemType") : typeNames; | 5216 String localTypeNames = typeNames.isNull() ? String("http://webkit.org/micro
data/undefinedItemType") : typeNames; |
5207 ASSERT_UNUSED(list, list == data->m_microDataItemListCache.get(localTypeName
s)); | 5217 ASSERT_UNUSED(list, list == data->m_microDataItemListCache.get(localTypeName
s)); |
5208 data->m_microDataItemListCache.remove(localTypeNames); | 5218 data->m_microDataItemListCache.remove(localTypeNames); |
5209 } | 5219 } |
5210 #endif | 5220 #endif |
5211 | 5221 |
5212 } // namespace WebCore | 5222 } // namespace WebCore |
OLD | NEW |