| 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, 2010, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // is an iframe element with an |allowattribute| attribute specified, and | 73 // is an iframe element with an |allowattribute| attribute specified, and |
| 74 // whose node document is allowed to use the feature indicated by | 74 // whose node document is allowed to use the feature indicated by |
| 75 // |allowattribute|, then return true. | 75 // |allowattribute|, then return true. |
| 76 if (frame->owner() && frame->owner()->allowFullscreen()) | 76 if (frame->owner() && frame->owner()->allowFullscreen()) |
| 77 return allowedToUseFullscreen(frame->tree().parent()); | 77 return allowedToUseFullscreen(frame->tree().parent()); |
| 78 | 78 |
| 79 // 4. Return false. | 79 // 4. Return false. |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // If Feature Policy is enabled, then we need this hack to support it, until | 83 // 2. If Feature Policy is enabled, return the policy for "fullscreen" |
| 84 // we have proper support for <iframe allowfullscreen> in FP: | 84 // feature. |
| 85 | 85 return frame->isFeatureEnabled(WebFeaturePolicyFeature::Fullscreen); |
| 86 // 1. If FP, by itself, enables fullscreen in this document, then fullscreen | |
| 87 // is allowed. | |
| 88 if (frame->isFeatureEnabled(WebFeaturePolicyFeature::Fullscreen)) { | |
| 89 return true; | |
| 90 } | |
| 91 | |
| 92 // 2. Otherwise, if the embedding frame's document is allowed to use | |
| 93 // fullscreen (either through FP or otherwise), and either: | |
| 94 // a) this is a same-origin embedded document, or | |
| 95 // b) this document's iframe has the allowfullscreen attribute set, | |
| 96 // then fullscreen is allowed. | |
| 97 if (!frame->isMainFrame()) { | |
| 98 if (allowedToUseFullscreen(frame->tree().parent())) { | |
| 99 return (frame->owner() && frame->owner()->allowFullscreen()) || | |
| 100 frame->tree() | |
| 101 .parent() | |
| 102 ->securityContext() | |
| 103 ->getSecurityOrigin() | |
| 104 ->isSameSchemeHostPortAndSuborigin( | |
| 105 frame->securityContext()->getSecurityOrigin()); | |
| 106 } | |
| 107 } | |
| 108 | |
| 109 // Otherwise, fullscreen is not allowed. (If we reach here and this is the | |
| 110 // main frame, then fullscreen must have been disabled by FP.) | |
| 111 return false; | |
| 112 } | 86 } |
| 113 | 87 |
| 114 bool allowedToRequestFullscreen(Document& document) { | 88 bool allowedToRequestFullscreen(Document& document) { |
| 115 // An algorithm is allowed to request fullscreen if one of the following is | 89 // An algorithm is allowed to request fullscreen if one of the following is |
| 116 // true: | 90 // true: |
| 117 | 91 |
| 118 // The algorithm is triggered by a user activation. | 92 // The algorithm is triggered by a user activation. |
| 119 if (UserGestureIndicator::utilizeUserGesture()) | 93 if (UserGestureIndicator::utilizeUserGesture()) |
| 120 return true; | 94 return true; |
| 121 | 95 |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 DEFINE_TRACE(Fullscreen) { | 839 DEFINE_TRACE(Fullscreen) { |
| 866 visitor->trace(m_pendingFullscreenElement); | 840 visitor->trace(m_pendingFullscreenElement); |
| 867 visitor->trace(m_fullscreenElementStack); | 841 visitor->trace(m_fullscreenElementStack); |
| 868 visitor->trace(m_currentFullScreenElement); | 842 visitor->trace(m_currentFullScreenElement); |
| 869 visitor->trace(m_eventQueue); | 843 visitor->trace(m_eventQueue); |
| 870 Supplement<Document>::trace(visitor); | 844 Supplement<Document>::trace(visitor); |
| 871 ContextLifecycleObserver::trace(visitor); | 845 ContextLifecycleObserver::trace(visitor); |
| 872 } | 846 } |
| 873 | 847 |
| 874 } // namespace blink | 848 } // namespace blink |
| OLD | NEW |