Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2053673002: Move Fullscreen static helpers to an anonymous namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "core/layout/LayoutBlockFlow.h" 45 #include "core/layout/LayoutBlockFlow.h"
46 #include "core/layout/LayoutFullScreen.h" 46 #include "core/layout/LayoutFullScreen.h"
47 #include "core/layout/api/LayoutFullScreenItem.h" 47 #include "core/layout/api/LayoutFullScreenItem.h"
48 #include "core/page/ChromeClient.h" 48 #include "core/page/ChromeClient.h"
49 #include "platform/UserGestureIndicator.h" 49 #include "platform/UserGestureIndicator.h"
50 50
51 namespace blink { 51 namespace blink {
52 52
53 using namespace HTMLNames; 53 using namespace HTMLNames;
54 54
55 static bool fullscreenIsAllowedForAllOwners(const Document& document) 55 namespace {
56
57 bool fullscreenIsAllowedForAllOwners(const Document& document)
56 { 58 {
57 if (!document.frame()) 59 if (!document.frame())
58 return false; 60 return false;
59 61
60 for (const Frame* frame = document.frame(); frame->owner(); frame = frame->t ree().parent()) { 62 for (const Frame* frame = document.frame(); frame->owner(); frame = frame->t ree().parent()) {
61 if (!frame->owner()->allowFullscreen()) 63 if (!frame->owner()->allowFullscreen())
62 return false; 64 return false;
63 } 65 }
64 return true; 66 return true;
65 } 67 }
66 68
67 static bool fullscreenIsSupported(const Document& document) 69 bool fullscreenIsSupported(const Document& document)
68 { 70 {
69 // Fullscreen is supported if there is no previously-established user prefer ence, 71 // Fullscreen is supported if there is no previously-established user prefer ence,
70 // security risk, or platform limitation. 72 // security risk, or platform limitation.
71 return !document.settings() || document.settings()->fullscreenSupported(); 73 return !document.settings() || document.settings()->fullscreenSupported();
72 } 74 }
73 75
74 static bool fullscreenElementReady(const Element& element) 76 bool fullscreenElementReady(const Element& element)
75 { 77 {
76 // A fullscreen element ready check for an element |element| returns true if all of the 78 // A fullscreen element ready check for an element |element| returns true if all of the
77 // following are true, and false otherwise: 79 // following are true, and false otherwise:
78 80
79 // |element| is in a document. 81 // |element| is in a document.
80 if (!element.inShadowIncludingDocument()) 82 if (!element.inShadowIncludingDocument())
81 return false; 83 return false;
82 84
83 // |element|'s node document's fullscreen enabled flag is set. 85 // |element|'s node document's fullscreen enabled flag is set.
84 if (!fullscreenIsAllowedForAllOwners(element.document())) 86 if (!fullscreenIsAllowedForAllOwners(element.document()))
(...skipping 15 matching lines...) Expand all
100 // fullscreen element ready check returns true for |element|'s node document 's browsing 102 // fullscreen element ready check returns true for |element|'s node document 's browsing
101 // context's browsing context container, or it has no browsing context conta iner. 103 // context's browsing context container, or it has no browsing context conta iner.
102 if (const Element* owner = element.document().localOwner()) { 104 if (const Element* owner = element.document().localOwner()) {
103 if (!fullscreenElementReady(*owner)) 105 if (!fullscreenElementReady(*owner))
104 return false; 106 return false;
105 } 107 }
106 108
107 return true; 109 return true;
108 } 110 }
109 111
110 static bool isPrefixed(const AtomicString& type) 112 bool isPrefixed(const AtomicString& type)
111 { 113 {
112 return type == EventTypeNames::webkitfullscreenchange || type == EventTypeNa mes::webkitfullscreenerror; 114 return type == EventTypeNames::webkitfullscreenchange || type == EventTypeNa mes::webkitfullscreenerror;
113 } 115 }
114 116
115 static Event* createEvent(const AtomicString& type, EventTarget& target) 117 Event* createEvent(const AtomicString& type, EventTarget& target)
116 { 118 {
117 EventInit initializer; 119 EventInit initializer;
118 initializer.setBubbles(isPrefixed(type)); 120 initializer.setBubbles(isPrefixed(type));
119 Event* event = Event::create(type, initializer); 121 Event* event = Event::create(type, initializer);
120 event->setTarget(&target); 122 event->setTarget(&target);
121 return event; 123 return event;
122 } 124 }
123 125
126 } // anonymous namespace
127
124 const char* Fullscreen::supplementName() 128 const char* Fullscreen::supplementName()
125 { 129 {
126 return "Fullscreen"; 130 return "Fullscreen";
127 } 131 }
128 132
129 Fullscreen& Fullscreen::from(Document& document) 133 Fullscreen& Fullscreen::from(Document& document)
130 { 134 {
131 Fullscreen* fullscreen = fromIfExists(document); 135 Fullscreen* fullscreen = fromIfExists(document);
132 if (!fullscreen) { 136 if (!fullscreen) {
133 fullscreen = new Fullscreen(document); 137 fullscreen = new Fullscreen(document);
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 DEFINE_TRACE(Fullscreen) 629 DEFINE_TRACE(Fullscreen)
626 { 630 {
627 visitor->trace(m_fullScreenElement); 631 visitor->trace(m_fullScreenElement);
628 visitor->trace(m_fullScreenElementStack); 632 visitor->trace(m_fullScreenElementStack);
629 visitor->trace(m_eventQueue); 633 visitor->trace(m_eventQueue);
630 Supplement<Document>::trace(visitor); 634 Supplement<Document>::trace(visitor);
631 ContextLifecycleObserver::trace(visitor); 635 ContextLifecycleObserver::trace(visitor);
632 } 636 }
633 637
634 } // namespace blink 638 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698