Bug 24571 - Element is visible even if backface-visibility is 'hidden' and the back is facing towards the viewer.
Summary: Element is visible even if backface-visibility is 'hidden' and the back is fa...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 37460 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-13 04:05 PDT by Kim Grönholm
Modified: 2010-04-13 17:55 PDT (History)
2 users (show)

See Also:


Attachments
Test case for backface visibility (470 bytes, text/html)
2009-03-13 04:07 PDT, Kim Grönholm
no flags Details
Patch to enable backface visibility property to have effect (1.29 KB, patch)
2009-03-13 04:10 PDT, Kim Grönholm
simon.fraser: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***