| 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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 documentLoader->setUserChosenEncoding(charset); | 1111 documentLoader->setUserChosenEncoding(charset); |
| 1112 WTF::TextEncoding encoding(charset); | 1112 WTF::TextEncoding encoding(charset); |
| 1113 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). | 1113 // In case the encoding didn't exist, we keep the old one (helps some sites
specifying invalid encodings). |
| 1114 if (!encoding.isValid()) | 1114 if (!encoding.isValid()) |
| 1115 return; | 1115 return; |
| 1116 DocumentEncodingData newEncodingData = m_encodingData; | 1116 DocumentEncodingData newEncodingData = m_encodingData; |
| 1117 newEncodingData.encoding = encoding; | 1117 newEncodingData.encoding = encoding; |
| 1118 setEncodingData(newEncodingData); | 1118 setEncodingData(newEncodingData); |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 void Document::setContentLanguage(const String& language) | 1121 void Document::setContentLanguage(const AtomicString& language) |
| 1122 { | 1122 { |
| 1123 if (m_contentLanguage == language) | 1123 if (m_contentLanguage == language) |
| 1124 return; | 1124 return; |
| 1125 m_contentLanguage = language; | 1125 m_contentLanguage = language; |
| 1126 | 1126 |
| 1127 // Document's style depends on the content language. | 1127 // Document's style depends on the content language. |
| 1128 setNeedsStyleRecalc(); | 1128 setNeedsStyleRecalc(); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta
te) | 1131 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta
te) |
| (...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 } | 2797 } |
| 2798 | 2798 |
| 2799 | 2799 |
| 2800 CSSStyleSheet* Document::elementSheet() | 2800 CSSStyleSheet* Document::elementSheet() |
| 2801 { | 2801 { |
| 2802 if (!m_elemSheet) | 2802 if (!m_elemSheet) |
| 2803 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); | 2803 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); |
| 2804 return m_elemSheet.get(); | 2804 return m_elemSheet.get(); |
| 2805 } | 2805 } |
| 2806 | 2806 |
| 2807 void Document::processHttpEquiv(const String& equiv, const String& content) | 2807 void Document::processHttpEquiv(const AtomicString& equiv, const AtomicString& c
ontent) |
| 2808 { | 2808 { |
| 2809 ASSERT(!equiv.isNull() && !content.isNull()); | 2809 ASSERT(!equiv.isNull() && !content.isNull()); |
| 2810 | 2810 |
| 2811 if (equalIgnoringCase(equiv, "default-style")) | 2811 if (equalIgnoringCase(equiv, "default-style")) |
| 2812 processHttpEquivDefaultStyle(content); | 2812 processHttpEquivDefaultStyle(content); |
| 2813 else if (equalIgnoringCase(equiv, "refresh")) | 2813 else if (equalIgnoringCase(equiv, "refresh")) |
| 2814 processHttpEquivRefresh(content); | 2814 processHttpEquivRefresh(content); |
| 2815 else if (equalIgnoringCase(equiv, "set-cookie")) | 2815 else if (equalIgnoringCase(equiv, "set-cookie")) |
| 2816 processHttpEquivSetCookie(content); | 2816 processHttpEquivSetCookie(content); |
| 2817 else if (equalIgnoringCase(equiv, "content-language")) | 2817 else if (equalIgnoringCase(equiv, "content-language")) |
| 2818 setContentLanguage(content); | 2818 setContentLanguage(content); |
| 2819 else if (equalIgnoringCase(equiv, "x-dns-prefetch-control")) | 2819 else if (equalIgnoringCase(equiv, "x-dns-prefetch-control")) |
| 2820 parseDNSPrefetchControlHeader(content); | 2820 parseDNSPrefetchControlHeader(content); |
| 2821 else if (equalIgnoringCase(equiv, "x-frame-options")) | 2821 else if (equalIgnoringCase(equiv, "x-frame-options")) |
| 2822 processHttpEquivXFrameOptions(content); | 2822 processHttpEquivXFrameOptions(content); |
| 2823 else if (equalIgnoringCase(equiv, "content-security-policy") | 2823 else if (equalIgnoringCase(equiv, "content-security-policy") |
| 2824 || equalIgnoringCase(equiv, "content-security-policy-report-only") | 2824 || equalIgnoringCase(equiv, "content-security-policy-report-only") |
| 2825 || equalIgnoringCase(equiv, "x-webkit-csp") | 2825 || equalIgnoringCase(equiv, "x-webkit-csp") |
| 2826 || equalIgnoringCase(equiv, "x-webkit-csp-report-only")) | 2826 || equalIgnoringCase(equiv, "x-webkit-csp-report-only")) |
| 2827 processHttpEquivContentSecurityPolicy(equiv, content); | 2827 processHttpEquivContentSecurityPolicy(equiv, content); |
| 2828 } | 2828 } |
| 2829 | 2829 |
| 2830 void Document::processHttpEquivContentSecurityPolicy(const String& equiv, const
String& content) | 2830 void Document::processHttpEquivContentSecurityPolicy(const AtomicString& equiv,
const AtomicString& content) |
| 2831 { | 2831 { |
| 2832 if (equalIgnoringCase(equiv, "content-security-policy")) | 2832 if (equalIgnoringCase(equiv, "content-security-policy")) |
| 2833 contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy
::Enforce); | 2833 contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy
::Enforce); |
| 2834 else if (equalIgnoringCase(equiv, "content-security-policy-report-only")) | 2834 else if (equalIgnoringCase(equiv, "content-security-policy-report-only")) |
| 2835 contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy
::Report); | 2835 contentSecurityPolicy()->didReceiveHeader(content, ContentSecurityPolicy
::Report); |
| 2836 // FIXME: Remove deprecation messages after the next release branch. | 2836 // FIXME: Remove deprecation messages after the next release branch. |
| 2837 else if (equalIgnoringCase(equiv, "x-webkit-csp")) | 2837 else if (equalIgnoringCase(equiv, "x-webkit-csp")) |
| 2838 UseCounter::countDeprecation(this, UseCounter::PrefixedContentSecurityPo
licy); | 2838 UseCounter::countDeprecation(this, UseCounter::PrefixedContentSecurityPo
licy); |
| 2839 else if (equalIgnoringCase(equiv, "x-webkit-csp-report-only")) | 2839 else if (equalIgnoringCase(equiv, "x-webkit-csp-report-only")) |
| 2840 UseCounter::countDeprecation(this, UseCounter::PrefixedContentSecurityPo
licyReportOnly); | 2840 UseCounter::countDeprecation(this, UseCounter::PrefixedContentSecurityPo
licyReportOnly); |
| 2841 else | 2841 else |
| 2842 ASSERT_NOT_REACHED(); | 2842 ASSERT_NOT_REACHED(); |
| 2843 } | 2843 } |
| 2844 | 2844 |
| 2845 void Document::processHttpEquivDefaultStyle(const String& content) | 2845 void Document::processHttpEquivDefaultStyle(const AtomicString& content) |
| 2846 { | 2846 { |
| 2847 // The preferred style set has been overridden as per section | 2847 // The preferred style set has been overridden as per section |
| 2848 // 14.3.2 of the HTML4.0 specification. We need to update the | 2848 // 14.3.2 of the HTML4.0 specification. We need to update the |
| 2849 // sheet used variable and then update our style selector. | 2849 // sheet used variable and then update our style selector. |
| 2850 // For more info, see the test at: | 2850 // For more info, see the test at: |
| 2851 // http://www.hixie.ch/tests/evil/css/import/main/preferred.html | 2851 // http://www.hixie.ch/tests/evil/css/import/main/preferred.html |
| 2852 // -dwh | 2852 // -dwh |
| 2853 m_styleEngine->setSelectedStylesheetSetName(content); | 2853 m_styleEngine->setSelectedStylesheetSetName(content); |
| 2854 m_styleEngine->setPreferredStylesheetSetName(content); | 2854 m_styleEngine->setPreferredStylesheetSetName(content); |
| 2855 styleResolverChanged(RecalcStyleDeferred); | 2855 styleResolverChanged(RecalcStyleDeferred); |
| 2856 } | 2856 } |
| 2857 | 2857 |
| 2858 void Document::processHttpEquivRefresh(const String& content) | 2858 void Document::processHttpEquivRefresh(const AtomicString& content) |
| 2859 { | 2859 { |
| 2860 maybeHandleHttpRefresh(content, HttpRefreshFromMetaTag); | 2860 maybeHandleHttpRefresh(content, HttpRefreshFromMetaTag); |
| 2861 } | 2861 } |
| 2862 | 2862 |
| 2863 void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType htt
pRefreshType) | 2863 void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType htt
pRefreshType) |
| 2864 { | 2864 { |
| 2865 if (m_isViewSource || !m_frame) | 2865 if (m_isViewSource || !m_frame) |
| 2866 return; | 2866 return; |
| 2867 | 2867 |
| 2868 double delay; | 2868 double delay; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2881 } | 2881 } |
| 2882 | 2882 |
| 2883 if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomati
cFeatures)) { | 2883 if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomati
cFeatures)) { |
| 2884 String message = "Refused to execute the redirect specified via '<meta h
ttp-equiv='refresh' content='...'>'. The document is sandboxed, and the 'allow-s
cripts' keyword is not set."; | 2884 String message = "Refused to execute the redirect specified via '<meta h
ttp-equiv='refresh' content='...'>'. The document is sandboxed, and the 'allow-s
cripts' keyword is not set."; |
| 2885 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message); | 2885 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message); |
| 2886 return; | 2886 return; |
| 2887 } | 2887 } |
| 2888 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); | 2888 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); |
| 2889 } | 2889 } |
| 2890 | 2890 |
| 2891 void Document::processHttpEquivSetCookie(const String& content) | 2891 void Document::processHttpEquivSetCookie(const AtomicString& content) |
| 2892 { | 2892 { |
| 2893 // FIXME: make setCookie work on XML documents too; e.g. in case of <html:me
ta .....> | 2893 // FIXME: make setCookie work on XML documents too; e.g. in case of <html:me
ta .....> |
| 2894 if (!isHTMLDocument()) | 2894 if (!isHTMLDocument()) |
| 2895 return; | 2895 return; |
| 2896 | 2896 |
| 2897 // Exception (for sandboxed documents) ignored. | 2897 // Exception (for sandboxed documents) ignored. |
| 2898 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); | 2898 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); |
| 2899 } | 2899 } |
| 2900 | 2900 |
| 2901 void Document::processHttpEquivXFrameOptions(const String& content) | 2901 void Document::processHttpEquivXFrameOptions(const AtomicString& content) |
| 2902 { | 2902 { |
| 2903 Frame* frame = this->frame(); | 2903 Frame* frame = this->frame(); |
| 2904 if (!frame) | 2904 if (!frame) |
| 2905 return; | 2905 return; |
| 2906 | 2906 |
| 2907 FrameLoader& frameLoader = frame->loader(); | 2907 FrameLoader& frameLoader = frame->loader(); |
| 2908 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); | 2908 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); |
| 2909 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI
dentifier)) { | 2909 if (frameLoader.shouldInterruptLoadForXFrameOptions(content, url(), requestI
dentifier)) { |
| 2910 String message = "Refused to display '" + url().elidedString() + "' in a
frame because it set 'X-Frame-Options' to '" + content + "'."; | 2910 String message = "Refused to display '" + url().elidedString() + "' in a
frame because it set 'X-Frame-Options' to '" + content + "'."; |
| 2911 frameLoader.stopAllLoaders(); | 2911 frameLoader.stopAllLoaders(); |
| (...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5216 } | 5216 } |
| 5217 | 5217 |
| 5218 FastTextAutosizer* Document::fastTextAutosizer() | 5218 FastTextAutosizer* Document::fastTextAutosizer() |
| 5219 { | 5219 { |
| 5220 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) | 5220 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable
d()) |
| 5221 m_fastTextAutosizer = FastTextAutosizer::create(this); | 5221 m_fastTextAutosizer = FastTextAutosizer::create(this); |
| 5222 return m_fastTextAutosizer.get(); | 5222 return m_fastTextAutosizer.get(); |
| 5223 } | 5223 } |
| 5224 | 5224 |
| 5225 } // namespace WebCore | 5225 } // namespace WebCore |
| OLD | NEW |