Bug 1595800 - Part 1: Move screen orientation attributes from Document to BrowsingContext r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D54999

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Micah Tigley 2019-12-03 17:49:07 +00:00
parent e0b847846e
commit 38f31dfbce
4 changed files with 32 additions and 0 deletions

View File

@ -52,6 +52,17 @@ extern mozilla::LazyLogModule gAutoplayPermissionLog;
#define AUTOPLAY_LOG(msg, ...) \
MOZ_LOG(gAutoplayPermissionLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
namespace IPC {
// Allow serialization and deserialization of OrientationType over IPC
template <>
struct ParamTraits<mozilla::dom::OrientationType>
: public ContiguousEnumSerializerInclusive<
mozilla::dom::OrientationType,
mozilla::dom::OrientationType::Portrait_primary,
mozilla::dom::OrientationType::Landscape_secondary> {};
} // namespace IPC
namespace mozilla {
namespace dom {

View File

@ -273,6 +273,18 @@ class BrowsingContext : public nsISupports,
bool IsLoading();
// ScreenOrientation related APIs
void SetCurrentOrientation(OrientationType aType, float aAngle) {
SetCurrentOrientationType(aType);
SetCurrentOrientationAngle(aAngle);
}
void SetRDMPaneOrientation(OrientationType aType, float aAngle) {
if (mInRDMPane) {
SetCurrentOrientation(aType, aAngle);
}
}
// Using the rules for choosing a browsing context we try to find
// the browsing context with the given name in the set of
// transitively reachable browsing contexts. Performs access control

View File

@ -42,6 +42,11 @@ MOZ_BC_FIELD(FeaturePolicy, RefPtr<mozilla::dom::FeaturePolicy>)
// See nsSandboxFlags.h for the possible flags.
MOZ_BC_FIELD(SandboxFlags, uint32_t)
// ScreenOrientation-related APIs
MOZ_BC_FIELD(CurrentOrientationAngle, float)
MOZ_BC_FIELD(CurrentOrientationType, mozilla::dom::OrientationType)
MOZ_BC_FIELD(HistoryID, nsID)
MOZ_BC_FIELD(InRDMPane, bool)

View File

@ -51,6 +51,10 @@ interface BrowsingContext {
// The inRDMPane flag indicates whether or not Responsive Design Mode is
// active for the browsing context.
attribute boolean inRDMPane;
// Extension to give chrome JS the ability to set the window screen
// orientation while in RDM.
void setRDMPaneOrientation(OrientationType type, float rotationAngle);
};
[Exposed=Window, ChromeOnly]