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

推荐订阅源

cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
雷峰网
雷峰网
Recent Announcements
Recent Announcements
月光博客
月光博客
G
Google Developers Blog
腾讯CDC
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
云风的 BLOG
云风的 BLOG
W
WeLiveSecurity
博客园 - 【当耐特】
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 聂微东
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
P
Privacy International News Feed
MyScale Blog
MyScale Blog
K
Kaspersky official blog
T
The Blog of Author Tim Ferriss
Attack and Defense Labs
Attack and Defense Labs
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
aimingoo的专栏
aimingoo的专栏
I
Intezer
Vercel News
Vercel News
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
Netflix TechBlog - Medium
P
Proofpoint News Feed
Latest news
Latest news
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tor Project blog
S
Security Affairs
P
Proofpoint News Feed
博客园 - 三生石上(FineUI控件)
博客园 - Franky
C
Cyber Attacks, Cyber Crime and Cyber Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
美团技术团队
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Security @ Cisco Blogs
L
LINUX DO - 热门话题
Know Your Adversary
Know Your Adversary
Project Zero
Project Zero
D
Docker
L
Lohrmann on Cybersecurity
F
Full Disclosure

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 {