[webkit-dev] enhancement - html hole element
simon.fraser at apple.com
Thu Sep 18 12:07:23 PDT 2014
On Sep 18, 2014, at 9:22 AM, Julien Isorce <j.isorce at samsung.com> wrote:
> A typical scenario when running WebKit in an embedded environment like a TV or STB is to "punch through" graphics to the video plane.
> At Samsung Research UK we have developed a new <hole> element that acts much like a <canvas> to
> - Expose a rectangular "hole" in a web page.
> We realise that there is currently no W3 specification for this element, but since our solution works we wanted to open the discussion to see if there is any wider interest, and if there is, to start the process of drafting a specification. Some details:
> - Principle:
> A hole is a rectangular area that behaves pretty much like a canvas, but everything in its area is transparent.
> Every layer behind the hole is transparent in this rectangle.
> - Use case:
> On TV this is useful to see the channel displayed behind the browser. Retrieving the hole's position and size
> This use case applies in many interactive TV applications, so it could be useful for a lot of people.
> - Interfaces:
> We have defined a new tag <hole> which is similar to the <canvas> tag.
> We have defined a "geometrychanged" JS event which is sent when the hole dimensions change.
> This event contains the hole width, height and position in screen coordinates.
> - Hole in canvas:
> A hole tag has been defined to be less intrusive and having the feature in separate places in the code.
> But we now think it may be better to actually put the "hole" capabilities under the canvas.
> For example <canvas style="background:hole;">
> Note that setting it as transparent is not enough to have a hole as the layers behind the canvas won't be necessarily transparent, and not only in its area.
> The whole point of the hole capability is to make transparent every layers behind the hole and only in a specific rectangle.
> - Next steps:
> I would be very interested to hear if there are any other developers who need this functionality. If so, let's discuss the best way to share it, or possibly do it a better way.
> Comments are welcome.
I don’t think it’s appropriate to add <hole> to WebKit.
<hole> is really just adapting to a limitation of the platform’s compositing architecture. More powerful hardware like computers and smartphones are able to composite video above and below web content, which is achieved in WebCore via the accelerated compositing code path. I don’t think it’s appropriate to burden the platform with an element that only applies on power-limited hardware.
The right solution for a WebKit implementation would be to solve this via the accelerated composting code. Just use a <video> or <object> in your markup, then implement the hole-punching via the GraphicsLayer subsystem.
More information about the webkit-dev