Giter Site home page Giter Site logo

googlechromelabs / feature-policy-demos Goto Github PK

View Code? Open in Web Editor NEW
24.0 9.0 13.0 32.86 MB

Feature Policy Kitchen Sink Demos

Home Page: https://feature-policy-demos.appspot.com/

License: Apache License 2.0

JavaScript 29.70% HTML 60.68% CSS 9.62%
demos feature-policy performance web

feature-policy-demos's Introduction

Permissions Policy and Document Policy Demos

Kitchen sink of Permissions Policy and Document Policy demos.

Development

First install the dependencies:

npm i

Then run the web server:

npm run start

Deployment

npm run deploy

feature-policy-demos's People

Contributors

adamchainz avatar beaufortfrancois avatar dependabot[bot] avatar ebidel avatar ehsan-karamad avatar huchenlei avatar jeffposnick avatar jpchase avatar loonybear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feature-policy-demos's Issues

Clarify unsized-media comments

I was looking at the page for unsized-media and found it a little bit confusing.

Click the disallow/allow buttons above to see how the page loads with the policy on and off. When the policy is on, you won't see layout thrashing as large images load. Media without explicit sizes (either as HTML attributes ore defined in CSS) causes layout and text reflows as the page loads.

Could this be written more precisely as this?:

Click the disallow/allow buttons above to see how the page loads with the policy on and off. When the policy is on, you won't see layout thrashing as large images load. When the policy is off, media without explicit sizes (either as HTML attributes or defined in CSS) causes layout and text reflows as the page loads.


<!--
When both dimension are specified, unsized-media has no effect. The image will
be sized to the specified dimensions and no re-layout will occur.
-->
<img src="https://picsum.photos/1200/700/?random" width="100%" height="300">

Should the height on this picture be set to 700 instead of 300? It shows up as being distorted.


When no dimensions are specified (either via style attr, width/height attr, or class):
1. unsized-media on: image/video will have an intrinsic size. Causes re-layout.
2. unsized-media off: image/video will have a default size of 300x150. No re-layout.

When one dimension is specified (via a class, width="200", style="width:200px").
1. unsized-media off: image/video will be one of the specified dimension
   and the intrinsic ratio. Causes a re-layout.
2. unsized-media on: image/video will be one of the default dimensions (300x150)
   and the specified dimension. No re-layout.

When both dimension are specified, unsized-media has no effect. The image will
be sized to the specified dimensions and no re-layout will occur.

In the docs these two lists seem to contradict each other, I think the second list should have the off/on switched?


One of the goals of this page (I think?) is to show the distorting effect of this feature policy if you don't set width/height correctly. It could be good to explicitly call that out in the page, otherwise people may come away from looking at this page with the impression "unsized-media, that's the one that skews all my images".

Oversized-images demo not working anymore

Hi there!

Two months ago, I was able to get this demo working on my Chrome browser. It is not the case anymore.

Chrome version: 83.0
Experimental Web Platform features: enable
Experimental Productivity Features: enable (as explained here)
Browser restarted after flags change.
I've also tried adding a Feature-Policy header with the ModHeader extension.

Nothing happens, all images are visible in the demo. Was this Feature-Policy removed from Chrome?

Sample page for `vertical-scroll`.

For vertical-scroll demo, (similar to other policies) a sample html page is loaded inside an <iframe> where the feature itself is enabled/disabled. This is a bit limiting in demonstrating a feature such as vertical-scroll where for proper illustration, the actual <iframe> should be scrollable in its parent. Essentially with the new changes to vertical-scroll policy, when a frame is disabled it will not consume any scroll gestures. With the current demo it leads to the whole page appearing as unscrollable which is in fact only because the <iframe> containing vertical-scroll.html was not scrollable to begin with.

I think setting up for a new feature for demo-ing should involve an optional step to configure the embedding page as well. Perhaps in updatePage we could check if policy requires further tuning (although putting raw code in policy.json which is where all the feature related information coming from might not be a good idea)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.