Skip to content
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

Handle nested transforms and clips when the transform consists solely of a translation. #251

Merged
merged 1 commit into from Mar 29, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Handle nested transforms and clips when the transform consists solely of

a translation.

This is a partial fix for the underlying issue, sufficient to address
servo/servo#10164.
  • Loading branch information
pcwalton committed Mar 29, 2016
commit f0ab448db76385669c2a26c098e60250e378541e
@@ -65,7 +65,14 @@ impl NodeCompiler for AABBTreeNode {
let StackingContextIndex(stacking_context_id) = draw_list.stacking_context_index.unwrap();
let context = &stacking_context_info[stacking_context_id];

builder.set_current_clip_rect_offset(context.offset_from_layer);
// FIXME(pcwalton): This is a not-great partial solution to servo/servo#10164.
// A better solution would be to do this only if the transform consists of a
// translation+scale only and fall back to stenciling if the object has a more
// complex transform.
let offset_from_layer = context.transform
.invert()
.transform_point(&context.offset_from_layer);
builder.set_current_clip_rect_offset(offset_from_layer);

for index in &draw_list_index_buffer.indices {
let DrawListItemIndex(index) = *index;
@@ -0,0 +1,19 @@
<style>
.red {
width: 200px;
height: 200px;
overflow: hidden;
transform: scale(0.5);
background: red;
}
.green {
height: 100px;
width: 200px;
transform: translateX(-100px);
background-color: green;
}
</style>

<div class="red">
<div class="green"></div>
</div>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.