| 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 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 } | 3143 } |
| 3144 | 3144 |
| 3145 if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomati
cFeatures)) { | 3145 if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomati
cFeatures)) { |
| 3146 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."; | 3146 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."; |
| 3147 addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMes
sageLevel, message)); | 3147 addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMes
sageLevel, message)); |
| 3148 return; | 3148 return; |
| 3149 } | 3149 } |
| 3150 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); | 3150 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL); |
| 3151 } | 3151 } |
| 3152 | 3152 |
| 3153 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin
) | 3153 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin
) const |
| 3154 { | 3154 { |
| 3155 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy
ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type ==
origin; | 3155 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy
ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type ==
origin; |
| 3156 } | 3156 } |
| 3157 | 3157 |
| 3158 void Document::setViewportDescription(const ViewportDescription& viewportDescrip
tion) | 3158 void Document::setViewportDescription(const ViewportDescription& viewportDescrip
tion) |
| 3159 { | 3159 { |
| 3160 if (viewportDescription == m_viewportDescription) | |
| 3161 return; | |
| 3162 | |
| 3163 if (settings() && !settings()->viewportMetaEnabled() && viewportDescription.
isLegacyViewportType()) | |
| 3164 return; | |
| 3165 | |
| 3166 // The UA-defined min-width is used by the processing of legacy meta tags. | |
| 3167 if (!viewportDescription.isSpecifiedByAuthor()) | |
| 3168 m_viewportDefaultMinWidth = viewportDescription.minWidth; | |
| 3169 | |
| 3170 if (viewportDescription.isLegacyViewportType()) { | 3160 if (viewportDescription.isLegacyViewportType()) { |
| 3161 if (viewportDescription == m_legacyViewportDescription) |
| 3162 return; |
| 3171 m_legacyViewportDescription = viewportDescription; | 3163 m_legacyViewportDescription = viewportDescription; |
| 3172 | 3164 } else { |
| 3173 // When no author style for @viewport is present, and a meta tag for def
ining | 3165 if (viewportDescription == m_viewportDescription) |
| 3174 // the viewport is, apply the meta tag viewport instead of the UA styles
. | |
| 3175 if (m_viewportDescription.type == ViewportDescription::AuthorStyleSheet) | |
| 3176 return; | 3166 return; |
| 3177 m_viewportDescription = viewportDescription; | 3167 m_viewportDescription = viewportDescription; |
| 3178 } else { | 3168 |
| 3179 // If the legacy viewport tag has higher priority than the cascaded @vie
wport | 3169 // The UA-defined min-width is considered specifically by Android WebVie
w quirks mode. |
| 3180 // descriptors, use the values from the legacy tag. | 3170 if (!viewportDescription.isSpecifiedByAuthor()) |
| 3181 if (!shouldOverrideLegacyDescription(viewportDescription.type)) | 3171 m_viewportDefaultMinWidth = viewportDescription.minWidth; |
| 3182 m_viewportDescription = m_legacyViewportDescription; | |
| 3183 else | |
| 3184 m_viewportDescription = viewportDescription; | |
| 3185 } | 3172 } |
| 3186 | 3173 |
| 3187 updateViewportDescription(); | 3174 updateViewportDescription(); |
| 3188 } | 3175 } |
| 3189 | 3176 |
| 3177 ViewportDescription Document::viewportDescription() const |
| 3178 { |
| 3179 ViewportDescription appliedViewportDescription = m_viewportDescription; |
| 3180 bool viewportMetaEnabled = settings() && settings()->viewportMetaEnabled(); |
| 3181 if (m_legacyViewportDescription.type != ViewportDescription::UserAgentStyleS
heet && viewportMetaEnabled) |
| 3182 appliedViewportDescription = m_legacyViewportDescription; |
| 3183 if (shouldOverrideLegacyDescription(m_viewportDescription.type)) |
| 3184 appliedViewportDescription = m_viewportDescription; |
| 3185 |
| 3186 return appliedViewportDescription; |
| 3187 } |
| 3188 |
| 3190 void Document::updateViewportDescription() | 3189 void Document::updateViewportDescription() |
| 3191 { | 3190 { |
| 3192 if (frame() && frame()->isMainFrame()) { | 3191 if (frame() && frame()->isMainFrame()) { |
| 3193 frameHost()->chromeClient().dispatchViewportPropertiesDidChange(m_viewpo
rtDescription); | 3192 frameHost()->chromeClient().dispatchViewportPropertiesDidChange(viewport
Description()); |
| 3194 } | 3193 } |
| 3195 } | 3194 } |
| 3196 | 3195 |
| 3197 void Document::processReferrerPolicy(const String& policy) | 3196 void Document::processReferrerPolicy(const String& policy) |
| 3198 { | 3197 { |
| 3199 ReferrerPolicy referrerPolicy; | 3198 ReferrerPolicy referrerPolicy; |
| 3200 if (!SecurityPolicy::referrerPolicyFromString(policy, &referrerPolicy)) { | 3199 if (!SecurityPolicy::referrerPolicyFromString(policy, &referrerPolicy)) { |
| 3201 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe
ssageLevel, "Failed to set referrer policy: The value '" + policy + "' is not on
e of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade',
'origin', 'origin-when-crossorigin', or 'unsafe-url'. This document's referrer p
olicy has been left unchanged.")); | 3200 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe
ssageLevel, "Failed to set referrer policy: The value '" + policy + "' is not on
e of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade',
'origin', 'origin-when-crossorigin', or 'unsafe-url'. This document's referrer p
olicy has been left unchanged.")); |
| 3202 return; | 3201 return; |
| 3203 } | 3202 } |
| (...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6028 #ifndef NDEBUG | 6027 #ifndef NDEBUG |
| 6029 using namespace blink; | 6028 using namespace blink; |
| 6030 void showLiveDocumentInstances() | 6029 void showLiveDocumentInstances() |
| 6031 { | 6030 { |
| 6032 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6031 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 6033 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6032 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6034 for (Document* document : set) | 6033 for (Document* document : set) |
| 6035 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6034 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 6036 } | 6035 } |
| 6037 #endif | 6036 #endif |
| OLD | NEW |