Auto merge of #16597 - Manishearth:stylo-overflow, r=emilio

stylo: support all overflow values

overflow:clip doesn't exist, it's just called clip internally. Renamed, and added the other missing values.

I also removed the overflow newtype -- no need for extra code bloat, and it's not protecting us from much.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16597)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-04-25 15:59:13 -05:00 committed by GitHub
commit cd8af86244
10 changed files with 63 additions and 81 deletions

View file

@ -53,7 +53,7 @@ use servo_geometry::max_rect;
use std::cmp::{max, min};
use std::fmt;
use std::sync::Arc;
use style::computed_values::{border_collapse, box_sizing, display, float, overflow_x, overflow_y};
use style::computed_values::{border_collapse, box_sizing, display, float, overflow_x};
use style::computed_values::{position, text_align};
use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
@ -1440,7 +1440,7 @@ impl BlockFlow {
FormattingContextType::Other
}
_ if style.get_box().overflow_x != overflow_x::T::visible ||
style.get_box().overflow_y != overflow_y::T(overflow_x::T::visible) ||
style.get_box().overflow_y != overflow_x::T::visible ||
style.is_multicol() => {
FormattingContextType::Block
}
@ -1677,7 +1677,7 @@ impl BlockFlow {
pub fn overflow_style_may_require_scroll_root(&self) -> bool {
match (self.fragment.style().get_box().overflow_x,
self.fragment.style().get_box().overflow_y.0) {
self.fragment.style().get_box().overflow_y) {
(overflow_x::T::auto, _) | (overflow_x::T::scroll, _) | (overflow_x::T::hidden, _) |
(_, overflow_x::T::auto) | (_, overflow_x::T::scroll) | (_, overflow_x::T::hidden) =>
true,

View file

@ -2132,7 +2132,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
self.base.overflow.scroll.size.width > content_box.size.width ||
self.base.overflow.scroll.size.height > content_box.size.height ||
overflow_x::T::hidden == self.fragment.style.get_box().overflow_x ||
overflow_x::T::hidden == self.fragment.style.get_box().overflow_y.0;
overflow_x::T::hidden == self.fragment.style.get_box().overflow_y;
self.mark_scrolling_overflow(has_scrolling_overflow);
if !has_scrolling_overflow {
@ -2163,11 +2163,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
content_size.width = content_box.size.width;
}
if overflow_x::T::hidden == self.fragment.style.get_box().overflow_y.0 {
if overflow_x::T::hidden == self.fragment.style.get_box().overflow_y {
content_size.height = content_box.size.height;
}
if overflow_x::T::hidden == self.fragment.style.get_box().overflow_y.0 ||
if overflow_x::T::hidden == self.fragment.style.get_box().overflow_y ||
overflow_x::T::hidden == self.fragment.style.get_box().overflow_x {
preserved_state.push_clip(state, &border_box, self.positioning());
}

View file

@ -276,7 +276,7 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
overflow.scroll.origin.x = Au(0);
overflow.scroll.size.width = border_box.size.width;
}
if overflow_x::T::visible != self.as_block().fragment.style.get_box().overflow_y.0 {
if overflow_x::T::visible != self.as_block().fragment.style.get_box().overflow_y {
overflow.paint.origin.y = Au(0);
overflow.paint.size.height = border_box.size.height;
overflow.scroll.origin.y = Au(0);

View file

@ -2150,7 +2150,7 @@ impl Fragment {
let block_flow = flow.as_block();
let start_margin = block_flow.fragment.margin.block_start;
let end_margin = block_flow.fragment.margin.block_end;
if style.get_box().overflow_y.0 == overflow_x::T::visible {
if style.get_box().overflow_y == overflow_x::T::visible {
if let Some(baseline_offset) = flow.baseline_offset_of_last_line_box_in_flow() {
let ascent = baseline_offset + start_margin;
let space_below_baseline = block_flow.fragment.border_box.size.block -
@ -2491,7 +2491,7 @@ impl Fragment {
match (self.style().get_box().position,
self.style().get_position().z_index,
self.style().get_box().overflow_x,
self.style().get_box().overflow_y.0) {
self.style().get_box().overflow_y) {
(position::T::absolute,
Either::Second(Auto),
overflow_x::T::visible,

View file

@ -885,7 +885,7 @@ pub fn process_node_overflow_request<N: LayoutNode>(requested_node: N) -> NodeOv
let style = &*layout_node.as_element().unwrap().resolved_style();
let style_box = style.get_box();
NodeOverflowResponse(Some((Point2D::new(style_box.overflow_x, style_box.overflow_y.0))))
NodeOverflowResponse(Some((Point2D::new(style_box.overflow_x, style_box.overflow_y))))
}
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)