From 2b23429aaebcbaa030a8b8a1bd21dbe7b57e638a Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 7 Jun 2018 22:47:23 +0900 Subject: [PATCH 1/2] add Screen Orientation types --- baselines/dom.generated.d.ts | 24 ++++++++++++++++++++ inputfiles/idl/Screen Orientation.widl | 31 ++++++++++++++++++++++++++ inputfiles/idlSources.json | 4 ++++ 3 files changed, 59 insertions(+) create mode 100644 inputfiles/idl/Screen Orientation.widl diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index cf9aed910..6f7f29d8d 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -13760,6 +13760,7 @@ interface Screen extends EventTarget { readonly logicalYDPI: number; readonly msOrientation: string; onmsorientationchange: ((this: Screen, ev: Event) => any) | null; + readonly orientation: ScreenOrientation; readonly pixelDepth: number; readonly systemXDPI: number; readonly systemYDPI: number; @@ -13779,6 +13780,27 @@ declare var Screen: { new(): Screen; }; +interface ScreenOrientationEventMap { + "change": Event; +} + +interface ScreenOrientation extends EventTarget { + readonly angle: number; + onchange: ((this: ScreenOrientation, ev: Event) => any) | null; + readonly type: OrientationType; + lock(orientation: OrientationLockType): Promise; + unlock(): void; + addEventListener(type: K, listener: (this: ScreenOrientation, ev: ScreenOrientationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: ScreenOrientation, ev: ScreenOrientationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var ScreenOrientation: { + prototype: ScreenOrientation; + new(): ScreenOrientation; +}; + interface ScriptProcessorNodeEventMap { "audioprocess": AudioProcessingEvent; } @@ -17225,6 +17247,8 @@ type NavigationReason = "up" | "down" | "left" | "right"; type NavigationType = "navigate" | "reload" | "back_forward" | "prerender"; type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; +type OrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary"; +type OrientationType = "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary"; type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom"; type OverSampleType = "none" | "2x" | "4x"; type PanningModelType = "equalpower" | "HRTF"; diff --git a/inputfiles/idl/Screen Orientation.widl b/inputfiles/idl/Screen Orientation.widl new file mode 100644 index 000000000..f8a74c932 --- /dev/null +++ b/inputfiles/idl/Screen Orientation.widl @@ -0,0 +1,31 @@ +partial interface Screen { + [SameObject] + readonly attribute ScreenOrientation orientation; +}; + +[Exposed=Window] +interface ScreenOrientation : EventTarget { + Promise lock(OrientationLockType orientation); + void unlock(); + readonly attribute OrientationType type; + readonly attribute unsigned short angle; + attribute EventHandler onchange; +}; + +enum OrientationType { + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" +}; + +enum OrientationLockType { + "any", + "natural", + "landscape", + "portrait", + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" +}; diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index 021b9f6d2..5984c14fc 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -80,6 +80,10 @@ "url": "https://w3c.github.io/resource-timing/", "title": "Resource Timing" }, + { + "url": "https://www.w3.org/TR/screen-orientation/", + "title": "Screen Orientation" + }, { "url": "https://w3c.github.io/ServiceWorker/", "title": "Service Workers" From 656b95809e1b6381bb850d0434b04802a455977e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 8 Jun 2018 14:18:14 +0900 Subject: [PATCH 2/2] remove non-standard [un]lockOrientation --- baselines/dom.generated.d.ts | 5 ----- inputfiles/addedTypes.json | 23 ----------------------- inputfiles/removedTypes.json | 10 +++++++++- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 6f7f29d8d..00b1cf2cb 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -13765,10 +13765,6 @@ interface Screen extends EventTarget { readonly systemXDPI: number; readonly systemYDPI: number; readonly width: number; - lockOrientation(orientations: OrientationLockType | OrientationLockType[]): boolean; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - unlockOrientation(): void; addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -17165,7 +17161,6 @@ type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; type MouseWheelEvent = WheelEvent; type ScrollRestoration = "auto" | "manual"; type InsertPosition = "beforebegin" | "afterbegin" | "beforeend" | "afterend"; -type OrientationLockType = "any" | "natural" | "portrait" | "landscape" | "portrait-primary" | "portrait-secondary" | "landscape-primary"| "landscape-secondary"; type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey; type AlgorithmIdentifier = string | Algorithm; type MutationRecordType = "attributes" | "characterData" | "childList"; diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index ad555f156..de0ba635c 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2123,25 +2123,6 @@ }, "no-interface-object": "1" }, - "Screen": { - "name": "Screen", - "methods": { - "method": { - "lockOrientation": { - "name": "lockOrientation", - "override-signatures": [ - "lockOrientation(orientations: OrientationLockType | OrientationLockType[]): boolean" - ] - }, - "unlockOrientation": { - "name": "unlockOrientation", - "override-signatures": [ - "unlockOrientation(): void" - ] - } - } - } - }, "HTMLTableDataCellElement": { "name": "HTMLTableDataCellElement", "extends": "HTMLTableCellElement", @@ -2384,10 +2365,6 @@ "override-type": "Headers | string[][] | Record", "new-type": "HeadersInit" }, - { - "override-type": "\"any\" | \"natural\" | \"portrait\" | \"landscape\" | \"portrait-primary\" | \"portrait-secondary\" | \"landscape-primary\"| \"landscape-secondary\"", - "new-type": "OrientationLockType" - }, { "override-type": "number | string | Date | BufferSource | IDBArrayKey", "new-type": "IDBValidKey" diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 2da8c7b3e..9204f2db3 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -40,6 +40,14 @@ }, "MediaQueryListListener": null, "MSStreamReader": null, + "Screen": { + "methods": { + "method": { + "msLockOrientation": null, + "msUnlockOrientation": null + } + } + }, "StorageEvent": { "methods": { "method": { @@ -93,4 +101,4 @@ "new-type": "ArrayBufferView" }] } -} \ No newline at end of file +}