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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 #include "core/editing/SpellChecker.h" | 103 #include "core/editing/SpellChecker.h" |
104 #include "core/events/BeforeUnloadEvent.h" | 104 #include "core/events/BeforeUnloadEvent.h" |
105 #include "core/events/Event.h" | 105 #include "core/events/Event.h" |
106 #include "core/events/EventFactory.h" | 106 #include "core/events/EventFactory.h" |
107 #include "core/events/EventListener.h" | 107 #include "core/events/EventListener.h" |
108 #include "core/events/HashChangeEvent.h" | 108 #include "core/events/HashChangeEvent.h" |
109 #include "core/events/PageTransitionEvent.h" | 109 #include "core/events/PageTransitionEvent.h" |
110 #include "core/events/ScopedEventQueue.h" | 110 #include "core/events/ScopedEventQueue.h" |
111 #include "core/events/ThreadLocalEventNames.h" | 111 #include "core/events/ThreadLocalEventNames.h" |
112 #include "core/fetch/ResourceFetcher.h" | 112 #include "core/fetch/ResourceFetcher.h" |
113 #include "core/fetch/TextResourceDecoder.h" | |
114 #include "core/frame/ContentSecurityPolicy.h" | 113 #include "core/frame/ContentSecurityPolicy.h" |
115 #include "core/frame/DOMSecurityPolicy.h" | 114 #include "core/frame/DOMSecurityPolicy.h" |
116 #include "core/frame/DOMWindow.h" | 115 #include "core/frame/DOMWindow.h" |
117 #include "core/frame/Frame.h" | 116 #include "core/frame/Frame.h" |
118 #include "core/frame/FrameView.h" | 117 #include "core/frame/FrameView.h" |
119 #include "core/frame/History.h" | 118 #include "core/frame/History.h" |
120 #include "core/frame/animation/AnimationController.h" | 119 #include "core/frame/animation/AnimationController.h" |
121 #include "core/html/HTMLAllCollection.h" | 120 #include "core/html/HTMLAllCollection.h" |
122 #include "core/html/HTMLAnchorElement.h" | 121 #include "core/html/HTMLAnchorElement.h" |
123 #include "core/html/HTMLCanvasElement.h" | 122 #include "core/html/HTMLCanvasElement.h" |
124 #include "core/html/HTMLCollection.h" | 123 #include "core/html/HTMLCollection.h" |
125 #include "core/html/HTMLDialogElement.h" | 124 #include "core/html/HTMLDialogElement.h" |
126 #include "core/html/HTMLDocument.h" | 125 #include "core/html/HTMLDocument.h" |
127 #include "core/html/HTMLFrameOwnerElement.h" | 126 #include "core/html/HTMLFrameOwnerElement.h" |
128 #include "core/html/HTMLHeadElement.h" | 127 #include "core/html/HTMLHeadElement.h" |
129 #include "core/html/HTMLHtmlElement.h" | 128 #include "core/html/HTMLHtmlElement.h" |
130 #include "core/html/HTMLIFrameElement.h" | 129 #include "core/html/HTMLIFrameElement.h" |
131 #include "core/html/HTMLImport.h" | 130 #include "core/html/HTMLImport.h" |
132 #include "core/html/HTMLInputElement.h" | 131 #include "core/html/HTMLInputElement.h" |
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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1106 |
1107 void Document::setCharset(const String& charset) | 1107 void Document::setCharset(const String& charset) |
1108 { | 1108 { |
1109 if (DocumentLoader* documentLoader = loader()) | 1109 if (DocumentLoader* documentLoader = loader()) |
1110 documentLoader->setUserChosenEncoding(charset); | 1110 documentLoader->setUserChosenEncoding(charset); |
1111 WTF::TextEncoding encoding(charset); | 1111 WTF::TextEncoding encoding(charset); |
1112 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). | 1112 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). |
1113 if (!encoding.isValid()) | 1113 if (!encoding.isValid()) |
1114 return; | 1114 return; |
1115 DocumentEncodingData newEncodingData = m_encodingData; | 1115 DocumentEncodingData newEncodingData = m_encodingData; |
1116 newEncodingData.encoding = encoding; | 1116 newEncodingData.setEncoding(encoding); |
1117 setEncodingData(newEncodingData); | 1117 setEncodingData(newEncodingData); |
1118 } | 1118 } |
1119 | 1119 |
1120 void Document::setContentLanguage(const AtomicString& language) | 1120 void Document::setContentLanguage(const AtomicString& language) |
1121 { | 1121 { |
1122 if (m_contentLanguage == language) | 1122 if (m_contentLanguage == language) |
1123 return; | 1123 return; |
1124 m_contentLanguage = language; | 1124 m_contentLanguage = language; |
1125 | 1125 |
1126 // Document's style depends on the content language. | 1126 // Document's style depends on the content language. |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 // If the document has already been detached, do not make a new axObjectCach
e. | 2089 // If the document has already been detached, do not make a new axObjectCach
e. |
2090 if (!topDocument->renderView()) | 2090 if (!topDocument->renderView()) |
2091 return 0; | 2091 return 0; |
2092 | 2092 |
2093 ASSERT(topDocument == this || !m_axObjectCache); | 2093 ASSERT(topDocument == this || !m_axObjectCache); |
2094 if (!topDocument->m_axObjectCache) | 2094 if (!topDocument->m_axObjectCache) |
2095 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); | 2095 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
2096 return topDocument->m_axObjectCache.get(); | 2096 return topDocument->m_axObjectCache.get(); |
2097 } | 2097 } |
2098 | 2098 |
2099 void Document::setVisuallyOrdered() | |
2100 { | |
2101 m_visuallyOrdered = true; | |
2102 // FIXME: How is possible to not have a renderer here? | |
2103 if (renderView()) | |
2104 renderView()->style()->setRTLOrdering(VisualOrder); | |
2105 setNeedsStyleRecalc(); | |
2106 } | |
2107 | |
2108 PassRefPtr<DocumentParser> Document::createParser() | 2099 PassRefPtr<DocumentParser> Document::createParser() |
2109 { | 2100 { |
2110 if (isHTMLDocument()) { | 2101 if (isHTMLDocument()) { |
2111 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
this->page()); | 2102 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
this->page()); |
2112 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); | 2103 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); |
2113 } | 2104 } |
2114 // FIXME: this should probably pass the frame instead | 2105 // FIXME: this should probably pass the frame instead |
2115 return XMLDocumentParser::create(this, view()); | 2106 return XMLDocumentParser::create(this, view()); |
2116 } | 2107 } |
2117 | 2108 |
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3966 | 3957 |
3967 void Document::setEncodingData(const DocumentEncodingData& newData) | 3958 void Document::setEncodingData(const DocumentEncodingData& newData) |
3968 { | 3959 { |
3969 // It's possible for the encoding of the document to change while we're deco
ding | 3960 // It's possible for the encoding of the document to change while we're deco
ding |
3970 // data. That can only occur while we're processing the <head> portion of th
e | 3961 // data. That can only occur while we're processing the <head> portion of th
e |
3971 // document. There isn't much user-visible content in the <head>, but there
is | 3962 // document. There isn't much user-visible content in the <head>, but there
is |
3972 // the <title> element. This function detects that situation and re-decodes
the | 3963 // the <title> element. This function detects that situation and re-decodes
the |
3973 // document's title so that the user doesn't see an incorrectly decoded titl
e | 3964 // document's title so that the user doesn't see an incorrectly decoded titl
e |
3974 // in the title bar. | 3965 // in the title bar. |
3975 if (m_titleElement | 3966 if (m_titleElement |
3976 && encoding() != newData.encoding | 3967 && encoding() != newData.encoding() |
3977 && !m_titleElement->firstElementChild() | 3968 && !m_titleElement->firstElementChild() |
3978 && encoding() == Latin1Encoding() | 3969 && encoding() == Latin1Encoding() |
3979 && m_titleElement->textContent().containsOnlyLatin1()) { | 3970 && m_titleElement->textContent().containsOnlyLatin1()) { |
3980 | 3971 |
3981 CString originalBytes = m_titleElement->textContent().latin1(); | 3972 CString originalBytes = m_titleElement->textContent().latin1(); |
3982 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding); | 3973 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); |
3983 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); | 3974 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); |
3984 m_titleElement->setTextContent(correctlyDecodedTitle); | 3975 m_titleElement->setTextContent(correctlyDecodedTitle); |
3985 } | 3976 } |
3986 | 3977 |
3987 m_encodingData = newData; | 3978 m_encodingData = newData; |
| 3979 |
| 3980 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 |
| 3981 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); |
| 3982 if (shouldUseVisualOrdering != m_visuallyOrdered) { |
| 3983 m_visuallyOrdered = shouldUseVisualOrdering; |
| 3984 // FIXME: How is possible to not have a renderer here? |
| 3985 if (renderView()) |
| 3986 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); |
| 3987 setNeedsStyleRecalc(); |
| 3988 } |
3988 } | 3989 } |
3989 | 3990 |
3990 KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const | 3991 KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const |
3991 { | 3992 { |
3992 // Always return a null URL when passed a null string. | 3993 // Always return a null URL when passed a null string. |
3993 // FIXME: Should we change the KURL constructor to have this behavior? | 3994 // FIXME: Should we change the KURL constructor to have this behavior? |
3994 // See also [CSS]StyleSheet::completeURL(const String&) | 3995 // See also [CSS]StyleSheet::completeURL(const String&) |
3995 if (url.isNull()) | 3996 if (url.isNull()) |
3996 return KURL(); | 3997 return KURL(); |
3997 const KURL* baseURLFromParent = 0; | 3998 const KURL* baseURLFromParent = 0; |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5226 } | 5227 } |
5227 | 5228 |
5228 FastTextAutosizer* Document::fastTextAutosizer() | 5229 FastTextAutosizer* Document::fastTextAutosizer() |
5229 { | 5230 { |
5230 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5231 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5231 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5232 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5232 return m_fastTextAutosizer.get(); | 5233 return m_fastTextAutosizer.get(); |
5233 } | 5234 } |
5234 | 5235 |
5235 } // namespace WebCore | 5236 } // namespace WebCore |
OLD | NEW |