Bug 24571

Summary: Element is visible even if backface-visibility is 'hidden' and the back is facing towards the viewer.
Product: WebKit Reporter: Kim Grönholm <kim.1.gronholm>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: cabel, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Test case for backface visibility
none
Patch to enable backface visibility property to have effect simon.fraser: review-

Description Kim Grönholm 2009-03-13 04:05:45 PDT
Element is visible even if backface-visibility is 'hidden' and the back is facing towards the viewer.
Comment 1 Kim Grönholm 2009-03-13 04:07:54 PDT
Created attachment 28574 [details]
Test case for backface visibility

A simple test case for -webkit-backface-visibility property
Comment 2 Kim Grönholm 2009-03-13 04:10:11 PDT
Created attachment 28575 [details]
Patch to enable backface visibility property to have effect

This small patch enables -webkit-backface-visibility CSS property to have effect and fixes the test case.
Comment 3 Simon Fraser (smfr) 2009-03-13 08:22:49 PDT
backface-visibility isn't supported unless you have rendering that supports 3d transforms.

The fix is also incorrect, because you need to compute a transform relative to the root, and not just the container.
Comment 4 Simon Fraser (smfr) 2009-03-13 08:24:04 PDT
Comment on attachment 28575 [details]
Patch to enable backface visibility property to have effect

> Index: WebCore/rendering/RenderLayer.cpp
> ===================================================================
> --- WebCore/rendering/RenderLayer.cpp	(revision 41663)
> +++ WebCore/rendering/RenderLayer.cpp	(working copy)
> @@ -1955,6 +1955,12 @@ RenderLayer::paintLayer(RenderLayer* roo
>          TransformationMatrix transform;
>          transform.translate(x, y);
>          transform = *m_transform * transform;
> +
> +        // Don't paint anything if backface-visibility is 'hidden' and the back is facing towards the viewer.
> +        if (renderer()->style()->backfaceVisibility() == BackfaceVisibilityHidden) {
> +            if (transform.inverse().m33() < 0)
> +            return;
> +        }

This is wrong; backface-visibility has to take into account the transform to the root, not just the parent layer. It really needs to be implemented by the GraphicsLayer machinery.
Comment 5 Simon Fraser (smfr) 2009-05-27 13:43:33 PDT
backface-visibility is only supported when ACCELERATED_COMPOSITING is enabled, and in that situation it works.

If you have a 3d rendering path that does not rely on ACCELERATED_COMPOSITING, then it presumably requires a bunch of extra changes which would also need to be committed.
Comment 6 Simon Fraser (smfr) 2010-04-13 17:55:29 PDT
*** Bug 37460 has been marked as a duplicate of this bug. ***