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
HTML List works #1 #1524
HTML List works #1 #1524
Changes from all commits
File filter...
Jump to…
| @@ -51,22 +51,25 @@ thead, tbody, | ||
| s, strike, del { text-decoration: line-through } | ||
| hr { border: 1px inset } | ||
|
|
||
| /* lists */ | ||
| dd { display: block; margin-left: 40px } | ||
| p, dl, multicol { display: block; margin: 1em 0 } | ||
| ul { display: block; list-style-type: disc; | ||
| margin: 1em 0; padding-left: 40px } | ||
|
|
||
| ol { display: block; list-style-type: decimal; | ||
| margin: 1em 0; padding-left: 40px } | ||
| p { display: block; margin: 1em 0 } | ||
|
|
||
| /* 14.3.8 Lists : http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#lists */ | ||
| dd, dl, dt, ol, ul { display: block; } | ||
| li { display: list-item } | ||
|
|
||
| dl, ol, ul { margin-top: 1em; margin-bottom: 1em; } | ||
|
|
||
| /* nested lists have no top/bottom margins */ | ||
| ul ul, ul ol, ul dl, | ||
| ol ul, ol ol, ol dl, | ||
| dl ul, dl ol, dl dl { margin-top: 0; margin-bottom: 0 } | ||
|
|
||
| dd { margin-left: 40px; } /* LTR-specific: use 'margin-right' for rtl elements */ | ||
| ol, ul { padding-left: 40px; } /* LTR-specific: use 'padding-right' for rtl elements */ | ||
|
|
||
| ol { list-style-type: decimal; } | ||
| ul { list-style-type: disc; } | ||
|
|
||
| /* 2 deep unordered lists use a circle */ | ||
| ol ul, ul ul { list-style-type: circle; } | ||
|
|
||
| @@ -75,14 +78,14 @@ ol ol ul, ol ul ul, | ||
| ul ol ul, ul ul ul { list-style-type: square; } | ||
|
|
||
| /* The type attribute on ol and ul elements */ | ||
| ul[type="disc"] { list-style-type: disc; } | ||
| ul[type="circle"] { list-style-type: circle; } | ||
| ul[type="square"] { list-style-type: square; } | ||
| ol[type="1"] { list-style-type: decimal; } | ||
| ol[type="a"] { list-style-type: lower-alpha; } | ||
| ol[type="A"] { list-style-type: upper-alpha; } | ||
| ol[type="i"] { list-style-type: lower-roman; } | ||
| ol[type="I"] { list-style-type: upper-roman; } | ||
| ol[type="1"], li[type="1"] { list-style-type: decimal; } | ||
recrack
Contributor
|
||
| ol[type="a"], li[type="a"] { list-style-type: lower-alpha; } | ||
| ol[type="A"], li[type="A"] { list-style-type: upper-alpha; } | ||
| ol[type="i"], li[type="i"] { list-style-type: lower-roman; } | ||
| ol[type="I"], li[type="I"] { list-style-type: upper-roman; } | ||
| ul[type="disc"], li[type="disc"] { list-style-type: disc; } | ||
| ul[type="circle"], li[type="circle"] { list-style-type: circle; } | ||
| ul[type="square"], li[type="square"] { list-style-type: square; } | ||
|
|
||
| u, ins { text-decoration: underline } | ||
| br:before { content: "\A"; white-space: pre-line } | ||
| @@ -120,6 +120,10 @@ impl BlockFlow { | ||
| self.float.is_some() | ||
| } | ||
|
|
||
| pub fn is_list(&self) -> bool { | ||
| self.base.listdata.is_some() | ||
| } | ||
|
|
||
| pub fn teardown(&mut self) { | ||
| for box_ in self.box_.iter() { | ||
| box_.teardown(); | ||
| @@ -492,27 +496,41 @@ impl BlockFlow { | ||
| box_.position.set(position); | ||
| } | ||
|
|
||
| /// wrapper of build_display_list. For switching to html list. | ||
| pub fn build_display_list_wrapper<E:ExtraDisplayListData>( | ||
metajack
Contributor
|
||
| &self, | ||
| builder: &DisplayListBuilder, | ||
| dirty: &Rect<Au>, | ||
| offset: Point2D<Au>, | ||
| flow: &Flow, | ||
| list: &RefCell<DisplayList<E>>) { | ||
| if self.is_list() { | ||
| for box_ in self.box_.iter() { | ||
| box_.add_marker_to_display_list(builder, dirty, flow, list) | ||
| } | ||
| } | ||
|
|
||
| // add box that starts block context | ||
| for box_ in self.box_.iter() { | ||
| box_.build_display_list(builder, dirty, offset, flow, list) | ||
| } | ||
| } | ||
|
|
||
| pub fn build_display_list_block<E:ExtraDisplayListData>( | ||
| &mut self, | ||
| builder: &DisplayListBuilder, | ||
| dirty: &Rect<Au>, | ||
| list: &RefCell<DisplayList<E>>) | ||
| -> bool { | ||
| if self.is_float() { | ||
| return self.build_display_list_float(builder, dirty, list); | ||
| } | ||
|
|
||
| let abs_rect = Rect(self.base.abs_position, self.base.position.size); | ||
| if !abs_rect.intersects(dirty) { | ||
| return true; | ||
| } | ||
|
|
||
| debug!("build_display_list_block: adding display element"); | ||
|
|
||
| // add box that starts block context | ||
| for box_ in self.box_.iter() { | ||
| box_.build_display_list(builder, dirty, self.base.abs_position, (&*self) as &Flow, list) | ||
| } | ||
| self.build_display_list_wrapper(builder, dirty, self.base.abs_position, (&*self) as &Flow, list); | ||
|
|
||
| // TODO: handle any out-of-flow elements | ||
| let this_position = self.base.abs_position; | ||
|
|
||
| @@ -536,11 +554,8 @@ impl BlockFlow { | ||
| } | ||
|
|
||
| let offset = self.base.abs_position + self.float.get_ref().rel_pos; | ||
| // add box that starts block context | ||
| for box_ in self.box_.iter() { | ||
| box_.build_display_list(builder, dirty, offset, (&*self) as &Flow, list) | ||
| } | ||
|
|
||
|
|
||
| self.build_display_list_wrapper(builder, dirty, offset, (&*self) as &Flow, list); | ||
|
|
||
| // TODO: handle any out-of-flow elements | ||
|
|
||
This is wrong.
<li>elements do not have thistypeattribute. Only<ol>does.