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

Unified 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: fullscreenIsAllowedForAllOwners 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/FullscreenElementStack.cpp
diff --git a/Source/core/dom/FullscreenElementStack.cpp b/Source/core/dom/FullscreenElementStack.cpp
index 2f72ac811d85fb537842fe0cb8faf66730c4b3fd..8fb5ebceaff45fd9e99583562649b08a5d3600e1 100644
--- a/Source/core/dom/FullscreenElementStack.cpp
+++ b/Source/core/dom/FullscreenElementStack.cpp
@@ -34,6 +34,7 @@
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
+#include "core/frame/UseCounter.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLMediaElement.h"
#include "core/page/Chrome.h"
@@ -45,13 +46,18 @@ namespace WebCore {
using namespace HTMLNames;
-static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner)
+static bool fullscreenIsAllowedForAllOwners(const Document& document)
{
+ const HTMLFrameOwnerElement* owner = document.ownerElement();
if (!owner)
return true;
do {
- if (!(owner->hasAttribute(attribute) || owner->hasAttribute(prefixedAttribute)))
- return false;
+ if (!owner->hasAttribute(allowfullscreenAttr)) {
+ if (owner->hasAttribute(webkitallowfullscreenAttr))
+ UseCounter::count(document, UseCounter::PrefixedAllowFullscreenAttribute);
+ else
+ return false;
+ }
} while ((owner = owner->document().ownerElement()));
return true;
}
@@ -134,7 +140,7 @@ void FullscreenElementStack::documentWasDisposed()
bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) const
{
ASSERT(element);
- return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, element->document().ownerElement());
+ return fullscreenIsAllowedForAllOwners(element->document());
}
void FullscreenElementStack::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType)
@@ -359,8 +365,7 @@ bool FullscreenElementStack::webkitFullscreenEnabled(Document& document)
// browsing context's documents have their fullscreen enabled flag set, or false otherwise.
// Top-level browsing contexts are implied to have their allowFullScreen attribute set.
- return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, document.ownerElement());
-
+ return fullscreenIsAllowedForAllOwners(document);
}
void FullscreenElementStack::webkitWillEnterFullScreenForElement(Element* element)
« 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