layout: Support any display property in generated content, and allow

tables to clear floats.

Improves the GitHub header.
This commit is contained in:
Patrick Walton 2014-09-26 13:49:26 -07:00
parent ab17d31bbf
commit 47fc64052c
7 changed files with 99 additions and 50 deletions

View file

@ -45,7 +45,7 @@ use table_cell::TableCellFlow;
use text::TextRunScanner;
use util::{LayoutDataAccess, OpaqueNodeMethods};
use wrapper::{PostorderNodeMutTraversal, TLayoutNode, ThreadSafeLayoutNode};
use wrapper::{Before, BeforeBlock, After, AfterBlock, Normal};
use wrapper::{Before, After, Normal};
use gfx::display_list::OpaqueNode;
use script::dom::element::{HTMLIFrameElementTypeId, HTMLImageElementTypeId};
@ -887,8 +887,9 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
// Pseudo-element.
let style = node.style();
let display = match node.get_pseudo_element_type() {
Normal | Before | After => display::inline,
BeforeBlock | AfterBlock => display::block,
Normal => display::inline,
Before(display) => display,
After(display) => display,
};
(display, style.get_box().float, style.get_box().position)
}
@ -1041,12 +1042,8 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
match &mut *layout_data_ref {
&Some(ref mut layout_data) =>{
match self.get_pseudo_element_type() {
Before | BeforeBlock => {
layout_data.data.before_flow_construction_result = result
},
After | AfterBlock => {
layout_data.data.after_flow_construction_result = result
},
Before(_) => layout_data.data.before_flow_construction_result = result,
After(_) => layout_data.data.after_flow_construction_result = result,
Normal => layout_data.data.flow_construction_result = result,
}
},
@ -1060,11 +1057,11 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
match &mut *layout_data_ref {
&Some(ref mut layout_data) => {
match self.get_pseudo_element_type() {
Before | BeforeBlock => {
Before(_) => {
mem::replace(&mut layout_data.data.before_flow_construction_result,
NoConstructionResult)
}
After | AfterBlock => {
After(_) => {
mem::replace(&mut layout_data.data.after_flow_construction_result,
NoConstructionResult)
}