-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cocoa WebView rendering / interactivity issues (video/audio), setWantsLayer vs. CSS 3D trick #21
Comments
See: 71fb04c |
(note: above description updated) |
…s a workaround for the fixed layout scaled rendering (CSS transform), see readium/SDKLauncher-OSX#21
Ah, I figured-out a pure-CSS trick to work around the WebView rendering / clipping bug. Basically, the scaling mechanism for fixed-layout documents has to apply to the HTML document itself, so that its full composited surface area is picked-up by Cocoa / NSView. Because this is a CSS transform, it does not affect the computed CSS dimensions of wrapper div and iframe, so it works just as in the normal case (no side effects / regression bugs in coordinate /size computations, and the visual result is the same). Caveat: authored HTML documents may originally contain a CSS transform on the root html element, in which case it gets overridden by Readium's own (but, because this edge-case is unlikely to occur, I think it is a perfectly acceptable trade-off). |
Although the fix referred-to above works fine for general rendering (including rich CSS animations), there may still be occasional issues with audio/video. See #22 |
I just tested with my SmokeTest files and it looks good. Will also run through the relevant EPUB Test Suite files next. |
Fixed layout issue only.
Problem: without Cocoa-NSView-setWantsLayer and CSS-3D (-webkit-transform: translateZ(0)), OSX-WebView renders the iframe contents partially (top-left corner only, rectangular surface area equivalent to the percentage of the transform-scale applied to the "scaler" div (iframe parent element)). The HTML inspector reveals that the content actually exists (text can be selected with the mouse, etc.), but somehow it does not get composited by the WebView / Cocoa rendering pipeline.
With setWantsLayer applied to the NSView control (either the WebView itself, or its superview), there are some improvements but not across the board (i.e. not with every FXL titles) For example, highly-graphical content that makes use of CSS animations (sprites, etc.) fails to render correctly. Sometimes, pages are blank (white empty background), yet the HTML/CSS inspector shows that the tree is rendered correctly in the backstore, just not flushed correctly in the display layer.
With CSS-3D applied to the iframe or its parent element, there are no display issues (i.e. no "invisible" or cropped content), but unfortunately there are nasty side effects, such as broken HTML5 audio/video interactivity, lack of text selection, jagged font rendering.
The text was updated successfully, but these errors were encountered: