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

Side by Side Diff: Source/core/dom/FullscreenElementStack.cpp

Issue 212433004: Add a UseCounter for the webkitallowfullscreen attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | 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 16 matching lines...) Expand all
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "core/dom/FullscreenElementStack.h" 29 #include "core/dom/FullscreenElementStack.h"
30 30
31 #include "HTMLNames.h" 31 #include "HTMLNames.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/events/Event.h" 33 #include "core/events/Event.h"
34 #include "core/frame/FrameHost.h" 34 #include "core/frame/FrameHost.h"
35 #include "core/frame/LocalFrame.h" 35 #include "core/frame/LocalFrame.h"
36 #include "core/frame/Settings.h" 36 #include "core/frame/Settings.h"
37 #include "core/frame/UseCounter.h"
37 #include "core/html/HTMLFrameOwnerElement.h" 38 #include "core/html/HTMLFrameOwnerElement.h"
38 #include "core/html/HTMLMediaElement.h" 39 #include "core/html/HTMLMediaElement.h"
39 #include "core/page/Chrome.h" 40 #include "core/page/Chrome.h"
40 #include "core/page/ChromeClient.h" 41 #include "core/page/ChromeClient.h"
41 #include "core/rendering/RenderFullScreen.h" 42 #include "core/rendering/RenderFullScreen.h"
42 #include "platform/UserGestureIndicator.h" 43 #include "platform/UserGestureIndicator.h"
43 44
44 namespace WebCore { 45 namespace WebCore {
45 46
46 using namespace HTMLNames; 47 using namespace HTMLNames;
47 48
48 static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, cons t WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner) 49 static bool allowFullscreenOnAllOwners(const Document& document)
falken 2014/03/26 13:59:32 nit: would isAllowFullscreenOnAllOwners or fullscr
philipj_slow 2014/03/26 16:18:58 I wanted something with "allowfullscreen" in the n
49 { 50 {
51 const HTMLFrameOwnerElement* owner = document.ownerElement();
50 if (!owner) 52 if (!owner)
51 return true; 53 return true;
52 do { 54 do {
53 if (!(owner->hasAttribute(attribute) || owner->hasAttribute(prefixedAttr ibute))) 55 if (!owner->hasAttribute(allowfullscreenAttr)) {
54 return false; 56 if (owner->hasAttribute(webkitallowfullscreenAttr))
57 UseCounter::count(document, UseCounter::PrefixedAllowFullscreenA ttribute);
58 else
59 return false;
60 }
55 } while ((owner = owner->document().ownerElement())); 61 } while ((owner = owner->document().ownerElement()));
56 return true; 62 return true;
57 } 63 }
58 64
59 const char* FullscreenElementStack::supplementName() 65 const char* FullscreenElementStack::supplementName()
60 { 66 {
61 return "FullscreenElementStack"; 67 return "FullscreenElementStack";
62 } 68 }
63 69
64 FullscreenElementStack& FullscreenElementStack::from(Document& document) 70 FullscreenElementStack& FullscreenElementStack::from(Document& document)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 133
128 void FullscreenElementStack::documentWasDisposed() 134 void FullscreenElementStack::documentWasDisposed()
129 { 135 {
130 m_fullScreenElement = nullptr; 136 m_fullScreenElement = nullptr;
131 m_fullScreenElementStack.clear(); 137 m_fullScreenElementStack.clear();
132 } 138 }
133 139
134 bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) con st 140 bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) con st
135 { 141 {
136 ASSERT(element); 142 ASSERT(element);
137 return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr , element->document().ownerElement()); 143 return allowFullscreenOnAllOwners(element->document());
138 } 144 }
139 145
140 void FullscreenElementStack::requestFullScreenForElement(Element* element, unsig ned short flags, FullScreenCheckType checkType) 146 void FullscreenElementStack::requestFullScreenForElement(Element* element, unsig ned short flags, FullScreenCheckType checkType)
141 { 147 {
142 // Ignore this request if the document is not in a live frame. 148 // Ignore this request if the document is not in a live frame.
143 if (!document()->isActive()) 149 if (!document()->isActive())
144 return; 150 return;
145 151
146 // The Mozilla Full Screen API <https://wiki.mozilla.org/Gecko:FullScreenAPI > has different requirements 152 // The Mozilla Full Screen API <https://wiki.mozilla.org/Gecko:FullScreenAPI > has different requirements
147 // for full screen mode, and do not have the concept of a full screen elemen t stack. 153 // for full screen mode, and do not have the concept of a full screen elemen t stack.
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Otherwise, notify the chrome of the new full screen element. 358 // Otherwise, notify the chrome of the new full screen element.
353 host->chrome().client().enterFullScreenForElement(newTop); 359 host->chrome().client().enterFullScreenForElement(newTop);
354 } 360 }
355 361
356 bool FullscreenElementStack::webkitFullscreenEnabled(Document& document) 362 bool FullscreenElementStack::webkitFullscreenEnabled(Document& document)
357 { 363 {
358 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor 364 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor
359 // browsing context's documents have their fullscreen enabled flag set, or f alse otherwise. 365 // browsing context's documents have their fullscreen enabled flag set, or f alse otherwise.
360 366
361 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set. 367 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set.
362 return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr , document.ownerElement()); 368 return allowFullscreenOnAllOwners(document);
363
364 } 369 }
365 370
366 void FullscreenElementStack::webkitWillEnterFullScreenForElement(Element* elemen t) 371 void FullscreenElementStack::webkitWillEnterFullScreenForElement(Element* elemen t)
367 { 372 {
368 ASSERT(element); 373 ASSERT(element);
369 if (!document()->isActive()) 374 if (!document()->isActive())
370 return; 375 return;
371 376
372 ASSERT(document()->settings()); // If we're active we must have settings. 377 ASSERT(document()->settings()); // If we're active we must have settings.
373 ASSERT(document()->settings()->fullScreenEnabled()); 378 ASSERT(document()->settings()->fullScreenEnabled());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 if (!target) 576 if (!target)
572 target = fullscreen->webkitCurrentFullScreenElement(); 577 target = fullscreen->webkitCurrentFullScreenElement();
573 } 578 }
574 579
575 if (!target) 580 if (!target)
576 target = doc; 581 target = doc;
577 m_fullScreenChangeEventTargetQueue.append(target); 582 m_fullScreenChangeEventTargetQueue.append(target);
578 } 583 }
579 584
580 } // namespace WebCore 585 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698