WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
91448
Unify allowfullscreen logic in Document::webkitFullScreenEnabled and fullScreenIsAllowedForElement.
https://bugs.webkit.org/show_bug.cgi?id=91448
Summary
Unify allowfullscreen logic in Document::webkitFullScreenEnabled and fullScre...
Vincent Scheib
Reported
2012-07-16 17:13:22 PDT
Simplify Document::webkitFullScreenEnabled element traversal.
Attachments
Patch
(2.28 KB, patch)
2012-07-17 08:11 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(9.06 KB, patch)
2012-07-17 13:48 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(9.06 KB, patch)
2012-07-17 14:23 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(9.03 KB, patch)
2012-07-17 16:37 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(8.83 KB, patch)
2012-07-18 10:30 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(8.61 KB, patch)
2012-07-18 10:46 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(8.61 KB, patch)
2012-07-18 11:02 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Patch
(8.65 KB, patch)
2012-07-18 11:07 PDT
,
Vincent Scheib
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Vincent Scheib
Comment 1
2012-07-17 08:11:51 PDT
Created
attachment 152766
[details]
Patch
Vincent Scheib
Comment 2
2012-07-17 08:14:37 PDT
Pointer lock will be using the same iframe allow logic. Reducing the code here first.
Jer Noble
Comment 3
2012-07-17 09:18:51 PDT
This patch subtly changes the behavior of Document::requestFullScreenForElement(). Before, a JavaScript call "iframe.webkitEnterFullScreen()" on an iframe without an "webkitallowfullscreen" attribute would allow the iframe to enter full screen mode. This makes sense, since it's the element owner that decides whether the full screen request will be accepted. With this patch, element->allowFullScreen() is checked against the requested element if that element is an iframe. This causes the above case (requesting full screen on an iframe directly) to fail. I believe the Document::fullScreenIsAllowedForElement() function could still be simplified, but there would have to be one iteration of finding the element's owner element before the do/while loop.
Vincent Scheib
Comment 4
2012-07-17 13:48:16 PDT
Created
attachment 152817
[details]
Patch
Vincent Scheib
Comment 5
2012-07-17 13:49:43 PDT
Thanks Jer, I've written a test to identify that particular case and adjusted the patch to handle it. Please take a look.
Vincent Scheib
Comment 6
2012-07-17 13:55:21 PDT
Comment on
attachment 152817
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152817&action=review
> Source/WebCore/html/HTMLFrameElementBase.cpp:253 > + return (hasAttribute(webkitallowfullscreenAttr) || !isFrameElementBase())
Jer, I migrated this logic of !isFrameElementBase(), but we do not have a test that detects this logic being in place. Can you describe what scenario this logic is handling?
Build Bot
Comment 7
2012-07-17 14:11:14 PDT
Comment on
attachment 152817
[details]
Patch
Attachment 152817
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/13282237
Vincent Scheib
Comment 8
2012-07-17 14:23:33 PDT
Created
attachment 152830
[details]
Patch
Vincent Scheib
Comment 9
2012-07-17 16:37:21 PDT
Created
attachment 152872
[details]
Patch
Vincent Scheib
Comment 10
2012-07-17 16:38:16 PDT
(In reply to
comment #6
)
> (From update of
attachment 152817
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=152817&action=review
> > > Source/WebCore/html/HTMLFrameElementBase.cpp:253 > > + return (hasAttribute(webkitallowfullscreenAttr) || !isFrameElementBase()) > > Jer, I migrated this logic of !isFrameElementBase(), but we do not have a test that detects this logic being in place. Can you describe what scenario this logic is handling?
Doh, nevermind. As I moved the implementation to FrameElementBase I've removed that.
Jer Noble
Comment 11
2012-07-17 16:58:09 PDT
Comment on
attachment 152872
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=152872&action=review
> Source/WebCore/dom/Document.cpp:5371 > + HTMLFrameOwnerElement* owner = element->document()->ownerElement(); > + if (!owner) > + return true; > + return owner->fullscreenIsAllowedByAllOwners();
This could be more easily written as: if (HTMLFrameOwnerElement* owner = element->document()->ownerElement()) return owner->fullscreenIsAllowedByAllOwners(); return true;
> Source/WebCore/dom/Document.cpp:5583 > HTMLFrameOwnerElement* owner = ownerElement(); > if (!owner) > return true; > - > - do { > - if (!owner->isFrameElementBase()) > - continue; > - > - if (!static_cast<HTMLFrameElementBase*>(owner)->allowFullScreen()) > - return false; > - } while ((owner = owner->document()->ownerElement())); > - > - return true; > + return owner->fullscreenIsAllowedByAllOwners();
This too.
> Source/WebCore/html/HTMLFrameElementBase.cpp:253 > + HTMLFrameOwnerElement* owner = document()->ownerElement(); > + return hasAttribute(webkitallowfullscreenAttr) && (!owner || owner->fullscreenIsAllowedByAllOwners());
Why recurse? It'd be trivial to walk up the owner chain instead. This function could even exist as a free function in Document.cpp. There's really no need for it to be a class function on HTMLFrameElementBase.
> Source/WebCore/html/HTMLFrameOwnerElement.h:61 > +#if ENABLE(FULLSCREEN_API) > + virtual bool fullscreenIsAllowedByAllOwners() const { return false; } > +#endif
This is probably a good idea (to provide a base implementation in HTMLFrameOwnerElement that is overridden in HTMLFrameElementBase), but there's no need to rename the function and provide a new implementation (see above about the free function possibility).
Vincent Scheib
Comment 12
2012-07-18 10:30:10 PDT
Created
attachment 153041
[details]
Patch
Vincent Scheib
Comment 13
2012-07-18 10:46:33 PDT
Created
attachment 153044
[details]
Patch
Jer Noble
Comment 14
2012-07-18 10:55:53 PDT
View in context:
https://bugs.webkit.org/attachment.cgi?id=153041&action=review
Looking good! Just a couple of nits.
> Source/WebCore/dom/Document.cpp:591 > + // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor > + // browsing context's documents have their fullscreen enabled flag set, or false otherwise.
Nit: please leave this comment in Document::webkitFullscreenEnabled().
> Source/WebCore/dom/Document.cpp:594 > + // Top-level browsing contexts are implied to have their allowFullScreen attribute set. > + if (owner) {
Nit: please return (true) early in this case. Otherwise the comment doesn't make (as much) sense. (Also, other reviewers tend to prefer early returns to indented conditionals like this one.) Unofficial r=me.
Jer Noble
Comment 15
2012-07-18 10:56:17 PDT
(In reply to
comment #14
)
> > Source/WebCore/dom/Document.cpp:591 > > + // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor > > + // browsing context's documents have their fullscreen enabled flag set, or false otherwise. > > Nit: please leave this comment in Document::webkitFullscreenEnabled().
Looks like your latest patch does this. Thanks!
Early Warning System Bot
Comment 16
2012-07-18 10:59:24 PDT
Comment on
attachment 153044
[details]
Patch
Attachment 153044
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/13271648
Vincent Scheib
Comment 17
2012-07-18 11:02:40 PDT
Created
attachment 153049
[details]
Patch
Vincent Scheib
Comment 18
2012-07-18 11:04:27 PDT
Thanks Jer, looks nice and clean now - easy to reuse for pointer lock. enne, take a look?
Vincent Scheib
Comment 19
2012-07-18 11:07:14 PDT
Created
attachment 153050
[details]
Patch
Adrienne Walker
Comment 20
2012-07-18 11:18:56 PDT
Comment on
attachment 153050
[details]
Patch R=me.
WebKit Review Bot
Comment 21
2012-07-18 13:06:25 PDT
Comment on
attachment 153050
[details]
Patch Clearing flags on attachment: 153050 Committed
r123005
: <
http://trac.webkit.org/changeset/123005
>
WebKit Review Bot
Comment 22
2012-07-18 13:06:30 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug