Bug 1299795 - Disable fullscreen for sidebar. r?smaug
MozReview-Commit-ID: G09fKdufKW3
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -1046,17 +1046,17 @@
<hbox flex="1" id="browser">
<vbox id="browser-border-start" hidden="true" layer="true"/>
<vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
<sidebarheader id="sidebar-header" align="center">
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
<image id="sidebar-throbber"/>
<toolbarbutton class="close-icon tabbable" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="SidebarUI.hide();"/>
</sidebarheader>
- <browser id="sidebar" flex="1" autoscroll="false" disablehistory="true"
+ <browser id="sidebar" flex="1" autoscroll="false" disablehistory="true" disablefullscreen="true"
style="min-width: 14em; width: 18em; max-width: 36em;" tooltip="aHTMLTooltip"/>
</vbox>
<splitter id="sidebar-splitter" class="chromeclass-extrachrome sidebar-splitter" hidden="true"/>
<vbox id="appcontent" flex="1">
<notificationbox id="high-priority-global-notificationbox" notificationside="top"/>
<tabbrowser id="content"
flex="1" contenttooltip="aHTMLTooltip"
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -2501,50 +2501,57 @@ nsDocShell::GetFullscreenAllowed(bool* a
// Assume false until we determine otherwise...
*aFullscreenAllowed = false;
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
if (!win) {
return NS_OK;
}
- nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
- if (frameElement && !frameElement->IsXULElement()) {
- // We do not allow document inside any containing element other
- // than iframe to enter fullscreen.
- if (frameElement->IsHTMLElement(nsGkAtoms::iframe)) {
- // If any ancestor iframe does not have allowfullscreen attribute
- // set, then fullscreen is not allowed.
- if (!frameElement->HasAttr(kNameSpaceID_None,
- nsGkAtoms::allowfullscreen) &&
- !frameElement->HasAttr(kNameSpaceID_None,
- nsGkAtoms::mozallowfullscreen)) {
- return NS_OK;
- }
- } else if (frameElement->IsHTMLElement(nsGkAtoms::embed)) {
- // Respect allowfullscreen only if this is a rewritten YouTube embed.
- nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent =
- do_QueryInterface(frameElement);
- if (!objectLoadingContent) {
- return NS_OK;
- }
- nsObjectLoadingContent* olc =
- static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
- if (!olc->IsRewrittenYoutubeEmbed()) {
- return NS_OK;
- }
- // We don't have to check prefixed attributes because Flash does not
- // support them.
- if (!frameElement->HasAttr(kNameSpaceID_None,
- nsGkAtoms::allowfullscreen)) {
+ if (nsCOMPtr<Element> frameElement = win->GetFrameElementInternal()) {
+ if (frameElement->IsXULElement()) {
+ if (frameElement->HasAttr(kNameSpaceID_None,
+ nsGkAtoms::disablefullscreen)) {
+ // Document inside this frame is explicitly disabled.
return NS_OK;
}
} else {
- // neither iframe nor embed
- return NS_OK;
+ // We do not allow document inside any containing element other
+ // than iframe to enter fullscreen.
+ if (frameElement->IsHTMLElement(nsGkAtoms::iframe)) {
+ // If any ancestor iframe does not have allowfullscreen attribute
+ // set, then fullscreen is not allowed.
+ if (!frameElement->HasAttr(kNameSpaceID_None,
+ nsGkAtoms::allowfullscreen) &&
+ !frameElement->HasAttr(kNameSpaceID_None,
+ nsGkAtoms::mozallowfullscreen)) {
+ return NS_OK;
+ }
+ } else if (frameElement->IsHTMLElement(nsGkAtoms::embed)) {
+ // Respect allowfullscreen only if this is a rewritten YouTube embed.
+ nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent =
+ do_QueryInterface(frameElement);
+ if (!objectLoadingContent) {
+ return NS_OK;
+ }
+ nsObjectLoadingContent* olc =
+ static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
+ if (!olc->IsRewrittenYoutubeEmbed()) {
+ return NS_OK;
+ }
+ // We don't have to check prefixed attributes because Flash does not
+ // support them.
+ if (!frameElement->HasAttr(kNameSpaceID_None,
+ nsGkAtoms::allowfullscreen)) {
+ return NS_OK;
+ }
+ } else {
+ // neither iframe nor embed
+ return NS_OK;
+ }
}
}
// If we have no parent then we're the root docshell; no ancestor of the
// original docshell doesn't have a allowfullscreen attribute, so
// report fullscreen as allowed.
RefPtr<nsDocShell> parent = GetParentDocshell();
if (!parent) {
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -307,16 +307,17 @@ GK_ATOM(digit, "digit")
GK_ATOM(dir, "dir")
GK_ATOM(dirAutoSetBy, "dirAutoSetBy")
GK_ATOM(directionality, "directionality")
GK_ATOM(directory, "directory")
GK_ATOM(disableOutputEscaping, "disable-output-escaping")
GK_ATOM(disabled, "disabled")
GK_ATOM(disableglobalhistory, "disableglobalhistory")
GK_ATOM(disablehistory, "disablehistory")
+GK_ATOM(disablefullscreen, "disablefullscreen")
GK_ATOM(display, "display")
GK_ATOM(displayMode, "display-mode")
GK_ATOM(distinct, "distinct")
GK_ATOM(div, "div")
GK_ATOM(dl, "dl")
GK_ATOM(doctypePublic, "doctype-public")
GK_ATOM(doctypeSystem, "doctype-system")
GK_ATOM(document, "document")