Commit 427ff979 authored by philipj@opera.com's avatar philipj@opera.com

Add a UseCounter for the webkitallowfullscreen attribute

We support the unprefixed allowfullscreen attribute, so it would be nice
to also reflect it in HTMLIFrameElement.allowFullscreen. However, that's
tricky while there are two backing attributes, so first measure if the
prefixed attribute can be removed yet.

BUG=none

Review URL: https://codereview.chromium.org/212433004

git-svn-id: svn://svn.chromium.org/blink/trunk@170124 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2289b26f
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core/frame/FrameHost.h" #include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h" #include "core/frame/Settings.h"
#include "core/frame/UseCounter.h"
#include "core/html/HTMLFrameOwnerElement.h" #include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLMediaElement.h" #include "core/html/HTMLMediaElement.h"
#include "core/page/Chrome.h" #include "core/page/Chrome.h"
...@@ -45,13 +46,18 @@ namespace WebCore { ...@@ -45,13 +46,18 @@ namespace WebCore {
using namespace HTMLNames; 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) if (!owner)
return true; return true;
do { do {
if (!(owner->hasAttribute(attribute) || owner->hasAttribute(prefixedAttribute))) if (!owner->hasAttribute(allowfullscreenAttr)) {
return false; if (owner->hasAttribute(webkitallowfullscreenAttr))
UseCounter::count(document, UseCounter::PrefixedAllowFullscreenAttribute);
else
return false;
}
} while ((owner = owner->document().ownerElement())); } while ((owner = owner->document().ownerElement()));
return true; return true;
} }
...@@ -134,7 +140,7 @@ void FullscreenElementStack::documentWasDisposed() ...@@ -134,7 +140,7 @@ void FullscreenElementStack::documentWasDisposed()
bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) const bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) const
{ {
ASSERT(element); ASSERT(element);
return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr, element->document().ownerElement()); return fullscreenIsAllowedForAllOwners(element->document());
} }
void FullscreenElementStack::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType) void FullscreenElementStack::requestFullScreenForElement(Element* element, unsigned short flags, FullScreenCheckType checkType)
...@@ -359,8 +365,7 @@ bool FullscreenElementStack::webkitFullscreenEnabled(Document& document) ...@@ -359,8 +365,7 @@ bool FullscreenElementStack::webkitFullscreenEnabled(Document& document)
// browsing context's documents have their fullscreen enabled flag set, or false otherwise. // 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. // 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) void FullscreenElementStack::webkitWillEnterFullScreenForElement(Element* element)
......
...@@ -329,6 +329,7 @@ public: ...@@ -329,6 +329,7 @@ public:
NamedNodeMapRemoveNamedItemNS = 312, NamedNodeMapRemoveNamedItemNS = 312,
OpenWebDatabaseInWorker = 313, OpenWebDatabaseInWorker = 313,
OpenWebDatabaseSyncInWorker = 314, OpenWebDatabaseSyncInWorker = 314,
PrefixedAllowFullscreenAttribute = 315,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
NumberOfFeatures, // This enum value must be last. NumberOfFeatures, // This enum value must be last.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment