惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News | PayPal Newsroom
Application and Cybersecurity Blog
Application and Cybersecurity Blog
O
OpenAI News
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Latest news
Latest news
NISL@THU
NISL@THU
S
Security Affairs
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
AI
AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AWS News Blog
AWS News Blog
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
I
InfoQ
Schneier on Security
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
IT之家
IT之家
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
News and Events Feed by Topic
L
LINUX DO - 最新话题
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
H
Heimdal Security Blog
S
SegmentFault 最新的问题

Recent Commits to visual-viewport:gh-pages

archive this repo · WICG/visual-viewport@03de238 Viewport Segments: Fix mitigation by removing the focused area one (#88) · WICG/visual-viewport@ce02d5d Update Viewport Segments explainer. (#86) Add Security and Privacy self assessment for the viewport segments pr… Update link to draft spec · WICG/visual-viewport@44deaba Improve CG report metadata Link to fire an event definition · WICG/visual-viewport@74efebe Add definition of visual and layout viewports Minor editorial clean-ups · WICG/visual-viewport@0317366 Specify resize and scroll event ordering (#80) Code update · WICG/visual-viewport@ffb31ee Update JS example Update with previous changes Fix markdown links · WICG/visual-viewport@56af3e0 Address Daniel's changes Update README with segments explainer · WICG/visual-viewport@fb277c9 Update image path Add segments-explainer Merge pull request #77 from dlibby-/dlibby-segments-typo · WICG/visual-viewport@9d2419c
[Viewport Segments] Cleanup the existing explainer. · WICG/visual-viewport@8948a2a
darktears · 2025-05-01 · via Recent Commits to visual-viewport:gh-pages

@@ -12,13 +12,16 @@ Previously:

1212

| Name | Link |

1313

|------|------|

1414

| Device Posture API | [Explainer](https://github.com/w3c/device-posture), [Working Draft Spec](https://www.w3.org/TR/device-posture/) |

15+

| CSS Viewport Segments APIs | [Explainer](hhttps://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Foldables/explainer.md), [Media Queries Draft Spec](https://www.w3.org/TR/mediaqueries-5/#mf-horizontal-viewport-segments) and [Environment Variables Draft Spec](https://drafts.csswg.org/css-env-1/#viewport-segments)

1516

| Multi-Screen Window Placement API | [Explainer](https://github.com/webscreens/window-placement/blob/master/EXPLAINER.md), [Draft Community Group Report](https://webscreens.github.io/window-placement/) |

16-

| Visual Viewport API | [Draft CSSOM View Spec](https://drafts.csswg.org/cssom-view/#visualViewport), [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Visual_Viewport_API) |

17+

| Viewport API | [Draft CSSOM View Spec](https://drafts.csswg.org/css-viewport/)|

17181819

## Motivation:

1920

Web developers targeting foldable devices want to be able to effectively lay out the content in a window that spans multiple displays or across the fold of device with a foldable screen. However, the web platform does not yet provide the necessary primitives for building layouts that are optimized for foldable experiences.

2021

Developers may be able to solve this by taking a hard dependency on a specific device hardware parameters - an approach that is fragile, not scalable, and requires work duplication for each new device.

212223+

This API share the same goals and return the same information as the CSS Viewport Segments APIs linked above. It provides a convenient way for content author to access the information without relying on CSS.

24+2225

### Current problems:

2326

More specific challenges we've heard from our internal product teams that were exploring building experiences for this emerging classes of devices include:

2427

@@ -53,12 +56,12 @@ We propose a new concept of Viewport Segments, which represent the regions of th

5356

This proposal is primarily aimed at reactive scenarios, where an application wants to take advantage of the fact that it spans multiple displays, by virtue of the user/window manager placing it in that state. It is not designed for scenarios of proactively placing content in a separate top-level browsing context on the various displays available (this would fall under the [Window Placement API](https://github.com/webscreens/window-placement/blob/master/EXPLAINER.md) or [Presentation API](https://w3c.github.io/presentation-api/)). Note that given the [Screen Enumeration API](https://github.com/webscreens/screen-enumeration/blob/master/EXPLAINER.md) and existing primitives on the Web, it is possible to write JavaScript code that intersects the rectangles of the Display and window, while taking into account devicePixelRatio in order to compute the interesting layout regions of a window spanned across displays. However this may not correctly handle corner cases of future device form factors, and thus this proposal tries to centralize access to "here are the interesting parts of the screen a developer can target or consider for presenting content" as a practical starting point.

54575558

```

56-

interface VisualViewport : EventTarget {

59+

interface Viewport : EventTarget {

5760

readonly attribute FrozenArray<DOMRect> segments;

5861

}

5962

```

606361-

The value returned from querying `visualViewport.segments` will be an array of DOMRects and based on the data returned for each "viewport segment", developers will be able to infer the number of hinges available as well as the hinge orientation. When `visualViewport.segments` is queried on a device with only a single segment, this will return `null`. This isn't exposed in this case because this information is redundant with other fields on VisualViewport. This also avoids future compatibility issues so that authors don't start using `visualViewport.segments[0]` to target single-screen devices.

64+

The value returned from querying `viewport.segments` will be an array of DOMRects and based on the data returned for each "viewport segment", developers will be able to infer the number of hinges available as well as the hinge orientation. When `viewport.segments` is queried on a device with only a single segment, this will return an array of one element representing the viewport size.

62656366

A user may at any point take the browser window out of spanning mode and place it on one of the screens or vice-versa, in those cases the window resize event will fire and authors can query and get the number of available viewport segments.

6467

@@ -104,7 +107,7 @@ Let's take a look at a few practical examples of the scenarios above and how vie

104107

#### JavaScript solution outline:

105108106109

```js

107-

const segments = window.visualViewport.segments;

110+

const segments = window.viewport.segments;

108111109112

if (segments && segments.length > 1) {

110113

// now we know the device is a foldable

@@ -128,7 +131,7 @@ Additionally, there are a number of new [environment variables](https://drafts.c

128131129132

```js

130133

window.onresize = function() {

131-

const segments = window.visualViewport.segments;

134+

const segments = window.viewport.segments;

132135

if (segments && segments.length > 1) {

133136

// Make changes two split content into the segments.

134137

} else {