Closed Bug 1119117 Opened 10 years ago Closed 10 years ago

'opacity' elements clipped by overflow:hidden clip descendants which should not be clipped

Categories

(Core :: Layout, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: roc, Assigned: roc)

Details

Attachments

(2 files)

Attached file testcase (deleted) —
The attached testcase should be opacity:0.5 blue, and it is in Blink, but in Gecko it's blank.

d2's nsDisplayOpacity gets a clip set it on it from d1, because d1 is the containing block for d2. So the entire opacity group, including d3, gets clipped. But d1 is not a containing block ancestor of d3, so d3 should not be clipped.

The solution is probably to just not clip nsDisplayOpacity in BuildDisplayListForStackingContext. Instead we should let the current clip be passed down to the descendant display items.

Note that the same problem occurs for filters and mix-blend-mode, but in those cases the correct rendering is unclear (in fact, both Gecko and Chrome clip d3 in the filters case). I've requested spec feedback in http://lists.w3.org/Archives/Public/public-fx/2015JanMar/0002.html, and the results of that feedback will determine how we handle those features. In the meantime we should definitely fix opacity.
Attachment #8546538 - Flags: review?(matt.woodrow) → review+
The failing test is an async-scrolled DIV containing an opacity:0.5 element with two yellow children, one abs-pos, one not. ScrollFrameHelper::ComputeFrameMetrics computes a cliprect which we apply to the ContainerLayer for the opacity:0.5 element, reintroducing this bug.

As the comment in ContainerState::SetupScrollingMetadata says, when a ContainerLayer has a child layer whose animated geometry root is not a descendant of the ContainerLayer's animated geometry root, async scrolling does not work currently. That would be a lot of work to fix. That's the situation we're in here, though it's worse, because instead of just scrolling lagging, a chunk of an element is being incorrectly clipped out.

Avoiding this problem looks hard. We must have a single ContainerLayer for the opacity:0.5 element because the contents must be blended as a group. If we avoid putting a cliprect on that ContainerLayer (following the approach taken for the display item in the patch in this bug), we'll have to clip the child layers, but then those clips will be affected by the async scrolling transform. So this is complicated to fix and even then won't work well.

I think I'll just mark this test as failing for now. It's only passing on trunk because the non-async-scroll reference rendering is incorrect. This patch fixes the reference to render correctly, causing the test to fail.
https://hg.mozilla.org/mozilla-central/rev/ebb112ced42c
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
QA Whiteboard: [good first verify]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: