mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
parent
de7c67575e
commit
ff831bb478
2 changed files with 40 additions and 1 deletions
|
@ -47,7 +47,7 @@ use std::slice::IterMut;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use std::{fmt, mem, raw};
|
use std::{fmt, mem, raw};
|
||||||
use style::computed_values::{clear, display, empty_cells, float, position, text_align};
|
use style::computed_values::{clear, display, empty_cells, float, position, overflow_x, text_align};
|
||||||
use style::dom::TRestyleDamage;
|
use style::dom::TRestyleDamage;
|
||||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||||
use style::properties::{self, ComputedValues};
|
use style::properties::{self, ComputedValues};
|
||||||
|
@ -271,11 +271,43 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
||||||
FlowClass::TableCell => {
|
FlowClass::TableCell => {
|
||||||
// FIXME(#2795): Get the real container size.
|
// FIXME(#2795): Get the real container size.
|
||||||
let container_size = Size2D::zero();
|
let container_size = Size2D::zero();
|
||||||
|
|
||||||
|
let overflow_x = self.as_block().fragment.style.get_box().overflow_x;
|
||||||
|
let overflow_y = self.as_block().fragment.style.get_box().overflow_y;
|
||||||
|
|
||||||
for kid in mut_base(self).children.iter_mut() {
|
for kid in mut_base(self).children.iter_mut() {
|
||||||
let mut kid_overflow = base(kid).overflow;
|
let mut kid_overflow = base(kid).overflow;
|
||||||
let kid_position = base(kid).position.to_physical(base(kid).writing_mode,
|
let kid_position = base(kid).position.to_physical(base(kid).writing_mode,
|
||||||
container_size);
|
container_size);
|
||||||
kid_overflow.translate(&kid_position.origin);
|
kid_overflow.translate(&kid_position.origin);
|
||||||
|
|
||||||
|
// If the overflow for this flow is hidden on a given axis, just
|
||||||
|
// put the existing overflow in the kid rect, so that the union
|
||||||
|
// has no effect on this axis.
|
||||||
|
match overflow_x {
|
||||||
|
overflow_x::T::hidden => {
|
||||||
|
kid_overflow.paint.origin.x = overflow.paint.origin.x;
|
||||||
|
kid_overflow.paint.size.width = overflow.paint.size.width;
|
||||||
|
kid_overflow.scroll.origin.x = overflow.scroll.origin.x;
|
||||||
|
kid_overflow.scroll.size.width = overflow.scroll.size.width;
|
||||||
|
}
|
||||||
|
overflow_x::T::scroll |
|
||||||
|
overflow_x::T::auto |
|
||||||
|
overflow_x::T::visible => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match overflow_y.0 {
|
||||||
|
overflow_x::T::hidden => {
|
||||||
|
kid_overflow.paint.origin.y = overflow.paint.origin.y;
|
||||||
|
kid_overflow.paint.size.height = overflow.paint.size.height;
|
||||||
|
kid_overflow.scroll.origin.y = overflow.scroll.origin.y;
|
||||||
|
kid_overflow.scroll.size.height = overflow.scroll.size.height;
|
||||||
|
}
|
||||||
|
overflow_x::T::scroll |
|
||||||
|
overflow_x::T::auto |
|
||||||
|
overflow_x::T::visible => {}
|
||||||
|
}
|
||||||
|
|
||||||
overflow.union(&kid_overflow)
|
overflow.union(&kid_overflow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
tests/html/overflow-hidden.html
Normal file
7
tests/html/overflow-hidden.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<div style="position: absolute; left: 0px; bottom: 0px; width: 100%; height: 48px; overflow: hidden; background: red;">
|
||||||
|
<!-- vertical overflow -->
|
||||||
|
<span style="display: inline-block; height: 32px; width: 32px; margin: 20px;"></span>
|
||||||
|
<!-- horizontal overflow -->
|
||||||
|
<div style="width: 40px; height: 40px; position: absolute; right: -40px;"></div>
|
||||||
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue