From d78e1099278cf8b8117103555bd98f230bf82587 Mon Sep 17 00:00:00 2001 From: Junyoung Cho Date: Wed, 28 Aug 2013 18:57:06 +0900 Subject: [PATCH 1/3] Paint background-color in text box --- src/components/main/layout/box.rs | 4 ++++ src/test/html/inline_bg_color_simple.html | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/test/html/inline_bg_color_simple.html diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index 844e37954f5..a8e5177a155 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -599,6 +599,10 @@ impl RenderBox { match *self { UnscannedTextRenderBoxClass(*) => fail!(~"Shouldn't see unscanned boxes here."), TextRenderBoxClass(text_box) => { + + // Add the background to the list, if applicable. + self.paint_background_if_applicable(list, &absolute_box_bounds); + let nearest_ancestor_element = self.nearest_ancestor_element(); let color = nearest_ancestor_element.style().color().to_gfx_color(); diff --git a/src/test/html/inline_bg_color_simple.html b/src/test/html/inline_bg_color_simple.html new file mode 100644 index 00000000000..5f145e64e96 --- /dev/null +++ b/src/test/html/inline_bg_color_simple.html @@ -0,0 +1,11 @@ + + + + [block background color test] +

paragraph yellow

+ + [inline background color test] + span bluetexttexttextspan yellownested-span redtest finishes + + + From 93fba253a24b6b3d201c8f944088c150b205c603 Mon Sep 17 00:00:00 2001 From: Yusuke Suzuki Date: Fri, 30 Aug 2013 08:27:49 +0900 Subject: [PATCH 2/3] Implement IDL based HTMLSmallElement binding --- src/components/script/dom/bindings/node.rs | 1 - src/components/script/dom/element.rs | 7 ------- src/components/script/html/hubbub_html_parser.rs | 2 +- src/test/html/test_bindings.html | 1 + src/test/html/test_bindings.js | 2 +- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/components/script/dom/bindings/node.rs b/src/components/script/dom/bindings/node.rs index 6a7fee87288..ffd072493d9 100644 --- a/src/components/script/dom/bindings/node.rs +++ b/src/components/script/dom/bindings/node.rs @@ -129,7 +129,6 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode) -> *JSObject ElementNodeTypeId(HTMLTitleElementTypeId) => generate_element!(HTMLTitleElement), ElementNodeTypeId(HTMLUListElementTypeId) => generate_element!(HTMLUListElement), ElementNodeTypeId(HTMLUnknownElementTypeId) => generate_element!(HTMLUnknownElement), - ElementNodeTypeId(_) => element::create(cx, node).ptr, CommentNodeTypeId => generate_element!(Comment), DoctypeNodeTypeId => generate_element!(DocumentType), TextNodeTypeId => generate_element!(Text) diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 5ebfe1503cb..a2abbf47774 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -91,7 +91,6 @@ pub enum ElementTypeId { HTMLQuoteElementTypeId, HTMLScriptElementTypeId, HTMLSelectElementTypeId, - HTMLSmallElementTypeId, HTMLSourceElementTypeId, HTMLSpanElementTypeId, HTMLStyleElementTypeId, @@ -108,12 +107,6 @@ pub enum ElementTypeId { HTMLUnknownElementTypeId, } -// -// Regular old elements -// - -pub struct HTMLSmallElement { parent: HTMLElement } - // // Element methods // diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 75882950351..081c6a1ba25 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -225,7 +225,6 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode handle_element!(cx, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []); handle_element!(cx, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []); handle_element!(cx, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []); - handle_element!(cx, tag, "small", HTMLSmallElementTypeId, HTMLSmallElement, []); handle_element!(cx, tag, "source", HTMLSourceElementTypeId, HTMLSourceElement, []); handle_element!(cx, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []); handle_element!(cx, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []); @@ -256,6 +255,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode handle_htmlelement!(cx, tag, "b", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, tag, "i", HTMLElementTypeId, HTMLElement); handle_htmlelement!(cx, tag, "section", HTMLElementTypeId, HTMLElement); + handle_htmlelement!(cx, tag, "small", HTMLElementTypeId, HTMLElement); unsafe { let element = @HTMLUnknownElement { diff --git a/src/test/html/test_bindings.html b/src/test/html/test_bindings.html index 5408f6f5d33..e61904cd005 100644 --- a/src/test/html/test_bindings.html +++ b/src/test/html/test_bindings.html @@ -41,6 +41,7 @@ b i + small