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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #include "core/editing/SpellChecker.h" | 102 #include "core/editing/SpellChecker.h" |
103 #include "core/events/BeforeUnloadEvent.h" | 103 #include "core/events/BeforeUnloadEvent.h" |
104 #include "core/events/Event.h" | 104 #include "core/events/Event.h" |
105 #include "core/events/EventFactory.h" | 105 #include "core/events/EventFactory.h" |
106 #include "core/events/EventListener.h" | 106 #include "core/events/EventListener.h" |
107 #include "core/events/HashChangeEvent.h" | 107 #include "core/events/HashChangeEvent.h" |
108 #include "core/events/PageTransitionEvent.h" | 108 #include "core/events/PageTransitionEvent.h" |
109 #include "core/events/ScopedEventQueue.h" | 109 #include "core/events/ScopedEventQueue.h" |
110 #include "core/events/ThreadLocalEventNames.h" | 110 #include "core/events/ThreadLocalEventNames.h" |
111 #include "core/fetch/ResourceFetcher.h" | 111 #include "core/fetch/ResourceFetcher.h" |
112 #include "core/fetch/TextResourceDecoder.h" | |
113 #include "core/frame/ContentSecurityPolicy.h" | 112 #include "core/frame/ContentSecurityPolicy.h" |
114 #include "core/frame/DOMWindow.h" | 113 #include "core/frame/DOMWindow.h" |
115 #include "core/frame/Frame.h" | 114 #include "core/frame/Frame.h" |
116 #include "core/frame/FrameHost.h" | 115 #include "core/frame/FrameHost.h" |
117 #include "core/frame/FrameView.h" | 116 #include "core/frame/FrameView.h" |
118 #include "core/frame/History.h" | 117 #include "core/frame/History.h" |
119 #include "core/frame/PageConsole.h" | 118 #include "core/frame/PageConsole.h" |
120 #include "core/frame/Settings.h" | 119 #include "core/frame/Settings.h" |
121 #include "core/frame/animation/AnimationController.h" | 120 #include "core/frame/animation/AnimationController.h" |
122 #include "core/html/HTMLAllCollection.h" | 121 #include "core/html/HTMLAllCollection.h" |
(...skipping 10 matching lines...) Expand all Loading... |
133 #include "core/html/HTMLLinkElement.h" | 132 #include "core/html/HTMLLinkElement.h" |
134 #include "core/html/HTMLNameCollection.h" | 133 #include "core/html/HTMLNameCollection.h" |
135 #include "core/html/HTMLScriptElement.h" | 134 #include "core/html/HTMLScriptElement.h" |
136 #include "core/html/HTMLStyleElement.h" | 135 #include "core/html/HTMLStyleElement.h" |
137 #include "core/html/HTMLTitleElement.h" | 136 #include "core/html/HTMLTitleElement.h" |
138 #include "core/html/PluginDocument.h" | 137 #include "core/html/PluginDocument.h" |
139 #include "core/html/forms/FormController.h" | 138 #include "core/html/forms/FormController.h" |
140 #include "core/html/parser/HTMLDocumentParser.h" | 139 #include "core/html/parser/HTMLDocumentParser.h" |
141 #include "core/html/parser/HTMLParserIdioms.h" | 140 #include "core/html/parser/HTMLParserIdioms.h" |
142 #include "core/html/parser/NestingLevelIncrementer.h" | 141 #include "core/html/parser/NestingLevelIncrementer.h" |
| 142 #include "core/html/parser/TextResourceDecoder.h" |
143 #include "core/inspector/InspectorCounters.h" | 143 #include "core/inspector/InspectorCounters.h" |
144 #include "core/inspector/InspectorInstrumentation.h" | 144 #include "core/inspector/InspectorInstrumentation.h" |
145 #include "core/inspector/ScriptCallStack.h" | 145 #include "core/inspector/ScriptCallStack.h" |
146 #include "core/loader/CookieJar.h" | 146 #include "core/loader/CookieJar.h" |
147 #include "core/loader/DocumentLoader.h" | 147 #include "core/loader/DocumentLoader.h" |
148 #include "core/loader/FrameLoader.h" | 148 #include "core/loader/FrameLoader.h" |
149 #include "core/loader/FrameLoaderClient.h" | 149 #include "core/loader/FrameLoaderClient.h" |
150 #include "core/loader/ImageLoader.h" | 150 #include "core/loader/ImageLoader.h" |
151 #include "core/loader/appcache/ApplicationCacheHost.h" | 151 #include "core/loader/appcache/ApplicationCacheHost.h" |
152 #include "core/page/Chrome.h" | 152 #include "core/page/Chrome.h" |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 | 1137 |
1138 void Document::setCharset(const String& charset) | 1138 void Document::setCharset(const String& charset) |
1139 { | 1139 { |
1140 if (DocumentLoader* documentLoader = loader()) | 1140 if (DocumentLoader* documentLoader = loader()) |
1141 documentLoader->setUserChosenEncoding(charset); | 1141 documentLoader->setUserChosenEncoding(charset); |
1142 WTF::TextEncoding encoding(charset); | 1142 WTF::TextEncoding encoding(charset); |
1143 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). | 1143 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). |
1144 if (!encoding.isValid()) | 1144 if (!encoding.isValid()) |
1145 return; | 1145 return; |
1146 DocumentEncodingData newEncodingData = m_encodingData; | 1146 DocumentEncodingData newEncodingData = m_encodingData; |
1147 newEncodingData.encoding = encoding; | 1147 newEncodingData.setEncoding(encoding); |
1148 setEncodingData(newEncodingData); | 1148 setEncodingData(newEncodingData); |
1149 } | 1149 } |
1150 | 1150 |
1151 void Document::setContentLanguage(const AtomicString& language) | 1151 void Document::setContentLanguage(const AtomicString& language) |
1152 { | 1152 { |
1153 if (m_contentLanguage == language) | 1153 if (m_contentLanguage == language) |
1154 return; | 1154 return; |
1155 m_contentLanguage = language; | 1155 m_contentLanguage = language; |
1156 | 1156 |
1157 // Document's style depends on the content language. | 1157 // Document's style depends on the content language. |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 // If the document has already been detached, do not make a new axObjectCach
e. | 2139 // If the document has already been detached, do not make a new axObjectCach
e. |
2140 if (!topDocument->renderView()) | 2140 if (!topDocument->renderView()) |
2141 return 0; | 2141 return 0; |
2142 | 2142 |
2143 ASSERT(topDocument == this || !m_axObjectCache); | 2143 ASSERT(topDocument == this || !m_axObjectCache); |
2144 if (!topDocument->m_axObjectCache) | 2144 if (!topDocument->m_axObjectCache) |
2145 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); | 2145 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
2146 return topDocument->m_axObjectCache.get(); | 2146 return topDocument->m_axObjectCache.get(); |
2147 } | 2147 } |
2148 | 2148 |
2149 void Document::setVisuallyOrdered() | |
2150 { | |
2151 m_visuallyOrdered = true; | |
2152 // FIXME: How is possible to not have a renderer here? | |
2153 if (renderView()) | |
2154 renderView()->style()->setRTLOrdering(VisualOrder); | |
2155 setNeedsStyleRecalc(); | |
2156 } | |
2157 | |
2158 PassRefPtr<DocumentParser> Document::createParser() | 2149 PassRefPtr<DocumentParser> Document::createParser() |
2159 { | 2150 { |
2160 if (isHTMLDocument()) { | 2151 if (isHTMLDocument()) { |
2161 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
page()); | 2152 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
page()); |
2162 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); | 2153 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); |
2163 } | 2154 } |
2164 // FIXME: this should probably pass the frame instead | 2155 // FIXME: this should probably pass the frame instead |
2165 return XMLDocumentParser::create(this, view()); | 2156 return XMLDocumentParser::create(this, view()); |
2166 } | 2157 } |
2167 | 2158 |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4036 | 4027 |
4037 void Document::setEncodingData(const DocumentEncodingData& newData) | 4028 void Document::setEncodingData(const DocumentEncodingData& newData) |
4038 { | 4029 { |
4039 // It's possible for the encoding of the document to change while we're deco
ding | 4030 // It's possible for the encoding of the document to change while we're deco
ding |
4040 // data. That can only occur while we're processing the <head> portion of th
e | 4031 // data. That can only occur while we're processing the <head> portion of th
e |
4041 // document. There isn't much user-visible content in the <head>, but there
is | 4032 // document. There isn't much user-visible content in the <head>, but there
is |
4042 // the <title> element. This function detects that situation and re-decodes
the | 4033 // the <title> element. This function detects that situation and re-decodes
the |
4043 // document's title so that the user doesn't see an incorrectly decoded titl
e | 4034 // document's title so that the user doesn't see an incorrectly decoded titl
e |
4044 // in the title bar. | 4035 // in the title bar. |
4045 if (m_titleElement | 4036 if (m_titleElement |
4046 && encoding() != newData.encoding | 4037 && encoding() != newData.encoding() |
4047 && !m_titleElement->firstElementChild() | 4038 && !m_titleElement->firstElementChild() |
4048 && encoding() == Latin1Encoding() | 4039 && encoding() == Latin1Encoding() |
4049 && m_titleElement->textContent().containsOnlyLatin1()) { | 4040 && m_titleElement->textContent().containsOnlyLatin1()) { |
4050 | 4041 |
4051 CString originalBytes = m_titleElement->textContent().latin1(); | 4042 CString originalBytes = m_titleElement->textContent().latin1(); |
4052 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding); | 4043 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); |
4053 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); | 4044 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); |
4054 m_titleElement->setTextContent(correctlyDecodedTitle); | 4045 m_titleElement->setTextContent(correctlyDecodedTitle); |
4055 } | 4046 } |
4056 | 4047 |
4057 m_encodingData = newData; | 4048 m_encodingData = newData; |
| 4049 |
| 4050 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
| 4051 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
| 4052 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
| 4053 m_visuallyOrdered = shouldUseVisualOrdering; |
| 4054 // FIXME: How is possible to not have a renderer here? |
| 4055 if (renderView()) |
| 4056 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); |
| 4057 setNeedsStyleRecalc(); |
| 4058 } |
4058 } | 4059 } |
4059 | 4060 |
4060 KURL Document::completeURL(const String& url) const | 4061 KURL Document::completeURL(const String& url) const |
4061 { | 4062 { |
4062 return completeURLWithOverride(url, m_baseURL); | 4063 return completeURLWithOverride(url, m_baseURL); |
4063 } | 4064 } |
4064 | 4065 |
4065 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const | 4066 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const |
4066 { | 4067 { |
4067 // Always return a null URL when passed a null string. | 4068 // Always return a null URL when passed a null string. |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5316 } | 5317 } |
5317 if (m_hasAutofocused) | 5318 if (m_hasAutofocused) |
5318 return; | 5319 return; |
5319 m_hasAutofocused = true; | 5320 m_hasAutofocused = true; |
5320 ASSERT(!m_autofocusElement); | 5321 ASSERT(!m_autofocusElement); |
5321 m_autofocusElement = element; | 5322 m_autofocusElement = element; |
5322 m_taskRunner->postTask(AutofocusTask::create()); | 5323 m_taskRunner->postTask(AutofocusTask::create()); |
5323 } | 5324 } |
5324 | 5325 |
5325 } // namespace WebCore | 5326 } // namespace WebCore |
OLD | NEW |