mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #9841 - glennw:extra-overflow, r=pcwalton
Fix unexpected overflow with overflow: hidden set. Fixes #9719. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9841) <!-- Reviewable:end -->
This commit is contained in:
commit
3ff5082798
2 changed files with 40 additions and 1 deletions
|
@ -47,7 +47,7 @@ use std::slice::IterMut;
|
|||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
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::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::{self, ComputedValues};
|
||||
|
@ -271,11 +271,43 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
FlowClass::TableCell => {
|
||||
// FIXME(#2795): Get the real container size.
|
||||
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() {
|
||||
let mut kid_overflow = base(kid).overflow;
|
||||
let kid_position = base(kid).position.to_physical(base(kid).writing_mode,
|
||||
container_size);
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
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