| 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" |
| 113 #include "core/frame/ContentSecurityPolicy.h" | 114 #include "core/frame/ContentSecurityPolicy.h" |
| 114 #include "core/frame/DOMSecurityPolicy.h" | 115 #include "core/frame/DOMSecurityPolicy.h" |
| 115 #include "core/frame/DOMWindow.h" | 116 #include "core/frame/DOMWindow.h" |
| 116 #include "core/frame/Frame.h" | 117 #include "core/frame/Frame.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/animation/AnimationController.h" | 120 #include "core/frame/animation/AnimationController.h" |
| 120 #include "core/html/HTMLAllCollection.h" | 121 #include "core/html/HTMLAllCollection.h" |
| 121 #include "core/html/HTMLAnchorElement.h" | 122 #include "core/html/HTMLAnchorElement.h" |
| 122 #include "core/html/HTMLCanvasElement.h" | 123 #include "core/html/HTMLCanvasElement.h" |
| 123 #include "core/html/HTMLCollection.h" | 124 #include "core/html/HTMLCollection.h" |
| 124 #include "core/html/HTMLDialogElement.h" | 125 #include "core/html/HTMLDialogElement.h" |
| 125 #include "core/html/HTMLDocument.h" | 126 #include "core/html/HTMLDocument.h" |
| 126 #include "core/html/HTMLFrameOwnerElement.h" | 127 #include "core/html/HTMLFrameOwnerElement.h" |
| 127 #include "core/html/HTMLHeadElement.h" | 128 #include "core/html/HTMLHeadElement.h" |
| 128 #include "core/html/HTMLHtmlElement.h" | 129 #include "core/html/HTMLHtmlElement.h" |
| 129 #include "core/html/HTMLIFrameElement.h" | 130 #include "core/html/HTMLIFrameElement.h" |
| 130 #include "core/html/HTMLImport.h" | 131 #include "core/html/HTMLImport.h" |
| 131 #include "core/html/HTMLInputElement.h" | 132 #include "core/html/HTMLInputElement.h" |
| 132 #include "core/html/HTMLLinkElement.h" | 133 #include "core/html/HTMLLinkElement.h" |
| 133 #include "core/html/HTMLNameCollection.h" | 134 #include "core/html/HTMLNameCollection.h" |
| 134 #include "core/html/HTMLScriptElement.h" | 135 #include "core/html/HTMLScriptElement.h" |
| 135 #include "core/html/HTMLStyleElement.h" | 136 #include "core/html/HTMLStyleElement.h" |
| 136 #include "core/html/HTMLTitleElement.h" | 137 #include "core/html/HTMLTitleElement.h" |
| 137 #include "core/html/PluginDocument.h" | 138 #include "core/html/PluginDocument.h" |
| 138 #include "core/html/forms/FormController.h" | 139 #include "core/html/forms/FormController.h" |
| 139 #include "core/html/parser/HTMLDocumentParser.h" | 140 #include "core/html/parser/HTMLDocumentParser.h" |
| 140 #include "core/html/parser/HTMLParserIdioms.h" | 141 #include "core/html/parser/HTMLParserIdioms.h" |
| 141 #include "core/html/parser/NestingLevelIncrementer.h" | 142 #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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 | 1108 |
| 1109 void Document::setCharset(const String& charset) | 1109 void Document::setCharset(const String& charset) |
| 1110 { | 1110 { |
| 1111 if (DocumentLoader* documentLoader = loader()) | 1111 if (DocumentLoader* documentLoader = loader()) |
| 1112 documentLoader->setUserChosenEncoding(charset); | 1112 documentLoader->setUserChosenEncoding(charset); |
| 1113 WTF::TextEncoding encoding(charset); | 1113 WTF::TextEncoding encoding(charset); |
| 1114 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). | 1114 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). |
| 1115 if (!encoding.isValid()) | 1115 if (!encoding.isValid()) |
| 1116 return; | 1116 return; |
| 1117 DocumentEncodingData newEncodingData = m_encodingData; | 1117 DocumentEncodingData newEncodingData = m_encodingData; |
| 1118 newEncodingData.setEncoding(encoding); | 1118 newEncodingData.encoding = encoding; |
| 1119 setEncodingData(newEncodingData); | 1119 setEncodingData(newEncodingData); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 void Document::setContentLanguage(const AtomicString& language) | 1122 void Document::setContentLanguage(const AtomicString& language) |
| 1123 { | 1123 { |
| 1124 if (m_contentLanguage == language) | 1124 if (m_contentLanguage == language) |
| 1125 return; | 1125 return; |
| 1126 m_contentLanguage = language; | 1126 m_contentLanguage = language; |
| 1127 | 1127 |
| 1128 // Document's style depends on the content language. | 1128 // Document's style depends on the content language. |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 // If the document has already been detached, do not make a new axObjectCach
e. | 2095 // If the document has already been detached, do not make a new axObjectCach
e. |
| 2096 if (!topDocument->renderView()) | 2096 if (!topDocument->renderView()) |
| 2097 return 0; | 2097 return 0; |
| 2098 | 2098 |
| 2099 ASSERT(topDocument == this || !m_axObjectCache); | 2099 ASSERT(topDocument == this || !m_axObjectCache); |
| 2100 if (!topDocument->m_axObjectCache) | 2100 if (!topDocument->m_axObjectCache) |
| 2101 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); | 2101 topDocument->m_axObjectCache = adoptPtr(new AXObjectCache(topDocument)); |
| 2102 return topDocument->m_axObjectCache.get(); | 2102 return topDocument->m_axObjectCache.get(); |
| 2103 } | 2103 } |
| 2104 | 2104 |
| 2105 void Document::setVisuallyOrdered() |
| 2106 { |
| 2107 m_visuallyOrdered = true; |
| 2108 // FIXME: How is possible to not have a renderer here? |
| 2109 if (renderView()) |
| 2110 renderView()->style()->setRTLOrdering(VisualOrder); |
| 2111 setNeedsStyleRecalc(); |
| 2112 } |
| 2113 |
| 2105 PassRefPtr<DocumentParser> Document::createParser() | 2114 PassRefPtr<DocumentParser> Document::createParser() |
| 2106 { | 2115 { |
| 2107 if (isHTMLDocument()) { | 2116 if (isHTMLDocument()) { |
| 2108 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
this->page()); | 2117 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors(
this->page()); |
| 2109 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); | 2118 return HTMLDocumentParser::create(toHTMLDocument(this), reportErrors); |
| 2110 } | 2119 } |
| 2111 // FIXME: this should probably pass the frame instead | 2120 // FIXME: this should probably pass the frame instead |
| 2112 return XMLDocumentParser::create(this, view()); | 2121 return XMLDocumentParser::create(this, view()); |
| 2113 } | 2122 } |
| 2114 | 2123 |
| (...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3971 | 3980 |
| 3972 void Document::setEncodingData(const DocumentEncodingData& newData) | 3981 void Document::setEncodingData(const DocumentEncodingData& newData) |
| 3973 { | 3982 { |
| 3974 // It's possible for the encoding of the document to change while we're deco
ding | 3983 // It's possible for the encoding of the document to change while we're deco
ding |
| 3975 // data. That can only occur while we're processing the <head> portion of th
e | 3984 // data. That can only occur while we're processing the <head> portion of th
e |
| 3976 // document. There isn't much user-visible content in the <head>, but there
is | 3985 // document. There isn't much user-visible content in the <head>, but there
is |
| 3977 // the <title> element. This function detects that situation and re-decodes
the | 3986 // the <title> element. This function detects that situation and re-decodes
the |
| 3978 // document's title so that the user doesn't see an incorrectly decoded titl
e | 3987 // document's title so that the user doesn't see an incorrectly decoded titl
e |
| 3979 // in the title bar. | 3988 // in the title bar. |
| 3980 if (m_titleElement | 3989 if (m_titleElement |
| 3981 && encoding() != newData.encoding() | 3990 && encoding() != newData.encoding |
| 3982 && !m_titleElement->firstElementChild() | 3991 && !m_titleElement->firstElementChild() |
| 3983 && encoding() == Latin1Encoding() | 3992 && encoding() == Latin1Encoding() |
| 3984 && m_titleElement->textContent().containsOnlyLatin1()) { | 3993 && m_titleElement->textContent().containsOnlyLatin1()) { |
| 3985 | 3994 |
| 3986 CString originalBytes = m_titleElement->textContent().latin1(); | 3995 CString originalBytes = m_titleElement->textContent().latin1(); |
| 3987 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding()); | 3996 OwnPtr<TextCodec> codec = newTextCodec(newData.encoding); |
| 3988 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); | 3997 String correctlyDecodedTitle = codec->decode(originalBytes.data(), origi
nalBytes.length(), true); |
| 3989 m_titleElement->setTextContent(correctlyDecodedTitle); | 3998 m_titleElement->setTextContent(correctlyDecodedTitle); |
| 3990 } | 3999 } |
| 3991 | 4000 |
| 3992 m_encodingData = newData; | 4001 m_encodingData = newData; |
| 3993 | |
| 3994 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is
sues/detail?id=319643 | |
| 3995 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering(
); | |
| 3996 if (shouldUseVisualOrdering != m_visuallyOrdered) { | |
| 3997 m_visuallyOrdered = shouldUseVisualOrdering; | |
| 3998 // FIXME: How is possible to not have a renderer here? | |
| 3999 if (renderView()) | |
| 4000 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde
r : LogicalOrder); | |
| 4001 setNeedsStyleRecalc(); | |
| 4002 } | |
| 4003 } | 4002 } |
| 4004 | 4003 |
| 4005 KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const | 4004 KURL Document::completeURL(const String& url, const KURL& baseURLOverride) const |
| 4006 { | 4005 { |
| 4007 // Always return a null URL when passed a null string. | 4006 // Always return a null URL when passed a null string. |
| 4008 // FIXME: Should we change the KURL constructor to have this behavior? | 4007 // FIXME: Should we change the KURL constructor to have this behavior? |
| 4009 // See also [CSS]StyleSheet::completeURL(const String&) | 4008 // See also [CSS]StyleSheet::completeURL(const String&) |
| 4010 if (url.isNull()) | 4009 if (url.isNull()) |
| 4011 return KURL(); | 4010 return KURL(); |
| 4012 const KURL* baseURLFromParent = 0; | 4011 const KURL* baseURLFromParent = 0; |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5241 } | 5240 } |
| 5242 | 5241 |
| 5243 FastTextAutosizer* Document::fastTextAutosizer() | 5242 FastTextAutosizer* Document::fastTextAutosizer() |
| 5244 { | 5243 { |
| 5245 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5244 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
| 5246 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5245 m_fastTextAutosizer = FastTextAutosizer::create(this); |
| 5247 return m_fastTextAutosizer.get(); | 5246 return m_fastTextAutosizer.get(); |
| 5248 } | 5247 } |
| 5249 | 5248 |
| 5250 } // namespace WebCore | 5249 } // namespace WebCore |
| OLD | NEW |