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" |
112 #include "core/frame/ContentSecurityPolicy.h" | 113 #include "core/frame/ContentSecurityPolicy.h" |
113 #include "core/frame/DOMSecurityPolicy.h" | 114 #include "core/frame/DOMSecurityPolicy.h" |
114 #include "core/frame/DOMWindow.h" | 115 #include "core/frame/DOMWindow.h" |
115 #include "core/frame/Frame.h" | 116 #include "core/frame/Frame.h" |
116 #include "core/frame/FrameHost.h" | 117 #include "core/frame/FrameHost.h" |
117 #include "core/frame/FrameView.h" | 118 #include "core/frame/FrameView.h" |
118 #include "core/frame/History.h" | 119 #include "core/frame/History.h" |
119 #include "core/frame/PageConsole.h" | 120 #include "core/frame/PageConsole.h" |
120 #include "core/frame/Settings.h" | 121 #include "core/frame/Settings.h" |
121 #include "core/frame/animation/AnimationController.h" | 122 #include "core/frame/animation/AnimationController.h" |
(...skipping 11 matching lines...) Expand all Loading... |
133 #include "core/html/HTMLLinkElement.h" | 134 #include "core/html/HTMLLinkElement.h" |
134 #include "core/html/HTMLNameCollection.h" | 135 #include "core/html/HTMLNameCollection.h" |
135 #include "core/html/HTMLScriptElement.h" | 136 #include "core/html/HTMLScriptElement.h" |
136 #include "core/html/HTMLStyleElement.h" | 137 #include "core/html/HTMLStyleElement.h" |
137 #include "core/html/HTMLTitleElement.h" | 138 #include "core/html/HTMLTitleElement.h" |
138 #include "core/html/PluginDocument.h" | 139 #include "core/html/PluginDocument.h" |
139 #include "core/html/forms/FormController.h" | 140 #include "core/html/forms/FormController.h" |
140 #include "core/html/parser/HTMLDocumentParser.h" | 141 #include "core/html/parser/HTMLDocumentParser.h" |
141 #include "core/html/parser/HTMLParserIdioms.h" | 142 #include "core/html/parser/HTMLParserIdioms.h" |
142 #include "core/html/parser/NestingLevelIncrementer.h" | 143 #include "core/html/parser/NestingLevelIncrementer.h" |
143 #include "core/html/parser/TextResourceDecoder.h" | |
144 #include "core/inspector/InspectorCounters.h" | 144 #include "core/inspector/InspectorCounters.h" |
145 #include "core/inspector/InspectorInstrumentation.h" | 145 #include "core/inspector/InspectorInstrumentation.h" |
146 #include "core/inspector/ScriptCallStack.h" | 146 #include "core/inspector/ScriptCallStack.h" |
147 #include "core/loader/CookieJar.h" | 147 #include "core/loader/CookieJar.h" |
148 #include "core/loader/DocumentLoader.h" | 148 #include "core/loader/DocumentLoader.h" |
149 #include "core/loader/FrameLoader.h" | 149 #include "core/loader/FrameLoader.h" |
150 #include "core/loader/FrameLoaderClient.h" | 150 #include "core/loader/FrameLoaderClient.h" |
151 #include "core/loader/ImageLoader.h" | 151 #include "core/loader/ImageLoader.h" |
152 #include "core/loader/appcache/ApplicationCacheHost.h" | 152 #include "core/loader/appcache/ApplicationCacheHost.h" |
153 #include "core/page/Chrome.h" | 153 #include "core/page/Chrome.h" |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1098 |
1099 void Document::setCharset(const String& charset) | 1099 void Document::setCharset(const String& charset) |
1100 { | 1100 { |
1101 if (DocumentLoader* documentLoader = loader()) | 1101 if (DocumentLoader* documentLoader = loader()) |
1102 documentLoader->setUserChosenEncoding(charset); | 1102 documentLoader->setUserChosenEncoding(charset); |
1103 WTF::TextEncoding encoding(charset); | 1103 WTF::TextEncoding encoding(charset); |
1104 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). | 1104 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). |
1105 if (!encoding.isValid()) | 1105 if (!encoding.isValid()) |
1106 return; | 1106 return; |
1107 DocumentEncodingData newEncodingData = m_encodingData; | 1107 DocumentEncodingData newEncodingData = m_encodingData; |
1108 newEncodingData.setEncoding(encoding); | 1108 newEncodingData.encoding = encoding; |
1109 setEncodingData(newEncodingData); | 1109 setEncodingData(newEncodingData); |
1110 } | 1110 } |
1111 | 1111 |
1112 void Document::setContentLanguage(const AtomicString& language) | 1112 void Document::setContentLanguage(const AtomicString& language) |
1113 { | 1113 { |
1114 if (m_contentLanguage == language) | 1114 if (m_contentLanguage == language) |
1115 return; | 1115 return; |
1116 m_contentLanguage = language; | 1116 m_contentLanguage = language; |
1117 | 1117 |
1118 // Document's style depends on the content language. | 1118 // Document's style depends on the content language. |
(...skipping 970 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 |
2099 PassRefPtr<DocumentParser> Document::createParser() | 2108 PassRefPtr<DocumentParser> Document::createParser() |
2100 { | 2109 { |
2101 if (isHTMLDocument()) { | 2110 if (isHTMLDocument()) { |
2102 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
page()); | 2111 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
page()); |
2103 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); | 2112 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); |
2104 } | 2113 } |
2105 // FIXME: this should probably pass the frame instead | 2114 // FIXME: this should probably pass the frame instead |
2106 return XMLDocumentParser::create(this, view()); | 2115 return XMLDocumentParser::create(this, view()); |
2107 } | 2116 } |
2108 | 2117 |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3977 | 3986 |
3978 void Document::setEncodingData(const DocumentEncodingData& newData) | 3987 void Document::setEncodingData(const DocumentEncodingData& newData) |
3979 { | 3988 { |
3980 // It's possible for the encoding of the document to change while we're deco
ding | 3989 // It's possible for the encoding of the document to change while we're deco
ding |
3981 // data. That can only occur while we're processing the <head> portion of th
e | 3990 // data. That can only occur while we're processing the <head> portion of th
e |
3982 // document. There isn't much user-visible content in the <head>, but there
is | 3991 // document. There isn't much user-visible content in the <head>, but there
is |
3983 // the <title> element. This function detects that situation and re-decodes
the | 3992 // the <title> element. This function detects that situation and re-decodes
the |
3984 // document's title so that the user doesn't see an incorrectly decoded titl
e | 3993 // document's title so that the user doesn't see an incorrectly decoded titl
e |
3985 // in the title bar. | 3994 // in the title bar. |
3986 if (m_titleElement | 3995 if (m_titleElement |
3987 && encoding() != newData.encoding() | 3996 && encoding() != newData.encoding |
3988 && !m_titleElement->firstElementChild() | 3997 && !m_titleElement->firstElementChild() |
3989 && encoding() == Latin1Encoding() | 3998 && encoding() == Latin1Encoding() |
3990 && m_titleElement->textContent().containsOnlyLatin1()) { | 3999 && m_titleElement->textContent().containsOnlyLatin1()) { |
3991 | 4000 |
3992 CString originalBytes = m_titleElement->textContent().latin1(); | 4001 CString originalBytes = m_titleElement->textContent().latin1(); |
3993 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); | 4002 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding); |
3994 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); | 4003 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); |
3995 m_titleElement->setTextContent(correctlyDecodedTitle); | 4004 m_titleElement->setTextContent(correctlyDecodedTitle); |
3996 } | 4005 } |
3997 | 4006 |
3998 m_encodingData = newData; | 4007 m_encodingData = newData; |
3999 | |
4000 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 | |
4001 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); | |
4002 if (shouldUseVisualOrdering != m_visuallyOrdered) { | |
4003 m_visuallyOrdered = shouldUseVisualOrdering; | |
4004 // FIXME: How is possible to not have a renderer here? | |
4005 if (renderView()) | |
4006 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); | |
4007 setNeedsStyleRecalc(); | |
4008 } | |
4009 } | 4008 } |
4010 | 4009 |
4011 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const | 4010 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve
rride) const |
4012 { | 4011 { |
4013 // Always return a null URL when passed a null string. | 4012 // Always return a null URL when passed a null string. |
4014 // FIXME: Should we change the KURL constructor to have this behavior? | 4013 // FIXME: Should we change the KURL constructor to have this behavior? |
4015 // See also [CSS]StyleSheet::completeURL(const String&) | 4014 // See also [CSS]StyleSheet::completeURL(const String&) |
4016 if (url.isNull()) | 4015 if (url.isNull()) |
4017 return KURL(); | 4016 return KURL(); |
4018 // This logic is deliberately spread over many statements in an attempt to t
rack down http://crbug.com/312410. | 4017 // This logic is deliberately spread over many statements in an attempt to t
rack down http://crbug.com/312410. |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5248 } | 5247 } |
5249 | 5248 |
5250 FastTextAutosizer* Document::fastTextAutosizer() | 5249 FastTextAutosizer* Document::fastTextAutosizer() |
5251 { | 5250 { |
5252 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5251 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
5253 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5252 m_fastTextAutosizer = FastTextAutosizer::create(this); |
5254 return m_fastTextAutosizer.get(); | 5253 return m_fastTextAutosizer.get(); |
5255 } | 5254 } |
5256 | 5255 |
5257 } // namespace WebCore | 5256 } // namespace WebCore |
OLD | NEW |