Comments (2)
Setting width/height or attempting to read the bitmap of a detached OffscreenCanvas are programming errors IMHO. I am pretty sure throwing an InvalidState exception is the right thing to do in almost all cases.
For the placeholder situation, could you clarify what the problematic use case is? Setting the width or height on a placeholder canvas (i.e. after calling transferControlToOffscreen) is supposed to be a no-op. Spec'ed here: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-placeholder
As far as the spec is concerned, the placeholder canvas does not store a reference to the OffscreenCanvas that controls it (though implementations may have an internal reference that has no impact on API behavior). The only reference that is prescribed by the spec is in the other direction: the OffscreenCanvas has an optional weak reference to a placeholder canvas. The canvas element knows that it is being controlled by an offscreen canvas via its context mode
, which may be set to placeholder
, but it does not hold a reference to the actual OffscreenCanvas. There is no data flow from the placeholder to the OffscreenCanvas; data only flows in the other direction. This unidirectionality makes it trivial to ensure that the spec is free of signals that would be vulnerable to deadlocks or feedback loops.
from html.
Setting width/height or attempting to read the bitmap of a detached OffscreenCanvas are programming errors IMHO. I am pretty sure throwing an InvalidState exception is the right thing to do in almost all cases.
Agreed, I'll take it as a Chrome position and will try to prepare a PR to that effect when I get time.
For the placeholder situation, could you clarify what the problematic use case is?
I was only talking about the relation OffscreenCanvas => placeholder<canvas>
. I simply noticed that the OffscreenCanvas
's placeholder canvas element isn't unset in the transfer steps and since the width
and height
setters aren't defined (yet) for when context mode is detached
what happens to the placeholder canvas is also unspecced.
But I now see that even the context mode: none
has some small interop issues with placeholder canvases, and the specs seem unclear here too. See this fiddle where we can see that Safari does resize the placeholder canvas even when there is no context on the OffscreenCanvas, while Firefox will wait until the context is created and Chrome until there is actual drawings on the context. All the specs say is that commit()
was supposed to be updating the placeholder size, which is going to be replaced by "update the rendering".
from html.
Related Issues (20)
- Dark mode of HTML Spec does not render dark backgrounds for some dl elements HOT 1
- Proposal: Implement new method for parsing markup from `Fetch` responses HOT 4
- Allowing UA to do <source> selection for media element HOT 24
- Ergonomic way to move data between workers HOT 9
- img sizes="auto" skewing images using object-fit: contain HOT 8
- Ability to disable images loading, to customise when they load with scripting HOT 1
- Three-valued Button state (type=three-valued) of the type attribute of the input element HOT 3
- Three-valued Button state (type=three-valued) of the type attribute of the input element
- Labeled control when moving the mouse around is inconsistent accross UAs HOT 1
- Should showPicker() consume user activation? HOT 5
- navigationType in apply the history step used without a null check HOT 1
- Scrolling when near the edge of the viewport while dragging HOT 3
- Ability to configure whether script elements should execute for setHTMLUnsafe()
- `html` end tag omission HOT 3
- Navigation: Clarification on `ever populated` flag of DocumentState during apply the history step HOT 3
- Upcoming WHATNOT meeting on 2/8/2024 HOT 2
- Should dir=auto with no strong characters inherit directionality from parent or be ltr? HOT 10
- Navigation: DocumentState request referrer is not set for about:srcdoc
- `<callout>` element for callouts/alerts/admonitions HOT 35
- Proposal: HTML Attribute to state non-consent when scraping for training datasets HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html.