| 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, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights 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, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 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 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #include "core/editing/SpellChecker.h" | 105 #include "core/editing/SpellChecker.h" |
| 106 #include "core/events/BeforeUnloadEvent.h" | 106 #include "core/events/BeforeUnloadEvent.h" |
| 107 #include "core/events/Event.h" | 107 #include "core/events/Event.h" |
| 108 #include "core/events/EventFactory.h" | 108 #include "core/events/EventFactory.h" |
| 109 #include "core/events/EventListener.h" | 109 #include "core/events/EventListener.h" |
| 110 #include "core/events/HashChangeEvent.h" | 110 #include "core/events/HashChangeEvent.h" |
| 111 #include "core/events/PageTransitionEvent.h" | 111 #include "core/events/PageTransitionEvent.h" |
| 112 #include "core/events/ScopedEventQueue.h" | 112 #include "core/events/ScopedEventQueue.h" |
| 113 #include "core/events/ThreadLocalEventNames.h" | 113 #include "core/events/ThreadLocalEventNames.h" |
| 114 #include "core/fetch/ResourceFetcher.h" | 114 #include "core/fetch/ResourceFetcher.h" |
| 115 #include "core/fetch/TextResourceDecoder.h" | |
| 116 #include "core/frame/ContentSecurityPolicy.h" | 115 #include "core/frame/ContentSecurityPolicy.h" |
| 117 #include "core/frame/DOMSecurityPolicy.h" | 116 #include "core/frame/DOMSecurityPolicy.h" |
| 118 #include "core/frame/DOMWindow.h" | 117 #include "core/frame/DOMWindow.h" |
| 119 #include "core/frame/Frame.h" | 118 #include "core/frame/Frame.h" |
| 120 #include "core/frame/FrameView.h" | 119 #include "core/frame/FrameView.h" |
| 121 #include "core/frame/History.h" | 120 #include "core/frame/History.h" |
| 122 #include "core/frame/animation/AnimationController.h" | 121 #include "core/frame/animation/AnimationController.h" |
| 123 #include "core/html/HTMLAllCollection.h" | 122 #include "core/html/HTMLAllCollection.h" |
| 124 #include "core/html/HTMLAnchorElement.h" | 123 #include "core/html/HTMLAnchorElement.h" |
| 125 #include "core/html/HTMLCanvasElement.h" | 124 #include "core/html/HTMLCanvasElement.h" |
| 126 #include "core/html/HTMLCollection.h" | 125 #include "core/html/HTMLCollection.h" |
| 127 #include "core/html/HTMLDialogElement.h" | 126 #include "core/html/HTMLDialogElement.h" |
| 128 #include "core/html/HTMLDocument.h" | 127 #include "core/html/HTMLDocument.h" |
| 129 #include "core/html/HTMLFrameOwnerElement.h" | 128 #include "core/html/HTMLFrameOwnerElement.h" |
| 130 #include "core/html/HTMLHeadElement.h" | 129 #include "core/html/HTMLHeadElement.h" |
| 131 #include "core/html/HTMLHtmlElement.h" | 130 #include "core/html/HTMLHtmlElement.h" |
| 132 #include "core/html/HTMLIFrameElement.h" | 131 #include "core/html/HTMLIFrameElement.h" |
| 133 #include "core/html/HTMLImport.h" | 132 #include "core/html/HTMLImport.h" |
| 134 #include "core/html/HTMLInputElement.h" | 133 #include "core/html/HTMLInputElement.h" |
| 135 #include "core/html/HTMLLinkElement.h" | 134 #include "core/html/HTMLLinkElement.h" |
| 136 #include "core/html/HTMLNameCollection.h" | 135 #include "core/html/HTMLNameCollection.h" |
| 137 #include "core/html/HTMLScriptElement.h" | 136 #include "core/html/HTMLScriptElement.h" |
| 138 #include "core/html/HTMLStyleElement.h" | 137 #include "core/html/HTMLStyleElement.h" |
| 139 #include "core/html/HTMLTitleElement.h" | 138 #include "core/html/HTMLTitleElement.h" |
| 140 #include "core/html/PluginDocument.h" | 139 #include "core/html/PluginDocument.h" |
| 141 #include "core/html/forms/FormController.h" | 140 #include "core/html/forms/FormController.h" |
| 142 #include "core/html/parser/HTMLDocumentParser.h" | 141 #include "core/html/parser/HTMLDocumentParser.h" |
| 143 #include "core/html/parser/HTMLParserIdioms.h" | 142 #include "core/html/parser/HTMLParserIdioms.h" |
| 144 #include "core/html/parser/NestingLevelIncrementer.h" | 143 #include "core/html/parser/NestingLevelIncrementer.h" |
| 144 #include "core/html/parser/TextResourceDecoder.h" |
| 145 #include "core/inspector/InspectorCounters.h" | 145 #include "core/inspector/InspectorCounters.h" |
| 146 #include "core/inspector/InspectorInstrumentation.h" | 146 #include "core/inspector/InspectorInstrumentation.h" |
| 147 #include "core/inspector/ScriptCallStack.h" | 147 #include "core/inspector/ScriptCallStack.h" |
| 148 #include "core/loader/CookieJar.h" | 148 #include "core/loader/CookieJar.h" |
| 149 #include "core/loader/DocumentLoader.h" | 149 #include "core/loader/DocumentLoader.h" |
| 150 #include "core/loader/FrameLoader.h" | 150 #include "core/loader/FrameLoader.h" |
| 151 #include "core/loader/FrameLoaderClient.h" | 151 #include "core/loader/FrameLoaderClient.h" |
| 152 #include "core/loader/ImageLoader.h" | 152 #include "core/loader/ImageLoader.h" |
| 153 #include "core/loader/appcache/ApplicationCacheHost.h" | 153 #include "core/loader/appcache/ApplicationCacheHost.h" |
| 154 #include "core/page/Chrome.h" | 154 #include "core/page/Chrome.h" |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 | 1102 |
| 1103 void Document::setCharset(const String& charset) | 1103 void Document::setCharset(const String& charset) |
| 1104 { | 1104 { |
| 1105 if (DocumentLoader* documentLoader = loader()) | 1105 if (DocumentLoader* documentLoader = loader()) |
| 1106 documentLoader->setUserChosenEncoding(charset); | 1106 documentLoader->setUserChosenEncoding(charset); |
| 1107 WTF::TextEncoding encoding(charset); | 1107 WTF::TextEncoding encoding(charset); |
| 1108 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). | 1108 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). |
| 1109 if (!encoding.isValid()) | 1109 if (!encoding.isValid()) |
| 1110 return; | 1110 return; |
| 1111 DocumentEncodingData newEncodingData = m_encodingData; | 1111 DocumentEncodingData newEncodingData = m_encodingData; |
| 1112 newEncodingData.encoding = encoding; | 1112 newEncodingData.setEncoding(encoding); |
| 1113 setEncodingData(newEncodingData); | 1113 setEncodingData(newEncodingData); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void Document::setContentLanguage(const String& language) | 1116 void Document::setContentLanguage(const String& language) |
| 1117 { | 1117 { |
| 1118 if (m_contentLanguage == language) | 1118 if (m_contentLanguage == language) |
| 1119 return; | 1119 return; |
| 1120 m_contentLanguage = language; | 1120 m_contentLanguage = language; |
| 1121 | 1121 |
| 1122 // Document's style depends on the content language. | 1122 // Document's style depends on the content language. |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2102 // If the document has already been detached, do not make a new axObjectCach
e. | 2102 // If the document has already been detached, do not make a new axObjectCach
e. |
| 2103 if (!topDocument->renderView()) | 2103 if (!topDocument->renderView()) |
| 2104 return 0; | 2104 return 0; |
| 2105 | 2105 |
| 2106 ASSERT(topDocument == this || !m_axObjectCache); | 2106 ASSERT(topDocument == this || !m_axObjectCache); |
| 2107 if (!topDocument->m_axObjectCache) | 2107 if (!topDocument->m_axObjectCache) |
| 2108 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); | 2108 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
| 2109 return topDocument->m_axObjectCache.get(); | 2109 return topDocument->m_axObjectCache.get(); |
| 2110 } | 2110 } |
| 2111 | 2111 |
| 2112 void Document::setVisuallyOrdered() | |
| 2113 { | |
| 2114 m_visuallyOrdered = true; | |
| 2115 // FIXME: How is possible to not have a renderer here? | |
| 2116 if (renderView()) | |
| 2117 renderView()->style()->setRTLOrdering(VisualOrder); | |
| 2118 setNeedsStyleRecalc(); | |
| 2119 } | |
| 2120 | |
| 2121 PassRefPtr<DocumentParser> Document::createParser() | 2112 PassRefPtr<DocumentParser> Document::createParser() |
| 2122 { | 2113 { |
| 2123 if (isHTMLDocument()) { | 2114 if (isHTMLDocument()) { |
| 2124 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
this->page()); | 2115 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
this->page()); |
| 2125 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); | 2116 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); |
| 2126 } | 2117 } |
| 2127 // FIXME: this should probably pass the frame instead | 2118 // FIXME: this should probably pass the frame instead |
| 2128 return XMLDocumentParser::create(this, view()); | 2119 return XMLDocumentParser::create(this, view()); |
| 2129 } | 2120 } |
| 2130 | 2121 |
| (...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3956 | 3947 |
| 3957 void Document::setEncodingData(const DocumentEncodingData& newData) | 3948 void Document::setEncodingData(const DocumentEncodingData& newData) |
| 3958 { | 3949 { |
| 3959 // It's possible for the encoding of the document to change while we're deco
ding | 3950 // It's possible for the encoding of the document to change while we're deco
ding |
| 3960 // data. That can only occur while we're processing the <head> portion of th
e | 3951 // data. That can only occur while we're processing the <head> portion of th
e |
| 3961 // document. There isn't much user-visible content in the <head>, but there
is | 3952 // document. There isn't much user-visible content in the <head>, but there
is |
| 3962 // the <title> element. This function detects that situation and re-decodes
the | 3953 // the <title> element. This function detects that situation and re-decodes
the |
| 3963 // document's title so that the user doesn't see an incorrectly decoded titl
e | 3954 // document's title so that the user doesn't see an incorrectly decoded titl
e |
| 3964 // in the title bar. | 3955 // in the title bar. |
| 3965 if (m_titleElement | 3956 if (m_titleElement |
| 3966 && encoding() != newData.encoding | 3957 && encoding() != newData.encoding() |
| 3967 && !m_titleElement->firstElementChild() | 3958 && !m_titleElement->firstElementChild() |
| 3968 && encoding() == Latin1Encoding() | 3959 && encoding() == Latin1Encoding() |
| 3969 && m_titleElement->textContent().containsOnlyLatin1()) { | 3960 && m_titleElement->textContent().containsOnlyLatin1()) { |
| 3970 | 3961 |
| 3971 CString originalBytes = m_titleElement->textContent().latin1(); | 3962 CString originalBytes = m_titleElement->textContent().latin1(); |
| 3972 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding); | 3963 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); |
| 3973 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); | 3964 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); |
| 3974 m_titleElement->setTextContent(correctlyDecodedTitle, IGNORE_EXCEPTION); | 3965 m_titleElement->setTextContent(correctlyDecodedTitle, IGNORE_EXCEPTION); |
| 3975 } | 3966 } |
| 3976 | 3967 |
| 3977 m_encodingData = newData; | 3968 m_encodingData = newData; |
| 3969 |
| 3970 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
| 3971 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
| 3972 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
| 3973 m_visuallyOrdered = shouldUseVisualOrdering; |
| 3974 // FIXME: How is possible to not have a renderer here? |
| 3975 if (renderView()) |
| 3976 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); |
| 3977 setNeedsStyleRecalc(); |
| 3978 } |
| 3978 } | 3979 } |
| 3979 | 3980 |
| 3980 KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const | 3981 KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const |
| 3981 { | 3982 { |
| 3982 // Always return a null URL when passed a null string. | 3983 // Always return a null URL when passed a null string. |
| 3983 // FIXME: Should we change the KURL constructor to have this behavior? | 3984 // FIXME: Should we change the KURL constructor to have this behavior? |
| 3984 // See also [CSS]StyleSheet::completeURL(const String&) | 3985 // See also [CSS]StyleSheet::completeURL(const String&) |
| 3985 if (url.isNull()) | 3986 if (url.isNull()) |
| 3986 return KURL(); | 3987 return KURL(); |
| 3987 const KURL& baseURL = ((baseURLOverride.isEmpty() || baseURLOverride == blan
kURL()) && parentDocument()) ? parentDocument()->baseURL() : baseURLOverride; | 3988 const KURL& baseURL = ((baseURLOverride.isEmpty() || baseURLOverride == blan
kURL()) && parentDocument()) ? parentDocument()->baseURL() : baseURLOverride; |
| (...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5197 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) | 5198 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style
ResolverUpdateMode updateMode) |
| 5198 { | 5199 { |
| 5199 if (!isActive()) | 5200 if (!isActive()) |
| 5200 return; | 5201 return; |
| 5201 | 5202 |
| 5202 styleEngine()->modifiedStyleSheet(sheet); | 5203 styleEngine()->modifiedStyleSheet(sheet); |
| 5203 styleResolverChanged(when, updateMode); | 5204 styleResolverChanged(when, updateMode); |
| 5204 } | 5205 } |
| 5205 | 5206 |
| 5206 } // namespace WebCore | 5207 } // namespace WebCore |
| OLD | NEW |